5 // These should be provided...somehow...
6 void *memset(void *s, int c, size_t n);
7 void *memcpy(void *dest, const void *src, size_t n);
8 int memcmp(const void *s1, const void *s2, size_t n);
10 void __attribute__((noreturn)) abort(void);
11 static inline void assert(bool expression) {
12 if (!expression) { abort(); }
15 void *malloc(size_t size);
18 #define MALLOC(a, _) malloc(a)
19 #define FREE(p) if ((long)(p) > 1024) { free(p); }
20 #define DO_ASSERT(a) (void)(a)
23 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
24 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
25 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
26 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
28 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
30 typedef uint32_t int64_tArray;
31 typedef uint32_t int8_tArray;
32 typedef uint32_t uint32_tArray;
33 typedef uint32_t ptrArray;
34 typedef uint32_t jstring;
36 static inline uint32_t init_arr(size_t arr_len, size_t elem_size, const char *type_desc) {
37 uint32_t *elems = (uint32_t*)MALLOC(arr_len * elem_size + 4, type_desc);
39 return (uint32_t)elems;
42 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
43 char* err_buf = MALLOC(len + 4, "str conv buf");
44 *((uint32_t*)err_buf) = len;
45 memcpy(err_buf + 4, chars, len);
46 return (uint32_t) err_buf;
48 static inline LDKStr str_ref_to_owned_c(jstring str) {
49 uint32_t *str_len = (uint32_t*)str;
50 char* newchars = MALLOC(*str_len + 1, "String chars");
51 memcpy(newchars, (const char*)(str + 4), *str_len);
52 newchars[*str_len] = 0;
56 .chars_is_owned = true
61 typedef bool jboolean;
63 uint32_t __attribute__((visibility("default"))) TS_malloc(uint32_t size) {
64 return (uint32_t)MALLOC(size, "JS-Called malloc");
66 void __attribute__((visibility("default"))) TS_free(uint32_t ptr) {
69 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
70 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
72 case 0: return LDKAccessError_UnknownChain;
73 case 1: return LDKAccessError_UnknownTx;
77 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
79 case LDKAccessError_UnknownChain: return 0;
80 case LDKAccessError_UnknownTx: return 1;
84 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
86 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
87 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
91 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
93 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
94 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
98 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
100 case 0: return LDKConfirmationTarget_Background;
101 case 1: return LDKConfirmationTarget_Normal;
102 case 2: return LDKConfirmationTarget_HighPriority;
106 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
108 case LDKConfirmationTarget_Background: return 0;
109 case LDKConfirmationTarget_Normal: return 1;
110 case LDKConfirmationTarget_HighPriority: return 2;
114 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
116 case 0: return LDKCreationError_DescriptionTooLong;
117 case 1: return LDKCreationError_RouteTooLong;
118 case 2: return LDKCreationError_TimestampOutOfBounds;
119 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
123 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
125 case LDKCreationError_DescriptionTooLong: return 0;
126 case LDKCreationError_RouteTooLong: return 1;
127 case LDKCreationError_TimestampOutOfBounds: return 2;
128 case LDKCreationError_ExpiryTimeOutOfBounds: return 3;
132 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
134 case 0: return LDKCurrency_Bitcoin;
135 case 1: return LDKCurrency_BitcoinTestnet;
136 case 2: return LDKCurrency_Regtest;
137 case 3: return LDKCurrency_Simnet;
138 case 4: return LDKCurrency_Signet;
142 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
144 case LDKCurrency_Bitcoin: return 0;
145 case LDKCurrency_BitcoinTestnet: return 1;
146 case LDKCurrency_Regtest: return 2;
147 case LDKCurrency_Simnet: return 3;
148 case LDKCurrency_Signet: return 4;
152 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
154 case 0: return LDKIOError_NotFound;
155 case 1: return LDKIOError_PermissionDenied;
156 case 2: return LDKIOError_ConnectionRefused;
157 case 3: return LDKIOError_ConnectionReset;
158 case 4: return LDKIOError_ConnectionAborted;
159 case 5: return LDKIOError_NotConnected;
160 case 6: return LDKIOError_AddrInUse;
161 case 7: return LDKIOError_AddrNotAvailable;
162 case 8: return LDKIOError_BrokenPipe;
163 case 9: return LDKIOError_AlreadyExists;
164 case 10: return LDKIOError_WouldBlock;
165 case 11: return LDKIOError_InvalidInput;
166 case 12: return LDKIOError_InvalidData;
167 case 13: return LDKIOError_TimedOut;
168 case 14: return LDKIOError_WriteZero;
169 case 15: return LDKIOError_Interrupted;
170 case 16: return LDKIOError_Other;
171 case 17: return LDKIOError_UnexpectedEof;
175 static inline int32_t LDKIOError_to_js(LDKIOError val) {
177 case LDKIOError_NotFound: return 0;
178 case LDKIOError_PermissionDenied: return 1;
179 case LDKIOError_ConnectionRefused: return 2;
180 case LDKIOError_ConnectionReset: return 3;
181 case LDKIOError_ConnectionAborted: return 4;
182 case LDKIOError_NotConnected: return 5;
183 case LDKIOError_AddrInUse: return 6;
184 case LDKIOError_AddrNotAvailable: return 7;
185 case LDKIOError_BrokenPipe: return 8;
186 case LDKIOError_AlreadyExists: return 9;
187 case LDKIOError_WouldBlock: return 10;
188 case LDKIOError_InvalidInput: return 11;
189 case LDKIOError_InvalidData: return 12;
190 case LDKIOError_TimedOut: return 13;
191 case LDKIOError_WriteZero: return 14;
192 case LDKIOError_Interrupted: return 15;
193 case LDKIOError_Other: return 16;
194 case LDKIOError_UnexpectedEof: return 17;
198 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
200 case 0: return LDKLevel_Trace;
201 case 1: return LDKLevel_Debug;
202 case 2: return LDKLevel_Info;
203 case 3: return LDKLevel_Warn;
204 case 4: return LDKLevel_Error;
208 static inline int32_t LDKLevel_to_js(LDKLevel val) {
210 case LDKLevel_Trace: return 0;
211 case LDKLevel_Debug: return 1;
212 case LDKLevel_Info: return 2;
213 case LDKLevel_Warn: return 3;
214 case LDKLevel_Error: return 4;
218 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
220 case 0: return LDKNetwork_Bitcoin;
221 case 1: return LDKNetwork_Testnet;
222 case 2: return LDKNetwork_Regtest;
223 case 3: return LDKNetwork_Signet;
227 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
229 case LDKNetwork_Bitcoin: return 0;
230 case LDKNetwork_Testnet: return 1;
231 case LDKNetwork_Regtest: return 2;
232 case LDKNetwork_Signet: return 3;
236 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
238 case 0: return LDKSecp256k1Error_IncorrectSignature;
239 case 1: return LDKSecp256k1Error_InvalidMessage;
240 case 2: return LDKSecp256k1Error_InvalidPublicKey;
241 case 3: return LDKSecp256k1Error_InvalidSignature;
242 case 4: return LDKSecp256k1Error_InvalidSecretKey;
243 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
244 case 6: return LDKSecp256k1Error_InvalidTweak;
245 case 7: return LDKSecp256k1Error_TweakCheckFailed;
246 case 8: return LDKSecp256k1Error_NotEnoughMemory;
250 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
252 case LDKSecp256k1Error_IncorrectSignature: return 0;
253 case LDKSecp256k1Error_InvalidMessage: return 1;
254 case LDKSecp256k1Error_InvalidPublicKey: return 2;
255 case LDKSecp256k1Error_InvalidSignature: return 3;
256 case LDKSecp256k1Error_InvalidSecretKey: return 4;
257 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
258 case LDKSecp256k1Error_InvalidTweak: return 6;
259 case LDKSecp256k1Error_TweakCheckFailed: return 7;
260 case LDKSecp256k1Error_NotEnoughMemory: return 8;
264 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
266 case 0: return LDKSemanticError_NoPaymentHash;
267 case 1: return LDKSemanticError_MultiplePaymentHashes;
268 case 2: return LDKSemanticError_NoDescription;
269 case 3: return LDKSemanticError_MultipleDescriptions;
270 case 4: return LDKSemanticError_NoPaymentSecret;
271 case 5: return LDKSemanticError_MultiplePaymentSecrets;
272 case 6: return LDKSemanticError_InvalidFeatures;
273 case 7: return LDKSemanticError_InvalidRecoveryId;
274 case 8: return LDKSemanticError_InvalidSignature;
275 case 9: return LDKSemanticError_ImpreciseAmount;
279 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
281 case LDKSemanticError_NoPaymentHash: return 0;
282 case LDKSemanticError_MultiplePaymentHashes: return 1;
283 case LDKSemanticError_NoDescription: return 2;
284 case LDKSemanticError_MultipleDescriptions: return 3;
285 case LDKSemanticError_NoPaymentSecret: return 4;
286 case LDKSemanticError_MultiplePaymentSecrets: return 5;
287 case LDKSemanticError_InvalidFeatures: return 6;
288 case LDKSemanticError_InvalidRecoveryId: return 7;
289 case LDKSemanticError_InvalidSignature: return 8;
290 case LDKSemanticError_ImpreciseAmount: return 9;
294 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
296 case 0: return LDKSiPrefix_Milli;
297 case 1: return LDKSiPrefix_Micro;
298 case 2: return LDKSiPrefix_Nano;
299 case 3: return LDKSiPrefix_Pico;
303 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
305 case LDKSiPrefix_Milli: return 0;
306 case LDKSiPrefix_Micro: return 1;
307 case LDKSiPrefix_Nano: return 2;
308 case LDKSiPrefix_Pico: return 3;
312 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u8Z_new(int8_tArray elems) {
313 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
314 ret->datalen = *((uint32_t*)elems);
315 if (ret->datalen == 0) {
318 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
319 int8_t *java_elems = (int8_t*)(elems + 4);
320 for (size_t i = 0; i < ret->datalen; i++) {
321 ret->data[i] = java_elems[i];
324 return (uint64_t)ret;
326 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
327 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
328 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
331 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) { return CVec_u8Z_clone(&thing->script_pubkey);}int8_tArray __attribute__((visibility("default"))) TS_TxOut_get_script_pubkey(uint32_t thing) {
332 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
333 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
334 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
335 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
336 CVec_u8Z_free(ret_var);
340 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t __attribute__((visibility("default"))) TS_TxOut_get_value(uint32_t thing) {
341 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
342 int64_t ret_val = TxOut_get_value(thing_conv);
346 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_result_ok(uint32_t arg) {
347 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
349 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_ok(uint32_t arg) {
350 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
351 CHECK(val->result_ok);
352 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
353 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).bytes, 32);
356 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_err(uint32_t arg) {
357 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
358 CHECK(!val->result_ok);
359 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
362 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_result_ok(uint32_t arg) {
363 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
365 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_ok(uint32_t arg) {
366 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
367 CHECK(val->result_ok);
368 int8_tArray res_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
369 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compressed_form, 33);
372 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_err(uint32_t arg) {
373 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
374 CHECK(!val->result_ok);
375 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
378 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_result_ok(uint32_t arg) {
379 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
381 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t arg) {
382 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
383 CHECK(val->result_ok);
384 LDKTxCreationKeys res_var = (*val->contents.result);
385 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
386 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
387 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
390 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t arg) {
391 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
392 CHECK(!val->result_ok);
393 LDKDecodeError err_var = (*val->contents.err);
394 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
395 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
396 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
399 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_result_ok(uint32_t arg) {
400 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
402 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t arg) {
403 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
404 CHECK(val->result_ok);
405 LDKChannelPublicKeys res_var = (*val->contents.result);
406 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
407 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
408 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
411 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t arg) {
412 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
413 CHECK(!val->result_ok);
414 LDKDecodeError err_var = (*val->contents.err);
415 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
416 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
417 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
420 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_result_ok(uint32_t arg) {
421 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
423 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_ok(uint32_t arg) {
424 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
425 CHECK(val->result_ok);
426 LDKTxCreationKeys res_var = (*val->contents.result);
427 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
428 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
429 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
432 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_err(uint32_t arg) {
433 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
434 CHECK(!val->result_ok);
435 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
438 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u32Z_ref_from_ptr(uint32_t ptr) {
439 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
441 case LDKCOption_u32Z_Some: {
442 return 0 /* LDKCOption_u32Z - Some */; (void) obj->some;
444 case LDKCOption_u32Z_None: {
445 return 0 /* LDKCOption_u32Z - None */;
450 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_result_ok(uint32_t arg) {
451 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
453 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
454 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
455 CHECK(val->result_ok);
456 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
457 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
458 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
459 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
462 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
463 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
464 CHECK(!val->result_ok);
465 LDKDecodeError err_var = (*val->contents.err);
466 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
467 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
468 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
471 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
472 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
474 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
475 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
476 CHECK(val->result_ok);
477 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
478 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
479 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
480 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
483 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
484 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
485 CHECK(!val->result_ok);
486 LDKDecodeError err_var = (*val->contents.err);
487 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
488 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
489 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
492 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
493 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
495 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
496 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
497 CHECK(val->result_ok);
498 LDKChannelTransactionParameters res_var = (*val->contents.result);
499 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
500 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
501 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
504 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
505 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
506 CHECK(!val->result_ok);
507 LDKDecodeError err_var = (*val->contents.err);
508 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
509 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
510 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
513 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
514 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
516 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
517 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
518 CHECK(val->result_ok);
519 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
520 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
521 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
522 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
525 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
526 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
527 CHECK(!val->result_ok);
528 LDKDecodeError err_var = (*val->contents.err);
529 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
530 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
531 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
534 jboolean __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
535 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
537 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
538 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
539 CHECK(val->result_ok);
540 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
541 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
542 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
543 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
546 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
547 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
548 CHECK(!val->result_ok);
549 LDKDecodeError err_var = (*val->contents.err);
550 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
551 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
552 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
555 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_result_ok(uint32_t arg) {
556 return ((LDKCResult_TrustedClosingTransactionNoneZ*)arg)->result_ok;
558 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t arg) {
559 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
560 CHECK(val->result_ok);
561 LDKTrustedClosingTransaction res_var = (*val->contents.result);
562 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
563 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
564 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
567 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_err(uint32_t arg) {
568 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
569 CHECK(!val->result_ok);
570 return *val->contents.err;
572 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
573 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
575 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
576 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
577 CHECK(val->result_ok);
578 LDKCommitmentTransaction res_var = (*val->contents.result);
579 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
580 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
581 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
584 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
585 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
586 CHECK(!val->result_ok);
587 LDKDecodeError err_var = (*val->contents.err);
588 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
589 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
590 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
593 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_result_ok(uint32_t arg) {
594 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
596 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
597 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
598 CHECK(val->result_ok);
599 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
600 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
601 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
602 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
605 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
606 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
607 CHECK(!val->result_ok);
608 return *val->contents.err;
610 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_result_ok(uint32_t arg) {
611 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
613 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
614 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
615 CHECK(val->result_ok);
616 LDKCVec_SignatureZ res_var = (*val->contents.result);
617 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
618 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
619 for (size_t m = 0; m < res_var.datalen; m++) {
620 int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
621 memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64);
622 res_arr_ptr[m] = res_conv_12_arr;
626 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
627 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
628 CHECK(!val->result_ok);
629 return *val->contents.err;
631 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_result_ok(uint32_t arg) {
632 return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
634 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t arg) {
635 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
636 CHECK(val->result_ok);
637 LDKShutdownScript res_var = (*val->contents.result);
638 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
639 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
640 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
643 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t arg) {
644 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
645 CHECK(!val->result_ok);
646 LDKDecodeError err_var = (*val->contents.err);
647 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
648 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
649 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
652 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_result_ok(uint32_t arg) {
653 return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
655 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t arg) {
656 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
657 CHECK(val->result_ok);
658 LDKShutdownScript res_var = (*val->contents.result);
659 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
660 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
661 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
664 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t arg) {
665 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
666 CHECK(!val->result_ok);
667 LDKInvalidShutdownScript err_var = (*val->contents.err);
668 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
669 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
670 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
673 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_result_ok(uint32_t arg) {
674 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
676 void __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_ok(uint32_t arg) {
677 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
678 CHECK(val->result_ok);
679 return *val->contents.result;
681 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_err(uint32_t arg) {
682 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
683 CHECK(!val->result_ok);
684 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
687 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_result_ok(uint32_t arg) {
688 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
690 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_ok(uint32_t arg) {
691 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
692 CHECK(val->result_ok);
693 LDKRouteHop res_var = (*val->contents.result);
694 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
695 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
696 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
699 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_err(uint32_t arg) {
700 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
701 CHECK(!val->result_ok);
702 LDKDecodeError err_var = (*val->contents.err);
703 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
704 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
705 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
708 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) {
709 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
710 ret->datalen = *((uint32_t*)elems);
711 if (ret->datalen == 0) {
714 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
715 uint32_t *java_elems = (uint32_t*)(elems + 4);
716 for (size_t i = 0; i < ret->datalen; i++) {
717 uint32_t arr_elem = java_elems[i];
718 LDKRouteHop arr_elem_conv;
719 arr_elem_conv.inner = (void*)(arr_elem & (~1));
720 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
721 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
722 ret->data[i] = arr_elem_conv;
725 return (uint64_t)ret;
727 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
728 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
729 for (size_t i = 0; i < ret.datalen; i++) {
730 ret.data[i] = RouteHop_clone(&orig->data[i]);
734 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
735 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
736 for (size_t i = 0; i < ret.datalen; i++) {
737 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
741 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_result_ok(uint32_t arg) {
742 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
744 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
745 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
746 CHECK(val->result_ok);
747 LDKRoute res_var = (*val->contents.result);
748 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
749 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
750 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
753 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
754 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
755 CHECK(!val->result_ok);
756 LDKDecodeError err_var = (*val->contents.err);
757 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
758 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
759 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
762 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
763 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
765 case LDKCOption_u64Z_Some: {
766 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
768 case LDKCOption_u64Z_None: {
769 return 0 /* LDKCOption_u64Z - None */;
774 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) {
775 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
776 ret->datalen = *((uint32_t*)elems);
777 if (ret->datalen == 0) {
780 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
781 uint32_t *java_elems = (uint32_t*)(elems + 4);
782 for (size_t i = 0; i < ret->datalen; i++) {
783 uint32_t arr_elem = java_elems[i];
784 LDKChannelDetails arr_elem_conv;
785 arr_elem_conv.inner = (void*)(arr_elem & (~1));
786 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
787 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
788 ret->data[i] = arr_elem_conv;
791 return (uint64_t)ret;
793 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
794 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
795 for (size_t i = 0; i < ret.datalen; i++) {
796 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
800 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintZ_new(uint32_tArray elems) {
801 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
802 ret->datalen = *((uint32_t*)elems);
803 if (ret->datalen == 0) {
806 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
807 uint32_t *java_elems = (uint32_t*)(elems + 4);
808 for (size_t i = 0; i < ret->datalen; i++) {
809 uint32_t arr_elem = java_elems[i];
810 LDKRouteHint arr_elem_conv;
811 arr_elem_conv.inner = (void*)(arr_elem & (~1));
812 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
813 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
814 ret->data[i] = arr_elem_conv;
817 return (uint64_t)ret;
819 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
820 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
821 for (size_t i = 0; i < ret.datalen; i++) {
822 ret.data[i] = RouteHint_clone(&orig->data[i]);
826 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_result_ok(uint32_t arg) {
827 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
829 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
830 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
831 CHECK(val->result_ok);
832 LDKRoute res_var = (*val->contents.result);
833 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
834 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
835 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
838 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
839 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
840 CHECK(!val->result_ok);
841 LDKLightningError err_var = (*val->contents.err);
842 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
843 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
844 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
847 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_result_ok(uint32_t arg) {
848 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
850 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
851 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
852 CHECK(val->result_ok);
853 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
854 return (uint64_t)res_ref;
856 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
857 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
858 CHECK(!val->result_ok);
859 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
862 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
863 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
865 LDKTransaction b_ref;
866 b_ref.datalen = *((uint32_t*)b);
867 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
868 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
869 b_ref.data_is_owned = false;
871 return (uint64_t)ret;
873 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 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) {
2225 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
2227 case LDKCOption_u16Z_Some: {
2228 return 0 /* LDKCOption_u16Z - Some */; (void) obj->some;
2230 case LDKCOption_u16Z_None: {
2231 return 0 /* LDKCOption_u16Z - None */;
2236 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2237 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2239 case LDKAPIError_APIMisuseError: {
2240 LDKStr err_str = obj->api_misuse_error.err;
2241 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2242 return 0 /* LDKAPIError - APIMisuseError */; (void) err_conv;
2244 case LDKAPIError_FeeRateTooHigh: {
2245 LDKStr err_str = obj->fee_rate_too_high.err;
2246 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2247 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_conv; (void) obj->fee_rate_too_high.feerate;
2249 case LDKAPIError_RouteError: {
2250 LDKStr err_str = obj->route_error.err;
2251 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2252 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2254 case LDKAPIError_ChannelUnavailable: {
2255 LDKStr err_str = obj->channel_unavailable.err;
2256 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2257 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_conv;
2259 case LDKAPIError_MonitorUpdateFailed: {
2260 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2262 case LDKAPIError_IncompatibleShutdownScript: {
2263 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
2264 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2265 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2266 uint64_t script_ref = (uint64_t)script_var.inner & ~1;
2267 return 0 /* LDKAPIError - IncompatibleShutdownScript */; (void) script_ref;
2272 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
2273 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2275 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2276 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2277 CHECK(val->result_ok);
2278 return *val->contents.result;
2280 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2281 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2282 CHECK(!val->result_ok);
2283 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2286 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) {
2287 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2288 ret->datalen = *((uint32_t*)elems);
2289 if (ret->datalen == 0) {
2292 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2293 uint32_t *java_elems = (uint32_t*)(elems + 4);
2294 for (size_t i = 0; i < ret->datalen; i++) {
2295 uint32_t arr_elem = java_elems[i];
2296 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2297 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
2298 ret->data[i] = arr_elem_conv;
2301 return (uint64_t)ret;
2303 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2304 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2305 for (size_t i = 0; i < ret.datalen; i++) {
2306 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2310 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) {
2311 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2312 ret->datalen = *((uint32_t*)elems);
2313 if (ret->datalen == 0) {
2316 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2317 uint32_t *java_elems = (uint32_t*)(elems + 4);
2318 for (size_t i = 0; i < ret->datalen; i++) {
2319 uint32_t arr_elem = java_elems[i];
2320 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
2321 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
2322 ret->data[i] = arr_elem_conv;
2325 return (uint64_t)ret;
2327 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2328 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2329 for (size_t i = 0; i < ret.datalen; i++) {
2330 ret.data[i] = APIError_clone(&orig->data[i]);
2334 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2335 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
2337 case LDKPaymentSendFailure_ParameterError: {
2338 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
2339 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
2341 case LDKPaymentSendFailure_PathParameterError: {
2342 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
2343 uint32_tArray path_parameter_error_arr = init_arr(path_parameter_error_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2344 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
2345 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
2346 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2347 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
2348 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
2349 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
2351 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
2353 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2354 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
2355 uint32_tArray all_failed_retry_safe_arr = init_arr(all_failed_retry_safe_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2356 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
2357 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
2358 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
2359 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
2361 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
2363 case LDKPaymentSendFailure_PartialFailure: {
2364 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
2365 uint32_tArray partial_failure_arr = init_arr(partial_failure_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2366 uint32_t *partial_failure_arr_ptr = (uint32_t*)(partial_failure_arr + 4);
2367 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
2368 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2369 *partial_failure_conv_22_conv = partial_failure_var.data[w];
2370 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
2371 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
2373 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) partial_failure_arr;
2378 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
2379 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2381 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2382 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2383 CHECK(val->result_ok);
2384 return *val->contents.result;
2386 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2387 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2388 CHECK(!val->result_ok);
2389 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2392 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_result_ok(uint32_t arg) {
2393 return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok;
2395 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_get_ok(uint32_t arg) {
2396 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
2397 CHECK(val->result_ok);
2398 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2399 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2402 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_get_err(uint32_t arg) {
2403 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
2404 CHECK(!val->result_ok);
2405 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2408 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
2409 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
2411 case LDKNetAddress_IPv4: {
2412 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
2413 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
2414 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
2416 case LDKNetAddress_IPv6: {
2417 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
2418 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
2419 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
2421 case LDKNetAddress_OnionV2: {
2422 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
2423 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
2424 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
2426 case LDKNetAddress_OnionV3: {
2427 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2428 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
2429 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
2434 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
2435 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2436 ret->datalen = *((uint32_t*)elems);
2437 if (ret->datalen == 0) {
2440 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2441 uint32_t *java_elems = (uint32_t*)(elems + 4);
2442 for (size_t i = 0; i < ret->datalen; i++) {
2443 uint32_t arr_elem = java_elems[i];
2444 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
2445 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
2446 ret->data[i] = arr_elem_conv;
2449 return (uint64_t)ret;
2451 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2452 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2453 for (size_t i = 0; i < ret.datalen; i++) {
2454 ret.data[i] = NetAddress_clone(&orig->data[i]);
2458 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
2459 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
2460 LDKThirtyTwoBytes a_ref;
2461 CHECK(*((uint32_t*)a) == 32);
2462 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2464 LDKThirtyTwoBytes b_ref;
2465 CHECK(*((uint32_t*)b) == 32);
2466 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
2468 return (uint64_t)ret;
2470 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
2471 return ThirtyTwoBytes_clone(&tuple->a);
2473 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t tuple) {
2474 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
2475 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2476 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentSecretZ_get_a(tuple_conv).data, 32);
2480 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
2481 return ThirtyTwoBytes_clone(&tuple->b);
2483 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t tuple) {
2484 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
2485 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2486 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentSecretZ_get_b(tuple_conv).data, 32);
2490 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_result_ok(uint32_t arg) {
2491 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
2493 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_ok(uint32_t arg) {
2494 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2495 CHECK(val->result_ok);
2496 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2497 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2500 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_err(uint32_t arg) {
2501 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2502 CHECK(!val->result_ok);
2503 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2506 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
2507 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2508 ret->datalen = *((uint32_t*)elems);
2509 if (ret->datalen == 0) {
2512 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2513 uint32_t *java_elems = (uint32_t*)(elems + 4);
2514 for (size_t i = 0; i < ret->datalen; i++) {
2515 uint32_t arr_elem = java_elems[i];
2516 LDKChannelMonitor arr_elem_conv;
2517 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2518 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2519 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2520 ret->data[i] = arr_elem_conv;
2523 return (uint64_t)ret;
2525 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2526 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2527 for (size_t i = 0; i < ret.datalen; i++) {
2528 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2532 typedef struct LDKWatch_JCalls {
2533 atomic_size_t refcnt;
2534 uint32_t watch_channel_meth;
2535 uint32_t update_channel_meth;
2536 uint32_t release_pending_monitor_events_meth;
2538 static void LDKWatch_JCalls_free(void* this_arg) {
2539 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2540 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2541 js_free(j_calls->watch_channel_meth);
2542 js_free(j_calls->update_channel_meth);
2543 js_free(j_calls->release_pending_monitor_events_meth);
2547 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2548 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2549 LDKOutPoint funding_txo_var = funding_txo;
2550 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2551 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2552 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2553 if (funding_txo_var.is_owned) {
2554 funding_txo_ref |= 1;
2556 LDKChannelMonitor monitor_var = monitor;
2557 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2558 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2559 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
2560 if (monitor_var.is_owned) {
2563 uint32_t ret = js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2564 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2565 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2568 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2569 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2570 LDKOutPoint funding_txo_var = funding_txo;
2571 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2572 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2573 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2574 if (funding_txo_var.is_owned) {
2575 funding_txo_ref |= 1;
2577 LDKChannelMonitorUpdate update_var = update;
2578 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2579 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2580 uint64_t update_ref = (uint64_t)update_var.inner;
2581 if (update_var.is_owned) {
2584 uint32_t ret = js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2585 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2586 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2589 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
2590 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2591 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2592 LDKCVec_MonitorEventZ ret_constr;
2593 ret_constr.datalen = *((uint32_t*)ret);
2594 if (ret_constr.datalen > 0)
2595 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2597 ret_constr.data = NULL;
2598 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2599 for (size_t o = 0; o < ret_constr.datalen; o++) {
2600 uint32_t ret_conv_14 = ret_vals[o];
2601 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
2602 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
2603 ret_constr.data[o] = ret_conv_14_conv;
2607 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
2608 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
2609 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2611 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2612 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2613 atomic_init(&calls->refcnt, 1);
2614 //TODO: Assign calls->o from o
2617 .this_arg = (void*) calls,
2618 .watch_channel = watch_channel_LDKWatch_jcall,
2619 .update_channel = update_channel_LDKWatch_jcall,
2620 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
2621 .free = LDKWatch_JCalls_free,
2625 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2626 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2627 *res_ptr = LDKWatch_init(o);
2628 return (long)res_ptr;
2630 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2631 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2632 LDKOutPoint funding_txo_conv;
2633 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2634 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2635 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2636 LDKChannelMonitor monitor_conv;
2637 monitor_conv.inner = (void*)(monitor & (~1));
2638 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2639 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2640 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2641 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2642 return (uint64_t)ret_conv;
2645 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
2646 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2647 LDKOutPoint funding_txo_conv;
2648 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2649 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2650 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2651 LDKChannelMonitorUpdate update_conv;
2652 update_conv.inner = (void*)(update & (~1));
2653 update_conv.is_owned = (update & 1) || (update == 0);
2654 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2655 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2656 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2657 return (uint64_t)ret_conv;
2660 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
2661 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2662 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2663 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2664 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
2665 for (size_t o = 0; o < ret_var.datalen; o++) {
2666 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2667 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
2668 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
2669 ret_arr_ptr[o] = ret_conv_14_ref;
2675 typedef struct LDKBroadcasterInterface_JCalls {
2676 atomic_size_t refcnt;
2677 uint32_t broadcast_transaction_meth;
2678 } LDKBroadcasterInterface_JCalls;
2679 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2680 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2681 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2682 js_free(j_calls->broadcast_transaction_meth);
2686 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
2687 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2688 LDKTransaction tx_var = tx;
2689 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2690 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
2691 Transaction_free(tx_var);
2692 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
2694 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
2695 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
2696 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2698 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
2699 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2700 atomic_init(&calls->refcnt, 1);
2701 //TODO: Assign calls->o from o
2703 LDKBroadcasterInterface ret = {
2704 .this_arg = (void*) calls,
2705 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
2706 .free = LDKBroadcasterInterface_JCalls_free,
2710 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
2711 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2712 *res_ptr = LDKBroadcasterInterface_init(o);
2713 return (long)res_ptr;
2715 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
2716 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
2717 LDKTransaction tx_ref;
2718 tx_ref.datalen = *((uint32_t*)tx);
2719 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2720 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
2721 tx_ref.data_is_owned = true;
2722 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2725 typedef struct LDKKeysInterface_JCalls {
2726 atomic_size_t refcnt;
2727 uint32_t get_node_secret_meth;
2728 uint32_t get_destination_script_meth;
2729 uint32_t get_shutdown_scriptpubkey_meth;
2730 uint32_t get_channel_signer_meth;
2731 uint32_t get_secure_random_bytes_meth;
2732 uint32_t read_chan_signer_meth;
2733 uint32_t sign_invoice_meth;
2734 } LDKKeysInterface_JCalls;
2735 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2736 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2737 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2738 js_free(j_calls->get_node_secret_meth);
2739 js_free(j_calls->get_destination_script_meth);
2740 js_free(j_calls->get_shutdown_scriptpubkey_meth);
2741 js_free(j_calls->get_channel_signer_meth);
2742 js_free(j_calls->get_secure_random_bytes_meth);
2743 js_free(j_calls->read_chan_signer_meth);
2744 js_free(j_calls->sign_invoice_meth);
2748 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
2749 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2750 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
2751 LDKSecretKey ret_ref;
2752 CHECK(*((uint32_t*)ret) == 32);
2753 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
2756 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
2757 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2758 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
2759 LDKCVec_u8Z ret_ref;
2760 ret_ref.datalen = *((uint32_t*)ret);
2761 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2762 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2765 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
2766 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2767 uint32_t ret = js_invoke_function_0(j_calls->get_shutdown_scriptpubkey_meth);
2768 LDKShutdownScript ret_conv;
2769 ret_conv.inner = (void*)(ret & (~1));
2770 ret_conv.is_owned = (ret & 1) || (ret == 0);
2771 ret_conv = ShutdownScript_clone(&ret_conv);
2774 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2775 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2776 uint32_t ret = js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
2777 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
2778 ret_conv = Sign_clone(&ret_conv);
2781 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
2782 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2783 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
2784 LDKThirtyTwoBytes ret_ref;
2785 CHECK(*((uint32_t*)ret) == 32);
2786 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
2789 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
2790 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2791 LDKu8slice reader_var = reader;
2792 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2793 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
2794 uint32_t ret = js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
2795 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
2796 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
2799 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
2800 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2801 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
2802 int8_tArray invoice_preimage_arr = init_arr(invoice_preimage_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2803 memcpy((uint8_t*)(invoice_preimage_arr + 4), invoice_preimage_var.data, invoice_preimage_var.datalen);
2804 CVec_u8Z_free(invoice_preimage_var);
2805 uint32_t ret = js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
2806 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
2807 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
2810 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
2811 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
2812 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2814 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
2815 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2816 atomic_init(&calls->refcnt, 1);
2817 //TODO: Assign calls->o from o
2819 LDKKeysInterface ret = {
2820 .this_arg = (void*) calls,
2821 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
2822 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
2823 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
2824 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
2825 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
2826 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
2827 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
2828 .free = LDKKeysInterface_JCalls_free,
2832 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
2833 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2834 *res_ptr = LDKKeysInterface_init(o);
2835 return (long)res_ptr;
2837 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
2838 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2839 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2840 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
2844 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
2845 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2846 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2847 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2848 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2849 CVec_u8Z_free(ret_var);
2853 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
2854 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2855 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
2856 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2857 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2858 uint64_t ret_ref = (uint64_t)ret_var.inner;
2859 if (ret_var.is_owned) {
2865 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2866 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2867 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
2868 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2869 return (uint64_t)ret_ret;
2872 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
2873 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2874 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2875 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
2879 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
2880 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2881 LDKu8slice reader_ref;
2882 reader_ref.datalen = *((uint32_t*)reader);
2883 reader_ref.data = (int8_t*)(reader + 4);
2884 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
2885 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2886 return (uint64_t)ret_conv;
2889 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
2890 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2891 LDKCVec_u8Z invoice_preimage_ref;
2892 invoice_preimage_ref.datalen = *((uint32_t*)invoice_preimage);
2893 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
2894 memcpy(invoice_preimage_ref.data, (uint8_t*)(invoice_preimage + 4), invoice_preimage_ref.datalen);
2895 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
2896 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
2897 return (uint64_t)ret_conv;
2900 typedef struct LDKFeeEstimator_JCalls {
2901 atomic_size_t refcnt;
2902 uint32_t get_est_sat_per_1000_weight_meth;
2903 } LDKFeeEstimator_JCalls;
2904 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2905 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2906 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2907 js_free(j_calls->get_est_sat_per_1000_weight_meth);
2911 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2912 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2913 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
2914 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2916 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
2917 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
2918 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2920 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
2921 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2922 atomic_init(&calls->refcnt, 1);
2923 //TODO: Assign calls->o from o
2925 LDKFeeEstimator ret = {
2926 .this_arg = (void*) calls,
2927 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
2928 .free = LDKFeeEstimator_JCalls_free,
2932 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
2933 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2934 *res_ptr = LDKFeeEstimator_init(o);
2935 return (long)res_ptr;
2937 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
2938 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
2939 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
2940 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2944 typedef struct LDKLogger_JCalls {
2945 atomic_size_t refcnt;
2948 static void LDKLogger_JCalls_free(void* this_arg) {
2949 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2950 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2951 js_free(j_calls->log_meth);
2955 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
2956 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2957 const char* record_str = record;
2958 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
2959 js_invoke_function_1(j_calls->log_meth, record_conv);
2961 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2962 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2963 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2965 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
2966 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2967 atomic_init(&calls->refcnt, 1);
2968 //TODO: Assign calls->o from o
2971 .this_arg = (void*) calls,
2972 .log = log_LDKLogger_jcall,
2973 .free = LDKLogger_JCalls_free,
2977 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
2978 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2979 *res_ptr = LDKLogger_init(o);
2980 return (long)res_ptr;
2982 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
2983 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2984 LDKThirtyTwoBytes a_ref;
2985 CHECK(*((uint32_t*)a) == 32);
2986 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2988 LDKChannelManager b_conv;
2989 b_conv.inner = (void*)(b & (~1));
2990 b_conv.is_owned = (b & 1) || (b == 0);
2991 // Warning: we need a move here but no clone is available for LDKChannelManager
2993 return (uint64_t)ret;
2995 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
2996 return ThirtyTwoBytes_clone(&tuple->a);
2998 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t tuple) {
2999 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
3000 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3001 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_BlockHashChannelManagerZ_get_a(tuple_conv).data, 32);
3005 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
3008 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t tuple) {
3009 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
3010 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(tuple_conv);
3011 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3012 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3013 uint64_t ret_ref = (uint64_t)ret_var.inner & ~1;
3017 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
3018 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
3020 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
3021 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3022 CHECK(val->result_ok);
3023 LDKC2Tuple_BlockHashChannelManagerZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
3024 *res_conv = (*val->contents.result);
3025 // Warning: we really need to clone here, but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
3026 return ((uint64_t)res_conv) | 1;
3028 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
3029 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3030 CHECK(!val->result_ok);
3031 LDKDecodeError err_var = (*val->contents.err);
3032 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3033 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3034 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3037 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
3038 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
3040 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
3041 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
3042 CHECK(val->result_ok);
3043 LDKChannelConfig res_var = (*val->contents.result);
3044 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3045 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3046 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3049 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
3050 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
3051 CHECK(!val->result_ok);
3052 LDKDecodeError err_var = (*val->contents.err);
3053 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3054 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3055 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3058 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
3059 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
3061 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
3062 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3063 CHECK(val->result_ok);
3064 LDKOutPoint res_var = (*val->contents.result);
3065 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3066 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3067 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3070 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
3071 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3072 CHECK(!val->result_ok);
3073 LDKDecodeError err_var = (*val->contents.err);
3074 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3075 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3076 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3079 typedef struct LDKType_JCalls {
3080 atomic_size_t refcnt;
3081 uint32_t type_id_meth;
3082 uint32_t debug_str_meth;
3083 uint32_t write_meth;
3085 static void LDKType_JCalls_free(void* this_arg) {
3086 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3087 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3088 js_free(j_calls->type_id_meth);
3089 js_free(j_calls->debug_str_meth);
3090 js_free(j_calls->write_meth);
3094 uint16_t type_id_LDKType_jcall(const void* this_arg) {
3095 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3096 return js_invoke_function_0(j_calls->type_id_meth);
3098 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
3099 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3100 uint32_t ret = js_invoke_function_0(j_calls->debug_str_meth);
3101 LDKStr ret_conv = str_ref_to_owned_c(ret);
3104 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
3105 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3106 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
3107 LDKCVec_u8Z ret_ref;
3108 ret_ref.datalen = *((uint32_t*)ret);
3109 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3110 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
3113 static void LDKType_JCalls_cloned(LDKType* new_obj) {
3114 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
3115 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3117 static inline LDKType LDKType_init (/*TODO: JS Object Reference */void* o) {
3118 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
3119 atomic_init(&calls->refcnt, 1);
3120 //TODO: Assign calls->o from o
3123 .this_arg = (void*) calls,
3124 .type_id = type_id_LDKType_jcall,
3125 .debug_str = debug_str_LDKType_jcall,
3126 .write = write_LDKType_jcall,
3127 .cloned = LDKType_JCalls_cloned,
3128 .free = LDKType_JCalls_free,
3132 long __attribute__((visibility("default"))) TS_LDKType_new(/*TODO: JS Object Reference */void* o) {
3133 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
3134 *res_ptr = LDKType_init(o);
3135 return (long)res_ptr;
3137 int16_t __attribute__((visibility("default"))) TS_Type_type_id(uint32_t this_arg) {
3138 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
3139 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
3143 jstring __attribute__((visibility("default"))) TS_Type_debug_str(uint32_t this_arg) {
3144 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
3145 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
3146 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
3151 int8_tArray __attribute__((visibility("default"))) TS_Type_write(uint32_t this_arg) {
3152 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
3153 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3154 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3155 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3156 CVec_u8Z_free(ret_var);
3160 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_TypeZ_ref_from_ptr(uint32_t ptr) {
3161 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
3163 case LDKCOption_TypeZ_Some: {
3164 LDKType* some_ret =MALLOC(sizeof(LDKType), "LDKType");
3165 *some_ret = Type_clone(&obj->some);
3166 return 0 /* LDKCOption_TypeZ - Some */; (void) (uint64_t)some_ret;
3168 case LDKCOption_TypeZ_None: {
3169 return 0 /* LDKCOption_TypeZ - None */;
3174 jboolean __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_result_ok(uint32_t arg) {
3175 return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
3177 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t arg) {
3178 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3179 CHECK(val->result_ok);
3180 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3183 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_err(uint32_t arg) {
3184 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3185 CHECK(!val->result_ok);
3186 LDKDecodeError err_var = (*val->contents.err);
3187 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3188 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3189 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3192 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_result_ok(uint32_t arg) {
3193 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
3195 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_ok(uint32_t arg) {
3196 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3197 CHECK(val->result_ok);
3198 uint32_t res_conv = LDKSiPrefix_to_js((*val->contents.result));
3201 void __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_err(uint32_t arg) {
3202 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3203 CHECK(!val->result_ok);
3204 return *val->contents.err;
3206 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_result_ok(uint32_t arg) {
3207 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
3209 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_ok(uint32_t arg) {
3210 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3211 CHECK(val->result_ok);
3212 LDKInvoice res_var = (*val->contents.result);
3213 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3214 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3215 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3218 void __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_err(uint32_t arg) {
3219 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3220 CHECK(!val->result_ok);
3221 return *val->contents.err;
3223 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_result_ok(uint32_t arg) {
3224 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
3226 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_ok(uint32_t arg) {
3227 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3228 CHECK(val->result_ok);
3229 LDKSignedRawInvoice res_var = (*val->contents.result);
3230 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3231 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3232 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3235 void __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_err(uint32_t arg) {
3236 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3237 CHECK(!val->result_ok);
3238 return *val->contents.err;
3240 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
3241 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
3242 LDKRawInvoice a_conv;
3243 a_conv.inner = (void*)(a & (~1));
3244 a_conv.is_owned = (a & 1) || (a == 0);
3245 a_conv = RawInvoice_clone(&a_conv);
3247 LDKThirtyTwoBytes b_ref;
3248 CHECK(*((uint32_t*)b) == 32);
3249 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
3251 LDKInvoiceSignature c_conv;
3252 c_conv.inner = (void*)(c & (~1));
3253 c_conv.is_owned = (c & 1) || (c == 0);
3254 c_conv = InvoiceSignature_clone(&c_conv);
3256 return (uint64_t)ret;
3258 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3259 return RawInvoice_clone(&tuple->a);
3261 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t tuple) {
3262 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3263 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(tuple_conv);
3264 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3265 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3266 uint64_t ret_ref = (uint64_t)ret_var.inner;
3267 if (ret_var.is_owned) {
3273 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3274 return ThirtyTwoBytes_clone(&tuple->b);
3276 int8_tArray __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t tuple) {
3277 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3278 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3279 memcpy((uint8_t*)(ret_arr + 4), C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(tuple_conv).data, 32);
3283 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3284 return InvoiceSignature_clone(&tuple->c);
3286 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t tuple) {
3287 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3288 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(tuple_conv);
3289 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3290 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3291 uint64_t ret_ref = (uint64_t)ret_var.inner;
3292 if (ret_var.is_owned) {
3298 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_result_ok(uint32_t arg) {
3299 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
3301 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_ok(uint32_t arg) {
3302 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3303 CHECK(val->result_ok);
3304 LDKPayeePubKey res_var = (*val->contents.result);
3305 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3306 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3307 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3310 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_err(uint32_t arg) {
3311 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3312 CHECK(!val->result_ok);
3313 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3316 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_PrivateRouteZ_new(uint32_tArray elems) {
3317 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
3318 ret->datalen = *((uint32_t*)elems);
3319 if (ret->datalen == 0) {
3322 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
3323 uint32_t *java_elems = (uint32_t*)(elems + 4);
3324 for (size_t i = 0; i < ret->datalen; i++) {
3325 uint32_t arr_elem = java_elems[i];
3326 LDKPrivateRoute arr_elem_conv;
3327 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3328 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3329 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
3330 ret->data[i] = arr_elem_conv;
3333 return (uint64_t)ret;
3335 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
3336 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
3337 for (size_t i = 0; i < ret.datalen; i++) {
3338 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
3342 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_result_ok(uint32_t arg) {
3343 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
3345 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t arg) {
3346 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3347 CHECK(val->result_ok);
3348 LDKPositiveTimestamp res_var = (*val->contents.result);
3349 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3350 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3351 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3354 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_err(uint32_t arg) {
3355 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3356 CHECK(!val->result_ok);
3357 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3360 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_result_ok(uint32_t arg) {
3361 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
3363 void __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_ok(uint32_t arg) {
3364 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3365 CHECK(val->result_ok);
3366 return *val->contents.result;
3368 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_err(uint32_t arg) {
3369 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3370 CHECK(!val->result_ok);
3371 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3374 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_result_ok(uint32_t arg) {
3375 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
3377 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_ok(uint32_t arg) {
3378 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3379 CHECK(val->result_ok);
3380 LDKInvoice res_var = (*val->contents.result);
3381 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3382 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3383 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3386 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_err(uint32_t arg) {
3387 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3388 CHECK(!val->result_ok);
3389 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3392 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_result_ok(uint32_t arg) {
3393 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
3395 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_ok(uint32_t arg) {
3396 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3397 CHECK(val->result_ok);
3398 LDKDescription 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_DescriptionCreationErrorZ_get_err(uint32_t arg) {
3405 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3406 CHECK(!val->result_ok);
3407 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3410 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_result_ok(uint32_t arg) {
3411 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
3413 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_ok(uint32_t arg) {
3414 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3415 CHECK(val->result_ok);
3416 LDKExpiryTime res_var = (*val->contents.result);
3417 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3418 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3419 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3422 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_err(uint32_t arg) {
3423 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3424 CHECK(!val->result_ok);
3425 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3428 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_result_ok(uint32_t arg) {
3429 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
3431 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_ok(uint32_t arg) {
3432 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3433 CHECK(val->result_ok);
3434 LDKPrivateRoute res_var = (*val->contents.result);
3435 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3436 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3437 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3440 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_err(uint32_t arg) {
3441 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3442 CHECK(!val->result_ok);
3443 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3446 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_result_ok(uint32_t arg) {
3447 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
3449 jstring __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_ok(uint32_t arg) {
3450 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3451 CHECK(val->result_ok);
3452 LDKStr res_str = (*val->contents.result);
3453 jstring res_conv = str_ref_to_ts(res_str.chars, res_str.len);
3456 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_err(uint32_t arg) {
3457 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3458 CHECK(!val->result_ok);
3459 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3462 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3463 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
3465 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3466 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3467 CHECK(val->result_ok);
3468 LDKChannelMonitorUpdate res_var = (*val->contents.result);
3469 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3470 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3471 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3474 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
3475 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3476 CHECK(!val->result_ok);
3477 LDKDecodeError err_var = (*val->contents.err);
3478 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3479 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3480 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3483 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3484 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
3486 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3487 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3488 CHECK(val->result_ok);
3489 LDKHTLCUpdate res_var = (*val->contents.result);
3490 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3491 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3492 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3495 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
3496 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3497 CHECK(!val->result_ok);
3498 LDKDecodeError err_var = (*val->contents.err);
3499 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3500 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3501 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3504 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
3505 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
3507 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
3508 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3509 CHECK(val->result_ok);
3510 return *val->contents.result;
3512 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
3513 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3514 CHECK(!val->result_ok);
3515 LDKMonitorUpdateError err_var = (*val->contents.err);
3516 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3517 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3518 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3521 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
3522 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
3524 a_conv.inner = (void*)(a & (~1));
3525 a_conv.is_owned = (a & 1) || (a == 0);
3526 a_conv = OutPoint_clone(&a_conv);
3529 b_ref.datalen = *((uint32_t*)b);
3530 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
3531 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
3533 return (uint64_t)ret;
3535 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
3536 return OutPoint_clone(&tuple->a);
3538 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t tuple) {
3539 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
3540 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(tuple_conv);
3541 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3542 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3543 uint64_t ret_ref = (uint64_t)ret_var.inner;
3544 if (ret_var.is_owned) {
3550 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
3551 return CVec_u8Z_clone(&tuple->b);
3553 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t tuple) {
3554 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
3555 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(tuple_conv);
3556 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3557 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3558 CVec_u8Z_free(ret_var);
3562 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
3563 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
3566 b_ref.datalen = *((uint32_t*)b);
3567 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
3568 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
3570 return (uint64_t)ret;
3572 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
3575 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t tuple) {
3576 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
3577 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(tuple_conv);
3581 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
3582 return CVec_u8Z_clone(&tuple->b);
3584 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t tuple) {
3585 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
3586 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(tuple_conv);
3587 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3588 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3589 CVec_u8Z_free(ret_var);
3593 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32ScriptZZ_new(uint32_tArray elems) {
3594 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
3595 ret->datalen = *((uint32_t*)elems);
3596 if (ret->datalen == 0) {
3599 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
3600 uint32_t *java_elems = (uint32_t*)(elems + 4);
3601 for (size_t i = 0; i < ret->datalen; i++) {
3602 uint32_t arr_elem = java_elems[i];
3603 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
3604 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
3605 ret->data[i] = arr_elem_conv;
3608 return (uint64_t)ret;
3610 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
3611 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
3612 for (size_t i = 0; i < ret.datalen; i++) {
3613 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
3617 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
3618 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
3619 LDKThirtyTwoBytes a_ref;
3620 CHECK(*((uint32_t*)a) == 32);
3621 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3623 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
3624 b_constr.datalen = *((uint32_t*)b);
3625 if (b_constr.datalen > 0)
3626 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
3628 b_constr.data = NULL;
3629 uint32_t* b_vals = (uint32_t*)(b + 4);
3630 for (size_t v = 0; v < b_constr.datalen; v++) {
3631 uint32_t b_conv_21 = b_vals[v];
3632 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1);
3633 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
3634 b_constr.data[v] = b_conv_21_conv;
3637 return (uint64_t)ret;
3639 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
3640 return ThirtyTwoBytes_clone(&tuple->a);
3642 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t tuple) {
3643 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
3644 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3645 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(tuple_conv).data, 32);
3649 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
3650 return CVec_C2Tuple_u32ScriptZZ_clone(&tuple->b);
3652 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t tuple) {
3653 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
3654 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(tuple_conv);
3655 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3656 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3657 for (size_t v = 0; v < ret_var.datalen; v++) {
3658 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
3659 *ret_conv_21_conv = ret_var.data[v];
3660 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv);
3666 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_new(uint32_tArray elems) {
3667 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
3668 ret->datalen = *((uint32_t*)elems);
3669 if (ret->datalen == 0) {
3672 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
3673 uint32_t *java_elems = (uint32_t*)(elems + 4);
3674 for (size_t i = 0; i < ret->datalen; i++) {
3675 uint32_t arr_elem = java_elems[i];
3676 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
3677 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
3678 ret->data[i] = arr_elem_conv;
3681 return (uint64_t)ret;
3683 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
3684 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 };
3685 for (size_t i = 0; i < ret.datalen; i++) {
3686 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
3690 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_ptr(uint32_t ptr) {
3691 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
3693 case LDKPaymentPurpose_InvoicePayment: {
3694 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3695 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->invoice_payment.payment_preimage.data, 32);
3696 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3697 memcpy((uint8_t*)(payment_secret_arr + 4), obj->invoice_payment.payment_secret.data, 32);
3698 return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->invoice_payment.user_payment_id;
3700 case LDKPaymentPurpose_SpontaneousPayment: {
3701 int8_tArray spontaneous_payment_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3702 memcpy((uint8_t*)(spontaneous_payment_arr + 4), obj->spontaneous_payment.data, 32);
3703 return 0 /* LDKPaymentPurpose - SpontaneousPayment */; (void) spontaneous_payment_arr;
3708 uint32_t __attribute__((visibility("default"))) TS_LDKClosureReason_ref_from_ptr(uint32_t ptr) {
3709 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
3711 case LDKClosureReason_CounterpartyForceClosed: {
3712 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
3713 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
3714 return 0 /* LDKClosureReason - CounterpartyForceClosed */; (void) peer_msg_conv;
3716 case LDKClosureReason_HolderForceClosed: {
3717 return 0 /* LDKClosureReason - HolderForceClosed */;
3719 case LDKClosureReason_CooperativeClosure: {
3720 return 0 /* LDKClosureReason - CooperativeClosure */;
3722 case LDKClosureReason_CommitmentTxConfirmed: {
3723 return 0 /* LDKClosureReason - CommitmentTxConfirmed */;
3725 case LDKClosureReason_ProcessingError: {
3726 LDKStr err_str = obj->processing_error.err;
3727 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3728 return 0 /* LDKClosureReason - ProcessingError */; (void) err_conv;
3730 case LDKClosureReason_DisconnectedPeer: {
3731 return 0 /* LDKClosureReason - DisconnectedPeer */;
3733 case LDKClosureReason_OutdatedChannelManager: {
3734 return 0 /* LDKClosureReason - OutdatedChannelManager */;
3739 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
3740 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
3742 case LDKEvent_FundingGenerationReady: {
3743 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3744 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
3745 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
3746 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3747 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
3748 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;
3750 case LDKEvent_PaymentReceived: {
3751 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3752 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
3753 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
3754 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) obj->payment_received.amt; (void) purpose_ref;
3756 case LDKEvent_PaymentSent: {
3757 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3758 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
3759 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
3761 case LDKEvent_PaymentPathFailed: {
3762 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3763 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_path_failed.payment_hash.data, 32);
3764 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
3765 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
3766 uint32_tArray path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3767 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
3768 for (size_t k = 0; k < path_var.datalen; k++) {
3769 LDKRouteHop path_conv_10_var = path_var.data[k];
3770 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3771 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3772 uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
3773 path_arr_ptr[k] = path_conv_10_ref;
3775 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;
3777 case LDKEvent_PendingHTLCsForwardable: {
3778 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
3780 case LDKEvent_SpendableOutputs: {
3781 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
3782 uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3783 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
3784 for (size_t b = 0; b < outputs_var.datalen; b++) {
3785 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
3786 outputs_arr_ptr[b] = outputs_conv_27_ref;
3788 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
3790 case LDKEvent_PaymentForwarded: {
3791 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
3792 return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
3794 case LDKEvent_ChannelClosed: {
3795 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3796 memcpy((uint8_t*)(channel_id_arr + 4), obj->channel_closed.channel_id.data, 32);
3797 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
3798 return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) reason_ref;
3803 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
3804 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
3805 ret->datalen = *((uint32_t*)elems);
3806 if (ret->datalen == 0) {
3809 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
3810 uint32_t *java_elems = (uint32_t*)(elems + 4);
3811 for (size_t i = 0; i < ret->datalen; i++) {
3812 uint32_t arr_elem = java_elems[i];
3813 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
3814 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
3815 ret->data[i] = arr_elem_conv;
3818 return (uint64_t)ret;
3820 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
3821 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
3822 for (size_t i = 0; i < ret.datalen; i++) {
3823 ret.data[i] = Event_clone(&orig->data[i]);
3827 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
3828 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
3830 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
3831 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
3833 return (uint64_t)ret;
3835 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
3838 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t tuple) {
3839 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
3840 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(tuple_conv);
3844 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
3845 return TxOut_clone(&tuple->b);
3847 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t tuple) {
3848 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
3849 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3850 *ret_ref = C2Tuple_u32TxOutZ_get_b(tuple_conv);
3851 return (uint64_t)ret_ref;
3854 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
3855 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
3856 ret->datalen = *((uint32_t*)elems);
3857 if (ret->datalen == 0) {
3860 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
3861 uint32_t *java_elems = (uint32_t*)(elems + 4);
3862 for (size_t i = 0; i < ret->datalen; i++) {
3863 uint32_t arr_elem = java_elems[i];
3864 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
3865 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
3866 ret->data[i] = arr_elem_conv;
3869 return (uint64_t)ret;
3871 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
3872 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
3873 for (size_t i = 0; i < ret.datalen; i++) {
3874 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
3878 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
3879 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
3880 LDKThirtyTwoBytes a_ref;
3881 CHECK(*((uint32_t*)a) == 32);
3882 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3884 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
3885 b_constr.datalen = *((uint32_t*)b);
3886 if (b_constr.datalen > 0)
3887 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
3889 b_constr.data = NULL;
3890 uint32_t* b_vals = (uint32_t*)(b + 4);
3891 for (size_t u = 0; u < b_constr.datalen; u++) {
3892 uint32_t b_conv_20 = b_vals[u];
3893 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1);
3894 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
3895 b_constr.data[u] = b_conv_20_conv;
3898 return (uint64_t)ret;
3900 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
3901 return ThirtyTwoBytes_clone(&tuple->a);
3903 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t tuple) {
3904 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
3905 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3906 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(tuple_conv).data, 32);
3910 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
3911 return CVec_C2Tuple_u32TxOutZZ_clone(&tuple->b);
3913 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t tuple) {
3914 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
3915 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(tuple_conv);
3916 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3917 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3918 for (size_t u = 0; u < ret_var.datalen; u++) {
3919 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
3920 *ret_conv_20_conv = ret_var.data[u];
3921 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
3927 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
3928 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
3929 ret->datalen = *((uint32_t*)elems);
3930 if (ret->datalen == 0) {
3933 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
3934 uint32_t *java_elems = (uint32_t*)(elems + 4);
3935 for (size_t i = 0; i < ret->datalen; i++) {
3936 uint32_t arr_elem = java_elems[i];
3937 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
3938 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
3939 ret->data[i] = arr_elem_conv;
3942 return (uint64_t)ret;
3944 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
3945 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 };
3946 for (size_t i = 0; i < ret.datalen; i++) {
3947 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
3951 uint32_t __attribute__((visibility("default"))) TS_LDKBalance_ref_from_ptr(uint32_t ptr) {
3952 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
3954 case LDKBalance_ClaimableOnChannelClose: {
3955 return 0 /* LDKBalance - ClaimableOnChannelClose */; (void) obj->claimable_on_channel_close.claimable_amount_satoshis;
3957 case LDKBalance_ClaimableAwaitingConfirmations: {
3958 return 0 /* LDKBalance - ClaimableAwaitingConfirmations */; (void) obj->claimable_awaiting_confirmations.claimable_amount_satoshis; (void) obj->claimable_awaiting_confirmations.confirmation_height;
3960 case LDKBalance_ContentiousClaimable: {
3961 return 0 /* LDKBalance - ContentiousClaimable */; (void) obj->contentious_claimable.claimable_amount_satoshis; (void) obj->contentious_claimable.timeout_height;
3963 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
3964 return 0 /* LDKBalance - MaybeClaimableHTLCAwaitingTimeout */; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
3969 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_BalanceZ_new(uint32_tArray elems) {
3970 LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
3971 ret->datalen = *((uint32_t*)elems);
3972 if (ret->datalen == 0) {
3975 ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
3976 uint32_t *java_elems = (uint32_t*)(elems + 4);
3977 for (size_t i = 0; i < ret->datalen; i++) {
3978 uint32_t arr_elem = java_elems[i];
3979 LDKBalance arr_elem_conv = *(LDKBalance*)(((uint64_t)arr_elem) & ~1);
3980 arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
3981 ret->data[i] = arr_elem_conv;
3984 return (uint64_t)ret;
3986 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
3987 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
3988 for (size_t i = 0; i < ret.datalen; i++) {
3989 ret.data[i] = Balance_clone(&orig->data[i]);
3993 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
3994 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
3996 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
3997 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
3998 CHECK(val->result_ok);
3999 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
4000 *res_conv = (*val->contents.result);
4001 *res_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv);
4002 return ((uint64_t)res_conv);
4004 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
4005 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4006 CHECK(!val->result_ok);
4007 LDKDecodeError err_var = (*val->contents.err);
4008 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4009 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4010 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4013 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
4014 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
4016 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
4017 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4018 CHECK(val->result_ok);
4019 return *val->contents.result;
4021 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
4022 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4023 CHECK(!val->result_ok);
4024 LDKLightningError err_var = (*val->contents.err);
4025 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4026 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4027 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4030 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
4031 LDKC2Tuple_PublicKeyTypeZ* ret = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
4033 CHECK(*((uint32_t*)a) == 33);
4034 memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
4036 LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
4037 b_conv = Type_clone(&b_conv);
4039 return (uint64_t)ret;
4041 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
4044 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t tuple) {
4045 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
4046 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4047 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PublicKeyTypeZ_get_a(tuple_conv).compressed_form, 33);
4051 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
4052 return Type_clone(&tuple->b);
4054 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t tuple) {
4055 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
4056 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
4057 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(tuple_conv);
4058 return (uint64_t)ret_ret;
4061 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_PublicKeyTypeZZ_new(uint32_tArray elems) {
4062 LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
4063 ret->datalen = *((uint32_t*)elems);
4064 if (ret->datalen == 0) {
4067 ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
4068 uint32_t *java_elems = (uint32_t*)(elems + 4);
4069 for (size_t i = 0; i < ret->datalen; i++) {
4070 uint32_t arr_elem = java_elems[i];
4071 LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1);
4072 arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
4073 ret->data[i] = arr_elem_conv;
4076 return (uint64_t)ret;
4078 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
4079 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
4080 for (size_t i = 0; i < ret.datalen; i++) {
4081 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
4085 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
4086 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
4088 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
4089 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4090 CHECK(val->result_ok);
4091 return *val->contents.result;
4093 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
4094 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4095 CHECK(!val->result_ok);
4096 LDKLightningError err_var = (*val->contents.err);
4097 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4098 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4099 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4102 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
4103 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4104 LDKChannelAnnouncement a_conv;
4105 a_conv.inner = (void*)(a & (~1));
4106 a_conv.is_owned = (a & 1) || (a == 0);
4107 a_conv = ChannelAnnouncement_clone(&a_conv);
4109 LDKChannelUpdate b_conv;
4110 b_conv.inner = (void*)(b & (~1));
4111 b_conv.is_owned = (b & 1) || (b == 0);
4112 b_conv = ChannelUpdate_clone(&b_conv);
4114 LDKChannelUpdate c_conv;
4115 c_conv.inner = (void*)(c & (~1));
4116 c_conv.is_owned = (c & 1) || (c == 0);
4117 c_conv = ChannelUpdate_clone(&c_conv);
4119 return (uint64_t)ret;
4121 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4122 return ChannelAnnouncement_clone(&tuple->a);
4124 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t tuple) {
4125 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4126 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(tuple_conv);
4127 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4128 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4129 uint64_t ret_ref = (uint64_t)ret_var.inner;
4130 if (ret_var.is_owned) {
4136 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4137 return ChannelUpdate_clone(&tuple->b);
4139 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t tuple) {
4140 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4141 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(tuple_conv);
4142 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4143 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4144 uint64_t ret_ref = (uint64_t)ret_var.inner;
4145 if (ret_var.is_owned) {
4151 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4152 return ChannelUpdate_clone(&tuple->c);
4154 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t tuple) {
4155 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4156 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(tuple_conv);
4157 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4158 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4159 uint64_t ret_ref = (uint64_t)ret_var.inner;
4160 if (ret_var.is_owned) {
4166 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
4167 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
4168 ret->datalen = *((uint32_t*)elems);
4169 if (ret->datalen == 0) {
4172 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ 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 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
4177 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
4178 ret->data[i] = arr_elem_conv;
4181 return (uint64_t)ret;
4183 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4184 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4185 for (size_t i = 0; i < ret.datalen; i++) {
4186 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4190 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
4191 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
4192 ret->datalen = *((uint32_t*)elems);
4193 if (ret->datalen == 0) {
4196 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
4197 uint32_t *java_elems = (uint32_t*)(elems + 4);
4198 for (size_t i = 0; i < ret->datalen; i++) {
4199 uint32_t arr_elem = java_elems[i];
4200 LDKNodeAnnouncement arr_elem_conv;
4201 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4202 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4203 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
4204 ret->data[i] = arr_elem_conv;
4207 return (uint64_t)ret;
4209 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4210 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4211 for (size_t i = 0; i < ret.datalen; i++) {
4212 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4216 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
4217 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4219 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
4220 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4221 CHECK(val->result_ok);
4222 LDKCVec_u8Z res_var = (*val->contents.result);
4223 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4224 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
4227 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
4228 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4229 CHECK(!val->result_ok);
4230 LDKPeerHandleError err_var = (*val->contents.err);
4231 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4232 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4233 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4236 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
4237 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
4239 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
4240 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4241 CHECK(val->result_ok);
4242 return *val->contents.result;
4244 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
4245 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4246 CHECK(!val->result_ok);
4247 LDKPeerHandleError err_var = (*val->contents.err);
4248 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4249 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4250 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4253 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
4254 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4256 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
4257 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4258 CHECK(val->result_ok);
4259 return *val->contents.result;
4261 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
4262 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4263 CHECK(!val->result_ok);
4264 LDKPeerHandleError err_var = (*val->contents.err);
4265 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4266 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4267 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4270 typedef struct LDKAccess_JCalls {
4271 atomic_size_t refcnt;
4272 uint32_t get_utxo_meth;
4274 static void LDKAccess_JCalls_free(void* this_arg) {
4275 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4276 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4277 js_free(j_calls->get_utxo_meth);
4281 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4282 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4283 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4284 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
4285 uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4286 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
4287 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
4290 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
4291 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
4292 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4294 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
4295 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4296 atomic_init(&calls->refcnt, 1);
4297 //TODO: Assign calls->o from o
4300 .this_arg = (void*) calls,
4301 .get_utxo = get_utxo_LDKAccess_jcall,
4302 .free = LDKAccess_JCalls_free,
4306 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
4307 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4308 *res_ptr = LDKAccess_init(o);
4309 return (long)res_ptr;
4311 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4312 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
4313 unsigned char genesis_hash_arr[32];
4314 CHECK(*((uint32_t*)genesis_hash) == 32);
4315 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
4316 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4317 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4318 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4319 return (uint64_t)ret_conv;
4322 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_AccessZ_ref_from_ptr(uint32_t ptr) {
4323 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
4325 case LDKCOption_AccessZ_Some: {
4326 LDKAccess* some_ret =MALLOC(sizeof(LDKAccess), "LDKAccess");
4327 *some_ret = obj->some;
4328 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
4329 return 0 /* LDKCOption_AccessZ - Some */; (void) (uint64_t)some_ret;
4331 case LDKCOption_AccessZ_None: {
4332 return 0 /* LDKCOption_AccessZ - None */;
4337 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
4338 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
4340 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4341 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4342 CHECK(val->result_ok);
4343 LDKDirectionalChannelInfo res_var = (*val->contents.result);
4344 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4345 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4346 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4349 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4350 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4351 CHECK(!val->result_ok);
4352 LDKDecodeError 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_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
4359 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
4361 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4362 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4363 CHECK(val->result_ok);
4364 LDKChannelInfo res_var = (*val->contents.result);
4365 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4366 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4367 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4370 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4371 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4372 CHECK(!val->result_ok);
4373 LDKDecodeError err_var = (*val->contents.err);
4374 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4375 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4376 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4379 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
4380 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
4382 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
4383 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4384 CHECK(val->result_ok);
4385 LDKRoutingFees res_var = (*val->contents.result);
4386 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4387 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4388 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4391 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
4392 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4393 CHECK(!val->result_ok);
4394 LDKDecodeError err_var = (*val->contents.err);
4395 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4396 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4397 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4400 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
4401 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
4403 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
4404 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4405 CHECK(val->result_ok);
4406 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
4407 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4408 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4409 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4412 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
4413 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4414 CHECK(!val->result_ok);
4415 LDKDecodeError err_var = (*val->contents.err);
4416 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4417 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4418 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4421 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
4422 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
4423 ret->datalen = *((uint32_t*)elems);
4424 if (ret->datalen == 0) {
4427 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
4428 int64_t *java_elems = (int64_t*)(elems + 4);
4429 for (size_t i = 0; i < ret->datalen; i++) {
4430 ret->data[i] = java_elems[i];
4433 return (uint64_t)ret;
4435 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4436 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4437 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4440 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
4441 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
4443 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
4444 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4445 CHECK(val->result_ok);
4446 LDKNodeInfo res_var = (*val->contents.result);
4447 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4448 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4449 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4452 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
4453 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4454 CHECK(!val->result_ok);
4455 LDKDecodeError err_var = (*val->contents.err);
4456 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4457 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4458 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4461 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
4462 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
4464 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
4465 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4466 CHECK(val->result_ok);
4467 LDKNetworkGraph res_var = (*val->contents.result);
4468 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4469 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4470 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4473 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
4474 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4475 CHECK(!val->result_ok);
4476 LDKDecodeError err_var = (*val->contents.err);
4477 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4478 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4479 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4482 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) {
4483 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
4485 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_ok(uint32_t arg) {
4486 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
4487 CHECK(val->result_ok);
4488 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4491 int8_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_err(uint32_t arg) {
4492 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
4493 CHECK(!val->result_ok);
4494 return *val->contents.err;
4496 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_result_ok(uint32_t arg) {
4497 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
4499 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_ok(uint32_t arg) {
4500 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
4501 CHECK(val->result_ok);
4502 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
4503 *res_conv = (*val->contents.result);
4504 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
4505 return (uint64_t)res_conv;
4507 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_err(uint32_t arg) {
4508 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
4509 CHECK(!val->result_ok);
4510 LDKDecodeError err_var = (*val->contents.err);
4511 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4512 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4513 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4516 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_result_ok(uint32_t arg) {
4517 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
4519 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_ok(uint32_t arg) {
4520 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4521 CHECK(val->result_ok);
4522 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4525 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_err(uint32_t arg) {
4526 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4527 CHECK(!val->result_ok);
4528 LDKDecodeError err_var = (*val->contents.err);
4529 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4530 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4531 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4534 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
4535 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
4536 ret->datalen = *((uint32_t*)elems);
4537 if (ret->datalen == 0) {
4540 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
4541 uint32_t *java_elems = (uint32_t*)(elems + 4);
4542 for (size_t i = 0; i < ret->datalen; i++) {
4543 uint32_t arr_elem = java_elems[i];
4544 LDKUpdateAddHTLC arr_elem_conv;
4545 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4546 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4547 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
4548 ret->data[i] = arr_elem_conv;
4551 return (uint64_t)ret;
4553 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
4554 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
4555 for (size_t i = 0; i < ret.datalen; i++) {
4556 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
4560 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
4561 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
4562 ret->datalen = *((uint32_t*)elems);
4563 if (ret->datalen == 0) {
4566 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
4567 uint32_t *java_elems = (uint32_t*)(elems + 4);
4568 for (size_t i = 0; i < ret->datalen; i++) {
4569 uint32_t arr_elem = java_elems[i];
4570 LDKUpdateFulfillHTLC arr_elem_conv;
4571 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4572 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4573 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
4574 ret->data[i] = arr_elem_conv;
4577 return (uint64_t)ret;
4579 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
4580 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
4581 for (size_t i = 0; i < ret.datalen; i++) {
4582 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
4586 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
4587 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
4588 ret->datalen = *((uint32_t*)elems);
4589 if (ret->datalen == 0) {
4592 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
4593 uint32_t *java_elems = (uint32_t*)(elems + 4);
4594 for (size_t i = 0; i < ret->datalen; i++) {
4595 uint32_t arr_elem = java_elems[i];
4596 LDKUpdateFailHTLC arr_elem_conv;
4597 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4598 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4599 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
4600 ret->data[i] = arr_elem_conv;
4603 return (uint64_t)ret;
4605 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
4606 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
4607 for (size_t i = 0; i < ret.datalen; i++) {
4608 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
4612 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
4613 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
4614 ret->datalen = *((uint32_t*)elems);
4615 if (ret->datalen == 0) {
4618 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
4619 uint32_t *java_elems = (uint32_t*)(elems + 4);
4620 for (size_t i = 0; i < ret->datalen; i++) {
4621 uint32_t arr_elem = java_elems[i];
4622 LDKUpdateFailMalformedHTLC arr_elem_conv;
4623 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4624 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4625 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
4626 ret->data[i] = arr_elem_conv;
4629 return (uint64_t)ret;
4631 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
4632 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
4633 for (size_t i = 0; i < ret.datalen; i++) {
4634 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
4638 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
4639 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
4641 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
4642 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4643 CHECK(val->result_ok);
4644 LDKAcceptChannel res_var = (*val->contents.result);
4645 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4646 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4647 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4650 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
4651 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4652 CHECK(!val->result_ok);
4653 LDKDecodeError err_var = (*val->contents.err);
4654 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4655 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4656 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4659 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
4660 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
4662 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
4663 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4664 CHECK(val->result_ok);
4665 LDKAnnouncementSignatures res_var = (*val->contents.result);
4666 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4667 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4668 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4671 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
4672 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4673 CHECK(!val->result_ok);
4674 LDKDecodeError err_var = (*val->contents.err);
4675 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4676 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4677 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4680 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
4681 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
4683 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
4684 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4685 CHECK(val->result_ok);
4686 LDKChannelReestablish res_var = (*val->contents.result);
4687 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4688 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4689 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4692 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
4693 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4694 CHECK(!val->result_ok);
4695 LDKDecodeError err_var = (*val->contents.err);
4696 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4697 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4698 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4701 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4702 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
4704 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4705 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4706 CHECK(val->result_ok);
4707 LDKClosingSigned res_var = (*val->contents.result);
4708 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4709 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4710 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4713 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
4714 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4715 CHECK(!val->result_ok);
4716 LDKDecodeError err_var = (*val->contents.err);
4717 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4718 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4719 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4722 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_result_ok(uint32_t arg) {
4723 return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
4725 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t arg) {
4726 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4727 CHECK(val->result_ok);
4728 LDKClosingSignedFeeRange res_var = (*val->contents.result);
4729 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4730 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4731 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4734 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t arg) {
4735 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4736 CHECK(!val->result_ok);
4737 LDKDecodeError err_var = (*val->contents.err);
4738 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4739 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4740 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4743 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
4744 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
4746 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
4747 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4748 CHECK(val->result_ok);
4749 LDKCommitmentSigned res_var = (*val->contents.result);
4750 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4751 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4752 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4755 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
4756 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4757 CHECK(!val->result_ok);
4758 LDKDecodeError err_var = (*val->contents.err);
4759 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4760 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4761 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4764 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
4765 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
4767 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
4768 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4769 CHECK(val->result_ok);
4770 LDKFundingCreated res_var = (*val->contents.result);
4771 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4772 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4773 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4776 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
4777 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4778 CHECK(!val->result_ok);
4779 LDKDecodeError err_var = (*val->contents.err);
4780 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4781 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4782 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4785 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4786 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
4788 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4789 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4790 CHECK(val->result_ok);
4791 LDKFundingSigned res_var = (*val->contents.result);
4792 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4793 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4794 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4797 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
4798 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4799 CHECK(!val->result_ok);
4800 LDKDecodeError err_var = (*val->contents.err);
4801 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4802 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4803 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4806 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
4807 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
4809 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
4810 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4811 CHECK(val->result_ok);
4812 LDKFundingLocked res_var = (*val->contents.result);
4813 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4814 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4815 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4818 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
4819 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4820 CHECK(!val->result_ok);
4821 LDKDecodeError err_var = (*val->contents.err);
4822 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4823 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4824 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4827 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_result_ok(uint32_t arg) {
4828 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
4830 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
4831 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4832 CHECK(val->result_ok);
4833 LDKInit res_var = (*val->contents.result);
4834 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4835 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4836 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4839 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
4840 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4841 CHECK(!val->result_ok);
4842 LDKDecodeError err_var = (*val->contents.err);
4843 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4844 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4845 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4848 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
4849 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
4851 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
4852 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4853 CHECK(val->result_ok);
4854 LDKOpenChannel res_var = (*val->contents.result);
4855 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4856 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4857 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4860 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
4861 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4862 CHECK(!val->result_ok);
4863 LDKDecodeError err_var = (*val->contents.err);
4864 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4865 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4866 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4869 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
4870 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
4872 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
4873 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4874 CHECK(val->result_ok);
4875 LDKRevokeAndACK res_var = (*val->contents.result);
4876 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4877 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4878 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4881 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
4882 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4883 CHECK(!val->result_ok);
4884 LDKDecodeError err_var = (*val->contents.err);
4885 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4886 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4887 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4890 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
4891 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
4893 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
4894 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4895 CHECK(val->result_ok);
4896 LDKShutdown res_var = (*val->contents.result);
4897 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4898 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4899 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4902 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
4903 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4904 CHECK(!val->result_ok);
4905 LDKDecodeError err_var = (*val->contents.err);
4906 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4907 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4908 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4911 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4912 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
4914 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4915 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4916 CHECK(val->result_ok);
4917 LDKUpdateFailHTLC res_var = (*val->contents.result);
4918 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4919 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4920 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4923 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
4924 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4925 CHECK(!val->result_ok);
4926 LDKDecodeError err_var = (*val->contents.err);
4927 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4928 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4929 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4932 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4933 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
4935 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4936 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4937 CHECK(val->result_ok);
4938 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
4939 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4940 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4941 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4944 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
4945 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4946 CHECK(!val->result_ok);
4947 LDKDecodeError err_var = (*val->contents.err);
4948 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4949 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4950 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4953 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
4954 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
4956 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
4957 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4958 CHECK(val->result_ok);
4959 LDKUpdateFee res_var = (*val->contents.result);
4960 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4961 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4962 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4965 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
4966 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4967 CHECK(!val->result_ok);
4968 LDKDecodeError err_var = (*val->contents.err);
4969 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4970 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4971 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4974 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4975 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
4977 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4978 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4979 CHECK(val->result_ok);
4980 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
4981 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4982 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4983 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4986 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
4987 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4988 CHECK(!val->result_ok);
4989 LDKDecodeError err_var = (*val->contents.err);
4990 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4991 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4992 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4995 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4996 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
4998 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4999 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5000 CHECK(val->result_ok);
5001 LDKUpdateAddHTLC res_var = (*val->contents.result);
5002 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5003 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5004 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5007 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
5008 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5009 CHECK(!val->result_ok);
5010 LDKDecodeError err_var = (*val->contents.err);
5011 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5012 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5013 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5016 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_result_ok(uint32_t arg) {
5017 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
5019 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
5020 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5021 CHECK(val->result_ok);
5022 LDKPing res_var = (*val->contents.result);
5023 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5024 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5025 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5028 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
5029 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5030 CHECK(!val->result_ok);
5031 LDKDecodeError err_var = (*val->contents.err);
5032 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5033 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5034 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5037 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_result_ok(uint32_t arg) {
5038 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
5040 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
5041 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5042 CHECK(val->result_ok);
5043 LDKPong res_var = (*val->contents.result);
5044 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5045 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5046 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5049 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
5050 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5051 CHECK(!val->result_ok);
5052 LDKDecodeError err_var = (*val->contents.err);
5053 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5054 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5055 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5058 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5059 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5061 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5062 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5063 CHECK(val->result_ok);
5064 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
5065 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5066 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5067 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5070 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5071 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5072 CHECK(!val->result_ok);
5073 LDKDecodeError err_var = (*val->contents.err);
5074 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5075 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5076 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5079 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5080 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5082 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5083 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5084 CHECK(val->result_ok);
5085 LDKChannelAnnouncement res_var = (*val->contents.result);
5086 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5087 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5088 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5091 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5092 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5093 CHECK(!val->result_ok);
5094 LDKDecodeError err_var = (*val->contents.err);
5095 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5096 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5097 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5100 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
5101 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
5103 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
5104 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5105 CHECK(val->result_ok);
5106 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
5107 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5108 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5109 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5112 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
5113 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5114 CHECK(!val->result_ok);
5115 LDKDecodeError err_var = (*val->contents.err);
5116 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5117 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5118 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5121 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
5122 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
5124 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
5125 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5126 CHECK(val->result_ok);
5127 LDKChannelUpdate res_var = (*val->contents.result);
5128 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5129 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5130 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5133 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
5134 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5135 CHECK(!val->result_ok);
5136 LDKDecodeError err_var = (*val->contents.err);
5137 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5138 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5139 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5142 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
5143 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
5145 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
5146 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5147 CHECK(val->result_ok);
5148 LDKErrorMessage res_var = (*val->contents.result);
5149 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5150 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5151 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5154 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
5155 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5156 CHECK(!val->result_ok);
5157 LDKDecodeError err_var = (*val->contents.err);
5158 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5159 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5160 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5163 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5164 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5166 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5167 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5168 CHECK(val->result_ok);
5169 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
5170 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5171 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5172 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5175 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5176 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5177 CHECK(!val->result_ok);
5178 LDKDecodeError err_var = (*val->contents.err);
5179 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5180 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5181 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5184 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5185 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5187 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5188 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5189 CHECK(val->result_ok);
5190 LDKNodeAnnouncement res_var = (*val->contents.result);
5191 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5192 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5193 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5196 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5197 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5198 CHECK(!val->result_ok);
5199 LDKDecodeError err_var = (*val->contents.err);
5200 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5201 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5202 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5205 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
5206 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
5208 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
5209 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5210 CHECK(val->result_ok);
5211 LDKQueryShortChannelIds res_var = (*val->contents.result);
5212 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5213 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5214 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5217 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
5218 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5219 CHECK(!val->result_ok);
5220 LDKDecodeError err_var = (*val->contents.err);
5221 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5222 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5223 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5226 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
5227 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
5229 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
5230 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5231 CHECK(val->result_ok);
5232 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
5233 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5234 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5235 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5238 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
5239 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5240 CHECK(!val->result_ok);
5241 LDKDecodeError err_var = (*val->contents.err);
5242 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5243 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5244 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5247 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
5248 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
5250 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5251 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5252 CHECK(val->result_ok);
5253 LDKQueryChannelRange res_var = (*val->contents.result);
5254 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5255 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5256 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5259 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5260 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5261 CHECK(!val->result_ok);
5262 LDKDecodeError err_var = (*val->contents.err);
5263 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5264 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5265 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5268 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
5269 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
5271 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5272 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5273 CHECK(val->result_ok);
5274 LDKReplyChannelRange res_var = (*val->contents.result);
5275 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5276 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5277 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5280 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5281 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5282 CHECK(!val->result_ok);
5283 LDKDecodeError err_var = (*val->contents.err);
5284 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5285 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5286 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5289 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
5290 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
5292 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
5293 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5294 CHECK(val->result_ok);
5295 LDKGossipTimestampFilter res_var = (*val->contents.result);
5296 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5297 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5298 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5301 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
5302 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5303 CHECK(!val->result_ok);
5304 LDKDecodeError err_var = (*val->contents.err);
5305 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5306 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5307 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5310 uint32_t __attribute__((visibility("default"))) TS_LDKSignOrCreationError_ref_from_ptr(uint32_t ptr) {
5311 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
5313 case LDKSignOrCreationError_SignError: {
5314 return 0 /* LDKSignOrCreationError - SignError */;
5316 case LDKSignOrCreationError_CreationError: {
5317 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
5318 return 0 /* LDKSignOrCreationError - CreationError */; (void) creation_error_conv;
5323 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_result_ok(uint32_t arg) {
5324 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
5326 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t arg) {
5327 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5328 CHECK(val->result_ok);
5329 LDKInvoice res_var = (*val->contents.result);
5330 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5331 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5332 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5335 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t arg) {
5336 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5337 CHECK(!val->result_ok);
5338 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
5341 typedef struct LDKFilter_JCalls {
5342 atomic_size_t refcnt;
5343 uint32_t register_tx_meth;
5344 uint32_t register_output_meth;
5346 static void LDKFilter_JCalls_free(void* this_arg) {
5347 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5348 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5349 js_free(j_calls->register_tx_meth);
5350 js_free(j_calls->register_output_meth);
5354 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5355 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5356 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5357 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5358 LDKu8slice script_pubkey_var = script_pubkey;
5359 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5360 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
5361 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
5363 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5364 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5365 LDKWatchedOutput output_var = output;
5366 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5367 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5368 uint64_t output_ref = (uint64_t)output_var.inner;
5369 if (output_var.is_owned) {
5372 uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
5373 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
5374 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
5377 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5378 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5379 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5381 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
5382 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5383 atomic_init(&calls->refcnt, 1);
5384 //TODO: Assign calls->o from o
5387 .this_arg = (void*) calls,
5388 .register_tx = register_tx_LDKFilter_jcall,
5389 .register_output = register_output_LDKFilter_jcall,
5390 .free = LDKFilter_JCalls_free,
5394 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
5395 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5396 *res_ptr = LDKFilter_init(o);
5397 return (long)res_ptr;
5399 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5400 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
5401 unsigned char txid_arr[32];
5402 CHECK(*((uint32_t*)txid) == 32);
5403 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5404 unsigned char (*txid_ref)[32] = &txid_arr;
5405 LDKu8slice script_pubkey_ref;
5406 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
5407 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
5408 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5411 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5412 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
5413 LDKWatchedOutput output_conv;
5414 output_conv.inner = (void*)(output & (~1));
5415 output_conv.is_owned = (output & 1) || (output == 0);
5416 output_conv = WatchedOutput_clone(&output_conv);
5417 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5418 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5419 uint64_t ret_ref = (uint64_t)ret_copy;
5423 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_FilterZ_ref_from_ptr(uint32_t ptr) {
5424 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
5426 case LDKCOption_FilterZ_Some: {
5427 LDKFilter* some_ret =MALLOC(sizeof(LDKFilter), "LDKFilter");
5428 *some_ret = obj->some;
5429 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
5430 return 0 /* LDKCOption_FilterZ - Some */; (void) (uint64_t)some_ret;
5432 case LDKCOption_FilterZ_None: {
5433 return 0 /* LDKCOption_FilterZ - None */;
5438 typedef struct LDKMessageSendEventsProvider_JCalls {
5439 atomic_size_t refcnt;
5440 uint32_t get_and_clear_pending_msg_events_meth;
5441 } LDKMessageSendEventsProvider_JCalls;
5442 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
5443 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5444 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5445 js_free(j_calls->get_and_clear_pending_msg_events_meth);
5449 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
5450 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5451 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
5452 LDKCVec_MessageSendEventZ ret_constr;
5453 ret_constr.datalen = *((uint32_t*)ret);
5454 if (ret_constr.datalen > 0)
5455 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5457 ret_constr.data = NULL;
5458 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5459 for (size_t s = 0; s < ret_constr.datalen; s++) {
5460 uint32_t ret_conv_18 = ret_vals[s];
5461 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
5462 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
5463 ret_constr.data[s] = ret_conv_18_conv;
5467 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
5468 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
5469 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5471 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5472 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
5473 atomic_init(&calls->refcnt, 1);
5474 //TODO: Assign calls->o from o
5476 LDKMessageSendEventsProvider ret = {
5477 .this_arg = (void*) calls,
5478 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
5479 .free = LDKMessageSendEventsProvider_JCalls_free,
5483 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5484 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
5485 *res_ptr = LDKMessageSendEventsProvider_init(o);
5486 return (long)res_ptr;
5488 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
5489 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
5490 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
5491 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5492 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5493 for (size_t s = 0; s < ret_var.datalen; s++) {
5494 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5495 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
5496 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
5497 ret_arr_ptr[s] = ret_conv_18_ref;
5503 typedef struct LDKEventHandler_JCalls {
5504 atomic_size_t refcnt;
5505 uint32_t handle_event_meth;
5506 } LDKEventHandler_JCalls;
5507 static void LDKEventHandler_JCalls_free(void* this_arg) {
5508 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5509 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5510 js_free(j_calls->handle_event_meth);
5514 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
5515 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5516 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
5517 *ret_event = Event_clone(event);
5518 js_invoke_function_1(j_calls->handle_event_meth, (uint64_t)ret_event);
5520 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
5521 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
5522 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5524 static inline LDKEventHandler LDKEventHandler_init (/*TODO: JS Object Reference */void* o) {
5525 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
5526 atomic_init(&calls->refcnt, 1);
5527 //TODO: Assign calls->o from o
5529 LDKEventHandler ret = {
5530 .this_arg = (void*) calls,
5531 .handle_event = handle_event_LDKEventHandler_jcall,
5532 .free = LDKEventHandler_JCalls_free,
5536 long __attribute__((visibility("default"))) TS_LDKEventHandler_new(/*TODO: JS Object Reference */void* o) {
5537 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5538 *res_ptr = LDKEventHandler_init(o);
5539 return (long)res_ptr;
5541 void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
5542 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
5543 LDKEvent* event_conv = (LDKEvent*)event;
5544 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
5547 typedef struct LDKEventsProvider_JCalls {
5548 atomic_size_t refcnt;
5549 uint32_t process_pending_events_meth;
5550 } LDKEventsProvider_JCalls;
5551 static void LDKEventsProvider_JCalls_free(void* this_arg) {
5552 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5553 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5554 js_free(j_calls->process_pending_events_meth);
5558 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
5559 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5560 LDKEventHandler* handler_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5561 *handler_ret = handler;
5562 js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)handler_ret);
5564 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
5565 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
5566 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5568 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5569 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
5570 atomic_init(&calls->refcnt, 1);
5571 //TODO: Assign calls->o from o
5573 LDKEventsProvider ret = {
5574 .this_arg = (void*) calls,
5575 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
5576 .free = LDKEventsProvider_JCalls_free,
5580 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5581 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5582 *res_ptr = LDKEventsProvider_init(o);
5583 return (long)res_ptr;
5585 void __attribute__((visibility("default"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
5586 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
5587 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
5588 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
5591 typedef struct LDKListen_JCalls {
5592 atomic_size_t refcnt;
5593 uint32_t block_connected_meth;
5594 uint32_t block_disconnected_meth;
5596 static void LDKListen_JCalls_free(void* this_arg) {
5597 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5598 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5599 js_free(j_calls->block_connected_meth);
5600 js_free(j_calls->block_disconnected_meth);
5604 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
5605 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5606 LDKu8slice block_var = block;
5607 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5608 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
5609 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
5611 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5612 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5613 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5614 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5615 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
5617 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
5618 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
5619 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5621 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
5622 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
5623 atomic_init(&calls->refcnt, 1);
5624 //TODO: Assign calls->o from o
5627 .this_arg = (void*) calls,
5628 .block_connected = block_connected_LDKListen_jcall,
5629 .block_disconnected = block_disconnected_LDKListen_jcall,
5630 .free = LDKListen_JCalls_free,
5634 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
5635 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
5636 *res_ptr = LDKListen_init(o);
5637 return (long)res_ptr;
5639 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
5640 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
5641 LDKu8slice block_ref;
5642 block_ref.datalen = *((uint32_t*)block);
5643 block_ref.data = (int8_t*)(block + 4);
5644 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
5647 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
5648 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
5649 unsigned char header_arr[80];
5650 CHECK(*((uint32_t*)header) == 80);
5651 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5652 unsigned char (*header_ref)[80] = &header_arr;
5653 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
5656 typedef struct LDKConfirm_JCalls {
5657 atomic_size_t refcnt;
5658 uint32_t transactions_confirmed_meth;
5659 uint32_t transaction_unconfirmed_meth;
5660 uint32_t best_block_updated_meth;
5661 uint32_t get_relevant_txids_meth;
5662 } LDKConfirm_JCalls;
5663 static void LDKConfirm_JCalls_free(void* this_arg) {
5664 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5665 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5666 js_free(j_calls->transactions_confirmed_meth);
5667 js_free(j_calls->transaction_unconfirmed_meth);
5668 js_free(j_calls->best_block_updated_meth);
5669 js_free(j_calls->get_relevant_txids_meth);
5673 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
5674 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5675 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5676 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5677 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
5678 uint32_tArray txdata_arr = init_arr(txdata_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5679 uint32_t *txdata_arr_ptr = (uint32_t*)(txdata_arr + 4);
5680 for (size_t c = 0; c < txdata_var.datalen; c++) {
5681 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5682 *txdata_conv_28_conv = txdata_var.data[c];
5683 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
5685 FREE(txdata_var.data);
5686 js_invoke_function_3(j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
5688 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
5689 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5690 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5691 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5692 js_invoke_function_1(j_calls->transaction_unconfirmed_meth, txid_arr);
5694 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5695 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5696 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5697 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5698 js_invoke_function_2(j_calls->best_block_updated_meth, header_arr, height);
5700 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
5701 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5702 ptrArray ret = js_invoke_function_0(j_calls->get_relevant_txids_meth);
5703 LDKCVec_TxidZ ret_constr;
5704 ret_constr.datalen = *((uint32_t*)ret);
5705 if (ret_constr.datalen > 0)
5706 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
5708 ret_constr.data = NULL;
5709 int8_tArray* ret_vals = (int8_tArray*)(ret + 4);
5710 for (size_t m = 0; m < ret_constr.datalen; m++) {
5711 int8_tArray ret_conv_12 = ret_vals[m];
5712 LDKThirtyTwoBytes ret_conv_12_ref;
5713 CHECK(*((uint32_t*)ret_conv_12) == 32);
5714 memcpy(ret_conv_12_ref.data, (uint8_t*)(ret_conv_12 + 4), 32);
5715 ret_constr.data[m] = ret_conv_12_ref;
5719 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
5720 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
5721 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5723 static inline LDKConfirm LDKConfirm_init (/*TODO: JS Object Reference */void* o) {
5724 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
5725 atomic_init(&calls->refcnt, 1);
5726 //TODO: Assign calls->o from o
5729 .this_arg = (void*) calls,
5730 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
5731 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
5732 .best_block_updated = best_block_updated_LDKConfirm_jcall,
5733 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
5734 .free = LDKConfirm_JCalls_free,
5738 long __attribute__((visibility("default"))) TS_LDKConfirm_new(/*TODO: JS Object Reference */void* o) {
5739 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
5740 *res_ptr = LDKConfirm_init(o);
5741 return (long)res_ptr;
5743 void __attribute__((visibility("default"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
5744 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5745 unsigned char header_arr[80];
5746 CHECK(*((uint32_t*)header) == 80);
5747 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5748 unsigned char (*header_ref)[80] = &header_arr;
5749 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5750 txdata_constr.datalen = *((uint32_t*)txdata);
5751 if (txdata_constr.datalen > 0)
5752 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5754 txdata_constr.data = NULL;
5755 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
5756 for (size_t c = 0; c < txdata_constr.datalen; c++) {
5757 uint32_t txdata_conv_28 = txdata_vals[c];
5758 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1);
5759 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
5760 txdata_constr.data[c] = txdata_conv_28_conv;
5762 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
5765 void __attribute__((visibility("default"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
5766 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5767 unsigned char txid_arr[32];
5768 CHECK(*((uint32_t*)txid) == 32);
5769 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5770 unsigned char (*txid_ref)[32] = &txid_arr;
5771 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
5774 void __attribute__((visibility("default"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
5775 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5776 unsigned char header_arr[80];
5777 CHECK(*((uint32_t*)header) == 80);
5778 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5779 unsigned char (*header_ref)[80] = &header_arr;
5780 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
5783 ptrArray __attribute__((visibility("default"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
5784 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5785 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
5786 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
5787 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
5788 for (size_t m = 0; m < ret_var.datalen; m++) {
5789 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5790 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
5791 ret_arr_ptr[m] = ret_conv_12_arr;
5797 typedef struct LDKPersist_JCalls {
5798 atomic_size_t refcnt;
5799 uint32_t persist_new_channel_meth;
5800 uint32_t update_persisted_channel_meth;
5801 } LDKPersist_JCalls;
5802 static void LDKPersist_JCalls_free(void* this_arg) {
5803 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5804 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5805 js_free(j_calls->persist_new_channel_meth);
5806 js_free(j_calls->update_persisted_channel_meth);
5810 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
5811 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5812 LDKOutPoint id_var = id;
5813 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5814 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5815 uint64_t id_ref = (uint64_t)id_var.inner;
5816 if (id_var.is_owned) {
5819 LDKChannelMonitor data_var = *data;
5820 data_var = ChannelMonitor_clone(data);
5821 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5822 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5823 uint64_t data_ref = (uint64_t)data_var.inner;
5824 if (data_var.is_owned) {
5827 uint32_t ret = js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
5828 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5829 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
5832 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
5833 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5834 LDKOutPoint id_var = id;
5835 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5836 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5837 uint64_t id_ref = (uint64_t)id_var.inner;
5838 if (id_var.is_owned) {
5841 LDKChannelMonitorUpdate update_var = *update;
5842 update_var = ChannelMonitorUpdate_clone(update);
5843 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5844 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5845 uint64_t update_ref = (uint64_t)update_var.inner;
5846 if (update_var.is_owned) {
5849 LDKChannelMonitor data_var = *data;
5850 data_var = ChannelMonitor_clone(data);
5851 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5852 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5853 uint64_t data_ref = (uint64_t)data_var.inner;
5854 if (data_var.is_owned) {
5857 uint32_t ret = js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
5858 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5859 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
5862 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
5863 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
5864 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5866 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
5867 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
5868 atomic_init(&calls->refcnt, 1);
5869 //TODO: Assign calls->o from o
5872 .this_arg = (void*) calls,
5873 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
5874 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
5875 .free = LDKPersist_JCalls_free,
5879 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
5880 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
5881 *res_ptr = LDKPersist_init(o);
5882 return (long)res_ptr;
5884 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t id, uint32_t data) {
5885 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5886 LDKOutPoint id_conv;
5887 id_conv.inner = (void*)(id & (~1));
5888 id_conv.is_owned = (id & 1) || (id == 0);
5889 id_conv = OutPoint_clone(&id_conv);
5890 LDKChannelMonitor data_conv;
5891 data_conv.inner = (void*)(data & (~1));
5892 data_conv.is_owned = false;
5893 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5894 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
5895 return (uint64_t)ret_conv;
5898 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
5899 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5900 LDKOutPoint id_conv;
5901 id_conv.inner = (void*)(id & (~1));
5902 id_conv.is_owned = (id & 1) || (id == 0);
5903 id_conv = OutPoint_clone(&id_conv);
5904 LDKChannelMonitorUpdate update_conv;
5905 update_conv.inner = (void*)(update & (~1));
5906 update_conv.is_owned = false;
5907 LDKChannelMonitor data_conv;
5908 data_conv.inner = (void*)(data & (~1));
5909 data_conv.is_owned = false;
5910 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5911 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
5912 return (uint64_t)ret_conv;
5915 typedef struct LDKChannelMessageHandler_JCalls {
5916 atomic_size_t refcnt;
5917 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5918 uint32_t handle_open_channel_meth;
5919 uint32_t handle_accept_channel_meth;
5920 uint32_t handle_funding_created_meth;
5921 uint32_t handle_funding_signed_meth;
5922 uint32_t handle_funding_locked_meth;
5923 uint32_t handle_shutdown_meth;
5924 uint32_t handle_closing_signed_meth;
5925 uint32_t handle_update_add_htlc_meth;
5926 uint32_t handle_update_fulfill_htlc_meth;
5927 uint32_t handle_update_fail_htlc_meth;
5928 uint32_t handle_update_fail_malformed_htlc_meth;
5929 uint32_t handle_commitment_signed_meth;
5930 uint32_t handle_revoke_and_ack_meth;
5931 uint32_t handle_update_fee_meth;
5932 uint32_t handle_announcement_signatures_meth;
5933 uint32_t peer_disconnected_meth;
5934 uint32_t peer_connected_meth;
5935 uint32_t handle_channel_reestablish_meth;
5936 uint32_t handle_channel_update_meth;
5937 uint32_t handle_error_meth;
5938 } LDKChannelMessageHandler_JCalls;
5939 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
5940 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5941 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5942 js_free(j_calls->handle_open_channel_meth);
5943 js_free(j_calls->handle_accept_channel_meth);
5944 js_free(j_calls->handle_funding_created_meth);
5945 js_free(j_calls->handle_funding_signed_meth);
5946 js_free(j_calls->handle_funding_locked_meth);
5947 js_free(j_calls->handle_shutdown_meth);
5948 js_free(j_calls->handle_closing_signed_meth);
5949 js_free(j_calls->handle_update_add_htlc_meth);
5950 js_free(j_calls->handle_update_fulfill_htlc_meth);
5951 js_free(j_calls->handle_update_fail_htlc_meth);
5952 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
5953 js_free(j_calls->handle_commitment_signed_meth);
5954 js_free(j_calls->handle_revoke_and_ack_meth);
5955 js_free(j_calls->handle_update_fee_meth);
5956 js_free(j_calls->handle_announcement_signatures_meth);
5957 js_free(j_calls->peer_disconnected_meth);
5958 js_free(j_calls->peer_connected_meth);
5959 js_free(j_calls->handle_channel_reestablish_meth);
5960 js_free(j_calls->handle_channel_update_meth);
5961 js_free(j_calls->handle_error_meth);
5965 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
5966 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5967 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5968 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5969 LDKInitFeatures their_features_var = their_features;
5970 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5971 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5972 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5973 if (their_features_var.is_owned) {
5974 their_features_ref |= 1;
5976 LDKOpenChannel msg_var = *msg;
5977 msg_var = OpenChannel_clone(msg);
5978 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5979 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5980 uint64_t msg_ref = (uint64_t)msg_var.inner;
5981 if (msg_var.is_owned) {
5984 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5986 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
5987 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5988 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5989 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5990 LDKInitFeatures their_features_var = their_features;
5991 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5992 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5993 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5994 if (their_features_var.is_owned) {
5995 their_features_ref |= 1;
5997 LDKAcceptChannel msg_var = *msg;
5998 msg_var = AcceptChannel_clone(msg);
5999 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6000 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6001 uint64_t msg_ref = (uint64_t)msg_var.inner;
6002 if (msg_var.is_owned) {
6005 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6007 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
6008 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6009 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6010 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6011 LDKFundingCreated msg_var = *msg;
6012 msg_var = FundingCreated_clone(msg);
6013 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6014 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6015 uint64_t msg_ref = (uint64_t)msg_var.inner;
6016 if (msg_var.is_owned) {
6019 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
6021 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
6022 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6023 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6024 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6025 LDKFundingSigned msg_var = *msg;
6026 msg_var = FundingSigned_clone(msg);
6027 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6028 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6029 uint64_t msg_ref = (uint64_t)msg_var.inner;
6030 if (msg_var.is_owned) {
6033 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
6035 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
6036 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6037 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6038 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6039 LDKFundingLocked msg_var = *msg;
6040 msg_var = FundingLocked_clone(msg);
6041 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6042 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6043 uint64_t msg_ref = (uint64_t)msg_var.inner;
6044 if (msg_var.is_owned) {
6047 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
6049 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
6050 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6051 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6052 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6053 LDKInitFeatures their_features_var = *their_features;
6054 their_features_var = InitFeatures_clone(their_features);
6055 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6056 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6057 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6058 if (their_features_var.is_owned) {
6059 their_features_ref |= 1;
6061 LDKShutdown msg_var = *msg;
6062 msg_var = Shutdown_clone(msg);
6063 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6064 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6065 uint64_t msg_ref = (uint64_t)msg_var.inner;
6066 if (msg_var.is_owned) {
6069 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
6071 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
6072 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6073 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6074 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6075 LDKClosingSigned msg_var = *msg;
6076 msg_var = ClosingSigned_clone(msg);
6077 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6078 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6079 uint64_t msg_ref = (uint64_t)msg_var.inner;
6080 if (msg_var.is_owned) {
6083 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
6085 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
6086 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6087 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6088 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6089 LDKUpdateAddHTLC msg_var = *msg;
6090 msg_var = UpdateAddHTLC_clone(msg);
6091 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6092 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6093 uint64_t msg_ref = (uint64_t)msg_var.inner;
6094 if (msg_var.is_owned) {
6097 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
6099 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
6100 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6101 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6102 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6103 LDKUpdateFulfillHTLC msg_var = *msg;
6104 msg_var = UpdateFulfillHTLC_clone(msg);
6105 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6106 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6107 uint64_t msg_ref = (uint64_t)msg_var.inner;
6108 if (msg_var.is_owned) {
6111 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
6113 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
6114 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6115 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6116 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6117 LDKUpdateFailHTLC msg_var = *msg;
6118 msg_var = UpdateFailHTLC_clone(msg);
6119 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6120 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6121 uint64_t msg_ref = (uint64_t)msg_var.inner;
6122 if (msg_var.is_owned) {
6125 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
6127 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
6128 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6129 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6130 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6131 LDKUpdateFailMalformedHTLC msg_var = *msg;
6132 msg_var = UpdateFailMalformedHTLC_clone(msg);
6133 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6134 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6135 uint64_t msg_ref = (uint64_t)msg_var.inner;
6136 if (msg_var.is_owned) {
6139 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
6141 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
6142 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6143 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6144 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6145 LDKCommitmentSigned msg_var = *msg;
6146 msg_var = CommitmentSigned_clone(msg);
6147 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6148 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6149 uint64_t msg_ref = (uint64_t)msg_var.inner;
6150 if (msg_var.is_owned) {
6153 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
6155 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
6156 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6157 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6158 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6159 LDKRevokeAndACK msg_var = *msg;
6160 msg_var = RevokeAndACK_clone(msg);
6161 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6162 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6163 uint64_t msg_ref = (uint64_t)msg_var.inner;
6164 if (msg_var.is_owned) {
6167 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
6169 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
6170 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6171 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6172 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6173 LDKUpdateFee msg_var = *msg;
6174 msg_var = UpdateFee_clone(msg);
6175 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6176 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6177 uint64_t msg_ref = (uint64_t)msg_var.inner;
6178 if (msg_var.is_owned) {
6181 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
6183 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
6184 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6185 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6186 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6187 LDKAnnouncementSignatures msg_var = *msg;
6188 msg_var = AnnouncementSignatures_clone(msg);
6189 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6190 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6191 uint64_t msg_ref = (uint64_t)msg_var.inner;
6192 if (msg_var.is_owned) {
6195 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
6197 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
6198 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6199 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6200 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6201 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
6203 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
6204 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6205 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6206 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6207 LDKInit msg_var = *msg;
6208 msg_var = Init_clone(msg);
6209 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6210 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6211 uint64_t msg_ref = (uint64_t)msg_var.inner;
6212 if (msg_var.is_owned) {
6215 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
6217 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
6218 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6219 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6220 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6221 LDKChannelReestablish msg_var = *msg;
6222 msg_var = ChannelReestablish_clone(msg);
6223 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6224 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6225 uint64_t msg_ref = (uint64_t)msg_var.inner;
6226 if (msg_var.is_owned) {
6229 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
6231 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
6232 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6233 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6234 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6235 LDKChannelUpdate msg_var = *msg;
6236 msg_var = ChannelUpdate_clone(msg);
6237 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6238 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6239 uint64_t msg_ref = (uint64_t)msg_var.inner;
6240 if (msg_var.is_owned) {
6243 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
6245 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
6246 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6247 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6248 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6249 LDKErrorMessage msg_var = *msg;
6250 msg_var = ErrorMessage_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_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
6259 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
6260 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
6261 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6262 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6264 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6265 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
6266 atomic_init(&calls->refcnt, 1);
6267 //TODO: Assign calls->o from o
6269 LDKChannelMessageHandler ret = {
6270 .this_arg = (void*) calls,
6271 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
6272 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
6273 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
6274 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
6275 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
6276 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
6277 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
6278 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
6279 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
6280 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
6281 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
6282 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
6283 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
6284 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
6285 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
6286 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
6287 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
6288 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
6289 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
6290 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
6291 .free = LDKChannelMessageHandler_JCalls_free,
6292 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6294 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6297 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6298 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6299 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
6300 return (long)res_ptr;
6302 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) {
6303 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6304 LDKPublicKey their_node_id_ref;
6305 CHECK(*((uint32_t*)their_node_id) == 33);
6306 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6307 LDKInitFeatures their_features_conv;
6308 their_features_conv.inner = (void*)(their_features & (~1));
6309 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6310 their_features_conv = InitFeatures_clone(&their_features_conv);
6311 LDKOpenChannel msg_conv;
6312 msg_conv.inner = (void*)(msg & (~1));
6313 msg_conv.is_owned = false;
6314 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6317 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) {
6318 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6319 LDKPublicKey their_node_id_ref;
6320 CHECK(*((uint32_t*)their_node_id) == 33);
6321 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6322 LDKInitFeatures their_features_conv;
6323 their_features_conv.inner = (void*)(their_features & (~1));
6324 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6325 their_features_conv = InitFeatures_clone(&their_features_conv);
6326 LDKAcceptChannel msg_conv;
6327 msg_conv.inner = (void*)(msg & (~1));
6328 msg_conv.is_owned = false;
6329 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6332 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6333 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6334 LDKPublicKey their_node_id_ref;
6335 CHECK(*((uint32_t*)their_node_id) == 33);
6336 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6337 LDKFundingCreated msg_conv;
6338 msg_conv.inner = (void*)(msg & (~1));
6339 msg_conv.is_owned = false;
6340 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6343 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6344 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6345 LDKPublicKey their_node_id_ref;
6346 CHECK(*((uint32_t*)their_node_id) == 33);
6347 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6348 LDKFundingSigned msg_conv;
6349 msg_conv.inner = (void*)(msg & (~1));
6350 msg_conv.is_owned = false;
6351 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6354 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6355 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6356 LDKPublicKey their_node_id_ref;
6357 CHECK(*((uint32_t*)their_node_id) == 33);
6358 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6359 LDKFundingLocked msg_conv;
6360 msg_conv.inner = (void*)(msg & (~1));
6361 msg_conv.is_owned = false;
6362 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6365 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
6366 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6367 LDKPublicKey their_node_id_ref;
6368 CHECK(*((uint32_t*)their_node_id) == 33);
6369 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6370 LDKInitFeatures their_features_conv;
6371 their_features_conv.inner = (void*)(their_features & (~1));
6372 their_features_conv.is_owned = false;
6373 LDKShutdown msg_conv;
6374 msg_conv.inner = (void*)(msg & (~1));
6375 msg_conv.is_owned = false;
6376 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
6379 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6380 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6381 LDKPublicKey their_node_id_ref;
6382 CHECK(*((uint32_t*)their_node_id) == 33);
6383 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6384 LDKClosingSigned msg_conv;
6385 msg_conv.inner = (void*)(msg & (~1));
6386 msg_conv.is_owned = false;
6387 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6390 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6391 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6392 LDKPublicKey their_node_id_ref;
6393 CHECK(*((uint32_t*)their_node_id) == 33);
6394 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6395 LDKUpdateAddHTLC msg_conv;
6396 msg_conv.inner = (void*)(msg & (~1));
6397 msg_conv.is_owned = false;
6398 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6401 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6402 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6403 LDKPublicKey their_node_id_ref;
6404 CHECK(*((uint32_t*)their_node_id) == 33);
6405 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6406 LDKUpdateFulfillHTLC msg_conv;
6407 msg_conv.inner = (void*)(msg & (~1));
6408 msg_conv.is_owned = false;
6409 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6412 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6413 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6414 LDKPublicKey their_node_id_ref;
6415 CHECK(*((uint32_t*)their_node_id) == 33);
6416 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6417 LDKUpdateFailHTLC msg_conv;
6418 msg_conv.inner = (void*)(msg & (~1));
6419 msg_conv.is_owned = false;
6420 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6423 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6424 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6425 LDKPublicKey their_node_id_ref;
6426 CHECK(*((uint32_t*)their_node_id) == 33);
6427 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6428 LDKUpdateFailMalformedHTLC msg_conv;
6429 msg_conv.inner = (void*)(msg & (~1));
6430 msg_conv.is_owned = false;
6431 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6434 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6435 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6436 LDKPublicKey their_node_id_ref;
6437 CHECK(*((uint32_t*)their_node_id) == 33);
6438 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6439 LDKCommitmentSigned msg_conv;
6440 msg_conv.inner = (void*)(msg & (~1));
6441 msg_conv.is_owned = false;
6442 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6445 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6446 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6447 LDKPublicKey their_node_id_ref;
6448 CHECK(*((uint32_t*)their_node_id) == 33);
6449 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6450 LDKRevokeAndACK msg_conv;
6451 msg_conv.inner = (void*)(msg & (~1));
6452 msg_conv.is_owned = false;
6453 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6456 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6457 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6458 LDKPublicKey their_node_id_ref;
6459 CHECK(*((uint32_t*)their_node_id) == 33);
6460 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6461 LDKUpdateFee msg_conv;
6462 msg_conv.inner = (void*)(msg & (~1));
6463 msg_conv.is_owned = false;
6464 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6467 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6468 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6469 LDKPublicKey their_node_id_ref;
6470 CHECK(*((uint32_t*)their_node_id) == 33);
6471 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6472 LDKAnnouncementSignatures msg_conv;
6473 msg_conv.inner = (void*)(msg & (~1));
6474 msg_conv.is_owned = false;
6475 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6478 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
6479 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6480 LDKPublicKey their_node_id_ref;
6481 CHECK(*((uint32_t*)their_node_id) == 33);
6482 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6483 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
6486 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6487 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6488 LDKPublicKey their_node_id_ref;
6489 CHECK(*((uint32_t*)their_node_id) == 33);
6490 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6492 msg_conv.inner = (void*)(msg & (~1));
6493 msg_conv.is_owned = false;
6494 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6497 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6498 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6499 LDKPublicKey their_node_id_ref;
6500 CHECK(*((uint32_t*)their_node_id) == 33);
6501 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6502 LDKChannelReestablish msg_conv;
6503 msg_conv.inner = (void*)(msg & (~1));
6504 msg_conv.is_owned = false;
6505 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6508 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6509 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6510 LDKPublicKey their_node_id_ref;
6511 CHECK(*((uint32_t*)their_node_id) == 33);
6512 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6513 LDKChannelUpdate msg_conv;
6514 msg_conv.inner = (void*)(msg & (~1));
6515 msg_conv.is_owned = false;
6516 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6519 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6520 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6521 LDKPublicKey their_node_id_ref;
6522 CHECK(*((uint32_t*)their_node_id) == 33);
6523 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6524 LDKErrorMessage msg_conv;
6525 msg_conv.inner = (void*)(msg & (~1));
6526 msg_conv.is_owned = false;
6527 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6530 typedef struct LDKRoutingMessageHandler_JCalls {
6531 atomic_size_t refcnt;
6532 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6533 uint32_t handle_node_announcement_meth;
6534 uint32_t handle_channel_announcement_meth;
6535 uint32_t handle_channel_update_meth;
6536 uint32_t get_next_channel_announcements_meth;
6537 uint32_t get_next_node_announcements_meth;
6538 uint32_t sync_routing_table_meth;
6539 uint32_t handle_reply_channel_range_meth;
6540 uint32_t handle_reply_short_channel_ids_end_meth;
6541 uint32_t handle_query_channel_range_meth;
6542 uint32_t handle_query_short_channel_ids_meth;
6543 } LDKRoutingMessageHandler_JCalls;
6544 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
6545 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6546 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6547 js_free(j_calls->handle_node_announcement_meth);
6548 js_free(j_calls->handle_channel_announcement_meth);
6549 js_free(j_calls->handle_channel_update_meth);
6550 js_free(j_calls->get_next_channel_announcements_meth);
6551 js_free(j_calls->get_next_node_announcements_meth);
6552 js_free(j_calls->sync_routing_table_meth);
6553 js_free(j_calls->handle_reply_channel_range_meth);
6554 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
6555 js_free(j_calls->handle_query_channel_range_meth);
6556 js_free(j_calls->handle_query_short_channel_ids_meth);
6560 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
6561 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6562 LDKNodeAnnouncement msg_var = *msg;
6563 msg_var = NodeAnnouncement_clone(msg);
6564 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6565 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6566 uint64_t msg_ref = (uint64_t)msg_var.inner;
6567 if (msg_var.is_owned) {
6570 uint32_t ret = js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
6571 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6572 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6575 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
6576 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6577 LDKChannelAnnouncement msg_var = *msg;
6578 msg_var = ChannelAnnouncement_clone(msg);
6579 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6580 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6581 uint64_t msg_ref = (uint64_t)msg_var.inner;
6582 if (msg_var.is_owned) {
6585 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
6586 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6587 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6590 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
6591 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6592 LDKChannelUpdate msg_var = *msg;
6593 msg_var = ChannelUpdate_clone(msg);
6594 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6595 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6596 uint64_t msg_ref = (uint64_t)msg_var.inner;
6597 if (msg_var.is_owned) {
6600 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
6601 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6602 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6605 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
6606 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6607 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
6608 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
6609 ret_constr.datalen = *((uint32_t*)ret);
6610 if (ret_constr.datalen > 0)
6611 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6613 ret_constr.data = NULL;
6614 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6615 for (size_t h = 0; h < ret_constr.datalen; h++) {
6616 uint32_t ret_conv_59 = ret_vals[h];
6617 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_59) & ~1);
6618 ret_conv_59_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_59) & ~1));
6619 ret_constr.data[h] = ret_conv_59_conv;
6623 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
6624 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6625 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6626 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
6627 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
6628 LDKCVec_NodeAnnouncementZ ret_constr;
6629 ret_constr.datalen = *((uint32_t*)ret);
6630 if (ret_constr.datalen > 0)
6631 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6633 ret_constr.data = NULL;
6634 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6635 for (size_t s = 0; s < ret_constr.datalen; s++) {
6636 uint32_t ret_conv_18 = ret_vals[s];
6637 LDKNodeAnnouncement ret_conv_18_conv;
6638 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
6639 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
6640 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
6641 ret_constr.data[s] = ret_conv_18_conv;
6645 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
6646 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6647 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6648 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6649 LDKInit init_var = *init;
6650 init_var = Init_clone(init);
6651 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6652 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6653 uint64_t init_ref = (uint64_t)init_var.inner;
6654 if (init_var.is_owned) {
6657 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
6659 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
6660 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6661 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6662 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6663 LDKReplyChannelRange msg_var = msg;
6664 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6665 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6666 uint64_t msg_ref = (uint64_t)msg_var.inner;
6667 if (msg_var.is_owned) {
6670 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
6671 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6672 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6675 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
6676 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6677 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6678 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6679 LDKReplyShortChannelIdsEnd msg_var = msg;
6680 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6681 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6682 uint64_t msg_ref = (uint64_t)msg_var.inner;
6683 if (msg_var.is_owned) {
6686 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
6687 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6688 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6691 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
6692 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6693 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6694 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6695 LDKQueryChannelRange msg_var = msg;
6696 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6697 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6698 uint64_t msg_ref = (uint64_t)msg_var.inner;
6699 if (msg_var.is_owned) {
6702 uint32_t ret = js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
6703 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6704 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6707 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
6708 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6709 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6710 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6711 LDKQueryShortChannelIds msg_var = msg;
6712 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6713 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6714 uint64_t msg_ref = (uint64_t)msg_var.inner;
6715 if (msg_var.is_owned) {
6718 uint32_t ret = js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
6719 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6720 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6723 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
6724 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
6725 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6726 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6728 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6729 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
6730 atomic_init(&calls->refcnt, 1);
6731 //TODO: Assign calls->o from o
6733 LDKRoutingMessageHandler ret = {
6734 .this_arg = (void*) calls,
6735 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
6736 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
6737 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
6738 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
6739 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
6740 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
6741 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
6742 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
6743 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
6744 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
6745 .free = LDKRoutingMessageHandler_JCalls_free,
6746 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6748 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6751 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6752 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
6753 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
6754 return (long)res_ptr;
6756 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
6757 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6758 LDKNodeAnnouncement msg_conv;
6759 msg_conv.inner = (void*)(msg & (~1));
6760 msg_conv.is_owned = false;
6761 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6762 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
6763 return (uint64_t)ret_conv;
6766 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
6767 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6768 LDKChannelAnnouncement msg_conv;
6769 msg_conv.inner = (void*)(msg & (~1));
6770 msg_conv.is_owned = false;
6771 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6772 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
6773 return (uint64_t)ret_conv;
6776 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
6777 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6778 LDKChannelUpdate msg_conv;
6779 msg_conv.inner = (void*)(msg & (~1));
6780 msg_conv.is_owned = false;
6781 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6782 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
6783 return (uint64_t)ret_conv;
6786 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
6787 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6788 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
6789 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6790 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6791 for (size_t h = 0; h < ret_var.datalen; h++) {
6792 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6793 *ret_conv_59_conv = ret_var.data[h];
6794 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
6800 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
6801 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6802 LDKPublicKey starting_point_ref;
6803 CHECK(*((uint32_t*)starting_point) == 33);
6804 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
6805 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
6806 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6807 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6808 for (size_t s = 0; s < ret_var.datalen; s++) {
6809 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
6810 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6811 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6812 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
6813 if (ret_conv_18_var.is_owned) {
6814 ret_conv_18_ref |= 1;
6816 ret_arr_ptr[s] = ret_conv_18_ref;
6822 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
6823 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6824 LDKPublicKey their_node_id_ref;
6825 CHECK(*((uint32_t*)their_node_id) == 33);
6826 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6828 init_conv.inner = (void*)(init & (~1));
6829 init_conv.is_owned = false;
6830 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
6833 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6834 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6835 LDKPublicKey their_node_id_ref;
6836 CHECK(*((uint32_t*)their_node_id) == 33);
6837 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6838 LDKReplyChannelRange msg_conv;
6839 msg_conv.inner = (void*)(msg & (~1));
6840 msg_conv.is_owned = (msg & 1) || (msg == 0);
6841 msg_conv = ReplyChannelRange_clone(&msg_conv);
6842 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6843 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6844 return (uint64_t)ret_conv;
6847 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) {
6848 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6849 LDKPublicKey their_node_id_ref;
6850 CHECK(*((uint32_t*)their_node_id) == 33);
6851 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6852 LDKReplyShortChannelIdsEnd msg_conv;
6853 msg_conv.inner = (void*)(msg & (~1));
6854 msg_conv.is_owned = (msg & 1) || (msg == 0);
6855 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
6856 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6857 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6858 return (uint64_t)ret_conv;
6861 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6862 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6863 LDKPublicKey their_node_id_ref;
6864 CHECK(*((uint32_t*)their_node_id) == 33);
6865 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6866 LDKQueryChannelRange msg_conv;
6867 msg_conv.inner = (void*)(msg & (~1));
6868 msg_conv.is_owned = (msg & 1) || (msg == 0);
6869 msg_conv = QueryChannelRange_clone(&msg_conv);
6870 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6871 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6872 return (uint64_t)ret_conv;
6875 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6876 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6877 LDKPublicKey their_node_id_ref;
6878 CHECK(*((uint32_t*)their_node_id) == 33);
6879 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6880 LDKQueryShortChannelIds msg_conv;
6881 msg_conv.inner = (void*)(msg & (~1));
6882 msg_conv.is_owned = (msg & 1) || (msg == 0);
6883 msg_conv = QueryShortChannelIds_clone(&msg_conv);
6884 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6885 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6886 return (uint64_t)ret_conv;
6889 typedef struct LDKCustomMessageReader_JCalls {
6890 atomic_size_t refcnt;
6892 } LDKCustomMessageReader_JCalls;
6893 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
6894 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
6895 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6896 js_free(j_calls->read_meth);
6900 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
6901 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
6902 LDKu8slice buffer_var = buffer;
6903 int8_tArray buffer_arr = init_arr(buffer_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
6904 memcpy((uint8_t*)(buffer_arr + 4), buffer_var.data, buffer_var.datalen);
6905 uint32_t ret = js_invoke_function_2(j_calls->read_meth, message_type, buffer_arr);
6906 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1);
6907 ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
6910 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
6911 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
6912 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6914 static inline LDKCustomMessageReader LDKCustomMessageReader_init (/*TODO: JS Object Reference */void* o) {
6915 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
6916 atomic_init(&calls->refcnt, 1);
6917 //TODO: Assign calls->o from o
6919 LDKCustomMessageReader ret = {
6920 .this_arg = (void*) calls,
6921 .read = read_LDKCustomMessageReader_jcall,
6922 .free = LDKCustomMessageReader_JCalls_free,
6926 long __attribute__((visibility("default"))) TS_LDKCustomMessageReader_new(/*TODO: JS Object Reference */void* o) {
6927 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
6928 *res_ptr = LDKCustomMessageReader_init(o);
6929 return (long)res_ptr;
6931 uint32_t __attribute__((visibility("default"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
6932 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)(((uint64_t)this_arg) & ~1);
6933 LDKu8slice buffer_ref;
6934 buffer_ref.datalen = *((uint32_t*)buffer);
6935 buffer_ref.data = (int8_t*)(buffer + 4);
6936 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
6937 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
6938 return (uint64_t)ret_conv;
6941 typedef struct LDKCustomMessageHandler_JCalls {
6942 atomic_size_t refcnt;
6943 LDKCustomMessageReader_JCalls* CustomMessageReader;
6944 uint32_t handle_custom_message_meth;
6945 uint32_t get_and_clear_pending_msg_meth;
6946 } LDKCustomMessageHandler_JCalls;
6947 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
6948 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
6949 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6950 js_free(j_calls->handle_custom_message_meth);
6951 js_free(j_calls->get_and_clear_pending_msg_meth);
6955 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
6956 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
6957 LDKType* msg_ret =MALLOC(sizeof(LDKType), "LDKType");
6959 int8_tArray sender_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6960 memcpy((uint8_t*)(sender_node_id_arr + 4), sender_node_id.compressed_form, 33);
6961 uint32_t ret = js_invoke_function_2(j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
6962 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6963 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6966 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
6967 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
6968 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_meth);
6969 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
6970 ret_constr.datalen = *((uint32_t*)ret);
6971 if (ret_constr.datalen > 0)
6972 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
6974 ret_constr.data = NULL;
6975 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6976 for (size_t z = 0; z < ret_constr.datalen; z++) {
6977 uint32_t ret_conv_25 = ret_vals[z];
6978 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_25) & ~1);
6979 ret_conv_25_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_25) & ~1));
6980 ret_constr.data[z] = ret_conv_25_conv;
6984 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
6985 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
6986 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6987 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
6989 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* CustomMessageReader) {
6990 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
6991 atomic_init(&calls->refcnt, 1);
6992 //TODO: Assign calls->o from o
6994 LDKCustomMessageHandler ret = {
6995 .this_arg = (void*) calls,
6996 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
6997 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
6998 .free = LDKCustomMessageHandler_JCalls_free,
6999 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
7001 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
7004 long __attribute__((visibility("default"))) TS_LDKCustomMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* CustomMessageReader) {
7005 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
7006 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
7007 return (long)res_ptr;
7009 uint32_t __attribute__((visibility("default"))) TS_CustomMessageHandler_handle_custom_message(uint32_t this_arg, uint32_t msg, int8_tArray sender_node_id) {
7010 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
7011 LDKType msg_conv = *(LDKType*)(((uint64_t)msg) & ~1);
7012 LDKPublicKey sender_node_id_ref;
7013 CHECK(*((uint32_t*)sender_node_id) == 33);
7014 memcpy(sender_node_id_ref.compressed_form, (uint8_t*)(sender_node_id + 4), 33);
7015 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7016 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
7017 return (uint64_t)ret_conv;
7020 uint32_tArray __attribute__((visibility("default"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
7021 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
7022 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
7023 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7024 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7025 for (size_t z = 0; z < ret_var.datalen; z++) {
7026 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
7027 *ret_conv_25_conv = ret_var.data[z];
7028 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
7034 typedef struct LDKSocketDescriptor_JCalls {
7035 atomic_size_t refcnt;
7036 uint32_t send_data_meth;
7037 uint32_t disconnect_socket_meth;
7040 } LDKSocketDescriptor_JCalls;
7041 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
7042 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7043 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7044 js_free(j_calls->send_data_meth);
7045 js_free(j_calls->disconnect_socket_meth);
7046 js_free(j_calls->eq_meth);
7047 js_free(j_calls->hash_meth);
7051 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
7052 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7053 LDKu8slice data_var = data;
7054 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7055 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
7056 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
7058 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
7059 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7060 js_invoke_function_0(j_calls->disconnect_socket_meth);
7062 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
7063 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7064 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
7065 *other_arg_clone = SocketDescriptor_clone(other_arg);
7066 return js_invoke_function_1(j_calls->eq_meth, (uint64_t)other_arg_clone);
7068 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
7069 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7070 return js_invoke_function_0(j_calls->hash_meth);
7072 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
7073 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
7074 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7076 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
7077 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
7078 atomic_init(&calls->refcnt, 1);
7079 //TODO: Assign calls->o from o
7081 LDKSocketDescriptor ret = {
7082 .this_arg = (void*) calls,
7083 .send_data = send_data_LDKSocketDescriptor_jcall,
7084 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
7085 .eq = eq_LDKSocketDescriptor_jcall,
7086 .hash = hash_LDKSocketDescriptor_jcall,
7087 .cloned = LDKSocketDescriptor_JCalls_cloned,
7088 .free = LDKSocketDescriptor_JCalls_free,
7092 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
7093 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
7094 *res_ptr = LDKSocketDescriptor_init(o);
7095 return (long)res_ptr;
7097 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
7098 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
7099 LDKu8slice data_ref;
7100 data_ref.datalen = *((uint32_t*)data);
7101 data_ref.data = (int8_t*)(data + 4);
7102 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
7106 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
7107 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
7108 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
7111 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
7112 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
7113 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
7117 typedef struct LDKChannelManagerPersister_JCalls {
7118 atomic_size_t refcnt;
7119 uint32_t persist_manager_meth;
7120 } LDKChannelManagerPersister_JCalls;
7121 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
7122 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
7123 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7124 js_free(j_calls->persist_manager_meth);
7128 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
7129 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
7130 LDKChannelManager channel_manager_var = *channel_manager;
7131 // Warning: we may need a move here but no clone is available for LDKChannelManager
7132 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7133 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7134 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
7135 if (channel_manager_var.is_owned) {
7136 channel_manager_ref |= 1;
7138 uint32_t ret = js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
7139 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
7140 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
7143 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
7144 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
7145 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7147 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (/*TODO: JS Object Reference */void* o) {
7148 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
7149 atomic_init(&calls->refcnt, 1);
7150 //TODO: Assign calls->o from o
7152 LDKChannelManagerPersister ret = {
7153 .this_arg = (void*) calls,
7154 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
7155 .free = LDKChannelManagerPersister_JCalls_free,
7159 long __attribute__((visibility("default"))) TS_LDKChannelManagerPersister_new(/*TODO: JS Object Reference */void* o) {
7160 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
7161 *res_ptr = LDKChannelManagerPersister_init(o);
7162 return (long)res_ptr;
7164 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerPersister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
7165 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
7166 LDKChannelManager channel_manager_conv;
7167 channel_manager_conv.inner = (void*)(channel_manager & (~1));
7168 channel_manager_conv.is_owned = false;
7169 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7170 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
7171 return (uint64_t)ret_conv;
7174 uint32_t __attribute__((visibility("default"))) TS_LDKFallback_ref_from_ptr(uint32_t ptr) {
7175 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
7177 case LDKFallback_SegWitProgram: {
7178 uint8_t version_val = obj->seg_wit_program.version._0;
7179 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
7180 int8_tArray program_arr = init_arr(program_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7181 memcpy((uint8_t*)(program_arr + 4), program_var.data, program_var.datalen);
7182 return 0 /* LDKFallback - SegWitProgram */; (void) version_val; (void) program_arr;
7184 case LDKFallback_PubKeyHash: {
7185 int8_tArray pub_key_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7186 memcpy((uint8_t*)(pub_key_hash_arr + 4), obj->pub_key_hash.data, 20);
7187 return 0 /* LDKFallback - PubKeyHash */; (void) pub_key_hash_arr;
7189 case LDKFallback_ScriptHash: {
7190 int8_tArray script_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7191 memcpy((uint8_t*)(script_hash_arr + 4), obj->script_hash.data, 20);
7192 return 0 /* LDKFallback - ScriptHash */; (void) script_hash_arr;
7197 jstring __attribute__((visibility("default"))) TS__ldk_get_compiled_version() {
7198 LDKStr ret_str = _ldk_get_compiled_version();
7199 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7204 jstring __attribute__((visibility("default"))) TS__ldk_c_bindings_get_compiled_version() {
7205 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
7206 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7211 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
7212 LDKTransaction _res_ref;
7213 _res_ref.datalen = *((uint32_t*)_res);
7214 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
7215 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
7216 _res_ref.data_is_owned = true;
7217 Transaction_free(_res_ref);
7220 uint32_t __attribute__((visibility("default"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
7221 LDKCVec_u8Z script_pubkey_ref;
7222 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
7223 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
7224 memcpy(script_pubkey_ref.data, (uint8_t*)(script_pubkey + 4), script_pubkey_ref.datalen);
7225 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7226 *ret_ref = TxOut_new(script_pubkey_ref, value);
7227 return (uint64_t)ret_ref;
7230 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
7231 if ((_res & 1) != 0) return;
7232 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
7234 TxOut_free(_res_conv);
7237 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
7238 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
7239 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7240 *ret_ref = TxOut_clone(orig_conv);
7241 return (uint64_t)ret_ref;
7244 void __attribute__((visibility("default"))) TS_Str_free(jstring _res) {
7245 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
7249 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
7251 CHECK(*((uint32_t*)o) == 32);
7252 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
7253 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
7254 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
7255 return (uint64_t)ret_conv;
7258 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
7259 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7260 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
7261 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
7262 return (uint64_t)ret_conv;
7265 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
7266 if ((_res & 1) != 0) return;
7267 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
7269 CResult_SecretKeyErrorZ_free(_res_conv);
7272 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
7274 CHECK(*((uint32_t*)o) == 33);
7275 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
7276 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7277 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
7278 return (uint64_t)ret_conv;
7281 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
7282 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7283 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7284 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
7285 return (uint64_t)ret_conv;
7288 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
7289 if ((_res & 1) != 0) return;
7290 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
7292 CResult_PublicKeyErrorZ_free(_res_conv);
7295 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
7296 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
7297 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7298 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
7299 return (uint64_t)ret_conv;
7302 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
7303 LDKTxCreationKeys o_conv;
7304 o_conv.inner = (void*)(o & (~1));
7305 o_conv.is_owned = (o & 1) || (o == 0);
7306 o_conv = TxCreationKeys_clone(&o_conv);
7307 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7308 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
7309 return (uint64_t)ret_conv;
7312 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
7313 LDKDecodeError e_conv;
7314 e_conv.inner = (void*)(e & (~1));
7315 e_conv.is_owned = (e & 1) || (e == 0);
7316 e_conv = DecodeError_clone(&e_conv);
7317 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7318 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
7319 return (uint64_t)ret_conv;
7322 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
7323 if ((_res & 1) != 0) return;
7324 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
7326 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
7329 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
7330 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
7331 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7332 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
7333 return (uint64_t)ret_conv;
7336 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
7337 LDKChannelPublicKeys o_conv;
7338 o_conv.inner = (void*)(o & (~1));
7339 o_conv.is_owned = (o & 1) || (o == 0);
7340 o_conv = ChannelPublicKeys_clone(&o_conv);
7341 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7342 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
7343 return (uint64_t)ret_conv;
7346 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
7347 LDKDecodeError e_conv;
7348 e_conv.inner = (void*)(e & (~1));
7349 e_conv.is_owned = (e & 1) || (e == 0);
7350 e_conv = DecodeError_clone(&e_conv);
7351 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7352 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
7353 return (uint64_t)ret_conv;
7356 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
7357 if ((_res & 1) != 0) return;
7358 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
7360 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
7363 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
7364 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
7365 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7366 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
7367 return (uint64_t)ret_conv;
7370 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
7371 LDKTxCreationKeys o_conv;
7372 o_conv.inner = (void*)(o & (~1));
7373 o_conv.is_owned = (o & 1) || (o == 0);
7374 o_conv = TxCreationKeys_clone(&o_conv);
7375 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7376 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
7377 return (uint64_t)ret_conv;
7380 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
7381 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7382 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7383 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
7384 return (uint64_t)ret_conv;
7387 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
7388 if ((_res & 1) != 0) return;
7389 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
7391 CResult_TxCreationKeysErrorZ_free(_res_conv);
7394 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
7395 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
7396 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7397 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
7398 return (uint64_t)ret_conv;
7401 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
7402 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7403 *ret_copy = COption_u32Z_some(o);
7404 uint64_t ret_ref = (uint64_t)ret_copy;
7408 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
7409 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7410 *ret_copy = COption_u32Z_none();
7411 uint64_t ret_ref = (uint64_t)ret_copy;
7415 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
7416 if ((_res & 1) != 0) return;
7417 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
7419 COption_u32Z_free(_res_conv);
7422 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
7423 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
7424 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7425 *ret_copy = COption_u32Z_clone(orig_conv);
7426 uint64_t ret_ref = (uint64_t)ret_copy;
7430 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
7431 LDKHTLCOutputInCommitment o_conv;
7432 o_conv.inner = (void*)(o & (~1));
7433 o_conv.is_owned = (o & 1) || (o == 0);
7434 o_conv = HTLCOutputInCommitment_clone(&o_conv);
7435 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7436 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
7437 return (uint64_t)ret_conv;
7440 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
7441 LDKDecodeError e_conv;
7442 e_conv.inner = (void*)(e & (~1));
7443 e_conv.is_owned = (e & 1) || (e == 0);
7444 e_conv = DecodeError_clone(&e_conv);
7445 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7446 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
7447 return (uint64_t)ret_conv;
7450 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
7451 if ((_res & 1) != 0) return;
7452 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
7454 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
7457 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
7458 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
7459 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7460 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
7461 return (uint64_t)ret_conv;
7464 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
7465 LDKCounterpartyChannelTransactionParameters o_conv;
7466 o_conv.inner = (void*)(o & (~1));
7467 o_conv.is_owned = (o & 1) || (o == 0);
7468 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
7469 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7470 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
7471 return (uint64_t)ret_conv;
7474 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
7475 LDKDecodeError e_conv;
7476 e_conv.inner = (void*)(e & (~1));
7477 e_conv.is_owned = (e & 1) || (e == 0);
7478 e_conv = DecodeError_clone(&e_conv);
7479 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7480 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
7481 return (uint64_t)ret_conv;
7484 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
7485 if ((_res & 1) != 0) return;
7486 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
7488 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
7491 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
7492 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
7493 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7494 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
7495 return (uint64_t)ret_conv;
7498 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
7499 LDKChannelTransactionParameters o_conv;
7500 o_conv.inner = (void*)(o & (~1));
7501 o_conv.is_owned = (o & 1) || (o == 0);
7502 o_conv = ChannelTransactionParameters_clone(&o_conv);
7503 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7504 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
7505 return (uint64_t)ret_conv;
7508 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
7509 LDKDecodeError e_conv;
7510 e_conv.inner = (void*)(e & (~1));
7511 e_conv.is_owned = (e & 1) || (e == 0);
7512 e_conv = DecodeError_clone(&e_conv);
7513 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7514 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
7515 return (uint64_t)ret_conv;
7518 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
7519 if ((_res & 1) != 0) return;
7520 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
7522 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
7525 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
7526 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
7527 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7528 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
7529 return (uint64_t)ret_conv;
7532 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
7533 LDKCVec_SignatureZ _res_constr;
7534 _res_constr.datalen = *((uint32_t*)_res);
7535 if (_res_constr.datalen > 0)
7536 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7538 _res_constr.data = NULL;
7539 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7540 for (size_t m = 0; m < _res_constr.datalen; m++) {
7541 int8_tArray _res_conv_12 = _res_vals[m];
7542 LDKSignature _res_conv_12_ref;
7543 CHECK(*((uint32_t*)_res_conv_12) == 64);
7544 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
7545 _res_constr.data[m] = _res_conv_12_ref;
7547 CVec_SignatureZ_free(_res_constr);
7550 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7551 LDKHolderCommitmentTransaction o_conv;
7552 o_conv.inner = (void*)(o & (~1));
7553 o_conv.is_owned = (o & 1) || (o == 0);
7554 o_conv = HolderCommitmentTransaction_clone(&o_conv);
7555 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7556 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
7557 return (uint64_t)ret_conv;
7560 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7561 LDKDecodeError e_conv;
7562 e_conv.inner = (void*)(e & (~1));
7563 e_conv.is_owned = (e & 1) || (e == 0);
7564 e_conv = DecodeError_clone(&e_conv);
7565 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7566 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
7567 return (uint64_t)ret_conv;
7570 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7571 if ((_res & 1) != 0) return;
7572 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
7574 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
7577 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7578 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
7579 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7580 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
7581 return (uint64_t)ret_conv;
7584 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7585 LDKBuiltCommitmentTransaction o_conv;
7586 o_conv.inner = (void*)(o & (~1));
7587 o_conv.is_owned = (o & 1) || (o == 0);
7588 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
7589 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7590 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
7591 return (uint64_t)ret_conv;
7594 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7595 LDKDecodeError e_conv;
7596 e_conv.inner = (void*)(e & (~1));
7597 e_conv.is_owned = (e & 1) || (e == 0);
7598 e_conv = DecodeError_clone(&e_conv);
7599 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7600 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
7601 return (uint64_t)ret_conv;
7604 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7605 if ((_res & 1) != 0) return;
7606 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
7608 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
7611 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7612 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
7613 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7614 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
7615 return (uint64_t)ret_conv;
7618 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
7619 LDKTrustedClosingTransaction o_conv;
7620 o_conv.inner = (void*)(o & (~1));
7621 o_conv.is_owned = (o & 1) || (o == 0);
7622 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
7623 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
7624 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
7625 return (uint64_t)ret_conv;
7628 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
7629 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
7630 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
7631 return (uint64_t)ret_conv;
7634 void __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
7635 if ((_res & 1) != 0) return;
7636 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(((uint64_t)_res) & ~1);
7638 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
7641 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7642 LDKCommitmentTransaction o_conv;
7643 o_conv.inner = (void*)(o & (~1));
7644 o_conv.is_owned = (o & 1) || (o == 0);
7645 o_conv = CommitmentTransaction_clone(&o_conv);
7646 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7647 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
7648 return (uint64_t)ret_conv;
7651 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7652 LDKDecodeError e_conv;
7653 e_conv.inner = (void*)(e & (~1));
7654 e_conv.is_owned = (e & 1) || (e == 0);
7655 e_conv = DecodeError_clone(&e_conv);
7656 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7657 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
7658 return (uint64_t)ret_conv;
7661 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7662 if ((_res & 1) != 0) return;
7663 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
7665 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
7668 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7669 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
7670 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7671 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
7672 return (uint64_t)ret_conv;
7675 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
7676 LDKTrustedCommitmentTransaction o_conv;
7677 o_conv.inner = (void*)(o & (~1));
7678 o_conv.is_owned = (o & 1) || (o == 0);
7679 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
7680 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
7681 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
7682 return (uint64_t)ret_conv;
7685 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
7686 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
7687 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
7688 return (uint64_t)ret_conv;
7691 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
7692 if ((_res & 1) != 0) return;
7693 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
7695 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
7698 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
7699 LDKCVec_SignatureZ o_constr;
7700 o_constr.datalen = *((uint32_t*)o);
7701 if (o_constr.datalen > 0)
7702 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7704 o_constr.data = NULL;
7705 int8_tArray* o_vals = (int8_tArray*)(o + 4);
7706 for (size_t m = 0; m < o_constr.datalen; m++) {
7707 int8_tArray o_conv_12 = o_vals[m];
7708 LDKSignature o_conv_12_ref;
7709 CHECK(*((uint32_t*)o_conv_12) == 64);
7710 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
7711 o_constr.data[m] = o_conv_12_ref;
7713 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7714 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
7715 return (uint64_t)ret_conv;
7718 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
7719 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7720 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
7721 return (uint64_t)ret_conv;
7724 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
7725 if ((_res & 1) != 0) return;
7726 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
7728 CResult_CVec_SignatureZNoneZ_free(_res_conv);
7731 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
7732 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
7733 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7734 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
7735 return (uint64_t)ret_conv;
7738 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
7739 LDKShutdownScript o_conv;
7740 o_conv.inner = (void*)(o & (~1));
7741 o_conv.is_owned = (o & 1) || (o == 0);
7742 o_conv = ShutdownScript_clone(&o_conv);
7743 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
7744 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
7745 return (uint64_t)ret_conv;
7748 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
7749 LDKDecodeError e_conv;
7750 e_conv.inner = (void*)(e & (~1));
7751 e_conv.is_owned = (e & 1) || (e == 0);
7752 e_conv = DecodeError_clone(&e_conv);
7753 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
7754 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
7755 return (uint64_t)ret_conv;
7758 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
7759 if ((_res & 1) != 0) return;
7760 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(((uint64_t)_res) & ~1);
7762 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
7765 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
7766 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
7767 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
7768 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
7769 return (uint64_t)ret_conv;
7772 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
7773 LDKShutdownScript o_conv;
7774 o_conv.inner = (void*)(o & (~1));
7775 o_conv.is_owned = (o & 1) || (o == 0);
7776 o_conv = ShutdownScript_clone(&o_conv);
7777 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
7778 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
7779 return (uint64_t)ret_conv;
7782 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
7783 LDKInvalidShutdownScript e_conv;
7784 e_conv.inner = (void*)(e & (~1));
7785 e_conv.is_owned = (e & 1) || (e == 0);
7786 // Warning: we need a move here but no clone is available for LDKInvalidShutdownScript
7787 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
7788 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
7789 return (uint64_t)ret_conv;
7792 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
7793 if ((_res & 1) != 0) return;
7794 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(((uint64_t)_res) & ~1);
7796 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
7799 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
7800 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7801 *ret_conv = CResult_NoneErrorZ_ok();
7802 return (uint64_t)ret_conv;
7805 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
7806 LDKIOError e_conv = LDKIOError_from_js(e);
7807 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7808 *ret_conv = CResult_NoneErrorZ_err(e_conv);
7809 return (uint64_t)ret_conv;
7812 void __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
7813 if ((_res & 1) != 0) return;
7814 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
7816 CResult_NoneErrorZ_free(_res_conv);
7819 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
7820 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
7821 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7822 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
7823 return (uint64_t)ret_conv;
7826 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
7828 o_conv.inner = (void*)(o & (~1));
7829 o_conv.is_owned = (o & 1) || (o == 0);
7830 o_conv = RouteHop_clone(&o_conv);
7831 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
7832 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
7833 return (uint64_t)ret_conv;
7836 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
7837 LDKDecodeError e_conv;
7838 e_conv.inner = (void*)(e & (~1));
7839 e_conv.is_owned = (e & 1) || (e == 0);
7840 e_conv = DecodeError_clone(&e_conv);
7841 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
7842 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
7843 return (uint64_t)ret_conv;
7846 void __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
7847 if ((_res & 1) != 0) return;
7848 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
7850 CResult_RouteHopDecodeErrorZ_free(_res_conv);
7853 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
7854 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
7855 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
7856 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
7857 return (uint64_t)ret_conv;
7860 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
7861 LDKCVec_RouteHopZ _res_constr;
7862 _res_constr.datalen = *((uint32_t*)_res);
7863 if (_res_constr.datalen > 0)
7864 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7866 _res_constr.data = NULL;
7867 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7868 for (size_t k = 0; k < _res_constr.datalen; k++) {
7869 uint32_t _res_conv_10 = _res_vals[k];
7870 LDKRouteHop _res_conv_10_conv;
7871 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
7872 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
7873 _res_constr.data[k] = _res_conv_10_conv;
7875 CVec_RouteHopZ_free(_res_constr);
7878 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
7879 LDKCVec_CVec_RouteHopZZ _res_constr;
7880 _res_constr.datalen = *((uint32_t*)_res);
7881 if (_res_constr.datalen > 0)
7882 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
7884 _res_constr.data = NULL;
7885 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
7886 for (size_t m = 0; m < _res_constr.datalen; m++) {
7887 uint32_tArray _res_conv_12 = _res_vals[m];
7888 LDKCVec_RouteHopZ _res_conv_12_constr;
7889 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
7890 if (_res_conv_12_constr.datalen > 0)
7891 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7893 _res_conv_12_constr.data = NULL;
7894 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
7895 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
7896 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
7897 LDKRouteHop _res_conv_12_conv_10_conv;
7898 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
7899 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
7900 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
7902 _res_constr.data[m] = _res_conv_12_constr;
7904 CVec_CVec_RouteHopZZ_free(_res_constr);
7907 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
7909 o_conv.inner = (void*)(o & (~1));
7910 o_conv.is_owned = (o & 1) || (o == 0);
7911 o_conv = Route_clone(&o_conv);
7912 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7913 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
7914 return (uint64_t)ret_conv;
7917 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
7918 LDKDecodeError e_conv;
7919 e_conv.inner = (void*)(e & (~1));
7920 e_conv.is_owned = (e & 1) || (e == 0);
7921 e_conv = DecodeError_clone(&e_conv);
7922 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7923 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
7924 return (uint64_t)ret_conv;
7927 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
7928 if ((_res & 1) != 0) return;
7929 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
7931 CResult_RouteDecodeErrorZ_free(_res_conv);
7934 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
7935 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
7936 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7937 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
7938 return (uint64_t)ret_conv;
7941 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
7942 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7943 *ret_copy = COption_u64Z_some(o);
7944 uint64_t ret_ref = (uint64_t)ret_copy;
7948 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
7949 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7950 *ret_copy = COption_u64Z_none();
7951 uint64_t ret_ref = (uint64_t)ret_copy;
7955 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
7956 if ((_res & 1) != 0) return;
7957 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
7959 COption_u64Z_free(_res_conv);
7962 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
7963 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
7964 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7965 *ret_copy = COption_u64Z_clone(orig_conv);
7966 uint64_t ret_ref = (uint64_t)ret_copy;
7970 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
7971 LDKCVec_ChannelDetailsZ _res_constr;
7972 _res_constr.datalen = *((uint32_t*)_res);
7973 if (_res_constr.datalen > 0)
7974 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7976 _res_constr.data = NULL;
7977 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7978 for (size_t q = 0; q < _res_constr.datalen; q++) {
7979 uint32_t _res_conv_16 = _res_vals[q];
7980 LDKChannelDetails _res_conv_16_conv;
7981 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7982 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7983 _res_constr.data[q] = _res_conv_16_conv;
7985 CVec_ChannelDetailsZ_free(_res_constr);
7988 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
7989 LDKCVec_RouteHintZ _res_constr;
7990 _res_constr.datalen = *((uint32_t*)_res);
7991 if (_res_constr.datalen > 0)
7992 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
7994 _res_constr.data = NULL;
7995 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7996 for (size_t l = 0; l < _res_constr.datalen; l++) {
7997 uint32_t _res_conv_11 = _res_vals[l];
7998 LDKRouteHint _res_conv_11_conv;
7999 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
8000 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
8001 _res_constr.data[l] = _res_conv_11_conv;
8003 CVec_RouteHintZ_free(_res_constr);
8006 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
8008 o_conv.inner = (void*)(o & (~1));
8009 o_conv.is_owned = (o & 1) || (o == 0);
8010 o_conv = Route_clone(&o_conv);
8011 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8012 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
8013 return (uint64_t)ret_conv;
8016 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
8017 LDKLightningError e_conv;
8018 e_conv.inner = (void*)(e & (~1));
8019 e_conv.is_owned = (e & 1) || (e == 0);
8020 e_conv = LightningError_clone(&e_conv);
8021 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8022 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
8023 return (uint64_t)ret_conv;
8026 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
8027 if ((_res & 1) != 0) return;
8028 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
8030 CResult_RouteLightningErrorZ_free(_res_conv);
8033 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
8034 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
8035 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8036 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
8037 return (uint64_t)ret_conv;
8040 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
8041 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
8042 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
8043 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8044 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
8045 return (uint64_t)ret_conv;
8048 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
8049 LDKAccessError e_conv = LDKAccessError_from_js(e);
8050 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8051 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
8052 return (uint64_t)ret_conv;
8055 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
8056 if ((_res & 1) != 0) return;
8057 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
8059 CResult_TxOutAccessErrorZ_free(_res_conv);
8062 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
8063 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
8064 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8065 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
8066 return (uint64_t)ret_conv;
8069 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
8070 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
8071 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8072 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
8073 return ((uint64_t)ret_conv);
8076 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
8077 LDKTransaction b_ref;
8078 b_ref.datalen = *((uint32_t*)b);
8079 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
8080 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
8081 b_ref.data_is_owned = true;
8082 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8083 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
8084 return ((uint64_t)ret_conv);
8087 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
8088 if ((_res & 1) != 0) return;
8089 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
8091 C2Tuple_usizeTransactionZ_free(_res_conv);
8094 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
8095 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
8096 _res_constr.datalen = *((uint32_t*)_res);
8097 if (_res_constr.datalen > 0)
8098 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8100 _res_constr.data = NULL;
8101 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8102 for (size_t c = 0; c < _res_constr.datalen; c++) {
8103 uint32_t _res_conv_28 = _res_vals[c];
8104 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_28) & ~1);
8105 FREE((void*)_res_conv_28);
8106 _res_constr.data[c] = _res_conv_28_conv;
8108 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
8111 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
8112 LDKCVec_TxidZ _res_constr;
8113 _res_constr.datalen = *((uint32_t*)_res);
8114 if (_res_constr.datalen > 0)
8115 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8117 _res_constr.data = NULL;
8118 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
8119 for (size_t m = 0; m < _res_constr.datalen; m++) {
8120 int8_tArray _res_conv_12 = _res_vals[m];
8121 LDKThirtyTwoBytes _res_conv_12_ref;
8122 CHECK(*((uint32_t*)_res_conv_12) == 32);
8123 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), 32);
8124 _res_constr.data[m] = _res_conv_12_ref;
8126 CVec_TxidZ_free(_res_constr);
8129 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
8130 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8131 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
8132 return (uint64_t)ret_conv;
8135 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
8136 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
8137 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8138 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
8139 return (uint64_t)ret_conv;
8142 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
8143 if ((_res & 1) != 0) return;
8144 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
8146 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
8149 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
8150 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
8151 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8152 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
8153 return (uint64_t)ret_conv;
8156 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
8157 LDKCVec_MonitorEventZ _res_constr;
8158 _res_constr.datalen = *((uint32_t*)_res);
8159 if (_res_constr.datalen > 0)
8160 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
8162 _res_constr.data = NULL;
8163 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8164 for (size_t o = 0; o < _res_constr.datalen; o++) {
8165 uint32_t _res_conv_14 = _res_vals[o];
8166 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
8167 FREE((void*)_res_conv_14);
8168 _res_constr.data[o] = _res_conv_14_conv;
8170 CVec_MonitorEventZ_free(_res_constr);
8173 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
8174 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
8175 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
8176 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8177 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
8178 uint64_t ret_ref = (uint64_t)ret_copy;
8182 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
8183 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8184 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
8185 uint64_t ret_ref = (uint64_t)ret_copy;
8189 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
8190 if ((_res & 1) != 0) return;
8191 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
8193 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
8196 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
8197 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
8198 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8199 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
8200 uint64_t ret_ref = (uint64_t)ret_copy;
8204 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
8205 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(((uint64_t)o) & ~1);
8206 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
8207 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8208 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
8209 uint64_t ret_ref = (uint64_t)ret_copy;
8213 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_none() {
8214 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8215 *ret_copy = COption_NetworkUpdateZ_none();
8216 uint64_t ret_ref = (uint64_t)ret_copy;
8220 void __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
8221 if ((_res & 1) != 0) return;
8222 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)_res) & ~1);
8224 COption_NetworkUpdateZ_free(_res_conv);
8227 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
8228 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
8229 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8230 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
8231 uint64_t ret_ref = (uint64_t)ret_copy;
8235 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
8236 LDKCVec_SpendableOutputDescriptorZ _res_constr;
8237 _res_constr.datalen = *((uint32_t*)_res);
8238 if (_res_constr.datalen > 0)
8239 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
8241 _res_constr.data = NULL;
8242 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8243 for (size_t b = 0; b < _res_constr.datalen; b++) {
8244 uint32_t _res_conv_27 = _res_vals[b];
8245 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
8246 FREE((void*)_res_conv_27);
8247 _res_constr.data[b] = _res_conv_27_conv;
8249 CVec_SpendableOutputDescriptorZ_free(_res_constr);
8252 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
8253 LDKCVec_MessageSendEventZ _res_constr;
8254 _res_constr.datalen = *((uint32_t*)_res);
8255 if (_res_constr.datalen > 0)
8256 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
8258 _res_constr.data = NULL;
8259 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8260 for (size_t s = 0; s < _res_constr.datalen; s++) {
8261 uint32_t _res_conv_18 = _res_vals[s];
8262 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
8263 FREE((void*)_res_conv_18);
8264 _res_constr.data[s] = _res_conv_18_conv;
8266 CVec_MessageSendEventZ_free(_res_constr);
8269 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
8270 LDKInitFeatures o_conv;
8271 o_conv.inner = (void*)(o & (~1));
8272 o_conv.is_owned = (o & 1) || (o == 0);
8273 o_conv = InitFeatures_clone(&o_conv);
8274 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
8275 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
8276 return (uint64_t)ret_conv;
8279 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
8280 LDKDecodeError e_conv;
8281 e_conv.inner = (void*)(e & (~1));
8282 e_conv.is_owned = (e & 1) || (e == 0);
8283 e_conv = DecodeError_clone(&e_conv);
8284 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
8285 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
8286 return (uint64_t)ret_conv;
8289 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
8290 if ((_res & 1) != 0) return;
8291 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8293 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
8296 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
8297 LDKNodeFeatures o_conv;
8298 o_conv.inner = (void*)(o & (~1));
8299 o_conv.is_owned = (o & 1) || (o == 0);
8300 o_conv = NodeFeatures_clone(&o_conv);
8301 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
8302 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
8303 return (uint64_t)ret_conv;
8306 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
8307 LDKDecodeError e_conv;
8308 e_conv.inner = (void*)(e & (~1));
8309 e_conv.is_owned = (e & 1) || (e == 0);
8310 e_conv = DecodeError_clone(&e_conv);
8311 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
8312 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
8313 return (uint64_t)ret_conv;
8316 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
8317 if ((_res & 1) != 0) return;
8318 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8320 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
8323 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
8324 LDKChannelFeatures o_conv;
8325 o_conv.inner = (void*)(o & (~1));
8326 o_conv.is_owned = (o & 1) || (o == 0);
8327 o_conv = ChannelFeatures_clone(&o_conv);
8328 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
8329 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
8330 return (uint64_t)ret_conv;
8333 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
8334 LDKDecodeError e_conv;
8335 e_conv.inner = (void*)(e & (~1));
8336 e_conv.is_owned = (e & 1) || (e == 0);
8337 e_conv = DecodeError_clone(&e_conv);
8338 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
8339 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
8340 return (uint64_t)ret_conv;
8343 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
8344 if ((_res & 1) != 0) return;
8345 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8347 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
8350 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
8351 LDKInvoiceFeatures o_conv;
8352 o_conv.inner = (void*)(o & (~1));
8353 o_conv.is_owned = (o & 1) || (o == 0);
8354 o_conv = InvoiceFeatures_clone(&o_conv);
8355 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
8356 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
8357 return (uint64_t)ret_conv;
8360 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
8361 LDKDecodeError e_conv;
8362 e_conv.inner = (void*)(e & (~1));
8363 e_conv.is_owned = (e & 1) || (e == 0);
8364 e_conv = DecodeError_clone(&e_conv);
8365 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
8366 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
8367 return (uint64_t)ret_conv;
8370 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
8371 if ((_res & 1) != 0) return;
8372 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8374 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
8377 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8378 LDKDelayedPaymentOutputDescriptor o_conv;
8379 o_conv.inner = (void*)(o & (~1));
8380 o_conv.is_owned = (o & 1) || (o == 0);
8381 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
8382 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8383 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
8384 return (uint64_t)ret_conv;
8387 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8388 LDKDecodeError e_conv;
8389 e_conv.inner = (void*)(e & (~1));
8390 e_conv.is_owned = (e & 1) || (e == 0);
8391 e_conv = DecodeError_clone(&e_conv);
8392 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8393 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
8394 return (uint64_t)ret_conv;
8397 void __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8398 if ((_res & 1) != 0) return;
8399 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8401 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
8404 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8405 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
8406 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8407 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
8408 return (uint64_t)ret_conv;
8411 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8412 LDKStaticPaymentOutputDescriptor o_conv;
8413 o_conv.inner = (void*)(o & (~1));
8414 o_conv.is_owned = (o & 1) || (o == 0);
8415 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
8416 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8417 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
8418 return (uint64_t)ret_conv;
8421 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8422 LDKDecodeError e_conv;
8423 e_conv.inner = (void*)(e & (~1));
8424 e_conv.is_owned = (e & 1) || (e == 0);
8425 e_conv = DecodeError_clone(&e_conv);
8426 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8427 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
8428 return (uint64_t)ret_conv;
8431 void __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8432 if ((_res & 1) != 0) return;
8433 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8435 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
8438 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8439 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
8440 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8441 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
8442 return (uint64_t)ret_conv;
8445 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8446 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
8447 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
8448 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8449 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
8450 return (uint64_t)ret_conv;
8453 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8454 LDKDecodeError e_conv;
8455 e_conv.inner = (void*)(e & (~1));
8456 e_conv.is_owned = (e & 1) || (e == 0);
8457 e_conv = DecodeError_clone(&e_conv);
8458 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8459 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
8460 return (uint64_t)ret_conv;
8463 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8464 if ((_res & 1) != 0) return;
8465 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8467 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
8470 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8471 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
8472 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8473 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
8474 return (uint64_t)ret_conv;
8477 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_ok() {
8478 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8479 *ret_conv = CResult_NoneNoneZ_ok();
8480 return (uint64_t)ret_conv;
8483 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_err() {
8484 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8485 *ret_conv = CResult_NoneNoneZ_err();
8486 return (uint64_t)ret_conv;
8489 void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
8490 if ((_res & 1) != 0) return;
8491 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)_res) & ~1);
8493 CResult_NoneNoneZ_free(_res_conv);
8496 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
8497 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
8498 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8499 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
8500 return (uint64_t)ret_conv;
8503 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
8504 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
8505 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8506 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
8507 return ((uint64_t)ret_conv);
8510 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
8512 CHECK(*((uint32_t*)a) == 64);
8513 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
8514 LDKCVec_SignatureZ b_constr;
8515 b_constr.datalen = *((uint32_t*)b);
8516 if (b_constr.datalen > 0)
8517 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8519 b_constr.data = NULL;
8520 int8_tArray* b_vals = (int8_tArray*)(b + 4);
8521 for (size_t m = 0; m < b_constr.datalen; m++) {
8522 int8_tArray b_conv_12 = b_vals[m];
8523 LDKSignature b_conv_12_ref;
8524 CHECK(*((uint32_t*)b_conv_12) == 64);
8525 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
8526 b_constr.data[m] = b_conv_12_ref;
8528 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8529 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
8530 return ((uint64_t)ret_conv);
8533 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
8534 if ((_res & 1) != 0) return;
8535 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
8537 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
8540 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
8541 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
8542 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
8543 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8544 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
8545 return (uint64_t)ret_conv;
8548 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
8549 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8550 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
8551 return (uint64_t)ret_conv;
8554 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
8555 if ((_res & 1) != 0) return;
8556 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
8558 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
8561 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
8562 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
8563 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8564 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
8565 return (uint64_t)ret_conv;
8568 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
8570 CHECK(*((uint32_t*)o) == 64);
8571 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
8572 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8573 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
8574 return (uint64_t)ret_conv;
8577 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
8578 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8579 *ret_conv = CResult_SignatureNoneZ_err();
8580 return (uint64_t)ret_conv;
8583 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
8584 if ((_res & 1) != 0) return;
8585 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
8587 CResult_SignatureNoneZ_free(_res_conv);
8590 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
8591 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
8592 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8593 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
8594 return (uint64_t)ret_conv;
8597 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
8598 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
8599 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8600 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
8601 return (uint64_t)ret_conv;
8604 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
8605 LDKDecodeError e_conv;
8606 e_conv.inner = (void*)(e & (~1));
8607 e_conv.is_owned = (e & 1) || (e == 0);
8608 e_conv = DecodeError_clone(&e_conv);
8609 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8610 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
8611 return (uint64_t)ret_conv;
8614 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
8615 if ((_res & 1) != 0) return;
8616 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
8618 CResult_SignDecodeErrorZ_free(_res_conv);
8621 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
8622 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
8623 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8624 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
8625 return (uint64_t)ret_conv;
8628 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
8629 LDKCVec_u8Z _res_ref;
8630 _res_ref.datalen = *((uint32_t*)_res);
8631 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
8632 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
8633 CVec_u8Z_free(_res_ref);
8636 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray arg) {
8637 LDKRecoverableSignature arg_ref;
8638 CHECK(*((uint32_t*)arg) == 68);
8639 memcpy(arg_ref.serialized_form, (uint8_t*)(arg + 4), 68);
8640 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8641 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
8642 return (uint64_t)ret_conv;
8645 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_err() {
8646 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8647 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
8648 return (uint64_t)ret_conv;
8651 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
8652 if ((_res & 1) != 0) return;
8653 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
8655 CResult_RecoverableSignatureNoneZ_free(_res_conv);
8658 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
8659 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
8660 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8661 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
8662 return (uint64_t)ret_conv;
8665 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
8666 LDKCVec_CVec_u8ZZ _res_constr;
8667 _res_constr.datalen = *((uint32_t*)_res);
8668 if (_res_constr.datalen > 0)
8669 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8671 _res_constr.data = NULL;
8672 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
8673 for (size_t m = 0; m < _res_constr.datalen; m++) {
8674 int8_tArray _res_conv_12 = _res_vals[m];
8675 LDKCVec_u8Z _res_conv_12_ref;
8676 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
8677 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
8678 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
8679 _res_constr.data[m] = _res_conv_12_ref;
8681 CVec_CVec_u8ZZ_free(_res_constr);
8684 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
8685 LDKCVec_CVec_u8ZZ o_constr;
8686 o_constr.datalen = *((uint32_t*)o);
8687 if (o_constr.datalen > 0)
8688 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8690 o_constr.data = NULL;
8691 int8_tArray* o_vals = (int8_tArray*)(o + 4);
8692 for (size_t m = 0; m < o_constr.datalen; m++) {
8693 int8_tArray o_conv_12 = o_vals[m];
8694 LDKCVec_u8Z o_conv_12_ref;
8695 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
8696 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
8697 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
8698 o_constr.data[m] = o_conv_12_ref;
8700 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8701 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
8702 return (uint64_t)ret_conv;
8705 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
8706 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8707 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
8708 return (uint64_t)ret_conv;
8711 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
8712 if ((_res & 1) != 0) return;
8713 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
8715 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
8718 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
8719 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
8720 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8721 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
8722 return (uint64_t)ret_conv;
8725 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
8726 LDKInMemorySigner o_conv;
8727 o_conv.inner = (void*)(o & (~1));
8728 o_conv.is_owned = (o & 1) || (o == 0);
8729 o_conv = InMemorySigner_clone(&o_conv);
8730 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8731 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
8732 return (uint64_t)ret_conv;
8735 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
8736 LDKDecodeError e_conv;
8737 e_conv.inner = (void*)(e & (~1));
8738 e_conv.is_owned = (e & 1) || (e == 0);
8739 e_conv = DecodeError_clone(&e_conv);
8740 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8741 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
8742 return (uint64_t)ret_conv;
8745 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
8746 if ((_res & 1) != 0) return;
8747 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
8749 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
8752 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
8753 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
8754 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8755 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
8756 return (uint64_t)ret_conv;
8759 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
8760 LDKCVec_TxOutZ _res_constr;
8761 _res_constr.datalen = *((uint32_t*)_res);
8762 if (_res_constr.datalen > 0)
8763 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
8765 _res_constr.data = NULL;
8766 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8767 for (size_t h = 0; h < _res_constr.datalen; h++) {
8768 uint32_t _res_conv_7 = _res_vals[h];
8769 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
8770 FREE((void*)_res_conv_7);
8771 _res_constr.data[h] = _res_conv_7_conv;
8773 CVec_TxOutZ_free(_res_constr);
8776 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
8777 LDKTransaction o_ref;
8778 o_ref.datalen = *((uint32_t*)o);
8779 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
8780 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
8781 o_ref.data_is_owned = true;
8782 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8783 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
8784 return (uint64_t)ret_conv;
8787 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
8788 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8789 *ret_conv = CResult_TransactionNoneZ_err();
8790 return (uint64_t)ret_conv;
8793 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
8794 if ((_res & 1) != 0) return;
8795 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
8797 CResult_TransactionNoneZ_free(_res_conv);
8800 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
8801 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
8802 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8803 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
8804 return (uint64_t)ret_conv;
8807 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
8808 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
8809 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
8810 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
8811 return ((uint64_t)ret_conv);
8814 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
8815 LDKThirtyTwoBytes a_ref;
8816 CHECK(*((uint32_t*)a) == 32);
8817 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8818 LDKChannelMonitor b_conv;
8819 b_conv.inner = (void*)(b & (~1));
8820 b_conv.is_owned = (b & 1) || (b == 0);
8821 b_conv = ChannelMonitor_clone(&b_conv);
8822 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
8823 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
8824 return ((uint64_t)ret_conv);
8827 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
8828 if ((_res & 1) != 0) return;
8829 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
8831 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
8834 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_BlockHashChannelMonitorZZ_free(uint32_tArray _res) {
8835 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
8836 _res_constr.datalen = *((uint32_t*)_res);
8837 if (_res_constr.datalen > 0)
8838 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
8840 _res_constr.data = NULL;
8841 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8842 for (size_t j = 0; j < _res_constr.datalen; j++) {
8843 uint32_t _res_conv_35 = _res_vals[j];
8844 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_35) & ~1);
8845 FREE((void*)_res_conv_35);
8846 _res_constr.data[j] = _res_conv_35_conv;
8848 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
8851 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(uint32_tArray o) {
8852 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
8853 o_constr.datalen = *((uint32_t*)o);
8854 if (o_constr.datalen > 0)
8855 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
8857 o_constr.data = NULL;
8858 uint32_t* o_vals = (uint32_t*)(o + 4);
8859 for (size_t j = 0; j < o_constr.datalen; j++) {
8860 uint32_t o_conv_35 = o_vals[j];
8861 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1);
8862 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1));
8863 o_constr.data[j] = o_conv_35_conv;
8865 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
8866 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
8867 return (uint64_t)ret_conv;
8870 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(uint32_t e) {
8871 LDKIOError e_conv = LDKIOError_from_js(e);
8872 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
8873 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
8874 return (uint64_t)ret_conv;
8877 void __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(uint32_t _res) {
8878 if ((_res & 1) != 0) return;
8879 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
8881 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
8884 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(uint32_t orig) {
8885 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
8886 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
8887 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
8888 return (uint64_t)ret_conv;
8891 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) {
8892 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
8893 *ret_copy = COption_u16Z_some(o);
8894 uint64_t ret_ref = (uint64_t)ret_copy;
8898 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_none() {
8899 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
8900 *ret_copy = COption_u16Z_none();
8901 uint64_t ret_ref = (uint64_t)ret_copy;
8905 void __attribute__((visibility("default"))) TS_COption_u16Z_free(uint32_t _res) {
8906 if ((_res & 1) != 0) return;
8907 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(((uint64_t)_res) & ~1);
8909 COption_u16Z_free(_res_conv);
8912 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_clone(uint32_t orig) {
8913 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
8914 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
8915 *ret_copy = COption_u16Z_clone(orig_conv);
8916 uint64_t ret_ref = (uint64_t)ret_copy;
8920 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
8921 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8922 *ret_conv = CResult_NoneAPIErrorZ_ok();
8923 return (uint64_t)ret_conv;
8926 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
8927 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
8928 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
8929 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8930 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
8931 return (uint64_t)ret_conv;
8934 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
8935 if ((_res & 1) != 0) return;
8936 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
8938 CResult_NoneAPIErrorZ_free(_res_conv);
8941 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
8942 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
8943 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8944 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
8945 return (uint64_t)ret_conv;
8948 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
8949 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
8950 _res_constr.datalen = *((uint32_t*)_res);
8951 if (_res_constr.datalen > 0)
8952 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
8954 _res_constr.data = NULL;
8955 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8956 for (size_t w = 0; w < _res_constr.datalen; w++) {
8957 uint32_t _res_conv_22 = _res_vals[w];
8958 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
8959 FREE((void*)_res_conv_22);
8960 _res_constr.data[w] = _res_conv_22_conv;
8962 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
8965 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
8966 LDKCVec_APIErrorZ _res_constr;
8967 _res_constr.datalen = *((uint32_t*)_res);
8968 if (_res_constr.datalen > 0)
8969 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
8971 _res_constr.data = NULL;
8972 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8973 for (size_t k = 0; k < _res_constr.datalen; k++) {
8974 uint32_t _res_conv_10 = _res_vals[k];
8975 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
8976 FREE((void*)_res_conv_10);
8977 _res_constr.data[k] = _res_conv_10_conv;
8979 CVec_APIErrorZ_free(_res_constr);
8982 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
8983 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8984 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
8985 return (uint64_t)ret_conv;
8988 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
8989 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
8990 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
8991 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8992 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
8993 return (uint64_t)ret_conv;
8996 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
8997 if ((_res & 1) != 0) return;
8998 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
9000 CResult_NonePaymentSendFailureZ_free(_res_conv);
9003 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
9004 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
9005 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9006 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
9007 return (uint64_t)ret_conv;
9010 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) {
9011 LDKThirtyTwoBytes o_ref;
9012 CHECK(*((uint32_t*)o) == 32);
9013 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
9014 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
9015 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
9016 return (uint64_t)ret_conv;
9019 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint32_t e) {
9020 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
9021 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
9022 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
9023 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
9024 return (uint64_t)ret_conv;
9027 void __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint32_t _res) {
9028 if ((_res & 1) != 0) return;
9029 LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
9031 CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
9034 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint32_t orig) {
9035 LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1);
9036 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
9037 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
9038 return (uint64_t)ret_conv;
9041 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
9042 LDKCVec_NetAddressZ _res_constr;
9043 _res_constr.datalen = *((uint32_t*)_res);
9044 if (_res_constr.datalen > 0)
9045 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9047 _res_constr.data = NULL;
9048 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9049 for (size_t m = 0; m < _res_constr.datalen; m++) {
9050 uint32_t _res_conv_12 = _res_vals[m];
9051 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
9052 FREE((void*)_res_conv_12);
9053 _res_constr.data[m] = _res_conv_12_conv;
9055 CVec_NetAddressZ_free(_res_constr);
9058 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
9059 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
9060 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
9061 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
9062 return ((uint64_t)ret_conv);
9065 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
9066 LDKThirtyTwoBytes a_ref;
9067 CHECK(*((uint32_t*)a) == 32);
9068 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9069 LDKThirtyTwoBytes b_ref;
9070 CHECK(*((uint32_t*)b) == 32);
9071 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
9072 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
9073 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
9074 return ((uint64_t)ret_conv);
9077 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
9078 if ((_res & 1) != 0) return;
9079 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
9081 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
9084 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
9085 LDKThirtyTwoBytes o_ref;
9086 CHECK(*((uint32_t*)o) == 32);
9087 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
9088 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
9089 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
9090 return (uint64_t)ret_conv;
9093 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
9094 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
9095 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
9096 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
9097 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
9098 return (uint64_t)ret_conv;
9101 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
9102 if ((_res & 1) != 0) return;
9103 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
9105 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
9108 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
9109 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
9110 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
9111 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
9112 return (uint64_t)ret_conv;
9115 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
9116 LDKCVec_ChannelMonitorZ _res_constr;
9117 _res_constr.datalen = *((uint32_t*)_res);
9118 if (_res_constr.datalen > 0)
9119 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
9121 _res_constr.data = NULL;
9122 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9123 for (size_t q = 0; q < _res_constr.datalen; q++) {
9124 uint32_t _res_conv_16 = _res_vals[q];
9125 LDKChannelMonitor _res_conv_16_conv;
9126 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9127 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9128 _res_constr.data[q] = _res_conv_16_conv;
9130 CVec_ChannelMonitorZ_free(_res_constr);
9133 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
9134 LDKThirtyTwoBytes a_ref;
9135 CHECK(*((uint32_t*)a) == 32);
9136 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9137 LDKChannelManager b_conv;
9138 b_conv.inner = (void*)(b & (~1));
9139 b_conv.is_owned = (b & 1) || (b == 0);
9140 // Warning: we need a move here but no clone is available for LDKChannelManager
9141 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
9142 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
9143 return ((uint64_t)ret_conv);
9146 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
9147 if ((_res & 1) != 0) return;
9148 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
9150 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
9153 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
9154 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
9155 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
9156 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9157 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
9158 return (uint64_t)ret_conv;
9161 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
9162 LDKDecodeError e_conv;
9163 e_conv.inner = (void*)(e & (~1));
9164 e_conv.is_owned = (e & 1) || (e == 0);
9165 e_conv = DecodeError_clone(&e_conv);
9166 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9167 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
9168 return (uint64_t)ret_conv;
9171 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
9172 if ((_res & 1) != 0) return;
9173 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9175 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
9178 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
9179 LDKChannelConfig o_conv;
9180 o_conv.inner = (void*)(o & (~1));
9181 o_conv.is_owned = (o & 1) || (o == 0);
9182 o_conv = ChannelConfig_clone(&o_conv);
9183 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9184 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
9185 return (uint64_t)ret_conv;
9188 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
9189 LDKDecodeError e_conv;
9190 e_conv.inner = (void*)(e & (~1));
9191 e_conv.is_owned = (e & 1) || (e == 0);
9192 e_conv = DecodeError_clone(&e_conv);
9193 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9194 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
9195 return (uint64_t)ret_conv;
9198 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
9199 if ((_res & 1) != 0) return;
9200 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
9202 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
9205 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
9206 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
9207 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9208 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
9209 return (uint64_t)ret_conv;
9212 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
9214 o_conv.inner = (void*)(o & (~1));
9215 o_conv.is_owned = (o & 1) || (o == 0);
9216 o_conv = OutPoint_clone(&o_conv);
9217 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9218 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
9219 return (uint64_t)ret_conv;
9222 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
9223 LDKDecodeError e_conv;
9224 e_conv.inner = (void*)(e & (~1));
9225 e_conv.is_owned = (e & 1) || (e == 0);
9226 e_conv = DecodeError_clone(&e_conv);
9227 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9228 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
9229 return (uint64_t)ret_conv;
9232 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
9233 if ((_res & 1) != 0) return;
9234 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
9236 CResult_OutPointDecodeErrorZ_free(_res_conv);
9239 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
9240 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
9241 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9242 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
9243 return (uint64_t)ret_conv;
9246 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_some(uint32_t o) {
9247 LDKType o_conv = *(LDKType*)(((uint64_t)o) & ~1);
9248 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9249 *ret_copy = COption_TypeZ_some(o_conv);
9250 uint64_t ret_ref = (uint64_t)ret_copy;
9254 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_none() {
9255 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9256 *ret_copy = COption_TypeZ_none();
9257 uint64_t ret_ref = (uint64_t)ret_copy;
9261 void __attribute__((visibility("default"))) TS_COption_TypeZ_free(uint32_t _res) {
9262 if ((_res & 1) != 0) return;
9263 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(((uint64_t)_res) & ~1);
9265 COption_TypeZ_free(_res_conv);
9268 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone(uint32_t orig) {
9269 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
9270 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9271 *ret_copy = COption_TypeZ_clone(orig_conv);
9272 uint64_t ret_ref = (uint64_t)ret_copy;
9276 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
9277 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(((uint64_t)o) & ~1);
9278 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
9279 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9280 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
9281 return (uint64_t)ret_conv;
9284 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
9285 LDKDecodeError e_conv;
9286 e_conv.inner = (void*)(e & (~1));
9287 e_conv.is_owned = (e & 1) || (e == 0);
9288 e_conv = DecodeError_clone(&e_conv);
9289 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9290 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
9291 return (uint64_t)ret_conv;
9294 void __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
9295 if ((_res & 1) != 0) return;
9296 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9298 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
9301 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
9302 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
9303 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9304 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
9305 return (uint64_t)ret_conv;
9308 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
9309 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
9310 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9311 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
9312 return (uint64_t)ret_conv;
9315 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_err() {
9316 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9317 *ret_conv = CResult_SiPrefixNoneZ_err();
9318 return (uint64_t)ret_conv;
9321 void __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_free(uint32_t _res) {
9322 if ((_res & 1) != 0) return;
9323 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
9325 CResult_SiPrefixNoneZ_free(_res_conv);
9328 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_clone(uint32_t orig) {
9329 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
9330 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9331 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
9332 return (uint64_t)ret_conv;
9335 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_ok(uint32_t o) {
9337 o_conv.inner = (void*)(o & (~1));
9338 o_conv.is_owned = (o & 1) || (o == 0);
9339 o_conv = Invoice_clone(&o_conv);
9340 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9341 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
9342 return (uint64_t)ret_conv;
9345 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_err() {
9346 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9347 *ret_conv = CResult_InvoiceNoneZ_err();
9348 return (uint64_t)ret_conv;
9351 void __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_free(uint32_t _res) {
9352 if ((_res & 1) != 0) return;
9353 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
9355 CResult_InvoiceNoneZ_free(_res_conv);
9358 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_clone(uint32_t orig) {
9359 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
9360 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9361 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
9362 return (uint64_t)ret_conv;
9365 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_ok(uint32_t o) {
9366 LDKSignedRawInvoice o_conv;
9367 o_conv.inner = (void*)(o & (~1));
9368 o_conv.is_owned = (o & 1) || (o == 0);
9369 o_conv = SignedRawInvoice_clone(&o_conv);
9370 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9371 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
9372 return (uint64_t)ret_conv;
9375 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_err() {
9376 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9377 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
9378 return (uint64_t)ret_conv;
9381 void __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_free(uint32_t _res) {
9382 if ((_res & 1) != 0) return;
9383 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
9385 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
9388 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_clone(uint32_t orig) {
9389 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
9390 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9391 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
9392 return (uint64_t)ret_conv;
9395 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
9396 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
9397 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
9398 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
9399 return ((uint64_t)ret_conv);
9402 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
9403 LDKRawInvoice a_conv;
9404 a_conv.inner = (void*)(a & (~1));
9405 a_conv.is_owned = (a & 1) || (a == 0);
9406 a_conv = RawInvoice_clone(&a_conv);
9407 LDKThirtyTwoBytes b_ref;
9408 CHECK(*((uint32_t*)b) == 32);
9409 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
9410 LDKInvoiceSignature c_conv;
9411 c_conv.inner = (void*)(c & (~1));
9412 c_conv.is_owned = (c & 1) || (c == 0);
9413 c_conv = InvoiceSignature_clone(&c_conv);
9414 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
9415 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
9416 return ((uint64_t)ret_conv);
9419 void __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
9420 if ((_res & 1) != 0) return;
9421 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
9423 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
9426 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
9427 LDKPayeePubKey o_conv;
9428 o_conv.inner = (void*)(o & (~1));
9429 o_conv.is_owned = (o & 1) || (o == 0);
9430 o_conv = PayeePubKey_clone(&o_conv);
9431 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
9432 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
9433 return (uint64_t)ret_conv;
9436 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
9437 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
9438 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
9439 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
9440 return (uint64_t)ret_conv;
9443 void __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
9444 if ((_res & 1) != 0) return;
9445 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
9447 CResult_PayeePubKeyErrorZ_free(_res_conv);
9450 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
9451 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
9452 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
9453 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
9454 return (uint64_t)ret_conv;
9457 void __attribute__((visibility("default"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
9458 LDKCVec_PrivateRouteZ _res_constr;
9459 _res_constr.datalen = *((uint32_t*)_res);
9460 if (_res_constr.datalen > 0)
9461 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
9463 _res_constr.data = NULL;
9464 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9465 for (size_t o = 0; o < _res_constr.datalen; o++) {
9466 uint32_t _res_conv_14 = _res_vals[o];
9467 LDKPrivateRoute _res_conv_14_conv;
9468 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
9469 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
9470 _res_constr.data[o] = _res_conv_14_conv;
9472 CVec_PrivateRouteZ_free(_res_constr);
9475 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
9476 LDKPositiveTimestamp o_conv;
9477 o_conv.inner = (void*)(o & (~1));
9478 o_conv.is_owned = (o & 1) || (o == 0);
9479 o_conv = PositiveTimestamp_clone(&o_conv);
9480 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
9481 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
9482 return (uint64_t)ret_conv;
9485 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
9486 LDKCreationError e_conv = LDKCreationError_from_js(e);
9487 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
9488 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
9489 return (uint64_t)ret_conv;
9492 void __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
9493 if ((_res & 1) != 0) return;
9494 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
9496 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
9499 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
9500 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
9501 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
9502 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
9503 return (uint64_t)ret_conv;
9506 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_ok() {
9507 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
9508 *ret_conv = CResult_NoneSemanticErrorZ_ok();
9509 return (uint64_t)ret_conv;
9512 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
9513 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
9514 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
9515 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
9516 return (uint64_t)ret_conv;
9519 void __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
9520 if ((_res & 1) != 0) return;
9521 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
9523 CResult_NoneSemanticErrorZ_free(_res_conv);
9526 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
9527 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
9528 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
9529 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
9530 return (uint64_t)ret_conv;
9533 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
9535 o_conv.inner = (void*)(o & (~1));
9536 o_conv.is_owned = (o & 1) || (o == 0);
9537 o_conv = Invoice_clone(&o_conv);
9538 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
9539 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
9540 return (uint64_t)ret_conv;
9543 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
9544 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
9545 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
9546 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
9547 return (uint64_t)ret_conv;
9550 void __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
9551 if ((_res & 1) != 0) return;
9552 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
9554 CResult_InvoiceSemanticErrorZ_free(_res_conv);
9557 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
9558 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
9559 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
9560 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
9561 return (uint64_t)ret_conv;
9564 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
9565 LDKDescription o_conv;
9566 o_conv.inner = (void*)(o & (~1));
9567 o_conv.is_owned = (o & 1) || (o == 0);
9568 o_conv = Description_clone(&o_conv);
9569 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
9570 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
9571 return (uint64_t)ret_conv;
9574 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
9575 LDKCreationError e_conv = LDKCreationError_from_js(e);
9576 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
9577 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
9578 return (uint64_t)ret_conv;
9581 void __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
9582 if ((_res & 1) != 0) return;
9583 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
9585 CResult_DescriptionCreationErrorZ_free(_res_conv);
9588 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
9589 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
9590 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
9591 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
9592 return (uint64_t)ret_conv;
9595 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_ok(uint32_t o) {
9596 LDKExpiryTime o_conv;
9597 o_conv.inner = (void*)(o & (~1));
9598 o_conv.is_owned = (o & 1) || (o == 0);
9599 o_conv = ExpiryTime_clone(&o_conv);
9600 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
9601 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
9602 return (uint64_t)ret_conv;
9605 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_err(uint32_t e) {
9606 LDKCreationError e_conv = LDKCreationError_from_js(e);
9607 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
9608 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
9609 return (uint64_t)ret_conv;
9612 void __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_free(uint32_t _res) {
9613 if ((_res & 1) != 0) return;
9614 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
9616 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
9619 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_clone(uint32_t orig) {
9620 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
9621 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
9622 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
9623 return (uint64_t)ret_conv;
9626 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
9627 LDKPrivateRoute o_conv;
9628 o_conv.inner = (void*)(o & (~1));
9629 o_conv.is_owned = (o & 1) || (o == 0);
9630 o_conv = PrivateRoute_clone(&o_conv);
9631 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
9632 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
9633 return (uint64_t)ret_conv;
9636 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
9637 LDKCreationError e_conv = LDKCreationError_from_js(e);
9638 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
9639 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
9640 return (uint64_t)ret_conv;
9643 void __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
9644 if ((_res & 1) != 0) return;
9645 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
9647 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
9650 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
9651 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
9652 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
9653 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
9654 return (uint64_t)ret_conv;
9657 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_ok(jstring o) {
9658 LDKStr o_conv = str_ref_to_owned_c(o);
9659 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
9660 *ret_conv = CResult_StringErrorZ_ok(o_conv);
9661 return (uint64_t)ret_conv;
9664 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_err(uint32_t e) {
9665 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
9666 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
9667 *ret_conv = CResult_StringErrorZ_err(e_conv);
9668 return (uint64_t)ret_conv;
9671 void __attribute__((visibility("default"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
9672 if ((_res & 1) != 0) return;
9673 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
9675 CResult_StringErrorZ_free(_res_conv);
9678 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
9679 LDKChannelMonitorUpdate o_conv;
9680 o_conv.inner = (void*)(o & (~1));
9681 o_conv.is_owned = (o & 1) || (o == 0);
9682 o_conv = ChannelMonitorUpdate_clone(&o_conv);
9683 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9684 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
9685 return (uint64_t)ret_conv;
9688 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
9689 LDKDecodeError e_conv;
9690 e_conv.inner = (void*)(e & (~1));
9691 e_conv.is_owned = (e & 1) || (e == 0);
9692 e_conv = DecodeError_clone(&e_conv);
9693 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9694 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
9695 return (uint64_t)ret_conv;
9698 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
9699 if ((_res & 1) != 0) return;
9700 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
9702 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
9705 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
9706 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
9707 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9708 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
9709 return (uint64_t)ret_conv;
9712 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
9713 LDKHTLCUpdate o_conv;
9714 o_conv.inner = (void*)(o & (~1));
9715 o_conv.is_owned = (o & 1) || (o == 0);
9716 o_conv = HTLCUpdate_clone(&o_conv);
9717 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9718 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
9719 return (uint64_t)ret_conv;
9722 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
9723 LDKDecodeError e_conv;
9724 e_conv.inner = (void*)(e & (~1));
9725 e_conv.is_owned = (e & 1) || (e == 0);
9726 e_conv = DecodeError_clone(&e_conv);
9727 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9728 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
9729 return (uint64_t)ret_conv;
9732 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
9733 if ((_res & 1) != 0) return;
9734 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
9736 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
9739 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
9740 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
9741 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9742 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
9743 return (uint64_t)ret_conv;
9746 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
9747 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
9748 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
9749 return (uint64_t)ret_conv;
9752 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
9753 LDKMonitorUpdateError e_conv;
9754 e_conv.inner = (void*)(e & (~1));
9755 e_conv.is_owned = (e & 1) || (e == 0);
9756 e_conv = MonitorUpdateError_clone(&e_conv);
9757 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
9758 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
9759 return (uint64_t)ret_conv;
9762 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
9763 if ((_res & 1) != 0) return;
9764 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
9766 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
9769 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
9770 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
9771 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
9772 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
9773 return (uint64_t)ret_conv;
9776 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
9777 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
9778 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
9779 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
9780 return ((uint64_t)ret_conv);
9783 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
9785 a_conv.inner = (void*)(a & (~1));
9786 a_conv.is_owned = (a & 1) || (a == 0);
9787 a_conv = OutPoint_clone(&a_conv);
9789 b_ref.datalen = *((uint32_t*)b);
9790 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
9791 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
9792 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
9793 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
9794 return ((uint64_t)ret_conv);
9797 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
9798 if ((_res & 1) != 0) return;
9799 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
9801 C2Tuple_OutPointScriptZ_free(_res_conv);
9804 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
9805 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
9806 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
9807 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
9808 return ((uint64_t)ret_conv);
9811 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
9813 b_ref.datalen = *((uint32_t*)b);
9814 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
9815 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
9816 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
9817 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
9818 return ((uint64_t)ret_conv);
9821 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
9822 if ((_res & 1) != 0) return;
9823 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
9825 C2Tuple_u32ScriptZ_free(_res_conv);
9828 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
9829 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
9830 _res_constr.datalen = *((uint32_t*)_res);
9831 if (_res_constr.datalen > 0)
9832 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
9834 _res_constr.data = NULL;
9835 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9836 for (size_t v = 0; v < _res_constr.datalen; v++) {
9837 uint32_t _res_conv_21 = _res_vals[v];
9838 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_21) & ~1);
9839 FREE((void*)_res_conv_21);
9840 _res_constr.data[v] = _res_conv_21_conv;
9842 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
9845 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
9846 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
9847 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
9848 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
9849 return ((uint64_t)ret_conv);
9852 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
9853 LDKThirtyTwoBytes a_ref;
9854 CHECK(*((uint32_t*)a) == 32);
9855 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9856 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
9857 b_constr.datalen = *((uint32_t*)b);
9858 if (b_constr.datalen > 0)
9859 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
9861 b_constr.data = NULL;
9862 uint32_t* b_vals = (uint32_t*)(b + 4);
9863 for (size_t v = 0; v < b_constr.datalen; v++) {
9864 uint32_t b_conv_21 = b_vals[v];
9865 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1);
9866 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
9867 b_constr.data[v] = b_conv_21_conv;
9869 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
9870 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
9871 return ((uint64_t)ret_conv);
9874 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
9875 if ((_res & 1) != 0) return;
9876 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
9878 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
9881 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
9882 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
9883 _res_constr.datalen = *((uint32_t*)_res);
9884 if (_res_constr.datalen > 0)
9885 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
9887 _res_constr.data = NULL;
9888 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9889 for (size_t o = 0; o < _res_constr.datalen; o++) {
9890 uint32_t _res_conv_40 = _res_vals[o];
9891 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_40) & ~1);
9892 FREE((void*)_res_conv_40);
9893 _res_constr.data[o] = _res_conv_40_conv;
9895 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
9898 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
9899 LDKCVec_EventZ _res_constr;
9900 _res_constr.datalen = *((uint32_t*)_res);
9901 if (_res_constr.datalen > 0)
9902 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
9904 _res_constr.data = NULL;
9905 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9906 for (size_t h = 0; h < _res_constr.datalen; h++) {
9907 uint32_t _res_conv_7 = _res_vals[h];
9908 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
9909 FREE((void*)_res_conv_7);
9910 _res_constr.data[h] = _res_conv_7_conv;
9912 CVec_EventZ_free(_res_constr);
9915 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
9916 LDKCVec_TransactionZ _res_constr;
9917 _res_constr.datalen = *((uint32_t*)_res);
9918 if (_res_constr.datalen > 0)
9919 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
9921 _res_constr.data = NULL;
9922 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
9923 for (size_t m = 0; m < _res_constr.datalen; m++) {
9924 int8_tArray _res_conv_12 = _res_vals[m];
9925 LDKTransaction _res_conv_12_ref;
9926 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
9927 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
9928 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
9929 _res_conv_12_ref.data_is_owned = true;
9930 _res_constr.data[m] = _res_conv_12_ref;
9932 CVec_TransactionZ_free(_res_constr);
9935 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
9936 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
9937 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
9938 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
9939 return ((uint64_t)ret_conv);
9942 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
9943 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
9944 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
9945 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
9946 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
9947 return ((uint64_t)ret_conv);
9950 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
9951 if ((_res & 1) != 0) return;
9952 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
9954 C2Tuple_u32TxOutZ_free(_res_conv);
9957 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
9958 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
9959 _res_constr.datalen = *((uint32_t*)_res);
9960 if (_res_constr.datalen > 0)
9961 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
9963 _res_constr.data = NULL;
9964 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9965 for (size_t u = 0; u < _res_constr.datalen; u++) {
9966 uint32_t _res_conv_20 = _res_vals[u];
9967 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_20) & ~1);
9968 FREE((void*)_res_conv_20);
9969 _res_constr.data[u] = _res_conv_20_conv;
9971 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
9974 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
9975 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
9976 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
9977 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
9978 return ((uint64_t)ret_conv);
9981 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
9982 LDKThirtyTwoBytes a_ref;
9983 CHECK(*((uint32_t*)a) == 32);
9984 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9985 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
9986 b_constr.datalen = *((uint32_t*)b);
9987 if (b_constr.datalen > 0)
9988 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
9990 b_constr.data = NULL;
9991 uint32_t* b_vals = (uint32_t*)(b + 4);
9992 for (size_t u = 0; u < b_constr.datalen; u++) {
9993 uint32_t b_conv_20 = b_vals[u];
9994 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1);
9995 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
9996 b_constr.data[u] = b_conv_20_conv;
9998 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
9999 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
10000 return ((uint64_t)ret_conv);
10003 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
10004 if ((_res & 1) != 0) return;
10005 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
10007 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
10010 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
10011 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
10012 _res_constr.datalen = *((uint32_t*)_res);
10013 if (_res_constr.datalen > 0)
10014 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
10016 _res_constr.data = NULL;
10017 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10018 for (size_t n = 0; n < _res_constr.datalen; n++) {
10019 uint32_t _res_conv_39 = _res_vals[n];
10020 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_39) & ~1);
10021 FREE((void*)_res_conv_39);
10022 _res_constr.data[n] = _res_conv_39_conv;
10024 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
10027 void __attribute__((visibility("default"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
10028 LDKCVec_BalanceZ _res_constr;
10029 _res_constr.datalen = *((uint32_t*)_res);
10030 if (_res_constr.datalen > 0)
10031 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
10033 _res_constr.data = NULL;
10034 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10035 for (size_t j = 0; j < _res_constr.datalen; j++) {
10036 uint32_t _res_conv_9 = _res_vals[j];
10037 LDKBalance _res_conv_9_conv = *(LDKBalance*)(((uint64_t)_res_conv_9) & ~1);
10038 FREE((void*)_res_conv_9);
10039 _res_constr.data[j] = _res_conv_9_conv;
10041 CVec_BalanceZ_free(_res_constr);
10044 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
10045 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
10046 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
10047 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10048 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
10049 return (uint64_t)ret_conv;
10052 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
10053 LDKDecodeError e_conv;
10054 e_conv.inner = (void*)(e & (~1));
10055 e_conv.is_owned = (e & 1) || (e == 0);
10056 e_conv = DecodeError_clone(&e_conv);
10057 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10058 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
10059 return (uint64_t)ret_conv;
10062 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
10063 if ((_res & 1) != 0) return;
10064 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
10066 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
10069 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
10070 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
10071 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10072 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
10073 return (uint64_t)ret_conv;
10076 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
10077 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10078 *ret_conv = CResult_NoneLightningErrorZ_ok();
10079 return (uint64_t)ret_conv;
10082 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
10083 LDKLightningError e_conv;
10084 e_conv.inner = (void*)(e & (~1));
10085 e_conv.is_owned = (e & 1) || (e == 0);
10086 e_conv = LightningError_clone(&e_conv);
10087 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10088 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
10089 return (uint64_t)ret_conv;
10092 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
10093 if ((_res & 1) != 0) return;
10094 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
10096 CResult_NoneLightningErrorZ_free(_res_conv);
10099 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
10100 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
10101 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10102 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
10103 return (uint64_t)ret_conv;
10106 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
10107 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
10108 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10109 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
10110 return ((uint64_t)ret_conv);
10113 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
10114 LDKPublicKey a_ref;
10115 CHECK(*((uint32_t*)a) == 33);
10116 memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
10117 LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
10118 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10119 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
10120 return ((uint64_t)ret_conv);
10123 void __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
10124 if ((_res & 1) != 0) return;
10125 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res) & ~1);
10127 C2Tuple_PublicKeyTypeZ_free(_res_conv);
10130 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
10131 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
10132 _res_constr.datalen = *((uint32_t*)_res);
10133 if (_res_constr.datalen > 0)
10134 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
10136 _res_constr.data = NULL;
10137 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10138 for (size_t z = 0; z < _res_constr.datalen; z++) {
10139 uint32_t _res_conv_25 = _res_vals[z];
10140 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res_conv_25) & ~1);
10141 FREE((void*)_res_conv_25);
10142 _res_constr.data[z] = _res_conv_25_conv;
10144 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
10147 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
10148 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10149 *ret_conv = CResult_boolLightningErrorZ_ok(o);
10150 return (uint64_t)ret_conv;
10153 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
10154 LDKLightningError e_conv;
10155 e_conv.inner = (void*)(e & (~1));
10156 e_conv.is_owned = (e & 1) || (e == 0);
10157 e_conv = LightningError_clone(&e_conv);
10158 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10159 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
10160 return (uint64_t)ret_conv;
10163 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
10164 if ((_res & 1) != 0) return;
10165 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
10167 CResult_boolLightningErrorZ_free(_res_conv);
10170 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
10171 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
10172 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10173 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
10174 return (uint64_t)ret_conv;
10177 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
10178 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
10179 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
10180 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
10181 return ((uint64_t)ret_conv);
10184 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
10185 LDKChannelAnnouncement a_conv;
10186 a_conv.inner = (void*)(a & (~1));
10187 a_conv.is_owned = (a & 1) || (a == 0);
10188 a_conv = ChannelAnnouncement_clone(&a_conv);
10189 LDKChannelUpdate b_conv;
10190 b_conv.inner = (void*)(b & (~1));
10191 b_conv.is_owned = (b & 1) || (b == 0);
10192 b_conv = ChannelUpdate_clone(&b_conv);
10193 LDKChannelUpdate c_conv;
10194 c_conv.inner = (void*)(c & (~1));
10195 c_conv.is_owned = (c & 1) || (c == 0);
10196 c_conv = ChannelUpdate_clone(&c_conv);
10197 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
10198 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
10199 return ((uint64_t)ret_conv);
10202 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
10203 if ((_res & 1) != 0) return;
10204 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
10206 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
10209 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
10210 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
10211 _res_constr.datalen = *((uint32_t*)_res);
10212 if (_res_constr.datalen > 0)
10213 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
10215 _res_constr.data = NULL;
10216 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10217 for (size_t h = 0; h < _res_constr.datalen; h++) {
10218 uint32_t _res_conv_59 = _res_vals[h];
10219 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_59) & ~1);
10220 FREE((void*)_res_conv_59);
10221 _res_constr.data[h] = _res_conv_59_conv;
10223 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
10226 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
10227 LDKCVec_NodeAnnouncementZ _res_constr;
10228 _res_constr.datalen = *((uint32_t*)_res);
10229 if (_res_constr.datalen > 0)
10230 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
10232 _res_constr.data = NULL;
10233 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10234 for (size_t s = 0; s < _res_constr.datalen; s++) {
10235 uint32_t _res_conv_18 = _res_vals[s];
10236 LDKNodeAnnouncement _res_conv_18_conv;
10237 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
10238 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
10239 _res_constr.data[s] = _res_conv_18_conv;
10241 CVec_NodeAnnouncementZ_free(_res_constr);
10244 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
10245 LDKCVec_PublicKeyZ _res_constr;
10246 _res_constr.datalen = *((uint32_t*)_res);
10247 if (_res_constr.datalen > 0)
10248 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
10250 _res_constr.data = NULL;
10251 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
10252 for (size_t m = 0; m < _res_constr.datalen; m++) {
10253 int8_tArray _res_conv_12 = _res_vals[m];
10254 LDKPublicKey _res_conv_12_ref;
10255 CHECK(*((uint32_t*)_res_conv_12) == 33);
10256 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
10257 _res_constr.data[m] = _res_conv_12_ref;
10259 CVec_PublicKeyZ_free(_res_constr);
10262 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
10264 o_ref.datalen = *((uint32_t*)o);
10265 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
10266 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
10267 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10268 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
10269 return (uint64_t)ret_conv;
10272 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
10273 LDKPeerHandleError e_conv;
10274 e_conv.inner = (void*)(e & (~1));
10275 e_conv.is_owned = (e & 1) || (e == 0);
10276 e_conv = PeerHandleError_clone(&e_conv);
10277 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10278 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
10279 return (uint64_t)ret_conv;
10282 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
10283 if ((_res & 1) != 0) return;
10284 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
10286 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
10289 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
10290 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
10291 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10292 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
10293 return (uint64_t)ret_conv;
10296 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
10297 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10298 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
10299 return (uint64_t)ret_conv;
10302 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
10303 LDKPeerHandleError e_conv;
10304 e_conv.inner = (void*)(e & (~1));
10305 e_conv.is_owned = (e & 1) || (e == 0);
10306 e_conv = PeerHandleError_clone(&e_conv);
10307 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10308 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
10309 return (uint64_t)ret_conv;
10312 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
10313 if ((_res & 1) != 0) return;
10314 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
10316 CResult_NonePeerHandleErrorZ_free(_res_conv);
10319 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
10320 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
10321 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10322 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
10323 return (uint64_t)ret_conv;
10326 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
10327 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
10328 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
10329 return (uint64_t)ret_conv;
10332 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
10333 LDKPeerHandleError e_conv;
10334 e_conv.inner = (void*)(e & (~1));
10335 e_conv.is_owned = (e & 1) || (e == 0);
10336 e_conv = PeerHandleError_clone(&e_conv);
10337 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
10338 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
10339 return (uint64_t)ret_conv;
10342 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
10343 if ((_res & 1) != 0) return;
10344 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
10346 CResult_boolPeerHandleErrorZ_free(_res_conv);
10349 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
10350 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
10351 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
10352 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
10353 return (uint64_t)ret_conv;
10356 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_some(uint32_t o) {
10357 LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1);
10358 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
10359 *ret_copy = COption_AccessZ_some(o_conv);
10360 uint64_t ret_ref = (uint64_t)ret_copy;
10364 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_none() {
10365 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
10366 *ret_copy = COption_AccessZ_none();
10367 uint64_t ret_ref = (uint64_t)ret_copy;
10371 void __attribute__((visibility("default"))) TS_COption_AccessZ_free(uint32_t _res) {
10372 if ((_res & 1) != 0) return;
10373 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(((uint64_t)_res) & ~1);
10375 COption_AccessZ_free(_res_conv);
10378 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
10379 LDKDirectionalChannelInfo o_conv;
10380 o_conv.inner = (void*)(o & (~1));
10381 o_conv.is_owned = (o & 1) || (o == 0);
10382 o_conv = DirectionalChannelInfo_clone(&o_conv);
10383 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
10384 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
10385 return (uint64_t)ret_conv;
10388 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
10389 LDKDecodeError e_conv;
10390 e_conv.inner = (void*)(e & (~1));
10391 e_conv.is_owned = (e & 1) || (e == 0);
10392 e_conv = DecodeError_clone(&e_conv);
10393 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
10394 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
10395 return (uint64_t)ret_conv;
10398 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
10399 if ((_res & 1) != 0) return;
10400 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
10402 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
10405 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
10406 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
10407 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
10408 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
10409 return (uint64_t)ret_conv;
10412 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
10413 LDKChannelInfo o_conv;
10414 o_conv.inner = (void*)(o & (~1));
10415 o_conv.is_owned = (o & 1) || (o == 0);
10416 o_conv = ChannelInfo_clone(&o_conv);
10417 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
10418 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
10419 return (uint64_t)ret_conv;
10422 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
10423 LDKDecodeError e_conv;
10424 e_conv.inner = (void*)(e & (~1));
10425 e_conv.is_owned = (e & 1) || (e == 0);
10426 e_conv = DecodeError_clone(&e_conv);
10427 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
10428 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
10429 return (uint64_t)ret_conv;
10432 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
10433 if ((_res & 1) != 0) return;
10434 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
10436 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
10439 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
10440 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
10441 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
10442 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
10443 return (uint64_t)ret_conv;
10446 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
10447 LDKRoutingFees o_conv;
10448 o_conv.inner = (void*)(o & (~1));
10449 o_conv.is_owned = (o & 1) || (o == 0);
10450 o_conv = RoutingFees_clone(&o_conv);
10451 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
10452 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
10453 return (uint64_t)ret_conv;
10456 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
10457 LDKDecodeError e_conv;
10458 e_conv.inner = (void*)(e & (~1));
10459 e_conv.is_owned = (e & 1) || (e == 0);
10460 e_conv = DecodeError_clone(&e_conv);
10461 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
10462 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
10463 return (uint64_t)ret_conv;
10466 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
10467 if ((_res & 1) != 0) return;
10468 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10470 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
10473 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
10474 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
10475 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
10476 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
10477 return (uint64_t)ret_conv;
10480 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
10481 LDKNodeAnnouncementInfo o_conv;
10482 o_conv.inner = (void*)(o & (~1));
10483 o_conv.is_owned = (o & 1) || (o == 0);
10484 o_conv = NodeAnnouncementInfo_clone(&o_conv);
10485 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
10486 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
10487 return (uint64_t)ret_conv;
10490 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
10491 LDKDecodeError e_conv;
10492 e_conv.inner = (void*)(e & (~1));
10493 e_conv.is_owned = (e & 1) || (e == 0);
10494 e_conv = DecodeError_clone(&e_conv);
10495 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
10496 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
10497 return (uint64_t)ret_conv;
10500 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
10501 if ((_res & 1) != 0) return;
10502 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
10504 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
10507 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
10508 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
10509 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
10510 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
10511 return (uint64_t)ret_conv;
10514 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
10515 LDKCVec_u64Z _res_constr;
10516 _res_constr.datalen = *((uint32_t*)_res);
10517 if (_res_constr.datalen > 0)
10518 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
10520 _res_constr.data = NULL;
10521 int64_t* _res_vals = (int64_t*)(_res + 4);
10522 for (size_t i = 0; i < _res_constr.datalen; i++) {
10523 int64_t _res_conv_8 = _res_vals[i];
10524 _res_constr.data[i] = _res_conv_8;
10526 CVec_u64Z_free(_res_constr);
10529 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
10530 LDKNodeInfo o_conv;
10531 o_conv.inner = (void*)(o & (~1));
10532 o_conv.is_owned = (o & 1) || (o == 0);
10533 o_conv = NodeInfo_clone(&o_conv);
10534 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
10535 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
10536 return (uint64_t)ret_conv;
10539 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
10540 LDKDecodeError e_conv;
10541 e_conv.inner = (void*)(e & (~1));
10542 e_conv.is_owned = (e & 1) || (e == 0);
10543 e_conv = DecodeError_clone(&e_conv);
10544 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
10545 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
10546 return (uint64_t)ret_conv;
10549 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
10550 if ((_res & 1) != 0) return;
10551 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
10553 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
10556 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
10557 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
10558 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
10559 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
10560 return (uint64_t)ret_conv;
10563 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
10564 LDKNetworkGraph o_conv;
10565 o_conv.inner = (void*)(o & (~1));
10566 o_conv.is_owned = (o & 1) || (o == 0);
10567 o_conv = NetworkGraph_clone(&o_conv);
10568 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
10569 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
10570 return (uint64_t)ret_conv;
10573 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
10574 LDKDecodeError e_conv;
10575 e_conv.inner = (void*)(e & (~1));
10576 e_conv.is_owned = (e & 1) || (e == 0);
10577 e_conv = DecodeError_clone(&e_conv);
10578 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
10579 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
10580 return (uint64_t)ret_conv;
10583 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
10584 if ((_res & 1) != 0) return;
10585 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
10587 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
10590 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
10591 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
10592 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
10593 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
10594 return (uint64_t)ret_conv;
10597 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
10598 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
10599 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
10600 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
10601 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
10602 return (uint64_t)ret_conv;
10605 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_err(int8_t e) {
10606 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
10607 *ret_conv = CResult_NetAddressu8Z_err(e);
10608 return (uint64_t)ret_conv;
10611 void __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_free(uint32_t _res) {
10612 if ((_res & 1) != 0) return;
10613 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
10615 CResult_NetAddressu8Z_free(_res_conv);
10618 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_clone(uint32_t orig) {
10619 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
10620 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
10621 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
10622 return (uint64_t)ret_conv;
10625 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
10626 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
10627 o_conv = CResult_NetAddressu8Z_clone((LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1));
10628 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
10629 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
10630 return (uint64_t)ret_conv;
10633 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_err(uint32_t e) {
10634 LDKDecodeError e_conv;
10635 e_conv.inner = (void*)(e & (~1));
10636 e_conv.is_owned = (e & 1) || (e == 0);
10637 e_conv = DecodeError_clone(&e_conv);
10638 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
10639 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
10640 return (uint64_t)ret_conv;
10643 void __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_free(uint32_t _res) {
10644 if ((_res & 1) != 0) return;
10645 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
10647 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
10650 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(uint32_t orig) {
10651 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
10652 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
10653 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
10654 return (uint64_t)ret_conv;
10657 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
10658 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
10659 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
10660 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
10661 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
10662 return (uint64_t)ret_conv;
10665 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
10666 LDKDecodeError e_conv;
10667 e_conv.inner = (void*)(e & (~1));
10668 e_conv.is_owned = (e & 1) || (e == 0);
10669 e_conv = DecodeError_clone(&e_conv);
10670 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
10671 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
10672 return (uint64_t)ret_conv;
10675 void __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
10676 if ((_res & 1) != 0) return;
10677 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
10679 CResult_NetAddressDecodeErrorZ_free(_res_conv);
10682 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
10683 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
10684 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
10685 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
10686 return (uint64_t)ret_conv;
10689 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
10690 LDKCVec_UpdateAddHTLCZ _res_constr;
10691 _res_constr.datalen = *((uint32_t*)_res);
10692 if (_res_constr.datalen > 0)
10693 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10695 _res_constr.data = NULL;
10696 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10697 for (size_t p = 0; p < _res_constr.datalen; p++) {
10698 uint32_t _res_conv_15 = _res_vals[p];
10699 LDKUpdateAddHTLC _res_conv_15_conv;
10700 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
10701 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
10702 _res_constr.data[p] = _res_conv_15_conv;
10704 CVec_UpdateAddHTLCZ_free(_res_constr);
10707 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
10708 LDKCVec_UpdateFulfillHTLCZ _res_constr;
10709 _res_constr.datalen = *((uint32_t*)_res);
10710 if (_res_constr.datalen > 0)
10711 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10713 _res_constr.data = NULL;
10714 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10715 for (size_t t = 0; t < _res_constr.datalen; t++) {
10716 uint32_t _res_conv_19 = _res_vals[t];
10717 LDKUpdateFulfillHTLC _res_conv_19_conv;
10718 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
10719 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
10720 _res_constr.data[t] = _res_conv_19_conv;
10722 CVec_UpdateFulfillHTLCZ_free(_res_constr);
10725 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
10726 LDKCVec_UpdateFailHTLCZ _res_constr;
10727 _res_constr.datalen = *((uint32_t*)_res);
10728 if (_res_constr.datalen > 0)
10729 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10731 _res_constr.data = NULL;
10732 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10733 for (size_t q = 0; q < _res_constr.datalen; q++) {
10734 uint32_t _res_conv_16 = _res_vals[q];
10735 LDKUpdateFailHTLC _res_conv_16_conv;
10736 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
10737 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
10738 _res_constr.data[q] = _res_conv_16_conv;
10740 CVec_UpdateFailHTLCZ_free(_res_constr);
10743 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
10744 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
10745 _res_constr.datalen = *((uint32_t*)_res);
10746 if (_res_constr.datalen > 0)
10747 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
10749 _res_constr.data = NULL;
10750 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10751 for (size_t z = 0; z < _res_constr.datalen; z++) {
10752 uint32_t _res_conv_25 = _res_vals[z];
10753 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
10754 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
10755 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
10756 _res_constr.data[z] = _res_conv_25_conv;
10758 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
10761 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
10762 LDKAcceptChannel o_conv;
10763 o_conv.inner = (void*)(o & (~1));
10764 o_conv.is_owned = (o & 1) || (o == 0);
10765 o_conv = AcceptChannel_clone(&o_conv);
10766 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
10767 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
10768 return (uint64_t)ret_conv;
10771 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
10772 LDKDecodeError e_conv;
10773 e_conv.inner = (void*)(e & (~1));
10774 e_conv.is_owned = (e & 1) || (e == 0);
10775 e_conv = DecodeError_clone(&e_conv);
10776 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
10777 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
10778 return (uint64_t)ret_conv;
10781 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
10782 if ((_res & 1) != 0) return;
10783 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
10785 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
10788 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
10789 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
10790 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
10791 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
10792 return (uint64_t)ret_conv;
10795 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
10796 LDKAnnouncementSignatures o_conv;
10797 o_conv.inner = (void*)(o & (~1));
10798 o_conv.is_owned = (o & 1) || (o == 0);
10799 o_conv = AnnouncementSignatures_clone(&o_conv);
10800 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
10801 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
10802 return (uint64_t)ret_conv;
10805 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
10806 LDKDecodeError e_conv;
10807 e_conv.inner = (void*)(e & (~1));
10808 e_conv.is_owned = (e & 1) || (e == 0);
10809 e_conv = DecodeError_clone(&e_conv);
10810 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
10811 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
10812 return (uint64_t)ret_conv;
10815 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
10816 if ((_res & 1) != 0) return;
10817 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10819 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
10822 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
10823 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
10824 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
10825 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
10826 return (uint64_t)ret_conv;
10829 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
10830 LDKChannelReestablish o_conv;
10831 o_conv.inner = (void*)(o & (~1));
10832 o_conv.is_owned = (o & 1) || (o == 0);
10833 o_conv = ChannelReestablish_clone(&o_conv);
10834 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
10835 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
10836 return (uint64_t)ret_conv;
10839 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
10840 LDKDecodeError e_conv;
10841 e_conv.inner = (void*)(e & (~1));
10842 e_conv.is_owned = (e & 1) || (e == 0);
10843 e_conv = DecodeError_clone(&e_conv);
10844 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
10845 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
10846 return (uint64_t)ret_conv;
10849 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
10850 if ((_res & 1) != 0) return;
10851 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
10853 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
10856 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
10857 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
10858 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
10859 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
10860 return (uint64_t)ret_conv;
10863 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
10864 LDKClosingSigned o_conv;
10865 o_conv.inner = (void*)(o & (~1));
10866 o_conv.is_owned = (o & 1) || (o == 0);
10867 o_conv = ClosingSigned_clone(&o_conv);
10868 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
10869 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
10870 return (uint64_t)ret_conv;
10873 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
10874 LDKDecodeError e_conv;
10875 e_conv.inner = (void*)(e & (~1));
10876 e_conv.is_owned = (e & 1) || (e == 0);
10877 e_conv = DecodeError_clone(&e_conv);
10878 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
10879 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
10880 return (uint64_t)ret_conv;
10883 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
10884 if ((_res & 1) != 0) return;
10885 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10887 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
10890 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
10891 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
10892 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
10893 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
10894 return (uint64_t)ret_conv;
10897 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
10898 LDKClosingSignedFeeRange o_conv;
10899 o_conv.inner = (void*)(o & (~1));
10900 o_conv.is_owned = (o & 1) || (o == 0);
10901 o_conv = ClosingSignedFeeRange_clone(&o_conv);
10902 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
10903 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
10904 return (uint64_t)ret_conv;
10907 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
10908 LDKDecodeError e_conv;
10909 e_conv.inner = (void*)(e & (~1));
10910 e_conv.is_owned = (e & 1) || (e == 0);
10911 e_conv = DecodeError_clone(&e_conv);
10912 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
10913 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
10914 return (uint64_t)ret_conv;
10917 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
10918 if ((_res & 1) != 0) return;
10919 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
10921 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
10924 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
10925 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
10926 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
10927 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
10928 return (uint64_t)ret_conv;
10931 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
10932 LDKCommitmentSigned o_conv;
10933 o_conv.inner = (void*)(o & (~1));
10934 o_conv.is_owned = (o & 1) || (o == 0);
10935 o_conv = CommitmentSigned_clone(&o_conv);
10936 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
10937 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
10938 return (uint64_t)ret_conv;
10941 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
10942 LDKDecodeError e_conv;
10943 e_conv.inner = (void*)(e & (~1));
10944 e_conv.is_owned = (e & 1) || (e == 0);
10945 e_conv = DecodeError_clone(&e_conv);
10946 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
10947 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
10948 return (uint64_t)ret_conv;
10951 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
10952 if ((_res & 1) != 0) return;
10953 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10955 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
10958 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
10959 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
10960 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
10961 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
10962 return (uint64_t)ret_conv;
10965 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
10966 LDKFundingCreated o_conv;
10967 o_conv.inner = (void*)(o & (~1));
10968 o_conv.is_owned = (o & 1) || (o == 0);
10969 o_conv = FundingCreated_clone(&o_conv);
10970 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
10971 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
10972 return (uint64_t)ret_conv;
10975 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
10976 LDKDecodeError e_conv;
10977 e_conv.inner = (void*)(e & (~1));
10978 e_conv.is_owned = (e & 1) || (e == 0);
10979 e_conv = DecodeError_clone(&e_conv);
10980 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
10981 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
10982 return (uint64_t)ret_conv;
10985 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
10986 if ((_res & 1) != 0) return;
10987 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10989 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
10992 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
10993 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
10994 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
10995 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
10996 return (uint64_t)ret_conv;
10999 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
11000 LDKFundingSigned o_conv;
11001 o_conv.inner = (void*)(o & (~1));
11002 o_conv.is_owned = (o & 1) || (o == 0);
11003 o_conv = FundingSigned_clone(&o_conv);
11004 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
11005 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
11006 return (uint64_t)ret_conv;
11009 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
11010 LDKDecodeError e_conv;
11011 e_conv.inner = (void*)(e & (~1));
11012 e_conv.is_owned = (e & 1) || (e == 0);
11013 e_conv = DecodeError_clone(&e_conv);
11014 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
11015 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
11016 return (uint64_t)ret_conv;
11019 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
11020 if ((_res & 1) != 0) return;
11021 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11023 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
11026 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
11027 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
11028 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
11029 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
11030 return (uint64_t)ret_conv;
11033 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
11034 LDKFundingLocked o_conv;
11035 o_conv.inner = (void*)(o & (~1));
11036 o_conv.is_owned = (o & 1) || (o == 0);
11037 o_conv = FundingLocked_clone(&o_conv);
11038 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
11039 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
11040 return (uint64_t)ret_conv;
11043 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
11044 LDKDecodeError e_conv;
11045 e_conv.inner = (void*)(e & (~1));
11046 e_conv.is_owned = (e & 1) || (e == 0);
11047 e_conv = DecodeError_clone(&e_conv);
11048 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
11049 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
11050 return (uint64_t)ret_conv;
11053 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
11054 if ((_res & 1) != 0) return;
11055 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11057 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
11060 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
11061 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
11062 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
11063 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
11064 return (uint64_t)ret_conv;
11067 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
11069 o_conv.inner = (void*)(o & (~1));
11070 o_conv.is_owned = (o & 1) || (o == 0);
11071 o_conv = Init_clone(&o_conv);
11072 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
11073 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
11074 return (uint64_t)ret_conv;
11077 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
11078 LDKDecodeError e_conv;
11079 e_conv.inner = (void*)(e & (~1));
11080 e_conv.is_owned = (e & 1) || (e == 0);
11081 e_conv = DecodeError_clone(&e_conv);
11082 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
11083 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
11084 return (uint64_t)ret_conv;
11087 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
11088 if ((_res & 1) != 0) return;
11089 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
11091 CResult_InitDecodeErrorZ_free(_res_conv);
11094 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
11095 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
11096 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
11097 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
11098 return (uint64_t)ret_conv;
11101 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
11102 LDKOpenChannel o_conv;
11103 o_conv.inner = (void*)(o & (~1));
11104 o_conv.is_owned = (o & 1) || (o == 0);
11105 o_conv = OpenChannel_clone(&o_conv);
11106 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
11107 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
11108 return (uint64_t)ret_conv;
11111 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
11112 LDKDecodeError e_conv;
11113 e_conv.inner = (void*)(e & (~1));
11114 e_conv.is_owned = (e & 1) || (e == 0);
11115 e_conv = DecodeError_clone(&e_conv);
11116 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
11117 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
11118 return (uint64_t)ret_conv;
11121 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
11122 if ((_res & 1) != 0) return;
11123 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
11125 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
11128 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
11129 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
11130 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
11131 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
11132 return (uint64_t)ret_conv;
11135 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
11136 LDKRevokeAndACK o_conv;
11137 o_conv.inner = (void*)(o & (~1));
11138 o_conv.is_owned = (o & 1) || (o == 0);
11139 o_conv = RevokeAndACK_clone(&o_conv);
11140 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
11141 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
11142 return (uint64_t)ret_conv;
11145 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
11146 LDKDecodeError e_conv;
11147 e_conv.inner = (void*)(e & (~1));
11148 e_conv.is_owned = (e & 1) || (e == 0);
11149 e_conv = DecodeError_clone(&e_conv);
11150 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
11151 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
11152 return (uint64_t)ret_conv;
11155 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
11156 if ((_res & 1) != 0) return;
11157 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
11159 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
11162 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
11163 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
11164 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
11165 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
11166 return (uint64_t)ret_conv;
11169 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
11170 LDKShutdown o_conv;
11171 o_conv.inner = (void*)(o & (~1));
11172 o_conv.is_owned = (o & 1) || (o == 0);
11173 o_conv = Shutdown_clone(&o_conv);
11174 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
11175 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
11176 return (uint64_t)ret_conv;
11179 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
11180 LDKDecodeError e_conv;
11181 e_conv.inner = (void*)(e & (~1));
11182 e_conv.is_owned = (e & 1) || (e == 0);
11183 e_conv = DecodeError_clone(&e_conv);
11184 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
11185 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
11186 return (uint64_t)ret_conv;
11189 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
11190 if ((_res & 1) != 0) return;
11191 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
11193 CResult_ShutdownDecodeErrorZ_free(_res_conv);
11196 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
11197 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
11198 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
11199 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
11200 return (uint64_t)ret_conv;
11203 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
11204 LDKUpdateFailHTLC o_conv;
11205 o_conv.inner = (void*)(o & (~1));
11206 o_conv.is_owned = (o & 1) || (o == 0);
11207 o_conv = UpdateFailHTLC_clone(&o_conv);
11208 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
11209 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
11210 return (uint64_t)ret_conv;
11213 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
11214 LDKDecodeError e_conv;
11215 e_conv.inner = (void*)(e & (~1));
11216 e_conv.is_owned = (e & 1) || (e == 0);
11217 e_conv = DecodeError_clone(&e_conv);
11218 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
11219 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
11220 return (uint64_t)ret_conv;
11223 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
11224 if ((_res & 1) != 0) return;
11225 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
11227 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
11230 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
11231 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
11232 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
11233 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
11234 return (uint64_t)ret_conv;
11237 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
11238 LDKUpdateFailMalformedHTLC o_conv;
11239 o_conv.inner = (void*)(o & (~1));
11240 o_conv.is_owned = (o & 1) || (o == 0);
11241 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
11242 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
11243 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
11244 return (uint64_t)ret_conv;
11247 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
11248 LDKDecodeError e_conv;
11249 e_conv.inner = (void*)(e & (~1));
11250 e_conv.is_owned = (e & 1) || (e == 0);
11251 e_conv = DecodeError_clone(&e_conv);
11252 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
11253 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
11254 return (uint64_t)ret_conv;
11257 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
11258 if ((_res & 1) != 0) return;
11259 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
11261 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
11264 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
11265 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
11266 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
11267 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
11268 return (uint64_t)ret_conv;
11271 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
11272 LDKUpdateFee o_conv;
11273 o_conv.inner = (void*)(o & (~1));
11274 o_conv.is_owned = (o & 1) || (o == 0);
11275 o_conv = UpdateFee_clone(&o_conv);
11276 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
11277 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
11278 return (uint64_t)ret_conv;
11281 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
11282 LDKDecodeError e_conv;
11283 e_conv.inner = (void*)(e & (~1));
11284 e_conv.is_owned = (e & 1) || (e == 0);
11285 e_conv = DecodeError_clone(&e_conv);
11286 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
11287 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
11288 return (uint64_t)ret_conv;
11291 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
11292 if ((_res & 1) != 0) return;
11293 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
11295 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
11298 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
11299 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
11300 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
11301 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
11302 return (uint64_t)ret_conv;
11305 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
11306 LDKUpdateFulfillHTLC o_conv;
11307 o_conv.inner = (void*)(o & (~1));
11308 o_conv.is_owned = (o & 1) || (o == 0);
11309 o_conv = UpdateFulfillHTLC_clone(&o_conv);
11310 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
11311 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
11312 return (uint64_t)ret_conv;
11315 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
11316 LDKDecodeError e_conv;
11317 e_conv.inner = (void*)(e & (~1));
11318 e_conv.is_owned = (e & 1) || (e == 0);
11319 e_conv = DecodeError_clone(&e_conv);
11320 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
11321 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
11322 return (uint64_t)ret_conv;
11325 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
11326 if ((_res & 1) != 0) return;
11327 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
11329 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
11332 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
11333 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
11334 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
11335 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
11336 return (uint64_t)ret_conv;
11339 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
11340 LDKUpdateAddHTLC o_conv;
11341 o_conv.inner = (void*)(o & (~1));
11342 o_conv.is_owned = (o & 1) || (o == 0);
11343 o_conv = UpdateAddHTLC_clone(&o_conv);
11344 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
11345 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
11346 return (uint64_t)ret_conv;
11349 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
11350 LDKDecodeError e_conv;
11351 e_conv.inner = (void*)(e & (~1));
11352 e_conv.is_owned = (e & 1) || (e == 0);
11353 e_conv = DecodeError_clone(&e_conv);
11354 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
11355 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
11356 return (uint64_t)ret_conv;
11359 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
11360 if ((_res & 1) != 0) return;
11361 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
11363 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
11366 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
11367 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
11368 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
11369 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
11370 return (uint64_t)ret_conv;
11373 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
11375 o_conv.inner = (void*)(o & (~1));
11376 o_conv.is_owned = (o & 1) || (o == 0);
11377 o_conv = Ping_clone(&o_conv);
11378 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
11379 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
11380 return (uint64_t)ret_conv;
11383 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
11384 LDKDecodeError e_conv;
11385 e_conv.inner = (void*)(e & (~1));
11386 e_conv.is_owned = (e & 1) || (e == 0);
11387 e_conv = DecodeError_clone(&e_conv);
11388 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
11389 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
11390 return (uint64_t)ret_conv;
11393 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
11394 if ((_res & 1) != 0) return;
11395 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
11397 CResult_PingDecodeErrorZ_free(_res_conv);
11400 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
11401 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
11402 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
11403 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
11404 return (uint64_t)ret_conv;
11407 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
11409 o_conv.inner = (void*)(o & (~1));
11410 o_conv.is_owned = (o & 1) || (o == 0);
11411 o_conv = Pong_clone(&o_conv);
11412 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
11413 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
11414 return (uint64_t)ret_conv;
11417 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
11418 LDKDecodeError e_conv;
11419 e_conv.inner = (void*)(e & (~1));
11420 e_conv.is_owned = (e & 1) || (e == 0);
11421 e_conv = DecodeError_clone(&e_conv);
11422 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
11423 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
11424 return (uint64_t)ret_conv;
11427 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
11428 if ((_res & 1) != 0) return;
11429 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
11431 CResult_PongDecodeErrorZ_free(_res_conv);
11434 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
11435 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
11436 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
11437 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
11438 return (uint64_t)ret_conv;
11441 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
11442 LDKUnsignedChannelAnnouncement o_conv;
11443 o_conv.inner = (void*)(o & (~1));
11444 o_conv.is_owned = (o & 1) || (o == 0);
11445 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
11446 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
11447 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
11448 return (uint64_t)ret_conv;
11451 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
11452 LDKDecodeError e_conv;
11453 e_conv.inner = (void*)(e & (~1));
11454 e_conv.is_owned = (e & 1) || (e == 0);
11455 e_conv = DecodeError_clone(&e_conv);
11456 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
11457 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
11458 return (uint64_t)ret_conv;
11461 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
11462 if ((_res & 1) != 0) return;
11463 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
11465 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
11468 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
11469 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
11470 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
11471 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
11472 return (uint64_t)ret_conv;
11475 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
11476 LDKChannelAnnouncement o_conv;
11477 o_conv.inner = (void*)(o & (~1));
11478 o_conv.is_owned = (o & 1) || (o == 0);
11479 o_conv = ChannelAnnouncement_clone(&o_conv);
11480 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
11481 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
11482 return (uint64_t)ret_conv;
11485 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
11486 LDKDecodeError e_conv;
11487 e_conv.inner = (void*)(e & (~1));
11488 e_conv.is_owned = (e & 1) || (e == 0);
11489 e_conv = DecodeError_clone(&e_conv);
11490 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
11491 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
11492 return (uint64_t)ret_conv;
11495 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
11496 if ((_res & 1) != 0) return;
11497 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
11499 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
11502 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
11503 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
11504 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
11505 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
11506 return (uint64_t)ret_conv;
11509 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
11510 LDKUnsignedChannelUpdate o_conv;
11511 o_conv.inner = (void*)(o & (~1));
11512 o_conv.is_owned = (o & 1) || (o == 0);
11513 o_conv = UnsignedChannelUpdate_clone(&o_conv);
11514 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
11515 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
11516 return (uint64_t)ret_conv;
11519 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
11520 LDKDecodeError e_conv;
11521 e_conv.inner = (void*)(e & (~1));
11522 e_conv.is_owned = (e & 1) || (e == 0);
11523 e_conv = DecodeError_clone(&e_conv);
11524 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
11525 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
11526 return (uint64_t)ret_conv;
11529 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
11530 if ((_res & 1) != 0) return;
11531 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11533 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
11536 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
11537 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
11538 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
11539 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
11540 return (uint64_t)ret_conv;
11543 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
11544 LDKChannelUpdate o_conv;
11545 o_conv.inner = (void*)(o & (~1));
11546 o_conv.is_owned = (o & 1) || (o == 0);
11547 o_conv = ChannelUpdate_clone(&o_conv);
11548 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
11549 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
11550 return (uint64_t)ret_conv;
11553 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
11554 LDKDecodeError e_conv;
11555 e_conv.inner = (void*)(e & (~1));
11556 e_conv.is_owned = (e & 1) || (e == 0);
11557 e_conv = DecodeError_clone(&e_conv);
11558 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
11559 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
11560 return (uint64_t)ret_conv;
11563 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
11564 if ((_res & 1) != 0) return;
11565 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11567 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
11570 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
11571 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
11572 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
11573 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
11574 return (uint64_t)ret_conv;
11577 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
11578 LDKErrorMessage o_conv;
11579 o_conv.inner = (void*)(o & (~1));
11580 o_conv.is_owned = (o & 1) || (o == 0);
11581 o_conv = ErrorMessage_clone(&o_conv);
11582 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
11583 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
11584 return (uint64_t)ret_conv;
11587 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
11588 LDKDecodeError e_conv;
11589 e_conv.inner = (void*)(e & (~1));
11590 e_conv.is_owned = (e & 1) || (e == 0);
11591 e_conv = DecodeError_clone(&e_conv);
11592 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
11593 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
11594 return (uint64_t)ret_conv;
11597 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
11598 if ((_res & 1) != 0) return;
11599 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
11601 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
11604 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
11605 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
11606 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
11607 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
11608 return (uint64_t)ret_conv;
11611 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
11612 LDKUnsignedNodeAnnouncement o_conv;
11613 o_conv.inner = (void*)(o & (~1));
11614 o_conv.is_owned = (o & 1) || (o == 0);
11615 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
11616 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
11617 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
11618 return (uint64_t)ret_conv;
11621 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
11622 LDKDecodeError e_conv;
11623 e_conv.inner = (void*)(e & (~1));
11624 e_conv.is_owned = (e & 1) || (e == 0);
11625 e_conv = DecodeError_clone(&e_conv);
11626 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
11627 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
11628 return (uint64_t)ret_conv;
11631 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
11632 if ((_res & 1) != 0) return;
11633 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
11635 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
11638 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
11639 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
11640 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
11641 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
11642 return (uint64_t)ret_conv;
11645 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
11646 LDKNodeAnnouncement o_conv;
11647 o_conv.inner = (void*)(o & (~1));
11648 o_conv.is_owned = (o & 1) || (o == 0);
11649 o_conv = NodeAnnouncement_clone(&o_conv);
11650 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
11651 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
11652 return (uint64_t)ret_conv;
11655 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
11656 LDKDecodeError e_conv;
11657 e_conv.inner = (void*)(e & (~1));
11658 e_conv.is_owned = (e & 1) || (e == 0);
11659 e_conv = DecodeError_clone(&e_conv);
11660 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
11661 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
11662 return (uint64_t)ret_conv;
11665 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
11666 if ((_res & 1) != 0) return;
11667 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
11669 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
11672 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
11673 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
11674 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
11675 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
11676 return (uint64_t)ret_conv;
11679 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
11680 LDKQueryShortChannelIds o_conv;
11681 o_conv.inner = (void*)(o & (~1));
11682 o_conv.is_owned = (o & 1) || (o == 0);
11683 o_conv = QueryShortChannelIds_clone(&o_conv);
11684 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
11685 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
11686 return (uint64_t)ret_conv;
11689 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
11690 LDKDecodeError e_conv;
11691 e_conv.inner = (void*)(e & (~1));
11692 e_conv.is_owned = (e & 1) || (e == 0);
11693 e_conv = DecodeError_clone(&e_conv);
11694 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
11695 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
11696 return (uint64_t)ret_conv;
11699 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
11700 if ((_res & 1) != 0) return;
11701 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
11703 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
11706 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
11707 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
11708 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
11709 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
11710 return (uint64_t)ret_conv;
11713 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
11714 LDKReplyShortChannelIdsEnd o_conv;
11715 o_conv.inner = (void*)(o & (~1));
11716 o_conv.is_owned = (o & 1) || (o == 0);
11717 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
11718 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
11719 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
11720 return (uint64_t)ret_conv;
11723 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
11724 LDKDecodeError e_conv;
11725 e_conv.inner = (void*)(e & (~1));
11726 e_conv.is_owned = (e & 1) || (e == 0);
11727 e_conv = DecodeError_clone(&e_conv);
11728 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
11729 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
11730 return (uint64_t)ret_conv;
11733 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
11734 if ((_res & 1) != 0) return;
11735 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
11737 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
11740 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
11741 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
11742 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
11743 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
11744 return (uint64_t)ret_conv;
11747 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
11748 LDKQueryChannelRange o_conv;
11749 o_conv.inner = (void*)(o & (~1));
11750 o_conv.is_owned = (o & 1) || (o == 0);
11751 o_conv = QueryChannelRange_clone(&o_conv);
11752 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
11753 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
11754 return (uint64_t)ret_conv;
11757 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
11758 LDKDecodeError e_conv;
11759 e_conv.inner = (void*)(e & (~1));
11760 e_conv.is_owned = (e & 1) || (e == 0);
11761 e_conv = DecodeError_clone(&e_conv);
11762 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
11763 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
11764 return (uint64_t)ret_conv;
11767 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
11768 if ((_res & 1) != 0) return;
11769 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
11771 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
11774 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
11775 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
11776 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
11777 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
11778 return (uint64_t)ret_conv;
11781 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
11782 LDKReplyChannelRange o_conv;
11783 o_conv.inner = (void*)(o & (~1));
11784 o_conv.is_owned = (o & 1) || (o == 0);
11785 o_conv = ReplyChannelRange_clone(&o_conv);
11786 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
11787 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
11788 return (uint64_t)ret_conv;
11791 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
11792 LDKDecodeError e_conv;
11793 e_conv.inner = (void*)(e & (~1));
11794 e_conv.is_owned = (e & 1) || (e == 0);
11795 e_conv = DecodeError_clone(&e_conv);
11796 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
11797 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
11798 return (uint64_t)ret_conv;
11801 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
11802 if ((_res & 1) != 0) return;
11803 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
11805 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
11808 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
11809 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
11810 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
11811 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
11812 return (uint64_t)ret_conv;
11815 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
11816 LDKGossipTimestampFilter o_conv;
11817 o_conv.inner = (void*)(o & (~1));
11818 o_conv.is_owned = (o & 1) || (o == 0);
11819 o_conv = GossipTimestampFilter_clone(&o_conv);
11820 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
11821 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
11822 return (uint64_t)ret_conv;
11825 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
11826 LDKDecodeError e_conv;
11827 e_conv.inner = (void*)(e & (~1));
11828 e_conv.is_owned = (e & 1) || (e == 0);
11829 e_conv = DecodeError_clone(&e_conv);
11830 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
11831 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
11832 return (uint64_t)ret_conv;
11835 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
11836 if ((_res & 1) != 0) return;
11837 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
11839 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
11842 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
11843 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
11844 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
11845 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
11846 return (uint64_t)ret_conv;
11849 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
11851 o_conv.inner = (void*)(o & (~1));
11852 o_conv.is_owned = (o & 1) || (o == 0);
11853 o_conv = Invoice_clone(&o_conv);
11854 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
11855 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
11856 return (uint64_t)ret_conv;
11859 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
11860 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
11861 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
11862 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
11863 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
11864 return (uint64_t)ret_conv;
11867 void __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
11868 if ((_res & 1) != 0) return;
11869 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
11871 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
11874 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
11875 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
11876 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
11877 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
11878 return (uint64_t)ret_conv;
11881 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_some(uint32_t o) {
11882 LDKFilter o_conv = *(LDKFilter*)(((uint64_t)o) & ~1);
11883 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
11884 *ret_copy = COption_FilterZ_some(o_conv);
11885 uint64_t ret_ref = (uint64_t)ret_copy;
11889 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_none() {
11890 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
11891 *ret_copy = COption_FilterZ_none();
11892 uint64_t ret_ref = (uint64_t)ret_copy;
11896 void __attribute__((visibility("default"))) TS_COption_FilterZ_free(uint32_t _res) {
11897 if ((_res & 1) != 0) return;
11898 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(((uint64_t)_res) & ~1);
11900 COption_FilterZ_free(_res_conv);
11903 void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
11904 if ((this_ptr & 1) != 0) return;
11905 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
11906 FREE((void*)this_ptr);
11907 PaymentPurpose_free(this_ptr_conv);
11910 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) {
11911 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
11912 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
11913 *ret_copy = PaymentPurpose_clone(orig_conv);
11914 uint64_t ret_ref = (uint64_t)ret_copy;
11918 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
11919 LDKThirtyTwoBytes payment_preimage_ref;
11920 CHECK(*((uint32_t*)payment_preimage) == 32);
11921 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
11922 LDKThirtyTwoBytes payment_secret_ref;
11923 CHECK(*((uint32_t*)payment_secret) == 32);
11924 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
11925 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
11926 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
11927 uint64_t ret_ref = (uint64_t)ret_copy;
11931 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
11932 LDKThirtyTwoBytes a_ref;
11933 CHECK(*((uint32_t*)a) == 32);
11934 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
11935 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
11936 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
11937 uint64_t ret_ref = (uint64_t)ret_copy;
11941 void __attribute__((visibility("default"))) TS_ClosureReason_free(uint32_t this_ptr) {
11942 if ((this_ptr & 1) != 0) return;
11943 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(((uint64_t)this_ptr) & ~1);
11944 FREE((void*)this_ptr);
11945 ClosureReason_free(this_ptr_conv);
11948 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_clone(uint32_t orig) {
11949 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
11950 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11951 *ret_copy = ClosureReason_clone(orig_conv);
11952 uint64_t ret_ref = (uint64_t)ret_copy;
11956 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
11957 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
11958 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11959 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
11960 uint64_t ret_ref = (uint64_t)ret_copy;
11964 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_holder_force_closed() {
11965 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11966 *ret_copy = ClosureReason_holder_force_closed();
11967 uint64_t ret_ref = (uint64_t)ret_copy;
11971 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_cooperative_closure() {
11972 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11973 *ret_copy = ClosureReason_cooperative_closure();
11974 uint64_t ret_ref = (uint64_t)ret_copy;
11978 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_commitment_tx_confirmed() {
11979 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11980 *ret_copy = ClosureReason_commitment_tx_confirmed();
11981 uint64_t ret_ref = (uint64_t)ret_copy;
11985 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_processing_error(jstring err) {
11986 LDKStr err_conv = str_ref_to_owned_c(err);
11987 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11988 *ret_copy = ClosureReason_processing_error(err_conv);
11989 uint64_t ret_ref = (uint64_t)ret_copy;
11993 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_disconnected_peer() {
11994 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11995 *ret_copy = ClosureReason_disconnected_peer();
11996 uint64_t ret_ref = (uint64_t)ret_copy;
12000 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_outdated_channel_manager() {
12001 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12002 *ret_copy = ClosureReason_outdated_channel_manager();
12003 uint64_t ret_ref = (uint64_t)ret_copy;
12007 int8_tArray __attribute__((visibility("default"))) TS_ClosureReason_write(uint32_t obj) {
12008 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
12009 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
12010 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12011 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12012 CVec_u8Z_free(ret_var);
12016 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
12017 if ((this_ptr & 1) != 0) return;
12018 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
12019 FREE((void*)this_ptr);
12020 Event_free(this_ptr_conv);
12023 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
12024 LDKEvent* orig_conv = (LDKEvent*)orig;
12025 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12026 *ret_copy = Event_clone(orig_conv);
12027 uint64_t ret_ref = (uint64_t)ret_copy;
12031 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) {
12032 LDKThirtyTwoBytes temporary_channel_id_ref;
12033 CHECK(*((uint32_t*)temporary_channel_id) == 32);
12034 memcpy(temporary_channel_id_ref.data, (uint8_t*)(temporary_channel_id + 4), 32);
12035 LDKCVec_u8Z output_script_ref;
12036 output_script_ref.datalen = *((uint32_t*)output_script);
12037 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
12038 memcpy(output_script_ref.data, (uint8_t*)(output_script + 4), output_script_ref.datalen);
12039 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12040 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
12041 uint64_t ret_ref = (uint64_t)ret_copy;
12045 uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
12046 LDKThirtyTwoBytes payment_hash_ref;
12047 CHECK(*((uint32_t*)payment_hash) == 32);
12048 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
12049 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
12050 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
12051 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12052 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
12053 uint64_t ret_ref = (uint64_t)ret_copy;
12057 uint32_t __attribute__((visibility("default"))) TS_Event_payment_sent(int8_tArray payment_preimage) {
12058 LDKThirtyTwoBytes payment_preimage_ref;
12059 CHECK(*((uint32_t*)payment_preimage) == 32);
12060 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
12061 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12062 *ret_copy = Event_payment_sent(payment_preimage_ref);
12063 uint64_t ret_ref = (uint64_t)ret_copy;
12067 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) {
12068 LDKThirtyTwoBytes payment_hash_ref;
12069 CHECK(*((uint32_t*)payment_hash) == 32);
12070 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
12071 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1);
12072 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
12073 LDKCVec_RouteHopZ path_constr;
12074 path_constr.datalen = *((uint32_t*)path);
12075 if (path_constr.datalen > 0)
12076 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12078 path_constr.data = NULL;
12079 uint32_t* path_vals = (uint32_t*)(path + 4);
12080 for (size_t k = 0; k < path_constr.datalen; k++) {
12081 uint32_t path_conv_10 = path_vals[k];
12082 LDKRouteHop path_conv_10_conv;
12083 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
12084 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
12085 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
12086 path_constr.data[k] = path_conv_10_conv;
12088 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12089 *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr);
12090 uint64_t ret_ref = (uint64_t)ret_copy;
12094 uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
12095 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12096 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
12097 uint64_t ret_ref = (uint64_t)ret_copy;
12101 uint32_t __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
12102 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
12103 outputs_constr.datalen = *((uint32_t*)outputs);
12104 if (outputs_constr.datalen > 0)
12105 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
12107 outputs_constr.data = NULL;
12108 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
12109 for (size_t b = 0; b < outputs_constr.datalen; b++) {
12110 uint32_t outputs_conv_27 = outputs_vals[b];
12111 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1);
12112 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
12113 outputs_constr.data[b] = outputs_conv_27_conv;
12115 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12116 *ret_copy = Event_spendable_outputs(outputs_constr);
12117 uint64_t ret_ref = (uint64_t)ret_copy;
12121 uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
12122 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
12123 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
12124 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12125 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
12126 uint64_t ret_ref = (uint64_t)ret_copy;
12130 uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, uint32_t reason) {
12131 LDKThirtyTwoBytes channel_id_ref;
12132 CHECK(*((uint32_t*)channel_id) == 32);
12133 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
12134 LDKClosureReason reason_conv = *(LDKClosureReason*)(((uint64_t)reason) & ~1);
12135 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
12136 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12137 *ret_copy = Event_channel_closed(channel_id_ref, reason_conv);
12138 uint64_t ret_ref = (uint64_t)ret_copy;
12142 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
12143 LDKEvent* obj_conv = (LDKEvent*)obj;
12144 LDKCVec_u8Z ret_var = Event_write(obj_conv);
12145 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12146 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12147 CVec_u8Z_free(ret_var);
12151 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
12152 if ((this_ptr & 1) != 0) return;
12153 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
12154 FREE((void*)this_ptr);
12155 MessageSendEvent_free(this_ptr_conv);
12158 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
12159 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
12160 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12161 *ret_copy = MessageSendEvent_clone(orig_conv);
12162 uint64_t ret_ref = (uint64_t)ret_copy;
12166 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
12167 LDKPublicKey node_id_ref;
12168 CHECK(*((uint32_t*)node_id) == 33);
12169 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12170 LDKAcceptChannel msg_conv;
12171 msg_conv.inner = (void*)(msg & (~1));
12172 msg_conv.is_owned = (msg & 1) || (msg == 0);
12173 msg_conv = AcceptChannel_clone(&msg_conv);
12174 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12175 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
12176 uint64_t ret_ref = (uint64_t)ret_copy;
12180 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
12181 LDKPublicKey node_id_ref;
12182 CHECK(*((uint32_t*)node_id) == 33);
12183 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12184 LDKOpenChannel msg_conv;
12185 msg_conv.inner = (void*)(msg & (~1));
12186 msg_conv.is_owned = (msg & 1) || (msg == 0);
12187 msg_conv = OpenChannel_clone(&msg_conv);
12188 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12189 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
12190 uint64_t ret_ref = (uint64_t)ret_copy;
12194 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
12195 LDKPublicKey node_id_ref;
12196 CHECK(*((uint32_t*)node_id) == 33);
12197 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12198 LDKFundingCreated msg_conv;
12199 msg_conv.inner = (void*)(msg & (~1));
12200 msg_conv.is_owned = (msg & 1) || (msg == 0);
12201 msg_conv = FundingCreated_clone(&msg_conv);
12202 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12203 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
12204 uint64_t ret_ref = (uint64_t)ret_copy;
12208 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
12209 LDKPublicKey node_id_ref;
12210 CHECK(*((uint32_t*)node_id) == 33);
12211 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12212 LDKFundingSigned msg_conv;
12213 msg_conv.inner = (void*)(msg & (~1));
12214 msg_conv.is_owned = (msg & 1) || (msg == 0);
12215 msg_conv = FundingSigned_clone(&msg_conv);
12216 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12217 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
12218 uint64_t ret_ref = (uint64_t)ret_copy;
12222 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
12223 LDKPublicKey node_id_ref;
12224 CHECK(*((uint32_t*)node_id) == 33);
12225 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12226 LDKFundingLocked msg_conv;
12227 msg_conv.inner = (void*)(msg & (~1));
12228 msg_conv.is_owned = (msg & 1) || (msg == 0);
12229 msg_conv = FundingLocked_clone(&msg_conv);
12230 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12231 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
12232 uint64_t ret_ref = (uint64_t)ret_copy;
12236 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
12237 LDKPublicKey node_id_ref;
12238 CHECK(*((uint32_t*)node_id) == 33);
12239 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12240 LDKAnnouncementSignatures msg_conv;
12241 msg_conv.inner = (void*)(msg & (~1));
12242 msg_conv.is_owned = (msg & 1) || (msg == 0);
12243 msg_conv = AnnouncementSignatures_clone(&msg_conv);
12244 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12245 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
12246 uint64_t ret_ref = (uint64_t)ret_copy;
12250 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
12251 LDKPublicKey node_id_ref;
12252 CHECK(*((uint32_t*)node_id) == 33);
12253 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12254 LDKCommitmentUpdate updates_conv;
12255 updates_conv.inner = (void*)(updates & (~1));
12256 updates_conv.is_owned = (updates & 1) || (updates == 0);
12257 updates_conv = CommitmentUpdate_clone(&updates_conv);
12258 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12259 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
12260 uint64_t ret_ref = (uint64_t)ret_copy;
12264 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
12265 LDKPublicKey node_id_ref;
12266 CHECK(*((uint32_t*)node_id) == 33);
12267 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12268 LDKRevokeAndACK msg_conv;
12269 msg_conv.inner = (void*)(msg & (~1));
12270 msg_conv.is_owned = (msg & 1) || (msg == 0);
12271 msg_conv = RevokeAndACK_clone(&msg_conv);
12272 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12273 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
12274 uint64_t ret_ref = (uint64_t)ret_copy;
12278 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
12279 LDKPublicKey node_id_ref;
12280 CHECK(*((uint32_t*)node_id) == 33);
12281 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12282 LDKClosingSigned msg_conv;
12283 msg_conv.inner = (void*)(msg & (~1));
12284 msg_conv.is_owned = (msg & 1) || (msg == 0);
12285 msg_conv = ClosingSigned_clone(&msg_conv);
12286 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12287 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
12288 uint64_t ret_ref = (uint64_t)ret_copy;
12292 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
12293 LDKPublicKey node_id_ref;
12294 CHECK(*((uint32_t*)node_id) == 33);
12295 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12296 LDKShutdown msg_conv;
12297 msg_conv.inner = (void*)(msg & (~1));
12298 msg_conv.is_owned = (msg & 1) || (msg == 0);
12299 msg_conv = Shutdown_clone(&msg_conv);
12300 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12301 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
12302 uint64_t ret_ref = (uint64_t)ret_copy;
12306 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
12307 LDKPublicKey node_id_ref;
12308 CHECK(*((uint32_t*)node_id) == 33);
12309 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12310 LDKChannelReestablish msg_conv;
12311 msg_conv.inner = (void*)(msg & (~1));
12312 msg_conv.is_owned = (msg & 1) || (msg == 0);
12313 msg_conv = ChannelReestablish_clone(&msg_conv);
12314 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12315 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
12316 uint64_t ret_ref = (uint64_t)ret_copy;
12320 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
12321 LDKChannelAnnouncement msg_conv;
12322 msg_conv.inner = (void*)(msg & (~1));
12323 msg_conv.is_owned = (msg & 1) || (msg == 0);
12324 msg_conv = ChannelAnnouncement_clone(&msg_conv);
12325 LDKChannelUpdate update_msg_conv;
12326 update_msg_conv.inner = (void*)(update_msg & (~1));
12327 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
12328 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
12329 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12330 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
12331 uint64_t ret_ref = (uint64_t)ret_copy;
12335 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
12336 LDKNodeAnnouncement msg_conv;
12337 msg_conv.inner = (void*)(msg & (~1));
12338 msg_conv.is_owned = (msg & 1) || (msg == 0);
12339 msg_conv = NodeAnnouncement_clone(&msg_conv);
12340 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12341 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
12342 uint64_t ret_ref = (uint64_t)ret_copy;
12346 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
12347 LDKChannelUpdate msg_conv;
12348 msg_conv.inner = (void*)(msg & (~1));
12349 msg_conv.is_owned = (msg & 1) || (msg == 0);
12350 msg_conv = ChannelUpdate_clone(&msg_conv);
12351 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12352 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
12353 uint64_t ret_ref = (uint64_t)ret_copy;
12357 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
12358 LDKPublicKey node_id_ref;
12359 CHECK(*((uint32_t*)node_id) == 33);
12360 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12361 LDKChannelUpdate msg_conv;
12362 msg_conv.inner = (void*)(msg & (~1));
12363 msg_conv.is_owned = (msg & 1) || (msg == 0);
12364 msg_conv = ChannelUpdate_clone(&msg_conv);
12365 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12366 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
12367 uint64_t ret_ref = (uint64_t)ret_copy;
12371 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
12372 LDKPublicKey node_id_ref;
12373 CHECK(*((uint32_t*)node_id) == 33);
12374 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12375 LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
12376 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
12377 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12378 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
12379 uint64_t ret_ref = (uint64_t)ret_copy;
12383 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
12384 LDKPublicKey node_id_ref;
12385 CHECK(*((uint32_t*)node_id) == 33);
12386 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12387 LDKQueryChannelRange msg_conv;
12388 msg_conv.inner = (void*)(msg & (~1));
12389 msg_conv.is_owned = (msg & 1) || (msg == 0);
12390 msg_conv = QueryChannelRange_clone(&msg_conv);
12391 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12392 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
12393 uint64_t ret_ref = (uint64_t)ret_copy;
12397 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
12398 LDKPublicKey node_id_ref;
12399 CHECK(*((uint32_t*)node_id) == 33);
12400 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12401 LDKQueryShortChannelIds msg_conv;
12402 msg_conv.inner = (void*)(msg & (~1));
12403 msg_conv.is_owned = (msg & 1) || (msg == 0);
12404 msg_conv = QueryShortChannelIds_clone(&msg_conv);
12405 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12406 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
12407 uint64_t ret_ref = (uint64_t)ret_copy;
12411 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
12412 LDKPublicKey node_id_ref;
12413 CHECK(*((uint32_t*)node_id) == 33);
12414 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12415 LDKReplyChannelRange msg_conv;
12416 msg_conv.inner = (void*)(msg & (~1));
12417 msg_conv.is_owned = (msg & 1) || (msg == 0);
12418 msg_conv = ReplyChannelRange_clone(&msg_conv);
12419 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12420 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
12421 uint64_t ret_ref = (uint64_t)ret_copy;
12425 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
12426 if ((this_ptr & 1) != 0) return;
12427 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
12428 FREE((void*)this_ptr);
12429 MessageSendEventsProvider_free(this_ptr_conv);
12432 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
12433 if ((this_ptr & 1) != 0) return;
12434 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
12435 FREE((void*)this_ptr);
12436 EventsProvider_free(this_ptr_conv);
12439 void __attribute__((visibility("default"))) TS_EventHandler_free(uint32_t this_ptr) {
12440 if ((this_ptr & 1) != 0) return;
12441 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
12442 FREE((void*)this_ptr);
12443 EventHandler_free(this_ptr_conv);
12446 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
12447 if ((this_ptr & 1) != 0) return;
12448 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
12449 FREE((void*)this_ptr);
12450 APIError_free(this_ptr_conv);
12453 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
12454 LDKAPIError* orig_conv = (LDKAPIError*)orig;
12455 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12456 *ret_copy = APIError_clone(orig_conv);
12457 uint64_t ret_ref = (uint64_t)ret_copy;
12461 uint32_t __attribute__((visibility("default"))) TS_APIError_apimisuse_error(jstring err) {
12462 LDKStr err_conv = str_ref_to_owned_c(err);
12463 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12464 *ret_copy = APIError_apimisuse_error(err_conv);
12465 uint64_t ret_ref = (uint64_t)ret_copy;
12469 uint32_t __attribute__((visibility("default"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
12470 LDKStr err_conv = str_ref_to_owned_c(err);
12471 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12472 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
12473 uint64_t ret_ref = (uint64_t)ret_copy;
12477 uint32_t __attribute__((visibility("default"))) TS_APIError_route_error(jstring err) {
12478 LDKStr err_conv = str_ref_to_owned_c(err);
12479 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12480 *ret_copy = APIError_route_error(err_conv);
12481 uint64_t ret_ref = (uint64_t)ret_copy;
12485 uint32_t __attribute__((visibility("default"))) TS_APIError_channel_unavailable(jstring err) {
12486 LDKStr err_conv = str_ref_to_owned_c(err);
12487 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12488 *ret_copy = APIError_channel_unavailable(err_conv);
12489 uint64_t ret_ref = (uint64_t)ret_copy;
12493 uint32_t __attribute__((visibility("default"))) TS_APIError_monitor_update_failed() {
12494 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12495 *ret_copy = APIError_monitor_update_failed();
12496 uint64_t ret_ref = (uint64_t)ret_copy;
12500 uint32_t __attribute__((visibility("default"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
12501 LDKShutdownScript script_conv;
12502 script_conv.inner = (void*)(script & (~1));
12503 script_conv.is_owned = (script & 1) || (script == 0);
12504 script_conv = ShutdownScript_clone(&script_conv);
12505 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12506 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
12507 uint64_t ret_ref = (uint64_t)ret_copy;
12511 uint32_t __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
12512 LDKu8slice msg_ref;
12513 msg_ref.datalen = *((uint32_t*)msg);
12514 msg_ref.data = (int8_t*)(msg + 4);
12515 unsigned char sk_arr[32];
12516 CHECK(*((uint32_t*)sk) == 32);
12517 memcpy(sk_arr, (uint8_t*)(sk + 4), 32);
12518 unsigned char (*sk_ref)[32] = &sk_arr;
12519 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12520 *ret_conv = sign(msg_ref, sk_ref);
12521 return (uint64_t)ret_conv;
12524 uint32_t __attribute__((visibility("default"))) TS_recover_pk(int8_tArray msg, jstring sig) {
12525 LDKu8slice msg_ref;
12526 msg_ref.datalen = *((uint32_t*)msg);
12527 msg_ref.data = (int8_t*)(msg + 4);
12528 LDKStr sig_conv = str_ref_to_owned_c(sig);
12529 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
12530 *ret_conv = recover_pk(msg_ref, sig_conv);
12531 return (uint64_t)ret_conv;
12534 jboolean __attribute__((visibility("default"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
12535 LDKu8slice msg_ref;
12536 msg_ref.datalen = *((uint32_t*)msg);
12537 msg_ref.data = (int8_t*)(msg + 4);
12538 LDKStr sig_conv = str_ref_to_owned_c(sig);
12539 LDKPublicKey pk_ref;
12540 CHECK(*((uint32_t*)pk) == 33);
12541 memcpy(pk_ref.compressed_form, (uint8_t*)(pk + 4), 33);
12542 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
12546 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
12547 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
12548 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
12552 uint32_t __attribute__((visibility("default"))) TS_Level_trace() {
12553 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
12557 uint32_t __attribute__((visibility("default"))) TS_Level_debug() {
12558 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
12562 uint32_t __attribute__((visibility("default"))) TS_Level_info() {
12563 uint32_t ret_conv = LDKLevel_to_js(Level_info());
12567 uint32_t __attribute__((visibility("default"))) TS_Level_warn() {
12568 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
12572 uint32_t __attribute__((visibility("default"))) TS_Level_error() {
12573 uint32_t ret_conv = LDKLevel_to_js(Level_error());
12577 jboolean __attribute__((visibility("default"))) TS_Level_eq(uint32_t a, uint32_t b) {
12578 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
12579 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
12580 jboolean ret_val = Level_eq(a_conv, b_conv);
12584 int64_t __attribute__((visibility("default"))) TS_Level_hash(uint32_t o) {
12585 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
12586 int64_t ret_val = Level_hash(o_conv);
12590 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
12591 uint32_t ret_conv = LDKLevel_to_js(Level_max());
12595 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
12596 if ((this_ptr & 1) != 0) return;
12597 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
12598 FREE((void*)this_ptr);
12599 Logger_free(this_ptr_conv);
12602 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
12603 LDKChannelHandshakeConfig this_obj_conv;
12604 this_obj_conv.inner = (void*)(this_obj & (~1));
12605 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12606 ChannelHandshakeConfig_free(this_obj_conv);
12609 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
12610 LDKChannelHandshakeConfig this_ptr_conv;
12611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12612 this_ptr_conv.is_owned = false;
12613 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
12617 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
12618 LDKChannelHandshakeConfig this_ptr_conv;
12619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12620 this_ptr_conv.is_owned = false;
12621 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
12624 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
12625 LDKChannelHandshakeConfig this_ptr_conv;
12626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12627 this_ptr_conv.is_owned = false;
12628 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
12632 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
12633 LDKChannelHandshakeConfig this_ptr_conv;
12634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12635 this_ptr_conv.is_owned = false;
12636 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
12639 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
12640 LDKChannelHandshakeConfig this_ptr_conv;
12641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12642 this_ptr_conv.is_owned = false;
12643 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
12647 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
12648 LDKChannelHandshakeConfig this_ptr_conv;
12649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12650 this_ptr_conv.is_owned = false;
12651 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
12654 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) {
12655 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
12656 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12657 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12658 uint64_t ret_ref = (uint64_t)ret_var.inner;
12659 if (ret_var.is_owned) {
12665 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
12666 LDKChannelHandshakeConfig orig_conv;
12667 orig_conv.inner = (void*)(orig & (~1));
12668 orig_conv.is_owned = false;
12669 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
12670 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12671 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12672 uint64_t ret_ref = (uint64_t)ret_var.inner;
12673 if (ret_var.is_owned) {
12679 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
12680 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
12681 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12682 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12683 uint64_t ret_ref = (uint64_t)ret_var.inner;
12684 if (ret_var.is_owned) {
12690 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
12691 LDKChannelHandshakeLimits this_obj_conv;
12692 this_obj_conv.inner = (void*)(this_obj & (~1));
12693 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12694 ChannelHandshakeLimits_free(this_obj_conv);
12697 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
12698 LDKChannelHandshakeLimits this_ptr_conv;
12699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12700 this_ptr_conv.is_owned = false;
12701 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
12705 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
12706 LDKChannelHandshakeLimits this_ptr_conv;
12707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12708 this_ptr_conv.is_owned = false;
12709 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
12712 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
12713 LDKChannelHandshakeLimits this_ptr_conv;
12714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12715 this_ptr_conv.is_owned = false;
12716 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
12720 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
12721 LDKChannelHandshakeLimits this_ptr_conv;
12722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12723 this_ptr_conv.is_owned = false;
12724 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
12727 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
12728 LDKChannelHandshakeLimits this_ptr_conv;
12729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12730 this_ptr_conv.is_owned = false;
12731 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
12735 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
12736 LDKChannelHandshakeLimits this_ptr_conv;
12737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12738 this_ptr_conv.is_owned = false;
12739 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
12742 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
12743 LDKChannelHandshakeLimits this_ptr_conv;
12744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12745 this_ptr_conv.is_owned = false;
12746 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
12750 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
12751 LDKChannelHandshakeLimits this_ptr_conv;
12752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12753 this_ptr_conv.is_owned = false;
12754 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
12757 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
12758 LDKChannelHandshakeLimits this_ptr_conv;
12759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12760 this_ptr_conv.is_owned = false;
12761 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
12765 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
12766 LDKChannelHandshakeLimits this_ptr_conv;
12767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12768 this_ptr_conv.is_owned = false;
12769 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
12772 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
12773 LDKChannelHandshakeLimits this_ptr_conv;
12774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12775 this_ptr_conv.is_owned = false;
12776 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
12780 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
12781 LDKChannelHandshakeLimits this_ptr_conv;
12782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12783 this_ptr_conv.is_owned = false;
12784 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
12787 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
12788 LDKChannelHandshakeLimits this_ptr_conv;
12789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12790 this_ptr_conv.is_owned = false;
12791 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
12795 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
12796 LDKChannelHandshakeLimits this_ptr_conv;
12797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12798 this_ptr_conv.is_owned = false;
12799 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
12802 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
12803 LDKChannelHandshakeLimits this_ptr_conv;
12804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12805 this_ptr_conv.is_owned = false;
12806 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
12810 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
12811 LDKChannelHandshakeLimits this_ptr_conv;
12812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12813 this_ptr_conv.is_owned = false;
12814 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
12817 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) {
12818 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);
12819 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12820 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12821 uint64_t ret_ref = (uint64_t)ret_var.inner;
12822 if (ret_var.is_owned) {
12828 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
12829 LDKChannelHandshakeLimits orig_conv;
12830 orig_conv.inner = (void*)(orig & (~1));
12831 orig_conv.is_owned = false;
12832 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
12833 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12834 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12835 uint64_t ret_ref = (uint64_t)ret_var.inner;
12836 if (ret_var.is_owned) {
12842 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
12843 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
12844 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12845 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12846 uint64_t ret_ref = (uint64_t)ret_var.inner;
12847 if (ret_var.is_owned) {
12853 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
12854 LDKChannelConfig this_obj_conv;
12855 this_obj_conv.inner = (void*)(this_obj & (~1));
12856 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12857 ChannelConfig_free(this_obj_conv);
12860 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
12861 LDKChannelConfig this_ptr_conv;
12862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12863 this_ptr_conv.is_owned = false;
12864 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
12868 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
12869 LDKChannelConfig this_ptr_conv;
12870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12871 this_ptr_conv.is_owned = false;
12872 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
12875 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
12876 LDKChannelConfig this_ptr_conv;
12877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12878 this_ptr_conv.is_owned = false;
12879 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
12883 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
12884 LDKChannelConfig this_ptr_conv;
12885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12886 this_ptr_conv.is_owned = false;
12887 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
12890 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
12891 LDKChannelConfig this_ptr_conv;
12892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12893 this_ptr_conv.is_owned = false;
12894 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
12898 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
12899 LDKChannelConfig this_ptr_conv;
12900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12901 this_ptr_conv.is_owned = false;
12902 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
12905 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
12906 LDKChannelConfig this_ptr_conv;
12907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12908 this_ptr_conv.is_owned = false;
12909 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
12913 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
12914 LDKChannelConfig this_ptr_conv;
12915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12916 this_ptr_conv.is_owned = false;
12917 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
12920 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
12921 LDKChannelConfig this_ptr_conv;
12922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12923 this_ptr_conv.is_owned = false;
12924 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
12928 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
12929 LDKChannelConfig this_ptr_conv;
12930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12931 this_ptr_conv.is_owned = false;
12932 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
12935 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
12936 LDKChannelConfig this_ptr_conv;
12937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12938 this_ptr_conv.is_owned = false;
12939 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
12943 void __attribute__((visibility("default"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
12944 LDKChannelConfig this_ptr_conv;
12945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12946 this_ptr_conv.is_owned = false;
12947 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
12950 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
12951 LDKChannelConfig this_ptr_conv;
12952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12953 this_ptr_conv.is_owned = false;
12954 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
12958 void __attribute__((visibility("default"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
12959 LDKChannelConfig this_ptr_conv;
12960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12961 this_ptr_conv.is_owned = false;
12962 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
12965 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) {
12966 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);
12967 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12968 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12969 uint64_t ret_ref = (uint64_t)ret_var.inner;
12970 if (ret_var.is_owned) {
12976 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
12977 LDKChannelConfig orig_conv;
12978 orig_conv.inner = (void*)(orig & (~1));
12979 orig_conv.is_owned = false;
12980 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
12981 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12982 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12983 uint64_t ret_ref = (uint64_t)ret_var.inner;
12984 if (ret_var.is_owned) {
12990 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
12991 LDKChannelConfig ret_var = ChannelConfig_default();
12992 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12993 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12994 uint64_t ret_ref = (uint64_t)ret_var.inner;
12995 if (ret_var.is_owned) {
13001 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
13002 LDKChannelConfig obj_conv;
13003 obj_conv.inner = (void*)(obj & (~1));
13004 obj_conv.is_owned = false;
13005 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
13006 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13007 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13008 CVec_u8Z_free(ret_var);
13012 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
13013 LDKu8slice ser_ref;
13014 ser_ref.datalen = *((uint32_t*)ser);
13015 ser_ref.data = (int8_t*)(ser + 4);
13016 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
13017 *ret_conv = ChannelConfig_read(ser_ref);
13018 return (uint64_t)ret_conv;
13021 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
13022 LDKUserConfig this_obj_conv;
13023 this_obj_conv.inner = (void*)(this_obj & (~1));
13024 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13025 UserConfig_free(this_obj_conv);
13028 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
13029 LDKUserConfig this_ptr_conv;
13030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13031 this_ptr_conv.is_owned = false;
13032 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
13033 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13034 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13035 uint64_t ret_ref = (uint64_t)ret_var.inner;
13036 if (ret_var.is_owned) {
13042 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
13043 LDKUserConfig this_ptr_conv;
13044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13045 this_ptr_conv.is_owned = false;
13046 LDKChannelHandshakeConfig val_conv;
13047 val_conv.inner = (void*)(val & (~1));
13048 val_conv.is_owned = (val & 1) || (val == 0);
13049 val_conv = ChannelHandshakeConfig_clone(&val_conv);
13050 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
13053 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
13054 LDKUserConfig this_ptr_conv;
13055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13056 this_ptr_conv.is_owned = false;
13057 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
13058 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13059 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13060 uint64_t ret_ref = (uint64_t)ret_var.inner;
13061 if (ret_var.is_owned) {
13067 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
13068 LDKUserConfig this_ptr_conv;
13069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13070 this_ptr_conv.is_owned = false;
13071 LDKChannelHandshakeLimits val_conv;
13072 val_conv.inner = (void*)(val & (~1));
13073 val_conv.is_owned = (val & 1) || (val == 0);
13074 val_conv = ChannelHandshakeLimits_clone(&val_conv);
13075 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
13078 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
13079 LDKUserConfig this_ptr_conv;
13080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13081 this_ptr_conv.is_owned = false;
13082 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
13083 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13084 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13085 uint64_t ret_ref = (uint64_t)ret_var.inner;
13086 if (ret_var.is_owned) {
13092 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
13093 LDKUserConfig this_ptr_conv;
13094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13095 this_ptr_conv.is_owned = false;
13096 LDKChannelConfig val_conv;
13097 val_conv.inner = (void*)(val & (~1));
13098 val_conv.is_owned = (val & 1) || (val == 0);
13099 val_conv = ChannelConfig_clone(&val_conv);
13100 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
13103 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
13104 LDKUserConfig this_ptr_conv;
13105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13106 this_ptr_conv.is_owned = false;
13107 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
13111 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
13112 LDKUserConfig this_ptr_conv;
13113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13114 this_ptr_conv.is_owned = false;
13115 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
13118 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) {
13119 LDKChannelHandshakeConfig own_channel_config_arg_conv;
13120 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
13121 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
13122 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
13123 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
13124 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
13125 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
13126 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
13127 LDKChannelConfig channel_options_arg_conv;
13128 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
13129 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
13130 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
13131 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);
13132 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13133 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13134 uint64_t ret_ref = (uint64_t)ret_var.inner;
13135 if (ret_var.is_owned) {
13141 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
13142 LDKUserConfig orig_conv;
13143 orig_conv.inner = (void*)(orig & (~1));
13144 orig_conv.is_owned = false;
13145 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
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_UserConfig_default() {
13156 LDKUserConfig ret_var = UserConfig_default();
13157 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13158 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13159 uint64_t ret_ref = (uint64_t)ret_var.inner;
13160 if (ret_var.is_owned) {
13166 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
13167 LDKBestBlock this_obj_conv;
13168 this_obj_conv.inner = (void*)(this_obj & (~1));
13169 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13170 BestBlock_free(this_obj_conv);
13173 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
13174 LDKBestBlock orig_conv;
13175 orig_conv.inner = (void*)(orig & (~1));
13176 orig_conv.is_owned = false;
13177 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
13178 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13179 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13180 uint64_t ret_ref = (uint64_t)ret_var.inner;
13181 if (ret_var.is_owned) {
13187 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
13188 LDKNetwork network_conv = LDKNetwork_from_js(network);
13189 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
13190 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13191 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13192 uint64_t ret_ref = (uint64_t)ret_var.inner;
13193 if (ret_var.is_owned) {
13199 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
13200 LDKThirtyTwoBytes block_hash_ref;
13201 CHECK(*((uint32_t*)block_hash) == 32);
13202 memcpy(block_hash_ref.data, (uint8_t*)(block_hash + 4), 32);
13203 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
13204 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13205 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13206 uint64_t ret_ref = (uint64_t)ret_var.inner;
13207 if (ret_var.is_owned) {
13213 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
13214 LDKBestBlock this_arg_conv;
13215 this_arg_conv.inner = (void*)(this_arg & (~1));
13216 this_arg_conv.is_owned = false;
13217 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13218 memcpy((uint8_t*)(ret_arr + 4), BestBlock_block_hash(&this_arg_conv).data, 32);
13222 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
13223 LDKBestBlock this_arg_conv;
13224 this_arg_conv.inner = (void*)(this_arg & (~1));
13225 this_arg_conv.is_owned = false;
13226 int32_t ret_val = BestBlock_height(&this_arg_conv);
13230 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
13231 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
13232 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
13236 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_chain() {
13237 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
13241 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_tx() {
13242 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
13246 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
13247 if ((this_ptr & 1) != 0) return;
13248 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
13249 FREE((void*)this_ptr);
13250 Access_free(this_ptr_conv);
13253 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
13254 if ((this_ptr & 1) != 0) return;
13255 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
13256 FREE((void*)this_ptr);
13257 Listen_free(this_ptr_conv);
13260 void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) {
13261 if ((this_ptr & 1) != 0) return;
13262 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
13263 FREE((void*)this_ptr);
13264 Confirm_free(this_ptr_conv);
13267 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
13268 if ((this_ptr & 1) != 0) return;
13269 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
13270 FREE((void*)this_ptr);
13271 Watch_free(this_ptr_conv);
13274 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
13275 if ((this_ptr & 1) != 0) return;
13276 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
13277 FREE((void*)this_ptr);
13278 Filter_free(this_ptr_conv);
13281 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
13282 LDKWatchedOutput this_obj_conv;
13283 this_obj_conv.inner = (void*)(this_obj & (~1));
13284 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13285 WatchedOutput_free(this_obj_conv);
13288 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
13289 LDKWatchedOutput this_ptr_conv;
13290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13291 this_ptr_conv.is_owned = false;
13292 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13293 memcpy((uint8_t*)(ret_arr + 4), WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
13297 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
13298 LDKWatchedOutput this_ptr_conv;
13299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13300 this_ptr_conv.is_owned = false;
13301 LDKThirtyTwoBytes val_ref;
13302 CHECK(*((uint32_t*)val) == 32);
13303 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13304 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
13307 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
13308 LDKWatchedOutput this_ptr_conv;
13309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13310 this_ptr_conv.is_owned = false;
13311 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
13312 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13313 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13314 uint64_t ret_ref = (uint64_t)ret_var.inner;
13315 if (ret_var.is_owned) {
13321 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
13322 LDKWatchedOutput this_ptr_conv;
13323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13324 this_ptr_conv.is_owned = false;
13325 LDKOutPoint val_conv;
13326 val_conv.inner = (void*)(val & (~1));
13327 val_conv.is_owned = (val & 1) || (val == 0);
13328 val_conv = OutPoint_clone(&val_conv);
13329 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
13332 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
13333 LDKWatchedOutput this_ptr_conv;
13334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13335 this_ptr_conv.is_owned = false;
13336 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
13337 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13338 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13342 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
13343 LDKWatchedOutput this_ptr_conv;
13344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13345 this_ptr_conv.is_owned = false;
13346 LDKCVec_u8Z val_ref;
13347 val_ref.datalen = *((uint32_t*)val);
13348 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13349 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
13350 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
13353 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
13354 LDKThirtyTwoBytes block_hash_arg_ref;
13355 CHECK(*((uint32_t*)block_hash_arg) == 32);
13356 memcpy(block_hash_arg_ref.data, (uint8_t*)(block_hash_arg + 4), 32);
13357 LDKOutPoint outpoint_arg_conv;
13358 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
13359 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
13360 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
13361 LDKCVec_u8Z script_pubkey_arg_ref;
13362 script_pubkey_arg_ref.datalen = *((uint32_t*)script_pubkey_arg);
13363 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13364 memcpy(script_pubkey_arg_ref.data, (uint8_t*)(script_pubkey_arg + 4), script_pubkey_arg_ref.datalen);
13365 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
13366 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13367 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13368 uint64_t ret_ref = (uint64_t)ret_var.inner;
13369 if (ret_var.is_owned) {
13375 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_clone(uint32_t orig) {
13376 LDKWatchedOutput orig_conv;
13377 orig_conv.inner = (void*)(orig & (~1));
13378 orig_conv.is_owned = false;
13379 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
13380 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13381 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13382 uint64_t ret_ref = (uint64_t)ret_var.inner;
13383 if (ret_var.is_owned) {
13389 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_hash(uint32_t o) {
13390 LDKWatchedOutput o_conv;
13391 o_conv.inner = (void*)(o & (~1));
13392 o_conv.is_owned = false;
13393 int64_t ret_val = WatchedOutput_hash(&o_conv);
13397 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
13398 if ((this_ptr & 1) != 0) return;
13399 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
13400 FREE((void*)this_ptr);
13401 BroadcasterInterface_free(this_ptr_conv);
13404 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
13405 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
13406 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
13410 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_background() {
13411 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
13415 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_normal() {
13416 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
13420 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_high_priority() {
13421 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
13425 jboolean __attribute__((visibility("default"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
13426 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
13427 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
13428 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
13432 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
13433 if ((this_ptr & 1) != 0) return;
13434 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
13435 FREE((void*)this_ptr);
13436 FeeEstimator_free(this_ptr_conv);
13439 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
13440 LDKChainMonitor this_obj_conv;
13441 this_obj_conv.inner = (void*)(this_obj & (~1));
13442 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13443 ChainMonitor_free(this_obj_conv);
13446 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
13447 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(((uint64_t)chain_source) & ~1);
13448 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
13449 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
13450 // Manually implement clone for Java trait instances
13452 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13453 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13454 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
13455 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
13456 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
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_tArray __attribute__((visibility("default"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
13467 LDKChainMonitor this_arg_conv;
13468 this_arg_conv.inner = (void*)(this_arg & (~1));
13469 this_arg_conv.is_owned = false;
13470 LDKCVec_ChannelDetailsZ ignored_channels_constr;
13471 ignored_channels_constr.datalen = *((uint32_t*)ignored_channels);
13472 if (ignored_channels_constr.datalen > 0)
13473 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13475 ignored_channels_constr.data = NULL;
13476 uint32_t* ignored_channels_vals = (uint32_t*)(ignored_channels + 4);
13477 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
13478 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
13479 LDKChannelDetails ignored_channels_conv_16_conv;
13480 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
13481 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
13482 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
13483 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
13485 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
13486 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13487 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13488 for (size_t j = 0; j < ret_var.datalen; j++) {
13489 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13490 *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
13491 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
13492 ret_arr_ptr[j] = ret_conv_9_ref;
13494 FREE(ret_var.data);
13498 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
13499 LDKChainMonitor this_arg_conv;
13500 this_arg_conv.inner = (void*)(this_arg & (~1));
13501 this_arg_conv.is_owned = false;
13502 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
13503 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
13504 return (uint64_t)ret_ret;
13507 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
13508 LDKChainMonitor this_arg_conv;
13509 this_arg_conv.inner = (void*)(this_arg & (~1));
13510 this_arg_conv.is_owned = false;
13511 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
13512 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
13513 return (uint64_t)ret_ret;
13516 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
13517 LDKChainMonitor this_arg_conv;
13518 this_arg_conv.inner = (void*)(this_arg & (~1));
13519 this_arg_conv.is_owned = false;
13520 LDKWatch* ret_ret =MALLOC(sizeof(LDKWatch), "LDKWatch");
13521 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
13522 return (uint64_t)ret_ret;
13525 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
13526 LDKChainMonitor this_arg_conv;
13527 this_arg_conv.inner = (void*)(this_arg & (~1));
13528 this_arg_conv.is_owned = false;
13529 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
13530 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
13531 return (uint64_t)ret_ret;
13534 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
13535 LDKChannelMonitorUpdate this_obj_conv;
13536 this_obj_conv.inner = (void*)(this_obj & (~1));
13537 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13538 ChannelMonitorUpdate_free(this_obj_conv);
13541 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
13542 LDKChannelMonitorUpdate this_ptr_conv;
13543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13544 this_ptr_conv.is_owned = false;
13545 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
13549 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
13550 LDKChannelMonitorUpdate this_ptr_conv;
13551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13552 this_ptr_conv.is_owned = false;
13553 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
13556 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
13557 LDKChannelMonitorUpdate orig_conv;
13558 orig_conv.inner = (void*)(orig & (~1));
13559 orig_conv.is_owned = false;
13560 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
13561 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13562 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13563 uint64_t ret_ref = (uint64_t)ret_var.inner;
13564 if (ret_var.is_owned) {
13570 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
13571 LDKChannelMonitorUpdate obj_conv;
13572 obj_conv.inner = (void*)(obj & (~1));
13573 obj_conv.is_owned = false;
13574 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
13575 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13576 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13577 CVec_u8Z_free(ret_var);
13581 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
13582 LDKu8slice ser_ref;
13583 ser_ref.datalen = *((uint32_t*)ser);
13584 ser_ref.data = (int8_t*)(ser + 4);
13585 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
13586 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
13587 return (uint64_t)ret_conv;
13590 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
13591 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
13592 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
13596 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
13597 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
13601 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
13602 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
13606 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) {
13607 LDKMonitorUpdateError this_obj_conv;
13608 this_obj_conv.inner = (void*)(this_obj & (~1));
13609 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13610 MonitorUpdateError_free(this_obj_conv);
13613 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
13614 LDKMonitorUpdateError orig_conv;
13615 orig_conv.inner = (void*)(orig & (~1));
13616 orig_conv.is_owned = false;
13617 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
13618 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13619 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13620 uint64_t ret_ref = (uint64_t)ret_var.inner;
13621 if (ret_var.is_owned) {
13627 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
13628 if ((this_ptr & 1) != 0) return;
13629 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
13630 FREE((void*)this_ptr);
13631 MonitorEvent_free(this_ptr_conv);
13634 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
13635 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
13636 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
13637 *ret_copy = MonitorEvent_clone(orig_conv);
13638 uint64_t ret_ref = (uint64_t)ret_copy;
13642 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_htlcevent(uint32_t a) {
13643 LDKHTLCUpdate a_conv;
13644 a_conv.inner = (void*)(a & (~1));
13645 a_conv.is_owned = (a & 1) || (a == 0);
13646 a_conv = HTLCUpdate_clone(&a_conv);
13647 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
13648 *ret_copy = MonitorEvent_htlcevent(a_conv);
13649 uint64_t ret_ref = (uint64_t)ret_copy;
13653 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
13654 LDKOutPoint a_conv;
13655 a_conv.inner = (void*)(a & (~1));
13656 a_conv.is_owned = (a & 1) || (a == 0);
13657 a_conv = OutPoint_clone(&a_conv);
13658 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
13659 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
13660 uint64_t ret_ref = (uint64_t)ret_copy;
13664 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
13665 LDKHTLCUpdate this_obj_conv;
13666 this_obj_conv.inner = (void*)(this_obj & (~1));
13667 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13668 HTLCUpdate_free(this_obj_conv);
13671 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
13672 LDKHTLCUpdate orig_conv;
13673 orig_conv.inner = (void*)(orig & (~1));
13674 orig_conv.is_owned = false;
13675 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
13676 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13677 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13678 uint64_t ret_ref = (uint64_t)ret_var.inner;
13679 if (ret_var.is_owned) {
13685 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
13686 LDKHTLCUpdate obj_conv;
13687 obj_conv.inner = (void*)(obj & (~1));
13688 obj_conv.is_owned = false;
13689 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
13690 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13691 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13692 CVec_u8Z_free(ret_var);
13696 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
13697 LDKu8slice ser_ref;
13698 ser_ref.datalen = *((uint32_t*)ser);
13699 ser_ref.data = (int8_t*)(ser + 4);
13700 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13701 *ret_conv = HTLCUpdate_read(ser_ref);
13702 return (uint64_t)ret_conv;
13705 void __attribute__((visibility("default"))) TS_Balance_free(uint32_t this_ptr) {
13706 if ((this_ptr & 1) != 0) return;
13707 LDKBalance this_ptr_conv = *(LDKBalance*)(((uint64_t)this_ptr) & ~1);
13708 FREE((void*)this_ptr);
13709 Balance_free(this_ptr_conv);
13712 uint32_t __attribute__((visibility("default"))) TS_Balance_clone(uint32_t orig) {
13713 LDKBalance* orig_conv = (LDKBalance*)orig;
13714 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13715 *ret_copy = Balance_clone(orig_conv);
13716 uint64_t ret_ref = (uint64_t)ret_copy;
13720 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
13721 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13722 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
13723 uint64_t ret_ref = (uint64_t)ret_copy;
13727 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
13728 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13729 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
13730 uint64_t ret_ref = (uint64_t)ret_copy;
13734 uint32_t __attribute__((visibility("default"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
13735 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13736 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
13737 uint64_t ret_ref = (uint64_t)ret_copy;
13741 uint32_t __attribute__((visibility("default"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
13742 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13743 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
13744 uint64_t ret_ref = (uint64_t)ret_copy;
13748 jboolean __attribute__((visibility("default"))) TS_Balance_eq(uint32_t a, uint32_t b) {
13749 LDKBalance* a_conv = (LDKBalance*)a;
13750 LDKBalance* b_conv = (LDKBalance*)b;
13751 jboolean ret_val = Balance_eq(a_conv, b_conv);
13755 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
13756 LDKChannelMonitor this_obj_conv;
13757 this_obj_conv.inner = (void*)(this_obj & (~1));
13758 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13759 ChannelMonitor_free(this_obj_conv);
13762 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
13763 LDKChannelMonitor orig_conv;
13764 orig_conv.inner = (void*)(orig & (~1));
13765 orig_conv.is_owned = false;
13766 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
13767 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13768 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13769 uint64_t ret_ref = (uint64_t)ret_var.inner;
13770 if (ret_var.is_owned) {
13776 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
13777 LDKChannelMonitor obj_conv;
13778 obj_conv.inner = (void*)(obj & (~1));
13779 obj_conv.is_owned = false;
13780 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
13781 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13782 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13783 CVec_u8Z_free(ret_var);
13787 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) {
13788 LDKChannelMonitor this_arg_conv;
13789 this_arg_conv.inner = (void*)(this_arg & (~1));
13790 this_arg_conv.is_owned = false;
13791 LDKChannelMonitorUpdate updates_conv;
13792 updates_conv.inner = (void*)(updates & (~1));
13793 updates_conv.is_owned = false;
13794 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13795 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13796 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
13797 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
13798 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
13799 return (uint64_t)ret_conv;
13802 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
13803 LDKChannelMonitor this_arg_conv;
13804 this_arg_conv.inner = (void*)(this_arg & (~1));
13805 this_arg_conv.is_owned = false;
13806 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
13810 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
13811 LDKChannelMonitor this_arg_conv;
13812 this_arg_conv.inner = (void*)(this_arg & (~1));
13813 this_arg_conv.is_owned = false;
13814 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
13815 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
13816 return ((uint64_t)ret_conv);
13819 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
13820 LDKChannelMonitor this_arg_conv;
13821 this_arg_conv.inner = (void*)(this_arg & (~1));
13822 this_arg_conv.is_owned = false;
13823 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
13824 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13825 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13826 for (size_t o = 0; o < ret_var.datalen; o++) {
13827 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
13828 *ret_conv_40_conv = ret_var.data[o];
13829 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
13831 FREE(ret_var.data);
13835 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
13836 LDKChannelMonitor this_arg_conv;
13837 this_arg_conv.inner = (void*)(this_arg & (~1));
13838 this_arg_conv.is_owned = false;
13839 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
13840 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
13843 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
13844 LDKChannelMonitor this_arg_conv;
13845 this_arg_conv.inner = (void*)(this_arg & (~1));
13846 this_arg_conv.is_owned = false;
13847 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
13848 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13849 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13850 for (size_t o = 0; o < ret_var.datalen; o++) {
13851 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
13852 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
13853 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
13854 ret_arr_ptr[o] = ret_conv_14_ref;
13856 FREE(ret_var.data);
13860 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
13861 LDKChannelMonitor this_arg_conv;
13862 this_arg_conv.inner = (void*)(this_arg & (~1));
13863 this_arg_conv.is_owned = false;
13864 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
13865 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13866 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13867 for (size_t h = 0; h < ret_var.datalen; h++) {
13868 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13869 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
13870 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
13871 ret_arr_ptr[h] = ret_conv_7_ref;
13873 FREE(ret_var.data);
13877 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
13878 LDKChannelMonitor this_arg_conv;
13879 this_arg_conv.inner = (void*)(this_arg & (~1));
13880 this_arg_conv.is_owned = false;
13881 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
13882 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
13883 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
13884 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
13885 for (size_t m = 0; m < ret_var.datalen; m++) {
13886 LDKTransaction ret_conv_12_var = ret_var.data[m];
13887 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13888 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
13889 Transaction_free(ret_conv_12_var);
13890 ret_arr_ptr[m] = ret_conv_12_arr;
13892 FREE(ret_var.data);
13896 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) {
13897 LDKChannelMonitor this_arg_conv;
13898 this_arg_conv.inner = (void*)(this_arg & (~1));
13899 this_arg_conv.is_owned = false;
13900 unsigned char header_arr[80];
13901 CHECK(*((uint32_t*)header) == 80);
13902 memcpy(header_arr, (uint8_t*)(header + 4), 80);
13903 unsigned char (*header_ref)[80] = &header_arr;
13904 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
13905 txdata_constr.datalen = *((uint32_t*)txdata);
13906 if (txdata_constr.datalen > 0)
13907 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13909 txdata_constr.data = NULL;
13910 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
13911 for (size_t c = 0; c < txdata_constr.datalen; c++) {
13912 uint32_t txdata_conv_28 = txdata_vals[c];
13913 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1);
13914 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
13915 txdata_constr.data[c] = txdata_conv_28_conv;
13917 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13918 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13919 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13920 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);
13921 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13922 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13923 for (size_t n = 0; n < ret_var.datalen; n++) {
13924 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
13925 *ret_conv_39_conv = ret_var.data[n];
13926 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
13928 FREE(ret_var.data);
13932 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) {
13933 LDKChannelMonitor this_arg_conv;
13934 this_arg_conv.inner = (void*)(this_arg & (~1));
13935 this_arg_conv.is_owned = false;
13936 unsigned char header_arr[80];
13937 CHECK(*((uint32_t*)header) == 80);
13938 memcpy(header_arr, (uint8_t*)(header + 4), 80);
13939 unsigned char (*header_ref)[80] = &header_arr;
13940 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13941 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13942 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13943 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
13946 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) {
13947 LDKChannelMonitor this_arg_conv;
13948 this_arg_conv.inner = (void*)(this_arg & (~1));
13949 this_arg_conv.is_owned = false;
13950 unsigned char header_arr[80];
13951 CHECK(*((uint32_t*)header) == 80);
13952 memcpy(header_arr, (uint8_t*)(header + 4), 80);
13953 unsigned char (*header_ref)[80] = &header_arr;
13954 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
13955 txdata_constr.datalen = *((uint32_t*)txdata);
13956 if (txdata_constr.datalen > 0)
13957 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13959 txdata_constr.data = NULL;
13960 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
13961 for (size_t c = 0; c < txdata_constr.datalen; c++) {
13962 uint32_t txdata_conv_28 = txdata_vals[c];
13963 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1);
13964 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
13965 txdata_constr.data[c] = txdata_conv_28_conv;
13967 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13968 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13969 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13970 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);
13971 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13972 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13973 for (size_t n = 0; n < ret_var.datalen; n++) {
13974 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
13975 *ret_conv_39_conv = ret_var.data[n];
13976 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
13978 FREE(ret_var.data);
13982 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) {
13983 LDKChannelMonitor this_arg_conv;
13984 this_arg_conv.inner = (void*)(this_arg & (~1));
13985 this_arg_conv.is_owned = false;
13986 unsigned char txid_arr[32];
13987 CHECK(*((uint32_t*)txid) == 32);
13988 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
13989 unsigned char (*txid_ref)[32] = &txid_arr;
13990 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13991 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13992 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13993 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
13996 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) {
13997 LDKChannelMonitor this_arg_conv;
13998 this_arg_conv.inner = (void*)(this_arg & (~1));
13999 this_arg_conv.is_owned = false;
14000 unsigned char header_arr[80];
14001 CHECK(*((uint32_t*)header) == 80);
14002 memcpy(header_arr, (uint8_t*)(header + 4), 80);
14003 unsigned char (*header_ref)[80] = &header_arr;
14004 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14005 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14006 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14007 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14008 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14009 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14010 for (size_t n = 0; n < ret_var.datalen; n++) {
14011 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14012 *ret_conv_39_conv = ret_var.data[n];
14013 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
14015 FREE(ret_var.data);
14019 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
14020 LDKChannelMonitor this_arg_conv;
14021 this_arg_conv.inner = (void*)(this_arg & (~1));
14022 this_arg_conv.is_owned = false;
14023 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
14024 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
14025 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
14026 for (size_t m = 0; m < ret_var.datalen; m++) {
14027 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14028 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
14029 ret_arr_ptr[m] = ret_conv_12_arr;
14031 FREE(ret_var.data);
14035 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
14036 LDKChannelMonitor this_arg_conv;
14037 this_arg_conv.inner = (void*)(this_arg & (~1));
14038 this_arg_conv.is_owned = false;
14039 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
14040 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14041 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14042 uint64_t ret_ref = (uint64_t)ret_var.inner;
14043 if (ret_var.is_owned) {
14049 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
14050 LDKChannelMonitor this_arg_conv;
14051 this_arg_conv.inner = (void*)(this_arg & (~1));
14052 this_arg_conv.is_owned = false;
14053 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
14054 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14055 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14056 for (size_t j = 0; j < ret_var.datalen; j++) {
14057 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14058 *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
14059 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
14060 ret_arr_ptr[j] = ret_conv_9_ref;
14062 FREE(ret_var.data);
14066 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
14067 if ((this_ptr & 1) != 0) return;
14068 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
14069 FREE((void*)this_ptr);
14070 Persist_free(this_ptr_conv);
14073 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
14074 LDKu8slice ser_ref;
14075 ser_ref.datalen = *((uint32_t*)ser);
14076 ser_ref.data = (int8_t*)(ser + 4);
14077 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
14078 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
14079 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
14080 return (uint64_t)ret_conv;
14083 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
14084 LDKOutPoint this_obj_conv;
14085 this_obj_conv.inner = (void*)(this_obj & (~1));
14086 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14087 OutPoint_free(this_obj_conv);
14090 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
14091 LDKOutPoint this_ptr_conv;
14092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14093 this_ptr_conv.is_owned = false;
14094 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14095 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
14099 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
14100 LDKOutPoint this_ptr_conv;
14101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14102 this_ptr_conv.is_owned = false;
14103 LDKThirtyTwoBytes val_ref;
14104 CHECK(*((uint32_t*)val) == 32);
14105 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14106 OutPoint_set_txid(&this_ptr_conv, val_ref);
14109 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
14110 LDKOutPoint this_ptr_conv;
14111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14112 this_ptr_conv.is_owned = false;
14113 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
14117 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
14118 LDKOutPoint this_ptr_conv;
14119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14120 this_ptr_conv.is_owned = false;
14121 OutPoint_set_index(&this_ptr_conv, val);
14124 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
14125 LDKThirtyTwoBytes txid_arg_ref;
14126 CHECK(*((uint32_t*)txid_arg) == 32);
14127 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
14128 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
14129 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14130 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14131 uint64_t ret_ref = (uint64_t)ret_var.inner;
14132 if (ret_var.is_owned) {
14138 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
14139 LDKOutPoint orig_conv;
14140 orig_conv.inner = (void*)(orig & (~1));
14141 orig_conv.is_owned = false;
14142 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
14143 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14144 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14145 uint64_t ret_ref = (uint64_t)ret_var.inner;
14146 if (ret_var.is_owned) {
14152 jboolean __attribute__((visibility("default"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
14153 LDKOutPoint a_conv;
14154 a_conv.inner = (void*)(a & (~1));
14155 a_conv.is_owned = false;
14156 LDKOutPoint b_conv;
14157 b_conv.inner = (void*)(b & (~1));
14158 b_conv.is_owned = false;
14159 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
14163 int64_t __attribute__((visibility("default"))) TS_OutPoint_hash(uint32_t o) {
14164 LDKOutPoint o_conv;
14165 o_conv.inner = (void*)(o & (~1));
14166 o_conv.is_owned = false;
14167 int64_t ret_val = OutPoint_hash(&o_conv);
14171 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
14172 LDKOutPoint this_arg_conv;
14173 this_arg_conv.inner = (void*)(this_arg & (~1));
14174 this_arg_conv.is_owned = false;
14175 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14176 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
14180 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
14181 LDKOutPoint obj_conv;
14182 obj_conv.inner = (void*)(obj & (~1));
14183 obj_conv.is_owned = false;
14184 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
14185 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14186 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14187 CVec_u8Z_free(ret_var);
14191 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
14192 LDKu8slice ser_ref;
14193 ser_ref.datalen = *((uint32_t*)ser);
14194 ser_ref.data = (int8_t*)(ser + 4);
14195 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14196 *ret_conv = OutPoint_read(ser_ref);
14197 return (uint64_t)ret_conv;
14200 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
14201 LDKDelayedPaymentOutputDescriptor this_obj_conv;
14202 this_obj_conv.inner = (void*)(this_obj & (~1));
14203 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14204 DelayedPaymentOutputDescriptor_free(this_obj_conv);
14207 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
14208 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14210 this_ptr_conv.is_owned = false;
14211 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14212 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14213 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14214 uint64_t ret_ref = (uint64_t)ret_var.inner;
14215 if (ret_var.is_owned) {
14221 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
14222 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14224 this_ptr_conv.is_owned = false;
14225 LDKOutPoint val_conv;
14226 val_conv.inner = (void*)(val & (~1));
14227 val_conv.is_owned = (val & 1) || (val == 0);
14228 val_conv = OutPoint_clone(&val_conv);
14229 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14232 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
14233 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14235 this_ptr_conv.is_owned = false;
14236 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14237 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
14241 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
14242 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14244 this_ptr_conv.is_owned = false;
14245 LDKPublicKey val_ref;
14246 CHECK(*((uint32_t*)val) == 33);
14247 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14248 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
14251 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
14252 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14254 this_ptr_conv.is_owned = false;
14255 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
14259 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
14260 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14262 this_ptr_conv.is_owned = false;
14263 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
14266 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
14267 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14269 this_ptr_conv.is_owned = false;
14270 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14271 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
14272 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14275 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
14276 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14278 this_ptr_conv.is_owned = false;
14279 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14280 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
14284 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
14285 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14287 this_ptr_conv.is_owned = false;
14288 LDKPublicKey val_ref;
14289 CHECK(*((uint32_t*)val) == 33);
14290 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14291 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
14294 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
14295 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14297 this_ptr_conv.is_owned = false;
14298 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14299 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
14303 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
14304 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14306 this_ptr_conv.is_owned = false;
14307 LDKThirtyTwoBytes val_ref;
14308 CHECK(*((uint32_t*)val) == 32);
14309 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14310 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14313 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
14314 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14316 this_ptr_conv.is_owned = false;
14317 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14321 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
14322 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14324 this_ptr_conv.is_owned = false;
14325 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14328 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) {
14329 LDKOutPoint outpoint_arg_conv;
14330 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14331 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14332 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14333 LDKPublicKey per_commitment_point_arg_ref;
14334 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
14335 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
14336 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14337 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
14338 LDKPublicKey revocation_pubkey_arg_ref;
14339 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
14340 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
14341 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14342 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
14343 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
14344 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);
14345 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14346 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14347 uint64_t ret_ref = (uint64_t)ret_var.inner;
14348 if (ret_var.is_owned) {
14354 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
14355 LDKDelayedPaymentOutputDescriptor orig_conv;
14356 orig_conv.inner = (void*)(orig & (~1));
14357 orig_conv.is_owned = false;
14358 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
14359 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14360 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14361 uint64_t ret_ref = (uint64_t)ret_var.inner;
14362 if (ret_var.is_owned) {
14368 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
14369 LDKDelayedPaymentOutputDescriptor obj_conv;
14370 obj_conv.inner = (void*)(obj & (~1));
14371 obj_conv.is_owned = false;
14372 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
14373 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14374 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14375 CVec_u8Z_free(ret_var);
14379 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
14380 LDKu8slice ser_ref;
14381 ser_ref.datalen = *((uint32_t*)ser);
14382 ser_ref.data = (int8_t*)(ser + 4);
14383 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14384 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
14385 return (uint64_t)ret_conv;
14388 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
14389 LDKStaticPaymentOutputDescriptor this_obj_conv;
14390 this_obj_conv.inner = (void*)(this_obj & (~1));
14391 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14392 StaticPaymentOutputDescriptor_free(this_obj_conv);
14395 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
14396 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14398 this_ptr_conv.is_owned = false;
14399 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14400 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14401 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14402 uint64_t ret_ref = (uint64_t)ret_var.inner;
14403 if (ret_var.is_owned) {
14409 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
14410 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14412 this_ptr_conv.is_owned = false;
14413 LDKOutPoint val_conv;
14414 val_conv.inner = (void*)(val & (~1));
14415 val_conv.is_owned = (val & 1) || (val == 0);
14416 val_conv = OutPoint_clone(&val_conv);
14417 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14420 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
14421 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14423 this_ptr_conv.is_owned = false;
14424 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14425 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
14426 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14429 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
14430 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14432 this_ptr_conv.is_owned = false;
14433 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14434 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
14438 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
14439 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14441 this_ptr_conv.is_owned = false;
14442 LDKThirtyTwoBytes val_ref;
14443 CHECK(*((uint32_t*)val) == 32);
14444 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14445 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14448 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
14449 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14451 this_ptr_conv.is_owned = false;
14452 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14456 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
14457 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14459 this_ptr_conv.is_owned = false;
14460 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14463 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) {
14464 LDKOutPoint outpoint_arg_conv;
14465 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14466 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14467 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14468 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14469 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
14470 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14471 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
14472 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
14473 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
14474 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14475 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14476 uint64_t ret_ref = (uint64_t)ret_var.inner;
14477 if (ret_var.is_owned) {
14483 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
14484 LDKStaticPaymentOutputDescriptor orig_conv;
14485 orig_conv.inner = (void*)(orig & (~1));
14486 orig_conv.is_owned = false;
14487 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
14488 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14489 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14490 uint64_t ret_ref = (uint64_t)ret_var.inner;
14491 if (ret_var.is_owned) {
14497 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
14498 LDKStaticPaymentOutputDescriptor obj_conv;
14499 obj_conv.inner = (void*)(obj & (~1));
14500 obj_conv.is_owned = false;
14501 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
14502 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14503 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14504 CVec_u8Z_free(ret_var);
14508 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
14509 LDKu8slice ser_ref;
14510 ser_ref.datalen = *((uint32_t*)ser);
14511 ser_ref.data = (int8_t*)(ser + 4);
14512 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14513 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
14514 return (uint64_t)ret_conv;
14517 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
14518 if ((this_ptr & 1) != 0) return;
14519 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
14520 FREE((void*)this_ptr);
14521 SpendableOutputDescriptor_free(this_ptr_conv);
14524 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
14525 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
14526 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14527 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
14528 uint64_t ret_ref = (uint64_t)ret_copy;
14532 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
14533 LDKOutPoint outpoint_conv;
14534 outpoint_conv.inner = (void*)(outpoint & (~1));
14535 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
14536 outpoint_conv = OutPoint_clone(&outpoint_conv);
14537 LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
14538 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
14539 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14540 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
14541 uint64_t ret_ref = (uint64_t)ret_copy;
14545 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
14546 LDKDelayedPaymentOutputDescriptor a_conv;
14547 a_conv.inner = (void*)(a & (~1));
14548 a_conv.is_owned = (a & 1) || (a == 0);
14549 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
14550 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14551 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
14552 uint64_t ret_ref = (uint64_t)ret_copy;
14556 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
14557 LDKStaticPaymentOutputDescriptor a_conv;
14558 a_conv.inner = (void*)(a & (~1));
14559 a_conv.is_owned = (a & 1) || (a == 0);
14560 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
14561 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14562 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
14563 uint64_t ret_ref = (uint64_t)ret_copy;
14567 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
14568 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
14569 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
14570 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14571 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14572 CVec_u8Z_free(ret_var);
14576 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
14577 LDKu8slice ser_ref;
14578 ser_ref.datalen = *((uint32_t*)ser);
14579 ser_ref.data = (int8_t*)(ser + 4);
14580 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14581 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
14582 return (uint64_t)ret_conv;
14585 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
14586 if ((this_ptr & 1) != 0) return;
14587 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
14588 FREE((void*)this_ptr);
14589 BaseSign_free(this_ptr_conv);
14592 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
14593 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
14594 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
14595 *ret_ret = Sign_clone(orig_conv);
14596 return (uint64_t)ret_ret;
14599 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
14600 if ((this_ptr & 1) != 0) return;
14601 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
14602 FREE((void*)this_ptr);
14603 Sign_free(this_ptr_conv);
14606 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
14607 if ((this_ptr & 1) != 0) return;
14608 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
14609 FREE((void*)this_ptr);
14610 KeysInterface_free(this_ptr_conv);
14613 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
14614 LDKInMemorySigner this_obj_conv;
14615 this_obj_conv.inner = (void*)(this_obj & (~1));
14616 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14617 InMemorySigner_free(this_obj_conv);
14620 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
14621 LDKInMemorySigner this_ptr_conv;
14622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14623 this_ptr_conv.is_owned = false;
14624 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14625 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
14629 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
14630 LDKInMemorySigner this_ptr_conv;
14631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14632 this_ptr_conv.is_owned = false;
14633 LDKSecretKey val_ref;
14634 CHECK(*((uint32_t*)val) == 32);
14635 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
14636 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
14639 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
14640 LDKInMemorySigner this_ptr_conv;
14641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14642 this_ptr_conv.is_owned = false;
14643 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14644 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
14648 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
14649 LDKInMemorySigner this_ptr_conv;
14650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14651 this_ptr_conv.is_owned = false;
14652 LDKSecretKey val_ref;
14653 CHECK(*((uint32_t*)val) == 32);
14654 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
14655 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
14658 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
14659 LDKInMemorySigner this_ptr_conv;
14660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14661 this_ptr_conv.is_owned = false;
14662 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14663 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
14667 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
14668 LDKInMemorySigner this_ptr_conv;
14669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14670 this_ptr_conv.is_owned = false;
14671 LDKSecretKey val_ref;
14672 CHECK(*((uint32_t*)val) == 32);
14673 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
14674 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
14677 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
14678 LDKInMemorySigner this_ptr_conv;
14679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14680 this_ptr_conv.is_owned = false;
14681 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14682 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
14686 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
14687 LDKInMemorySigner this_ptr_conv;
14688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14689 this_ptr_conv.is_owned = false;
14690 LDKSecretKey val_ref;
14691 CHECK(*((uint32_t*)val) == 32);
14692 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
14693 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
14696 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
14697 LDKInMemorySigner this_ptr_conv;
14698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14699 this_ptr_conv.is_owned = false;
14700 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14701 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
14705 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
14706 LDKInMemorySigner this_ptr_conv;
14707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14708 this_ptr_conv.is_owned = false;
14709 LDKSecretKey val_ref;
14710 CHECK(*((uint32_t*)val) == 32);
14711 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
14712 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
14715 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
14716 LDKInMemorySigner this_ptr_conv;
14717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14718 this_ptr_conv.is_owned = false;
14719 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14720 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
14724 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
14725 LDKInMemorySigner this_ptr_conv;
14726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14727 this_ptr_conv.is_owned = false;
14728 LDKThirtyTwoBytes val_ref;
14729 CHECK(*((uint32_t*)val) == 32);
14730 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14731 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
14734 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
14735 LDKInMemorySigner orig_conv;
14736 orig_conv.inner = (void*)(orig & (~1));
14737 orig_conv.is_owned = false;
14738 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
14739 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14740 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14741 uint64_t ret_ref = (uint64_t)ret_var.inner;
14742 if (ret_var.is_owned) {
14748 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) {
14749 LDKSecretKey funding_key_ref;
14750 CHECK(*((uint32_t*)funding_key) == 32);
14751 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
14752 LDKSecretKey revocation_base_key_ref;
14753 CHECK(*((uint32_t*)revocation_base_key) == 32);
14754 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
14755 LDKSecretKey payment_key_ref;
14756 CHECK(*((uint32_t*)payment_key) == 32);
14757 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
14758 LDKSecretKey delayed_payment_base_key_ref;
14759 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
14760 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
14761 LDKSecretKey htlc_base_key_ref;
14762 CHECK(*((uint32_t*)htlc_base_key) == 32);
14763 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
14764 LDKThirtyTwoBytes commitment_seed_ref;
14765 CHECK(*((uint32_t*)commitment_seed) == 32);
14766 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
14767 LDKThirtyTwoBytes channel_keys_id_ref;
14768 CHECK(*((uint32_t*)channel_keys_id) == 32);
14769 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
14770 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);
14771 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14772 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14773 uint64_t ret_ref = (uint64_t)ret_var.inner;
14774 if (ret_var.is_owned) {
14780 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
14781 LDKInMemorySigner this_arg_conv;
14782 this_arg_conv.inner = (void*)(this_arg & (~1));
14783 this_arg_conv.is_owned = false;
14784 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
14785 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14786 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14787 uint64_t ret_ref = (uint64_t)ret_var.inner;
14788 if (ret_var.is_owned) {
14794 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
14795 LDKInMemorySigner this_arg_conv;
14796 this_arg_conv.inner = (void*)(this_arg & (~1));
14797 this_arg_conv.is_owned = false;
14798 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
14802 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
14803 LDKInMemorySigner this_arg_conv;
14804 this_arg_conv.inner = (void*)(this_arg & (~1));
14805 this_arg_conv.is_owned = false;
14806 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
14810 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
14811 LDKInMemorySigner this_arg_conv;
14812 this_arg_conv.inner = (void*)(this_arg & (~1));
14813 this_arg_conv.is_owned = false;
14814 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
14818 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
14819 LDKInMemorySigner this_arg_conv;
14820 this_arg_conv.inner = (void*)(this_arg & (~1));
14821 this_arg_conv.is_owned = false;
14822 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
14823 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14824 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14825 uint64_t ret_ref = (uint64_t)ret_var.inner;
14826 if (ret_var.is_owned) {
14832 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
14833 LDKInMemorySigner this_arg_conv;
14834 this_arg_conv.inner = (void*)(this_arg & (~1));
14835 this_arg_conv.is_owned = false;
14836 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
14837 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14838 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14839 uint64_t ret_ref = (uint64_t)ret_var.inner;
14840 if (ret_var.is_owned) {
14846 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) {
14847 LDKInMemorySigner this_arg_conv;
14848 this_arg_conv.inner = (void*)(this_arg & (~1));
14849 this_arg_conv.is_owned = false;
14850 LDKTransaction spend_tx_ref;
14851 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
14852 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
14853 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
14854 spend_tx_ref.data_is_owned = true;
14855 LDKStaticPaymentOutputDescriptor descriptor_conv;
14856 descriptor_conv.inner = (void*)(descriptor & (~1));
14857 descriptor_conv.is_owned = false;
14858 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14859 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
14860 return (uint64_t)ret_conv;
14863 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) {
14864 LDKInMemorySigner this_arg_conv;
14865 this_arg_conv.inner = (void*)(this_arg & (~1));
14866 this_arg_conv.is_owned = false;
14867 LDKTransaction spend_tx_ref;
14868 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
14869 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
14870 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
14871 spend_tx_ref.data_is_owned = true;
14872 LDKDelayedPaymentOutputDescriptor descriptor_conv;
14873 descriptor_conv.inner = (void*)(descriptor & (~1));
14874 descriptor_conv.is_owned = false;
14875 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14876 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
14877 return (uint64_t)ret_conv;
14880 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
14881 LDKInMemorySigner this_arg_conv;
14882 this_arg_conv.inner = (void*)(this_arg & (~1));
14883 this_arg_conv.is_owned = false;
14884 LDKBaseSign* ret_ret =MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
14885 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
14886 return (uint64_t)ret_ret;
14889 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
14890 LDKInMemorySigner this_arg_conv;
14891 this_arg_conv.inner = (void*)(this_arg & (~1));
14892 this_arg_conv.is_owned = false;
14893 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
14894 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
14895 return (uint64_t)ret_ret;
14898 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
14899 LDKInMemorySigner obj_conv;
14900 obj_conv.inner = (void*)(obj & (~1));
14901 obj_conv.is_owned = false;
14902 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
14903 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14904 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14905 CVec_u8Z_free(ret_var);
14909 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
14910 LDKu8slice ser_ref;
14911 ser_ref.datalen = *((uint32_t*)ser);
14912 ser_ref.data = (int8_t*)(ser + 4);
14913 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14914 *ret_conv = InMemorySigner_read(ser_ref);
14915 return (uint64_t)ret_conv;
14918 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
14919 LDKKeysManager this_obj_conv;
14920 this_obj_conv.inner = (void*)(this_obj & (~1));
14921 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14922 KeysManager_free(this_obj_conv);
14925 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
14926 unsigned char seed_arr[32];
14927 CHECK(*((uint32_t*)seed) == 32);
14928 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
14929 unsigned char (*seed_ref)[32] = &seed_arr;
14930 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
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 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
14941 LDKKeysManager this_arg_conv;
14942 this_arg_conv.inner = (void*)(this_arg & (~1));
14943 this_arg_conv.is_owned = false;
14944 unsigned char params_arr[32];
14945 CHECK(*((uint32_t*)params) == 32);
14946 memcpy(params_arr, (uint8_t*)(params + 4), 32);
14947 unsigned char (*params_ref)[32] = ¶ms_arr;
14948 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
14949 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14950 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14951 uint64_t ret_ref = (uint64_t)ret_var.inner;
14952 if (ret_var.is_owned) {
14958 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) {
14959 LDKKeysManager this_arg_conv;
14960 this_arg_conv.inner = (void*)(this_arg & (~1));
14961 this_arg_conv.is_owned = false;
14962 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
14963 descriptors_constr.datalen = *((uint32_t*)descriptors);
14964 if (descriptors_constr.datalen > 0)
14965 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
14967 descriptors_constr.data = NULL;
14968 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
14969 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
14970 uint32_t descriptors_conv_27 = descriptors_vals[b];
14971 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
14972 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
14973 descriptors_constr.data[b] = descriptors_conv_27_conv;
14975 LDKCVec_TxOutZ outputs_constr;
14976 outputs_constr.datalen = *((uint32_t*)outputs);
14977 if (outputs_constr.datalen > 0)
14978 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
14980 outputs_constr.data = NULL;
14981 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
14982 for (size_t h = 0; h < outputs_constr.datalen; h++) {
14983 uint32_t outputs_conv_7 = outputs_vals[h];
14984 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
14985 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
14986 outputs_constr.data[h] = outputs_conv_7_conv;
14988 LDKCVec_u8Z change_destination_script_ref;
14989 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
14990 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
14991 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
14992 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14993 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
14994 return (uint64_t)ret_conv;
14997 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
14998 LDKKeysManager this_arg_conv;
14999 this_arg_conv.inner = (void*)(this_arg & (~1));
15000 this_arg_conv.is_owned = false;
15001 LDKKeysInterface* ret_ret =MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
15002 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
15003 return (uint64_t)ret_ret;
15006 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
15007 LDKChannelManager this_obj_conv;
15008 this_obj_conv.inner = (void*)(this_obj & (~1));
15009 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15010 ChannelManager_free(this_obj_conv);
15013 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
15014 LDKChainParameters this_obj_conv;
15015 this_obj_conv.inner = (void*)(this_obj & (~1));
15016 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15017 ChainParameters_free(this_obj_conv);
15020 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
15021 LDKChainParameters this_ptr_conv;
15022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15023 this_ptr_conv.is_owned = false;
15024 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
15028 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
15029 LDKChainParameters this_ptr_conv;
15030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15031 this_ptr_conv.is_owned = false;
15032 LDKNetwork val_conv = LDKNetwork_from_js(val);
15033 ChainParameters_set_network(&this_ptr_conv, val_conv);
15036 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
15037 LDKChainParameters this_ptr_conv;
15038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15039 this_ptr_conv.is_owned = false;
15040 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
15041 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15042 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15043 uint64_t ret_ref = (uint64_t)ret_var.inner;
15044 if (ret_var.is_owned) {
15050 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
15051 LDKChainParameters this_ptr_conv;
15052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15053 this_ptr_conv.is_owned = false;
15054 LDKBestBlock val_conv;
15055 val_conv.inner = (void*)(val & (~1));
15056 val_conv.is_owned = (val & 1) || (val == 0);
15057 val_conv = BestBlock_clone(&val_conv);
15058 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
15061 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
15062 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
15063 LDKBestBlock best_block_arg_conv;
15064 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
15065 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
15066 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
15067 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
15068 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15069 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15070 uint64_t ret_ref = (uint64_t)ret_var.inner;
15071 if (ret_var.is_owned) {
15077 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_clone(uint32_t orig) {
15078 LDKChainParameters orig_conv;
15079 orig_conv.inner = (void*)(orig & (~1));
15080 orig_conv.is_owned = false;
15081 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
15082 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15083 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15084 uint64_t ret_ref = (uint64_t)ret_var.inner;
15085 if (ret_var.is_owned) {
15091 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
15092 LDKCounterpartyForwardingInfo this_obj_conv;
15093 this_obj_conv.inner = (void*)(this_obj & (~1));
15094 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15095 CounterpartyForwardingInfo_free(this_obj_conv);
15098 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
15099 LDKCounterpartyForwardingInfo this_ptr_conv;
15100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15101 this_ptr_conv.is_owned = false;
15102 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
15106 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
15107 LDKCounterpartyForwardingInfo this_ptr_conv;
15108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15109 this_ptr_conv.is_owned = false;
15110 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
15113 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
15114 LDKCounterpartyForwardingInfo this_ptr_conv;
15115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15116 this_ptr_conv.is_owned = false;
15117 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
15121 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
15122 LDKCounterpartyForwardingInfo this_ptr_conv;
15123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15124 this_ptr_conv.is_owned = false;
15125 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
15128 int16_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
15129 LDKCounterpartyForwardingInfo this_ptr_conv;
15130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15131 this_ptr_conv.is_owned = false;
15132 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
15136 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
15137 LDKCounterpartyForwardingInfo this_ptr_conv;
15138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15139 this_ptr_conv.is_owned = false;
15140 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
15143 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) {
15144 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
15145 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15146 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15147 uint64_t ret_ref = (uint64_t)ret_var.inner;
15148 if (ret_var.is_owned) {
15154 uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
15155 LDKCounterpartyForwardingInfo orig_conv;
15156 orig_conv.inner = (void*)(orig & (~1));
15157 orig_conv.is_owned = false;
15158 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
15159 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15160 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15161 uint64_t ret_ref = (uint64_t)ret_var.inner;
15162 if (ret_var.is_owned) {
15168 void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
15169 LDKChannelCounterparty this_obj_conv;
15170 this_obj_conv.inner = (void*)(this_obj & (~1));
15171 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15172 ChannelCounterparty_free(this_obj_conv);
15175 int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
15176 LDKChannelCounterparty this_ptr_conv;
15177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15178 this_ptr_conv.is_owned = false;
15179 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15180 memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
15184 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
15185 LDKChannelCounterparty this_ptr_conv;
15186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15187 this_ptr_conv.is_owned = false;
15188 LDKPublicKey val_ref;
15189 CHECK(*((uint32_t*)val) == 33);
15190 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15191 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
15194 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
15195 LDKChannelCounterparty this_ptr_conv;
15196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15197 this_ptr_conv.is_owned = false;
15198 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
15199 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15200 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15201 uint64_t ret_ref = (uint64_t)ret_var.inner;
15202 if (ret_var.is_owned) {
15208 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
15209 LDKChannelCounterparty this_ptr_conv;
15210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15211 this_ptr_conv.is_owned = false;
15212 LDKInitFeatures val_conv;
15213 val_conv.inner = (void*)(val & (~1));
15214 val_conv.is_owned = (val & 1) || (val == 0);
15215 val_conv = InitFeatures_clone(&val_conv);
15216 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
15219 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
15220 LDKChannelCounterparty this_ptr_conv;
15221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15222 this_ptr_conv.is_owned = false;
15223 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
15227 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
15228 LDKChannelCounterparty this_ptr_conv;
15229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15230 this_ptr_conv.is_owned = false;
15231 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
15234 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
15235 LDKChannelCounterparty this_ptr_conv;
15236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15237 this_ptr_conv.is_owned = false;
15238 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
15239 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15240 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15241 uint64_t ret_ref = (uint64_t)ret_var.inner;
15242 if (ret_var.is_owned) {
15248 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
15249 LDKChannelCounterparty this_ptr_conv;
15250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15251 this_ptr_conv.is_owned = false;
15252 LDKCounterpartyForwardingInfo val_conv;
15253 val_conv.inner = (void*)(val & (~1));
15254 val_conv.is_owned = (val & 1) || (val == 0);
15255 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
15256 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
15259 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) {
15260 LDKPublicKey node_id_arg_ref;
15261 CHECK(*((uint32_t*)node_id_arg) == 33);
15262 memcpy(node_id_arg_ref.compressed_form, (uint8_t*)(node_id_arg + 4), 33);
15263 LDKInitFeatures features_arg_conv;
15264 features_arg_conv.inner = (void*)(features_arg & (~1));
15265 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
15266 features_arg_conv = InitFeatures_clone(&features_arg_conv);
15267 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
15268 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
15269 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
15270 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
15271 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
15272 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15273 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15274 uint64_t ret_ref = (uint64_t)ret_var.inner;
15275 if (ret_var.is_owned) {
15281 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
15282 LDKChannelCounterparty orig_conv;
15283 orig_conv.inner = (void*)(orig & (~1));
15284 orig_conv.is_owned = false;
15285 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
15286 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15287 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15288 uint64_t ret_ref = (uint64_t)ret_var.inner;
15289 if (ret_var.is_owned) {
15295 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
15296 LDKChannelDetails this_obj_conv;
15297 this_obj_conv.inner = (void*)(this_obj & (~1));
15298 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15299 ChannelDetails_free(this_obj_conv);
15302 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
15303 LDKChannelDetails this_ptr_conv;
15304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15305 this_ptr_conv.is_owned = false;
15306 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15307 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
15311 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
15312 LDKChannelDetails this_ptr_conv;
15313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15314 this_ptr_conv.is_owned = false;
15315 LDKThirtyTwoBytes val_ref;
15316 CHECK(*((uint32_t*)val) == 32);
15317 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15318 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
15321 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
15322 LDKChannelDetails this_ptr_conv;
15323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15324 this_ptr_conv.is_owned = false;
15325 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
15326 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15327 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15328 uint64_t ret_ref = (uint64_t)ret_var.inner;
15329 if (ret_var.is_owned) {
15335 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
15336 LDKChannelDetails this_ptr_conv;
15337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15338 this_ptr_conv.is_owned = false;
15339 LDKChannelCounterparty val_conv;
15340 val_conv.inner = (void*)(val & (~1));
15341 val_conv.is_owned = (val & 1) || (val == 0);
15342 val_conv = ChannelCounterparty_clone(&val_conv);
15343 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
15346 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
15347 LDKChannelDetails this_ptr_conv;
15348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15349 this_ptr_conv.is_owned = false;
15350 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
15351 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15352 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15353 uint64_t ret_ref = (uint64_t)ret_var.inner;
15354 if (ret_var.is_owned) {
15360 void __attribute__((visibility("default"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
15361 LDKChannelDetails this_ptr_conv;
15362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15363 this_ptr_conv.is_owned = false;
15364 LDKOutPoint val_conv;
15365 val_conv.inner = (void*)(val & (~1));
15366 val_conv.is_owned = (val & 1) || (val == 0);
15367 val_conv = OutPoint_clone(&val_conv);
15368 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
15371 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
15372 LDKChannelDetails this_ptr_conv;
15373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15374 this_ptr_conv.is_owned = false;
15375 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15376 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
15377 uint64_t ret_ref = (uint64_t)ret_copy;
15381 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
15382 LDKChannelDetails this_ptr_conv;
15383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15384 this_ptr_conv.is_owned = false;
15385 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
15386 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
15387 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
15390 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
15391 LDKChannelDetails this_ptr_conv;
15392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15393 this_ptr_conv.is_owned = false;
15394 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
15398 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
15399 LDKChannelDetails this_ptr_conv;
15400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15401 this_ptr_conv.is_owned = false;
15402 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
15405 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
15406 LDKChannelDetails this_ptr_conv;
15407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15408 this_ptr_conv.is_owned = false;
15409 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15410 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
15411 uint64_t ret_ref = (uint64_t)ret_copy;
15415 void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
15416 LDKChannelDetails this_ptr_conv;
15417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15418 this_ptr_conv.is_owned = false;
15419 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
15420 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
15421 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
15424 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_id(uint32_t this_ptr) {
15425 LDKChannelDetails this_ptr_conv;
15426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15427 this_ptr_conv.is_owned = false;
15428 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
15432 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_id(uint32_t this_ptr, int64_t val) {
15433 LDKChannelDetails this_ptr_conv;
15434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15435 this_ptr_conv.is_owned = false;
15436 ChannelDetails_set_user_id(&this_ptr_conv, val);
15439 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
15440 LDKChannelDetails this_ptr_conv;
15441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15442 this_ptr_conv.is_owned = false;
15443 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
15447 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
15448 LDKChannelDetails this_ptr_conv;
15449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15450 this_ptr_conv.is_owned = false;
15451 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
15454 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
15455 LDKChannelDetails this_ptr_conv;
15456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15457 this_ptr_conv.is_owned = false;
15458 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
15462 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
15463 LDKChannelDetails this_ptr_conv;
15464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15465 this_ptr_conv.is_owned = false;
15466 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
15469 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
15470 LDKChannelDetails this_ptr_conv;
15471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15472 this_ptr_conv.is_owned = false;
15473 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15474 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
15475 uint64_t ret_ref = (uint64_t)ret_copy;
15479 void __attribute__((visibility("default"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
15480 LDKChannelDetails this_ptr_conv;
15481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15482 this_ptr_conv.is_owned = false;
15483 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
15484 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
15485 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
15488 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
15489 LDKChannelDetails this_ptr_conv;
15490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15491 this_ptr_conv.is_owned = false;
15492 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15493 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
15494 uint64_t ret_ref = (uint64_t)ret_copy;
15498 void __attribute__((visibility("default"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
15499 LDKChannelDetails this_ptr_conv;
15500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15501 this_ptr_conv.is_owned = false;
15502 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
15503 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
15504 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
15507 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
15508 LDKChannelDetails this_ptr_conv;
15509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15510 this_ptr_conv.is_owned = false;
15511 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
15515 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
15516 LDKChannelDetails this_ptr_conv;
15517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15518 this_ptr_conv.is_owned = false;
15519 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
15522 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
15523 LDKChannelDetails this_ptr_conv;
15524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15525 this_ptr_conv.is_owned = false;
15526 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
15530 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
15531 LDKChannelDetails this_ptr_conv;
15532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15533 this_ptr_conv.is_owned = false;
15534 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
15537 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
15538 LDKChannelDetails this_ptr_conv;
15539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15540 this_ptr_conv.is_owned = false;
15541 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
15545 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
15546 LDKChannelDetails this_ptr_conv;
15547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15548 this_ptr_conv.is_owned = false;
15549 ChannelDetails_set_is_usable(&this_ptr_conv, val);
15552 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
15553 LDKChannelDetails this_ptr_conv;
15554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15555 this_ptr_conv.is_owned = false;
15556 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
15560 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
15561 LDKChannelDetails this_ptr_conv;
15562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15563 this_ptr_conv.is_owned = false;
15564 ChannelDetails_set_is_public(&this_ptr_conv, val);
15567 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint32_t counterparty_arg, uint32_t funding_txo_arg, uint32_t short_channel_id_arg, int64_t channel_value_satoshis_arg, uint32_t unspendable_punishment_reserve_arg, int64_t user_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, uint32_t confirmations_required_arg, uint32_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
15568 LDKThirtyTwoBytes channel_id_arg_ref;
15569 CHECK(*((uint32_t*)channel_id_arg) == 32);
15570 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
15571 LDKChannelCounterparty counterparty_arg_conv;
15572 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
15573 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
15574 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
15575 LDKOutPoint funding_txo_arg_conv;
15576 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
15577 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
15578 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
15579 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
15580 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
15581 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
15582 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
15583 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
15584 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
15585 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
15586 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
15587 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15588 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15589 uint64_t ret_ref = (uint64_t)ret_var.inner;
15590 if (ret_var.is_owned) {
15596 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
15597 LDKChannelDetails orig_conv;
15598 orig_conv.inner = (void*)(orig & (~1));
15599 orig_conv.is_owned = false;
15600 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
15601 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15602 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15603 uint64_t ret_ref = (uint64_t)ret_var.inner;
15604 if (ret_var.is_owned) {
15610 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
15611 if ((this_ptr & 1) != 0) return;
15612 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
15613 FREE((void*)this_ptr);
15614 PaymentSendFailure_free(this_ptr_conv);
15617 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
15618 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
15619 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15620 *ret_copy = PaymentSendFailure_clone(orig_conv);
15621 uint64_t ret_ref = (uint64_t)ret_copy;
15625 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
15626 LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
15627 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
15628 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15629 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
15630 uint64_t ret_ref = (uint64_t)ret_copy;
15634 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
15635 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
15636 a_constr.datalen = *((uint32_t*)a);
15637 if (a_constr.datalen > 0)
15638 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15640 a_constr.data = NULL;
15641 uint32_t* a_vals = (uint32_t*)(a + 4);
15642 for (size_t w = 0; w < a_constr.datalen; w++) {
15643 uint32_t a_conv_22 = a_vals[w];
15644 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
15645 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
15646 a_constr.data[w] = a_conv_22_conv;
15648 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15649 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
15650 uint64_t ret_ref = (uint64_t)ret_copy;
15654 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
15655 LDKCVec_APIErrorZ a_constr;
15656 a_constr.datalen = *((uint32_t*)a);
15657 if (a_constr.datalen > 0)
15658 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15660 a_constr.data = NULL;
15661 uint32_t* a_vals = (uint32_t*)(a + 4);
15662 for (size_t k = 0; k < a_constr.datalen; k++) {
15663 uint32_t a_conv_10 = a_vals[k];
15664 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(((uint64_t)a_conv_10) & ~1);
15665 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
15666 a_constr.data[k] = a_conv_10_conv;
15668 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15669 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
15670 uint64_t ret_ref = (uint64_t)ret_copy;
15674 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_partial_failure(uint32_tArray a) {
15675 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
15676 a_constr.datalen = *((uint32_t*)a);
15677 if (a_constr.datalen > 0)
15678 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15680 a_constr.data = NULL;
15681 uint32_t* a_vals = (uint32_t*)(a + 4);
15682 for (size_t w = 0; w < a_constr.datalen; w++) {
15683 uint32_t a_conv_22 = a_vals[w];
15684 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
15685 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
15686 a_constr.data[w] = a_conv_22_conv;
15688 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15689 *ret_copy = PaymentSendFailure_partial_failure(a_constr);
15690 uint64_t ret_ref = (uint64_t)ret_copy;
15694 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) {
15695 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
15696 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
15697 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
15698 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15699 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
15700 LDKUserConfig config_conv;
15701 config_conv.inner = (void*)(config & (~1));
15702 config_conv.is_owned = (config & 1) || (config == 0);
15703 config_conv = UserConfig_clone(&config_conv);
15704 LDKChainParameters params_conv;
15705 params_conv.inner = (void*)(params & (~1));
15706 params_conv.is_owned = (params & 1) || (params == 0);
15707 params_conv = ChainParameters_clone(¶ms_conv);
15708 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
15709 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15710 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15711 uint64_t ret_ref = (uint64_t)ret_var.inner;
15712 if (ret_var.is_owned) {
15718 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
15719 LDKChannelManager this_arg_conv;
15720 this_arg_conv.inner = (void*)(this_arg & (~1));
15721 this_arg_conv.is_owned = false;
15722 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
15723 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15724 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15725 uint64_t ret_ref = (uint64_t)ret_var.inner;
15726 if (ret_var.is_owned) {
15732 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_channel(uint32_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_id, uint32_t override_config) {
15733 LDKChannelManager this_arg_conv;
15734 this_arg_conv.inner = (void*)(this_arg & (~1));
15735 this_arg_conv.is_owned = false;
15736 LDKPublicKey their_network_key_ref;
15737 CHECK(*((uint32_t*)their_network_key) == 33);
15738 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
15739 LDKUserConfig override_config_conv;
15740 override_config_conv.inner = (void*)(override_config & (~1));
15741 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
15742 override_config_conv = UserConfig_clone(&override_config_conv);
15743 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15744 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
15745 return (uint64_t)ret_conv;
15748 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
15749 LDKChannelManager this_arg_conv;
15750 this_arg_conv.inner = (void*)(this_arg & (~1));
15751 this_arg_conv.is_owned = false;
15752 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
15753 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
15754 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
15755 for (size_t q = 0; q < ret_var.datalen; q++) {
15756 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
15757 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15758 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15759 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
15760 if (ret_conv_16_var.is_owned) {
15761 ret_conv_16_ref |= 1;
15763 ret_arr_ptr[q] = ret_conv_16_ref;
15765 FREE(ret_var.data);
15769 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
15770 LDKChannelManager this_arg_conv;
15771 this_arg_conv.inner = (void*)(this_arg & (~1));
15772 this_arg_conv.is_owned = false;
15773 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
15774 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
15775 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
15776 for (size_t q = 0; q < ret_var.datalen; q++) {
15777 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
15778 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15779 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15780 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
15781 if (ret_conv_16_var.is_owned) {
15782 ret_conv_16_ref |= 1;
15784 ret_arr_ptr[q] = ret_conv_16_ref;
15786 FREE(ret_var.data);
15790 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
15791 LDKChannelManager this_arg_conv;
15792 this_arg_conv.inner = (void*)(this_arg & (~1));
15793 this_arg_conv.is_owned = false;
15794 unsigned char channel_id_arr[32];
15795 CHECK(*((uint32_t*)channel_id) == 32);
15796 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
15797 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15798 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15799 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
15800 return (uint64_t)ret_conv;
15803 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) {
15804 LDKChannelManager this_arg_conv;
15805 this_arg_conv.inner = (void*)(this_arg & (~1));
15806 this_arg_conv.is_owned = false;
15807 unsigned char channel_id_arr[32];
15808 CHECK(*((uint32_t*)channel_id) == 32);
15809 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
15810 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15811 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15812 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
15813 return (uint64_t)ret_conv;
15816 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
15817 LDKChannelManager this_arg_conv;
15818 this_arg_conv.inner = (void*)(this_arg & (~1));
15819 this_arg_conv.is_owned = false;
15820 unsigned char channel_id_arr[32];
15821 CHECK(*((uint32_t*)channel_id) == 32);
15822 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
15823 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15824 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15825 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
15826 return (uint64_t)ret_conv;
15829 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
15830 LDKChannelManager this_arg_conv;
15831 this_arg_conv.inner = (void*)(this_arg & (~1));
15832 this_arg_conv.is_owned = false;
15833 ChannelManager_force_close_all_channels(&this_arg_conv);
15836 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
15837 LDKChannelManager this_arg_conv;
15838 this_arg_conv.inner = (void*)(this_arg & (~1));
15839 this_arg_conv.is_owned = false;
15840 LDKRoute route_conv;
15841 route_conv.inner = (void*)(route & (~1));
15842 route_conv.is_owned = false;
15843 LDKThirtyTwoBytes payment_hash_ref;
15844 CHECK(*((uint32_t*)payment_hash) == 32);
15845 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
15846 LDKThirtyTwoBytes payment_secret_ref;
15847 CHECK(*((uint32_t*)payment_secret) == 32);
15848 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
15849 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15850 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
15851 return (uint64_t)ret_conv;
15854 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
15855 LDKChannelManager this_arg_conv;
15856 this_arg_conv.inner = (void*)(this_arg & (~1));
15857 this_arg_conv.is_owned = false;
15858 LDKRoute route_conv;
15859 route_conv.inner = (void*)(route & (~1));
15860 route_conv.is_owned = false;
15861 LDKThirtyTwoBytes payment_preimage_ref;
15862 CHECK(*((uint32_t*)payment_preimage) == 32);
15863 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
15864 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
15865 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
15866 return (uint64_t)ret_conv;
15869 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
15870 LDKChannelManager this_arg_conv;
15871 this_arg_conv.inner = (void*)(this_arg & (~1));
15872 this_arg_conv.is_owned = false;
15873 unsigned char temporary_channel_id_arr[32];
15874 CHECK(*((uint32_t*)temporary_channel_id) == 32);
15875 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
15876 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
15877 LDKTransaction funding_transaction_ref;
15878 funding_transaction_ref.datalen = *((uint32_t*)funding_transaction);
15879 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
15880 memcpy(funding_transaction_ref.data, (uint8_t*)(funding_transaction + 4), funding_transaction_ref.datalen);
15881 funding_transaction_ref.data_is_owned = true;
15882 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15883 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
15884 return (uint64_t)ret_conv;
15887 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
15888 LDKChannelManager this_arg_conv;
15889 this_arg_conv.inner = (void*)(this_arg & (~1));
15890 this_arg_conv.is_owned = false;
15891 LDKThreeBytes rgb_ref;
15892 CHECK(*((uint32_t*)rgb) == 3);
15893 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
15894 LDKThirtyTwoBytes alias_ref;
15895 CHECK(*((uint32_t*)alias) == 32);
15896 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
15897 LDKCVec_NetAddressZ addresses_constr;
15898 addresses_constr.datalen = *((uint32_t*)addresses);
15899 if (addresses_constr.datalen > 0)
15900 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15902 addresses_constr.data = NULL;
15903 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
15904 for (size_t m = 0; m < addresses_constr.datalen; m++) {
15905 uint32_t addresses_conv_12 = addresses_vals[m];
15906 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
15907 addresses_constr.data[m] = addresses_conv_12_conv;
15909 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
15912 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
15913 LDKChannelManager this_arg_conv;
15914 this_arg_conv.inner = (void*)(this_arg & (~1));
15915 this_arg_conv.is_owned = false;
15916 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
15919 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
15920 LDKChannelManager this_arg_conv;
15921 this_arg_conv.inner = (void*)(this_arg & (~1));
15922 this_arg_conv.is_owned = false;
15923 ChannelManager_timer_tick_occurred(&this_arg_conv);
15926 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
15927 LDKChannelManager this_arg_conv;
15928 this_arg_conv.inner = (void*)(this_arg & (~1));
15929 this_arg_conv.is_owned = false;
15930 unsigned char payment_hash_arr[32];
15931 CHECK(*((uint32_t*)payment_hash) == 32);
15932 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
15933 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
15934 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
15938 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
15939 LDKChannelManager this_arg_conv;
15940 this_arg_conv.inner = (void*)(this_arg & (~1));
15941 this_arg_conv.is_owned = false;
15942 LDKThirtyTwoBytes payment_preimage_ref;
15943 CHECK(*((uint32_t*)payment_preimage) == 32);
15944 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
15945 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
15949 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
15950 LDKChannelManager this_arg_conv;
15951 this_arg_conv.inner = (void*)(this_arg & (~1));
15952 this_arg_conv.is_owned = false;
15953 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15954 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
15958 void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
15959 LDKChannelManager this_arg_conv;
15960 this_arg_conv.inner = (void*)(this_arg & (~1));
15961 this_arg_conv.is_owned = false;
15962 LDKOutPoint funding_txo_conv;
15963 funding_txo_conv.inner = (void*)(funding_txo & (~1));
15964 funding_txo_conv.is_owned = false;
15965 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
15968 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) {
15969 LDKChannelManager this_arg_conv;
15970 this_arg_conv.inner = (void*)(this_arg & (~1));
15971 this_arg_conv.is_owned = false;
15972 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
15973 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
15974 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15975 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
15976 return ((uint64_t)ret_conv);
15979 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) {
15980 LDKChannelManager this_arg_conv;
15981 this_arg_conv.inner = (void*)(this_arg & (~1));
15982 this_arg_conv.is_owned = false;
15983 LDKThirtyTwoBytes payment_hash_ref;
15984 CHECK(*((uint32_t*)payment_hash) == 32);
15985 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
15986 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
15987 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
15988 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15989 *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);
15990 return (uint64_t)ret_conv;
15993 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
15994 LDKChannelManager this_arg_conv;
15995 this_arg_conv.inner = (void*)(this_arg & (~1));
15996 this_arg_conv.is_owned = false;
15997 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
15998 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
15999 return (uint64_t)ret_ret;
16002 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
16003 LDKChannelManager this_arg_conv;
16004 this_arg_conv.inner = (void*)(this_arg & (~1));
16005 this_arg_conv.is_owned = false;
16006 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
16007 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
16008 return (uint64_t)ret_ret;
16011 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
16012 LDKChannelManager this_arg_conv;
16013 this_arg_conv.inner = (void*)(this_arg & (~1));
16014 this_arg_conv.is_owned = false;
16015 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
16016 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
16017 return (uint64_t)ret_ret;
16020 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
16021 LDKChannelManager this_arg_conv;
16022 this_arg_conv.inner = (void*)(this_arg & (~1));
16023 this_arg_conv.is_owned = false;
16024 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
16025 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
16026 return (uint64_t)ret_ret;
16029 jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
16030 LDKChannelManager this_arg_conv;
16031 this_arg_conv.inner = (void*)(this_arg & (~1));
16032 this_arg_conv.is_owned = false;
16033 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
16037 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
16038 LDKChannelManager this_arg_conv;
16039 this_arg_conv.inner = (void*)(this_arg & (~1));
16040 this_arg_conv.is_owned = false;
16041 ChannelManager_await_persistable_update(&this_arg_conv);
16044 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
16045 LDKChannelManager this_arg_conv;
16046 this_arg_conv.inner = (void*)(this_arg & (~1));
16047 this_arg_conv.is_owned = false;
16048 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
16049 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16050 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16051 uint64_t ret_ref = (uint64_t)ret_var.inner;
16052 if (ret_var.is_owned) {
16058 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
16059 LDKChannelManager this_arg_conv;
16060 this_arg_conv.inner = (void*)(this_arg & (~1));
16061 this_arg_conv.is_owned = false;
16062 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
16063 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
16064 return (uint64_t)ret_ret;
16067 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
16068 LDKChannelManager obj_conv;
16069 obj_conv.inner = (void*)(obj & (~1));
16070 obj_conv.is_owned = false;
16071 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
16072 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16073 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16074 CVec_u8Z_free(ret_var);
16078 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
16079 LDKChannelManagerReadArgs this_obj_conv;
16080 this_obj_conv.inner = (void*)(this_obj & (~1));
16081 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16082 ChannelManagerReadArgs_free(this_obj_conv);
16085 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
16086 LDKChannelManagerReadArgs this_ptr_conv;
16087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16088 this_ptr_conv.is_owned = false;
16089 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
16093 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
16094 LDKChannelManagerReadArgs this_ptr_conv;
16095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16096 this_ptr_conv.is_owned = false;
16097 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
16098 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
16101 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
16102 LDKChannelManagerReadArgs this_ptr_conv;
16103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16104 this_ptr_conv.is_owned = false;
16105 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
16109 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
16110 LDKChannelManagerReadArgs this_ptr_conv;
16111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16112 this_ptr_conv.is_owned = false;
16113 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
16114 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
16117 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
16118 LDKChannelManagerReadArgs this_ptr_conv;
16119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16120 this_ptr_conv.is_owned = false;
16121 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
16125 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
16126 LDKChannelManagerReadArgs this_ptr_conv;
16127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16128 this_ptr_conv.is_owned = false;
16129 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
16130 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
16133 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
16134 LDKChannelManagerReadArgs this_ptr_conv;
16135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16136 this_ptr_conv.is_owned = false;
16137 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
16141 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
16142 LDKChannelManagerReadArgs this_ptr_conv;
16143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16144 this_ptr_conv.is_owned = false;
16145 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
16146 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
16149 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
16150 LDKChannelManagerReadArgs this_ptr_conv;
16151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16152 this_ptr_conv.is_owned = false;
16153 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
16157 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
16158 LDKChannelManagerReadArgs this_ptr_conv;
16159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16160 this_ptr_conv.is_owned = false;
16161 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
16162 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
16165 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
16166 LDKChannelManagerReadArgs this_ptr_conv;
16167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16168 this_ptr_conv.is_owned = false;
16169 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
16170 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16171 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16172 uint64_t ret_ref = (uint64_t)ret_var.inner;
16173 if (ret_var.is_owned) {
16179 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
16180 LDKChannelManagerReadArgs this_ptr_conv;
16181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16182 this_ptr_conv.is_owned = false;
16183 LDKUserConfig val_conv;
16184 val_conv.inner = (void*)(val & (~1));
16185 val_conv.is_owned = (val & 1) || (val == 0);
16186 val_conv = UserConfig_clone(&val_conv);
16187 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
16190 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) {
16191 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
16192 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16193 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
16194 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
16195 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16196 LDKUserConfig default_config_conv;
16197 default_config_conv.inner = (void*)(default_config & (~1));
16198 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
16199 default_config_conv = UserConfig_clone(&default_config_conv);
16200 LDKCVec_ChannelMonitorZ channel_monitors_constr;
16201 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
16202 if (channel_monitors_constr.datalen > 0)
16203 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16205 channel_monitors_constr.data = NULL;
16206 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
16207 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
16208 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
16209 LDKChannelMonitor channel_monitors_conv_16_conv;
16210 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
16211 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
16212 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
16214 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);
16215 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16216 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16217 uint64_t ret_ref = (uint64_t)ret_var.inner;
16218 if (ret_var.is_owned) {
16224 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
16225 LDKu8slice ser_ref;
16226 ser_ref.datalen = *((uint32_t*)ser);
16227 ser_ref.data = (int8_t*)(ser + 4);
16228 LDKChannelManagerReadArgs arg_conv;
16229 arg_conv.inner = (void*)(arg & (~1));
16230 arg_conv.is_owned = (arg & 1) || (arg == 0);
16231 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
16232 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16233 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
16234 return (uint64_t)ret_conv;
16237 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
16238 LDKDecodeError this_obj_conv;
16239 this_obj_conv.inner = (void*)(this_obj & (~1));
16240 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16241 DecodeError_free(this_obj_conv);
16244 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
16245 LDKDecodeError orig_conv;
16246 orig_conv.inner = (void*)(orig & (~1));
16247 orig_conv.is_owned = false;
16248 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
16249 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16250 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16251 uint64_t ret_ref = (uint64_t)ret_var.inner;
16252 if (ret_var.is_owned) {
16258 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
16259 LDKInit this_obj_conv;
16260 this_obj_conv.inner = (void*)(this_obj & (~1));
16261 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16262 Init_free(this_obj_conv);
16265 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
16266 LDKInit this_ptr_conv;
16267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16268 this_ptr_conv.is_owned = false;
16269 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
16270 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16271 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16272 uint64_t ret_ref = (uint64_t)ret_var.inner;
16273 if (ret_var.is_owned) {
16279 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
16280 LDKInit this_ptr_conv;
16281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16282 this_ptr_conv.is_owned = false;
16283 LDKInitFeatures val_conv;
16284 val_conv.inner = (void*)(val & (~1));
16285 val_conv.is_owned = (val & 1) || (val == 0);
16286 val_conv = InitFeatures_clone(&val_conv);
16287 Init_set_features(&this_ptr_conv, val_conv);
16290 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
16291 LDKInitFeatures features_arg_conv;
16292 features_arg_conv.inner = (void*)(features_arg & (~1));
16293 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16294 features_arg_conv = InitFeatures_clone(&features_arg_conv);
16295 LDKInit ret_var = Init_new(features_arg_conv);
16296 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16297 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16298 uint64_t ret_ref = (uint64_t)ret_var.inner;
16299 if (ret_var.is_owned) {
16305 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
16307 orig_conv.inner = (void*)(orig & (~1));
16308 orig_conv.is_owned = false;
16309 LDKInit ret_var = Init_clone(&orig_conv);
16310 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16311 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16312 uint64_t ret_ref = (uint64_t)ret_var.inner;
16313 if (ret_var.is_owned) {
16319 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
16320 LDKErrorMessage this_obj_conv;
16321 this_obj_conv.inner = (void*)(this_obj & (~1));
16322 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16323 ErrorMessage_free(this_obj_conv);
16326 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
16327 LDKErrorMessage this_ptr_conv;
16328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16329 this_ptr_conv.is_owned = false;
16330 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16331 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
16335 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16336 LDKErrorMessage this_ptr_conv;
16337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16338 this_ptr_conv.is_owned = false;
16339 LDKThirtyTwoBytes val_ref;
16340 CHECK(*((uint32_t*)val) == 32);
16341 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16342 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
16345 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
16346 LDKErrorMessage this_ptr_conv;
16347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16348 this_ptr_conv.is_owned = false;
16349 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
16350 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16355 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
16356 LDKErrorMessage this_ptr_conv;
16357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16358 this_ptr_conv.is_owned = false;
16359 LDKStr val_conv = str_ref_to_owned_c(val);
16360 ErrorMessage_set_data(&this_ptr_conv, val_conv);
16363 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
16364 LDKThirtyTwoBytes channel_id_arg_ref;
16365 CHECK(*((uint32_t*)channel_id_arg) == 32);
16366 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16367 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
16368 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
16369 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16370 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16371 uint64_t ret_ref = (uint64_t)ret_var.inner;
16372 if (ret_var.is_owned) {
16378 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
16379 LDKErrorMessage orig_conv;
16380 orig_conv.inner = (void*)(orig & (~1));
16381 orig_conv.is_owned = false;
16382 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
16383 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16384 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16385 uint64_t ret_ref = (uint64_t)ret_var.inner;
16386 if (ret_var.is_owned) {
16392 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
16393 LDKPing this_obj_conv;
16394 this_obj_conv.inner = (void*)(this_obj & (~1));
16395 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16396 Ping_free(this_obj_conv);
16399 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
16400 LDKPing this_ptr_conv;
16401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16402 this_ptr_conv.is_owned = false;
16403 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
16407 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
16408 LDKPing this_ptr_conv;
16409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16410 this_ptr_conv.is_owned = false;
16411 Ping_set_ponglen(&this_ptr_conv, val);
16414 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
16415 LDKPing this_ptr_conv;
16416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16417 this_ptr_conv.is_owned = false;
16418 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
16422 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
16423 LDKPing this_ptr_conv;
16424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16425 this_ptr_conv.is_owned = false;
16426 Ping_set_byteslen(&this_ptr_conv, val);
16429 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
16430 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
16431 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16432 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16433 uint64_t ret_ref = (uint64_t)ret_var.inner;
16434 if (ret_var.is_owned) {
16440 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
16442 orig_conv.inner = (void*)(orig & (~1));
16443 orig_conv.is_owned = false;
16444 LDKPing ret_var = Ping_clone(&orig_conv);
16445 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16446 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16447 uint64_t ret_ref = (uint64_t)ret_var.inner;
16448 if (ret_var.is_owned) {
16454 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
16455 LDKPong this_obj_conv;
16456 this_obj_conv.inner = (void*)(this_obj & (~1));
16457 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16458 Pong_free(this_obj_conv);
16461 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
16462 LDKPong this_ptr_conv;
16463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16464 this_ptr_conv.is_owned = false;
16465 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
16469 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
16470 LDKPong this_ptr_conv;
16471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16472 this_ptr_conv.is_owned = false;
16473 Pong_set_byteslen(&this_ptr_conv, val);
16476 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
16477 LDKPong ret_var = Pong_new(byteslen_arg);
16478 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16479 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16480 uint64_t ret_ref = (uint64_t)ret_var.inner;
16481 if (ret_var.is_owned) {
16487 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
16489 orig_conv.inner = (void*)(orig & (~1));
16490 orig_conv.is_owned = false;
16491 LDKPong ret_var = Pong_clone(&orig_conv);
16492 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16493 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16494 uint64_t ret_ref = (uint64_t)ret_var.inner;
16495 if (ret_var.is_owned) {
16501 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
16502 LDKOpenChannel this_obj_conv;
16503 this_obj_conv.inner = (void*)(this_obj & (~1));
16504 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16505 OpenChannel_free(this_obj_conv);
16508 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
16509 LDKOpenChannel this_ptr_conv;
16510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16511 this_ptr_conv.is_owned = false;
16512 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16513 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
16517 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
16518 LDKOpenChannel this_ptr_conv;
16519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16520 this_ptr_conv.is_owned = false;
16521 LDKThirtyTwoBytes val_ref;
16522 CHECK(*((uint32_t*)val) == 32);
16523 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16524 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
16527 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
16528 LDKOpenChannel this_ptr_conv;
16529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16530 this_ptr_conv.is_owned = false;
16531 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16532 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
16536 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
16537 LDKOpenChannel this_ptr_conv;
16538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16539 this_ptr_conv.is_owned = false;
16540 LDKThirtyTwoBytes val_ref;
16541 CHECK(*((uint32_t*)val) == 32);
16542 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16543 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
16546 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
16547 LDKOpenChannel this_ptr_conv;
16548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16549 this_ptr_conv.is_owned = false;
16550 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
16554 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
16555 LDKOpenChannel this_ptr_conv;
16556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16557 this_ptr_conv.is_owned = false;
16558 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
16561 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
16562 LDKOpenChannel this_ptr_conv;
16563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16564 this_ptr_conv.is_owned = false;
16565 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
16569 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
16570 LDKOpenChannel this_ptr_conv;
16571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16572 this_ptr_conv.is_owned = false;
16573 OpenChannel_set_push_msat(&this_ptr_conv, val);
16576 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
16577 LDKOpenChannel this_ptr_conv;
16578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16579 this_ptr_conv.is_owned = false;
16580 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
16584 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
16585 LDKOpenChannel this_ptr_conv;
16586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16587 this_ptr_conv.is_owned = false;
16588 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
16591 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
16592 LDKOpenChannel this_ptr_conv;
16593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16594 this_ptr_conv.is_owned = false;
16595 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
16599 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
16600 LDKOpenChannel this_ptr_conv;
16601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16602 this_ptr_conv.is_owned = false;
16603 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16606 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
16607 LDKOpenChannel this_ptr_conv;
16608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16609 this_ptr_conv.is_owned = false;
16610 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
16614 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
16615 LDKOpenChannel this_ptr_conv;
16616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16617 this_ptr_conv.is_owned = false;
16618 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
16621 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
16622 LDKOpenChannel this_ptr_conv;
16623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16624 this_ptr_conv.is_owned = false;
16625 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
16629 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
16630 LDKOpenChannel this_ptr_conv;
16631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16632 this_ptr_conv.is_owned = false;
16633 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
16636 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
16637 LDKOpenChannel this_ptr_conv;
16638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16639 this_ptr_conv.is_owned = false;
16640 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
16644 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
16645 LDKOpenChannel this_ptr_conv;
16646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16647 this_ptr_conv.is_owned = false;
16648 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
16651 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
16652 LDKOpenChannel this_ptr_conv;
16653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16654 this_ptr_conv.is_owned = false;
16655 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
16659 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
16660 LDKOpenChannel this_ptr_conv;
16661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16662 this_ptr_conv.is_owned = false;
16663 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
16666 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
16667 LDKOpenChannel this_ptr_conv;
16668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16669 this_ptr_conv.is_owned = false;
16670 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
16674 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
16675 LDKOpenChannel this_ptr_conv;
16676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16677 this_ptr_conv.is_owned = false;
16678 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
16681 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
16682 LDKOpenChannel this_ptr_conv;
16683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16684 this_ptr_conv.is_owned = false;
16685 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16686 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
16690 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
16691 LDKOpenChannel this_ptr_conv;
16692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16693 this_ptr_conv.is_owned = false;
16694 LDKPublicKey val_ref;
16695 CHECK(*((uint32_t*)val) == 33);
16696 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16697 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
16700 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
16701 LDKOpenChannel this_ptr_conv;
16702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16703 this_ptr_conv.is_owned = false;
16704 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16705 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
16709 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
16710 LDKOpenChannel this_ptr_conv;
16711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16712 this_ptr_conv.is_owned = false;
16713 LDKPublicKey val_ref;
16714 CHECK(*((uint32_t*)val) == 33);
16715 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16716 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
16719 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
16720 LDKOpenChannel this_ptr_conv;
16721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16722 this_ptr_conv.is_owned = false;
16723 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16724 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
16728 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
16729 LDKOpenChannel this_ptr_conv;
16730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16731 this_ptr_conv.is_owned = false;
16732 LDKPublicKey val_ref;
16733 CHECK(*((uint32_t*)val) == 33);
16734 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16735 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
16738 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
16739 LDKOpenChannel this_ptr_conv;
16740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16741 this_ptr_conv.is_owned = false;
16742 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16743 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
16747 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
16748 LDKOpenChannel this_ptr_conv;
16749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16750 this_ptr_conv.is_owned = false;
16751 LDKPublicKey val_ref;
16752 CHECK(*((uint32_t*)val) == 33);
16753 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16754 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16757 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
16758 LDKOpenChannel this_ptr_conv;
16759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16760 this_ptr_conv.is_owned = false;
16761 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16762 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
16766 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
16767 LDKOpenChannel this_ptr_conv;
16768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16769 this_ptr_conv.is_owned = false;
16770 LDKPublicKey val_ref;
16771 CHECK(*((uint32_t*)val) == 33);
16772 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16773 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
16776 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
16777 LDKOpenChannel this_ptr_conv;
16778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16779 this_ptr_conv.is_owned = false;
16780 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16781 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16785 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16786 LDKOpenChannel this_ptr_conv;
16787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16788 this_ptr_conv.is_owned = false;
16789 LDKPublicKey val_ref;
16790 CHECK(*((uint32_t*)val) == 33);
16791 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16792 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
16795 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
16796 LDKOpenChannel this_ptr_conv;
16797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16798 this_ptr_conv.is_owned = false;
16799 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
16803 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
16804 LDKOpenChannel this_ptr_conv;
16805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16806 this_ptr_conv.is_owned = false;
16807 OpenChannel_set_channel_flags(&this_ptr_conv, val);
16810 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
16811 LDKOpenChannel orig_conv;
16812 orig_conv.inner = (void*)(orig & (~1));
16813 orig_conv.is_owned = false;
16814 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
16815 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16816 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16817 uint64_t ret_ref = (uint64_t)ret_var.inner;
16818 if (ret_var.is_owned) {
16824 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
16825 LDKAcceptChannel this_obj_conv;
16826 this_obj_conv.inner = (void*)(this_obj & (~1));
16827 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16828 AcceptChannel_free(this_obj_conv);
16831 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
16832 LDKAcceptChannel this_ptr_conv;
16833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16834 this_ptr_conv.is_owned = false;
16835 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16836 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
16840 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
16841 LDKAcceptChannel this_ptr_conv;
16842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16843 this_ptr_conv.is_owned = false;
16844 LDKThirtyTwoBytes val_ref;
16845 CHECK(*((uint32_t*)val) == 32);
16846 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16847 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
16850 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
16851 LDKAcceptChannel this_ptr_conv;
16852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16853 this_ptr_conv.is_owned = false;
16854 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
16858 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
16859 LDKAcceptChannel this_ptr_conv;
16860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16861 this_ptr_conv.is_owned = false;
16862 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
16865 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
16866 LDKAcceptChannel this_ptr_conv;
16867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16868 this_ptr_conv.is_owned = false;
16869 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
16873 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
16874 LDKAcceptChannel this_ptr_conv;
16875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16876 this_ptr_conv.is_owned = false;
16877 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16880 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
16881 LDKAcceptChannel this_ptr_conv;
16882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16883 this_ptr_conv.is_owned = false;
16884 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
16888 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
16889 LDKAcceptChannel this_ptr_conv;
16890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16891 this_ptr_conv.is_owned = false;
16892 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
16895 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
16896 LDKAcceptChannel this_ptr_conv;
16897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16898 this_ptr_conv.is_owned = false;
16899 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
16903 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
16904 LDKAcceptChannel this_ptr_conv;
16905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16906 this_ptr_conv.is_owned = false;
16907 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
16910 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
16911 LDKAcceptChannel this_ptr_conv;
16912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16913 this_ptr_conv.is_owned = false;
16914 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
16918 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
16919 LDKAcceptChannel this_ptr_conv;
16920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16921 this_ptr_conv.is_owned = false;
16922 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
16925 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
16926 LDKAcceptChannel this_ptr_conv;
16927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16928 this_ptr_conv.is_owned = false;
16929 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
16933 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
16934 LDKAcceptChannel this_ptr_conv;
16935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16936 this_ptr_conv.is_owned = false;
16937 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
16940 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
16941 LDKAcceptChannel this_ptr_conv;
16942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16943 this_ptr_conv.is_owned = false;
16944 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
16948 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
16949 LDKAcceptChannel this_ptr_conv;
16950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16951 this_ptr_conv.is_owned = false;
16952 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
16955 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
16956 LDKAcceptChannel this_ptr_conv;
16957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16958 this_ptr_conv.is_owned = false;
16959 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16960 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
16964 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
16965 LDKAcceptChannel this_ptr_conv;
16966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16967 this_ptr_conv.is_owned = false;
16968 LDKPublicKey val_ref;
16969 CHECK(*((uint32_t*)val) == 33);
16970 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16971 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
16974 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
16975 LDKAcceptChannel this_ptr_conv;
16976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16977 this_ptr_conv.is_owned = false;
16978 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16979 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
16983 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
16984 LDKAcceptChannel this_ptr_conv;
16985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16986 this_ptr_conv.is_owned = false;
16987 LDKPublicKey val_ref;
16988 CHECK(*((uint32_t*)val) == 33);
16989 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16990 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
16993 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
16994 LDKAcceptChannel this_ptr_conv;
16995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16996 this_ptr_conv.is_owned = false;
16997 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16998 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
17002 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
17003 LDKAcceptChannel this_ptr_conv;
17004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17005 this_ptr_conv.is_owned = false;
17006 LDKPublicKey val_ref;
17007 CHECK(*((uint32_t*)val) == 33);
17008 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17009 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
17012 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
17013 LDKAcceptChannel this_ptr_conv;
17014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17015 this_ptr_conv.is_owned = false;
17016 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17017 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
17021 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
17022 LDKAcceptChannel this_ptr_conv;
17023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17024 this_ptr_conv.is_owned = false;
17025 LDKPublicKey val_ref;
17026 CHECK(*((uint32_t*)val) == 33);
17027 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17028 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
17031 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
17032 LDKAcceptChannel this_ptr_conv;
17033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17034 this_ptr_conv.is_owned = false;
17035 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17036 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
17040 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
17041 LDKAcceptChannel this_ptr_conv;
17042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17043 this_ptr_conv.is_owned = false;
17044 LDKPublicKey val_ref;
17045 CHECK(*((uint32_t*)val) == 33);
17046 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17047 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
17050 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
17051 LDKAcceptChannel this_ptr_conv;
17052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17053 this_ptr_conv.is_owned = false;
17054 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17055 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
17059 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
17060 LDKAcceptChannel this_ptr_conv;
17061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17062 this_ptr_conv.is_owned = false;
17063 LDKPublicKey val_ref;
17064 CHECK(*((uint32_t*)val) == 33);
17065 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17066 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
17069 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
17070 LDKAcceptChannel orig_conv;
17071 orig_conv.inner = (void*)(orig & (~1));
17072 orig_conv.is_owned = false;
17073 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
17074 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17075 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17076 uint64_t ret_ref = (uint64_t)ret_var.inner;
17077 if (ret_var.is_owned) {
17083 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
17084 LDKFundingCreated this_obj_conv;
17085 this_obj_conv.inner = (void*)(this_obj & (~1));
17086 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17087 FundingCreated_free(this_obj_conv);
17090 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
17091 LDKFundingCreated this_ptr_conv;
17092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17093 this_ptr_conv.is_owned = false;
17094 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17095 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
17099 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
17100 LDKFundingCreated this_ptr_conv;
17101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17102 this_ptr_conv.is_owned = false;
17103 LDKThirtyTwoBytes val_ref;
17104 CHECK(*((uint32_t*)val) == 32);
17105 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17106 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
17109 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
17110 LDKFundingCreated this_ptr_conv;
17111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17112 this_ptr_conv.is_owned = false;
17113 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17114 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
17118 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
17119 LDKFundingCreated this_ptr_conv;
17120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17121 this_ptr_conv.is_owned = false;
17122 LDKThirtyTwoBytes val_ref;
17123 CHECK(*((uint32_t*)val) == 32);
17124 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17125 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
17128 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
17129 LDKFundingCreated this_ptr_conv;
17130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17131 this_ptr_conv.is_owned = false;
17132 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
17136 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
17137 LDKFundingCreated this_ptr_conv;
17138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17139 this_ptr_conv.is_owned = false;
17140 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
17143 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
17144 LDKFundingCreated this_ptr_conv;
17145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17146 this_ptr_conv.is_owned = false;
17147 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17148 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
17152 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
17153 LDKFundingCreated this_ptr_conv;
17154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17155 this_ptr_conv.is_owned = false;
17156 LDKSignature val_ref;
17157 CHECK(*((uint32_t*)val) == 64);
17158 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17159 FundingCreated_set_signature(&this_ptr_conv, val_ref);
17162 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) {
17163 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
17164 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
17165 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
17166 LDKThirtyTwoBytes funding_txid_arg_ref;
17167 CHECK(*((uint32_t*)funding_txid_arg) == 32);
17168 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
17169 LDKSignature signature_arg_ref;
17170 CHECK(*((uint32_t*)signature_arg) == 64);
17171 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17172 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
17173 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17174 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17175 uint64_t ret_ref = (uint64_t)ret_var.inner;
17176 if (ret_var.is_owned) {
17182 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
17183 LDKFundingCreated orig_conv;
17184 orig_conv.inner = (void*)(orig & (~1));
17185 orig_conv.is_owned = false;
17186 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
17187 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17188 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17189 uint64_t ret_ref = (uint64_t)ret_var.inner;
17190 if (ret_var.is_owned) {
17196 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
17197 LDKFundingSigned this_obj_conv;
17198 this_obj_conv.inner = (void*)(this_obj & (~1));
17199 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17200 FundingSigned_free(this_obj_conv);
17203 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
17204 LDKFundingSigned this_ptr_conv;
17205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17206 this_ptr_conv.is_owned = false;
17207 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17208 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
17212 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17213 LDKFundingSigned this_ptr_conv;
17214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17215 this_ptr_conv.is_owned = false;
17216 LDKThirtyTwoBytes val_ref;
17217 CHECK(*((uint32_t*)val) == 32);
17218 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17219 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
17222 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
17223 LDKFundingSigned this_ptr_conv;
17224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17225 this_ptr_conv.is_owned = false;
17226 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17227 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
17231 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
17232 LDKFundingSigned this_ptr_conv;
17233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17234 this_ptr_conv.is_owned = false;
17235 LDKSignature val_ref;
17236 CHECK(*((uint32_t*)val) == 64);
17237 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17238 FundingSigned_set_signature(&this_ptr_conv, val_ref);
17241 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
17242 LDKThirtyTwoBytes channel_id_arg_ref;
17243 CHECK(*((uint32_t*)channel_id_arg) == 32);
17244 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17245 LDKSignature signature_arg_ref;
17246 CHECK(*((uint32_t*)signature_arg) == 64);
17247 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17248 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
17249 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17250 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17251 uint64_t ret_ref = (uint64_t)ret_var.inner;
17252 if (ret_var.is_owned) {
17258 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
17259 LDKFundingSigned orig_conv;
17260 orig_conv.inner = (void*)(orig & (~1));
17261 orig_conv.is_owned = false;
17262 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
17263 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17264 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17265 uint64_t ret_ref = (uint64_t)ret_var.inner;
17266 if (ret_var.is_owned) {
17272 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
17273 LDKFundingLocked this_obj_conv;
17274 this_obj_conv.inner = (void*)(this_obj & (~1));
17275 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17276 FundingLocked_free(this_obj_conv);
17279 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
17280 LDKFundingLocked this_ptr_conv;
17281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17282 this_ptr_conv.is_owned = false;
17283 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17284 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
17288 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17289 LDKFundingLocked this_ptr_conv;
17290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17291 this_ptr_conv.is_owned = false;
17292 LDKThirtyTwoBytes val_ref;
17293 CHECK(*((uint32_t*)val) == 32);
17294 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17295 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
17298 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
17299 LDKFundingLocked this_ptr_conv;
17300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17301 this_ptr_conv.is_owned = false;
17302 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17303 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
17307 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
17308 LDKFundingLocked this_ptr_conv;
17309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17310 this_ptr_conv.is_owned = false;
17311 LDKPublicKey val_ref;
17312 CHECK(*((uint32_t*)val) == 33);
17313 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17314 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
17317 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
17318 LDKThirtyTwoBytes channel_id_arg_ref;
17319 CHECK(*((uint32_t*)channel_id_arg) == 32);
17320 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17321 LDKPublicKey next_per_commitment_point_arg_ref;
17322 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
17323 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
17324 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
17325 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17326 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17327 uint64_t ret_ref = (uint64_t)ret_var.inner;
17328 if (ret_var.is_owned) {
17334 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
17335 LDKFundingLocked orig_conv;
17336 orig_conv.inner = (void*)(orig & (~1));
17337 orig_conv.is_owned = false;
17338 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
17339 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17340 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17341 uint64_t ret_ref = (uint64_t)ret_var.inner;
17342 if (ret_var.is_owned) {
17348 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
17349 LDKShutdown this_obj_conv;
17350 this_obj_conv.inner = (void*)(this_obj & (~1));
17351 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17352 Shutdown_free(this_obj_conv);
17355 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
17356 LDKShutdown this_ptr_conv;
17357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17358 this_ptr_conv.is_owned = false;
17359 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17360 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
17364 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17365 LDKShutdown this_ptr_conv;
17366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17367 this_ptr_conv.is_owned = false;
17368 LDKThirtyTwoBytes val_ref;
17369 CHECK(*((uint32_t*)val) == 32);
17370 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17371 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
17374 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
17375 LDKShutdown this_ptr_conv;
17376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17377 this_ptr_conv.is_owned = false;
17378 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
17379 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17380 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17384 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
17385 LDKShutdown this_ptr_conv;
17386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17387 this_ptr_conv.is_owned = false;
17388 LDKCVec_u8Z val_ref;
17389 val_ref.datalen = *((uint32_t*)val);
17390 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
17391 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
17392 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
17395 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
17396 LDKThirtyTwoBytes channel_id_arg_ref;
17397 CHECK(*((uint32_t*)channel_id_arg) == 32);
17398 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17399 LDKCVec_u8Z scriptpubkey_arg_ref;
17400 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
17401 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
17402 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
17403 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
17404 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17405 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17406 uint64_t ret_ref = (uint64_t)ret_var.inner;
17407 if (ret_var.is_owned) {
17413 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
17414 LDKShutdown orig_conv;
17415 orig_conv.inner = (void*)(orig & (~1));
17416 orig_conv.is_owned = false;
17417 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
17418 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17419 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17420 uint64_t ret_ref = (uint64_t)ret_var.inner;
17421 if (ret_var.is_owned) {
17427 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
17428 LDKClosingSignedFeeRange this_obj_conv;
17429 this_obj_conv.inner = (void*)(this_obj & (~1));
17430 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17431 ClosingSignedFeeRange_free(this_obj_conv);
17434 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
17435 LDKClosingSignedFeeRange this_ptr_conv;
17436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17437 this_ptr_conv.is_owned = false;
17438 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
17442 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
17443 LDKClosingSignedFeeRange this_ptr_conv;
17444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17445 this_ptr_conv.is_owned = false;
17446 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
17449 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
17450 LDKClosingSignedFeeRange this_ptr_conv;
17451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17452 this_ptr_conv.is_owned = false;
17453 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
17457 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
17458 LDKClosingSignedFeeRange this_ptr_conv;
17459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17460 this_ptr_conv.is_owned = false;
17461 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
17464 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
17465 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
17466 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17467 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17468 uint64_t ret_ref = (uint64_t)ret_var.inner;
17469 if (ret_var.is_owned) {
17475 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
17476 LDKClosingSignedFeeRange orig_conv;
17477 orig_conv.inner = (void*)(orig & (~1));
17478 orig_conv.is_owned = false;
17479 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
17480 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17481 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17482 uint64_t ret_ref = (uint64_t)ret_var.inner;
17483 if (ret_var.is_owned) {
17489 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
17490 LDKClosingSigned this_obj_conv;
17491 this_obj_conv.inner = (void*)(this_obj & (~1));
17492 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17493 ClosingSigned_free(this_obj_conv);
17496 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
17497 LDKClosingSigned this_ptr_conv;
17498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17499 this_ptr_conv.is_owned = false;
17500 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17501 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
17505 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17506 LDKClosingSigned this_ptr_conv;
17507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17508 this_ptr_conv.is_owned = false;
17509 LDKThirtyTwoBytes val_ref;
17510 CHECK(*((uint32_t*)val) == 32);
17511 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17512 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
17515 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
17516 LDKClosingSigned this_ptr_conv;
17517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17518 this_ptr_conv.is_owned = false;
17519 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
17523 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
17524 LDKClosingSigned this_ptr_conv;
17525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17526 this_ptr_conv.is_owned = false;
17527 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
17530 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
17531 LDKClosingSigned this_ptr_conv;
17532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17533 this_ptr_conv.is_owned = false;
17534 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17535 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
17539 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
17540 LDKClosingSigned this_ptr_conv;
17541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17542 this_ptr_conv.is_owned = false;
17543 LDKSignature val_ref;
17544 CHECK(*((uint32_t*)val) == 64);
17545 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17546 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
17549 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
17550 LDKClosingSigned this_ptr_conv;
17551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17552 this_ptr_conv.is_owned = false;
17553 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
17554 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17555 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17556 uint64_t ret_ref = (uint64_t)ret_var.inner;
17557 if (ret_var.is_owned) {
17563 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
17564 LDKClosingSigned this_ptr_conv;
17565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17566 this_ptr_conv.is_owned = false;
17567 LDKClosingSignedFeeRange val_conv;
17568 val_conv.inner = (void*)(val & (~1));
17569 val_conv.is_owned = (val & 1) || (val == 0);
17570 val_conv = ClosingSignedFeeRange_clone(&val_conv);
17571 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
17574 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) {
17575 LDKThirtyTwoBytes channel_id_arg_ref;
17576 CHECK(*((uint32_t*)channel_id_arg) == 32);
17577 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17578 LDKSignature signature_arg_ref;
17579 CHECK(*((uint32_t*)signature_arg) == 64);
17580 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17581 LDKClosingSignedFeeRange fee_range_arg_conv;
17582 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
17583 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
17584 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
17585 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
17586 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17587 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17588 uint64_t ret_ref = (uint64_t)ret_var.inner;
17589 if (ret_var.is_owned) {
17595 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
17596 LDKClosingSigned orig_conv;
17597 orig_conv.inner = (void*)(orig & (~1));
17598 orig_conv.is_owned = false;
17599 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
17600 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17601 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17602 uint64_t ret_ref = (uint64_t)ret_var.inner;
17603 if (ret_var.is_owned) {
17609 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
17610 LDKUpdateAddHTLC this_obj_conv;
17611 this_obj_conv.inner = (void*)(this_obj & (~1));
17612 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17613 UpdateAddHTLC_free(this_obj_conv);
17616 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
17617 LDKUpdateAddHTLC this_ptr_conv;
17618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17619 this_ptr_conv.is_owned = false;
17620 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17621 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
17625 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17626 LDKUpdateAddHTLC this_ptr_conv;
17627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17628 this_ptr_conv.is_owned = false;
17629 LDKThirtyTwoBytes val_ref;
17630 CHECK(*((uint32_t*)val) == 32);
17631 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17632 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
17635 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
17636 LDKUpdateAddHTLC this_ptr_conv;
17637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17638 this_ptr_conv.is_owned = false;
17639 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
17643 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
17644 LDKUpdateAddHTLC this_ptr_conv;
17645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17646 this_ptr_conv.is_owned = false;
17647 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
17650 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
17651 LDKUpdateAddHTLC this_ptr_conv;
17652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17653 this_ptr_conv.is_owned = false;
17654 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
17658 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
17659 LDKUpdateAddHTLC this_ptr_conv;
17660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17661 this_ptr_conv.is_owned = false;
17662 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
17665 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
17666 LDKUpdateAddHTLC this_ptr_conv;
17667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17668 this_ptr_conv.is_owned = false;
17669 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17670 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
17674 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
17675 LDKUpdateAddHTLC this_ptr_conv;
17676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17677 this_ptr_conv.is_owned = false;
17678 LDKThirtyTwoBytes val_ref;
17679 CHECK(*((uint32_t*)val) == 32);
17680 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17681 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
17684 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
17685 LDKUpdateAddHTLC this_ptr_conv;
17686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17687 this_ptr_conv.is_owned = false;
17688 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
17692 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
17693 LDKUpdateAddHTLC this_ptr_conv;
17694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17695 this_ptr_conv.is_owned = false;
17696 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
17699 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
17700 LDKUpdateAddHTLC orig_conv;
17701 orig_conv.inner = (void*)(orig & (~1));
17702 orig_conv.is_owned = false;
17703 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
17704 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17705 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17706 uint64_t ret_ref = (uint64_t)ret_var.inner;
17707 if (ret_var.is_owned) {
17713 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
17714 LDKUpdateFulfillHTLC this_obj_conv;
17715 this_obj_conv.inner = (void*)(this_obj & (~1));
17716 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17717 UpdateFulfillHTLC_free(this_obj_conv);
17720 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
17721 LDKUpdateFulfillHTLC this_ptr_conv;
17722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17723 this_ptr_conv.is_owned = false;
17724 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17725 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
17729 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17730 LDKUpdateFulfillHTLC this_ptr_conv;
17731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17732 this_ptr_conv.is_owned = false;
17733 LDKThirtyTwoBytes val_ref;
17734 CHECK(*((uint32_t*)val) == 32);
17735 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17736 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
17739 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
17740 LDKUpdateFulfillHTLC this_ptr_conv;
17741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17742 this_ptr_conv.is_owned = false;
17743 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
17747 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
17748 LDKUpdateFulfillHTLC this_ptr_conv;
17749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17750 this_ptr_conv.is_owned = false;
17751 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
17754 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
17755 LDKUpdateFulfillHTLC this_ptr_conv;
17756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17757 this_ptr_conv.is_owned = false;
17758 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17759 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
17763 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
17764 LDKUpdateFulfillHTLC this_ptr_conv;
17765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17766 this_ptr_conv.is_owned = false;
17767 LDKThirtyTwoBytes val_ref;
17768 CHECK(*((uint32_t*)val) == 32);
17769 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17770 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
17773 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
17774 LDKThirtyTwoBytes channel_id_arg_ref;
17775 CHECK(*((uint32_t*)channel_id_arg) == 32);
17776 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17777 LDKThirtyTwoBytes payment_preimage_arg_ref;
17778 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
17779 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
17780 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
17781 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17782 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17783 uint64_t ret_ref = (uint64_t)ret_var.inner;
17784 if (ret_var.is_owned) {
17790 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
17791 LDKUpdateFulfillHTLC orig_conv;
17792 orig_conv.inner = (void*)(orig & (~1));
17793 orig_conv.is_owned = false;
17794 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
17795 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17796 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17797 uint64_t ret_ref = (uint64_t)ret_var.inner;
17798 if (ret_var.is_owned) {
17804 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
17805 LDKUpdateFailHTLC this_obj_conv;
17806 this_obj_conv.inner = (void*)(this_obj & (~1));
17807 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17808 UpdateFailHTLC_free(this_obj_conv);
17811 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
17812 LDKUpdateFailHTLC this_ptr_conv;
17813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17814 this_ptr_conv.is_owned = false;
17815 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17816 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
17820 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17821 LDKUpdateFailHTLC this_ptr_conv;
17822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17823 this_ptr_conv.is_owned = false;
17824 LDKThirtyTwoBytes val_ref;
17825 CHECK(*((uint32_t*)val) == 32);
17826 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17827 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
17830 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
17831 LDKUpdateFailHTLC this_ptr_conv;
17832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17833 this_ptr_conv.is_owned = false;
17834 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
17838 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
17839 LDKUpdateFailHTLC this_ptr_conv;
17840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17841 this_ptr_conv.is_owned = false;
17842 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
17845 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
17846 LDKUpdateFailHTLC orig_conv;
17847 orig_conv.inner = (void*)(orig & (~1));
17848 orig_conv.is_owned = false;
17849 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
17850 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17851 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17852 uint64_t ret_ref = (uint64_t)ret_var.inner;
17853 if (ret_var.is_owned) {
17859 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
17860 LDKUpdateFailMalformedHTLC this_obj_conv;
17861 this_obj_conv.inner = (void*)(this_obj & (~1));
17862 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17863 UpdateFailMalformedHTLC_free(this_obj_conv);
17866 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
17867 LDKUpdateFailMalformedHTLC this_ptr_conv;
17868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17869 this_ptr_conv.is_owned = false;
17870 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17871 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
17875 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17876 LDKUpdateFailMalformedHTLC this_ptr_conv;
17877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17878 this_ptr_conv.is_owned = false;
17879 LDKThirtyTwoBytes val_ref;
17880 CHECK(*((uint32_t*)val) == 32);
17881 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17882 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
17885 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
17886 LDKUpdateFailMalformedHTLC this_ptr_conv;
17887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17888 this_ptr_conv.is_owned = false;
17889 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
17893 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
17894 LDKUpdateFailMalformedHTLC this_ptr_conv;
17895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17896 this_ptr_conv.is_owned = false;
17897 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
17900 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
17901 LDKUpdateFailMalformedHTLC this_ptr_conv;
17902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17903 this_ptr_conv.is_owned = false;
17904 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
17908 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
17909 LDKUpdateFailMalformedHTLC this_ptr_conv;
17910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17911 this_ptr_conv.is_owned = false;
17912 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
17915 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
17916 LDKUpdateFailMalformedHTLC orig_conv;
17917 orig_conv.inner = (void*)(orig & (~1));
17918 orig_conv.is_owned = false;
17919 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
17920 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17921 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17922 uint64_t ret_ref = (uint64_t)ret_var.inner;
17923 if (ret_var.is_owned) {
17929 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_obj) {
17930 LDKCommitmentSigned this_obj_conv;
17931 this_obj_conv.inner = (void*)(this_obj & (~1));
17932 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17933 CommitmentSigned_free(this_obj_conv);
17936 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
17937 LDKCommitmentSigned this_ptr_conv;
17938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17939 this_ptr_conv.is_owned = false;
17940 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17941 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
17945 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17946 LDKCommitmentSigned this_ptr_conv;
17947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17948 this_ptr_conv.is_owned = false;
17949 LDKThirtyTwoBytes val_ref;
17950 CHECK(*((uint32_t*)val) == 32);
17951 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17952 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
17955 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
17956 LDKCommitmentSigned this_ptr_conv;
17957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17958 this_ptr_conv.is_owned = false;
17959 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17960 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
17964 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
17965 LDKCommitmentSigned this_ptr_conv;
17966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17967 this_ptr_conv.is_owned = false;
17968 LDKSignature val_ref;
17969 CHECK(*((uint32_t*)val) == 64);
17970 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17971 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
17974 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
17975 LDKCommitmentSigned this_ptr_conv;
17976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17977 this_ptr_conv.is_owned = false;
17978 LDKCVec_SignatureZ val_constr;
17979 val_constr.datalen = *((uint32_t*)val);
17980 if (val_constr.datalen > 0)
17981 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17983 val_constr.data = NULL;
17984 int8_tArray* val_vals = (int8_tArray*)(val + 4);
17985 for (size_t m = 0; m < val_constr.datalen; m++) {
17986 int8_tArray val_conv_12 = val_vals[m];
17987 LDKSignature val_conv_12_ref;
17988 CHECK(*((uint32_t*)val_conv_12) == 64);
17989 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
17990 val_constr.data[m] = val_conv_12_ref;
17992 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
17995 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
17996 LDKThirtyTwoBytes channel_id_arg_ref;
17997 CHECK(*((uint32_t*)channel_id_arg) == 32);
17998 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17999 LDKSignature signature_arg_ref;
18000 CHECK(*((uint32_t*)signature_arg) == 64);
18001 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
18002 LDKCVec_SignatureZ htlc_signatures_arg_constr;
18003 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
18004 if (htlc_signatures_arg_constr.datalen > 0)
18005 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18007 htlc_signatures_arg_constr.data = NULL;
18008 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
18009 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
18010 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
18011 LDKSignature htlc_signatures_arg_conv_12_ref;
18012 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
18013 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
18014 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
18016 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
18017 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18018 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18019 uint64_t ret_ref = (uint64_t)ret_var.inner;
18020 if (ret_var.is_owned) {
18026 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
18027 LDKCommitmentSigned orig_conv;
18028 orig_conv.inner = (void*)(orig & (~1));
18029 orig_conv.is_owned = false;
18030 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
18031 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18032 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18033 uint64_t ret_ref = (uint64_t)ret_var.inner;
18034 if (ret_var.is_owned) {
18040 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
18041 LDKRevokeAndACK this_obj_conv;
18042 this_obj_conv.inner = (void*)(this_obj & (~1));
18043 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18044 RevokeAndACK_free(this_obj_conv);
18047 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
18048 LDKRevokeAndACK this_ptr_conv;
18049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18050 this_ptr_conv.is_owned = false;
18051 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18052 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
18056 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18057 LDKRevokeAndACK this_ptr_conv;
18058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18059 this_ptr_conv.is_owned = false;
18060 LDKThirtyTwoBytes val_ref;
18061 CHECK(*((uint32_t*)val) == 32);
18062 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18063 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
18066 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
18067 LDKRevokeAndACK this_ptr_conv;
18068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18069 this_ptr_conv.is_owned = false;
18070 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18071 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
18075 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
18076 LDKRevokeAndACK this_ptr_conv;
18077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18078 this_ptr_conv.is_owned = false;
18079 LDKThirtyTwoBytes val_ref;
18080 CHECK(*((uint32_t*)val) == 32);
18081 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18082 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
18085 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
18086 LDKRevokeAndACK this_ptr_conv;
18087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18088 this_ptr_conv.is_owned = false;
18089 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18090 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
18094 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
18095 LDKRevokeAndACK this_ptr_conv;
18096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18097 this_ptr_conv.is_owned = false;
18098 LDKPublicKey val_ref;
18099 CHECK(*((uint32_t*)val) == 33);
18100 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18101 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
18104 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) {
18105 LDKThirtyTwoBytes channel_id_arg_ref;
18106 CHECK(*((uint32_t*)channel_id_arg) == 32);
18107 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18108 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
18109 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
18110 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
18111 LDKPublicKey next_per_commitment_point_arg_ref;
18112 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
18113 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
18114 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
18115 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18116 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18117 uint64_t ret_ref = (uint64_t)ret_var.inner;
18118 if (ret_var.is_owned) {
18124 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
18125 LDKRevokeAndACK orig_conv;
18126 orig_conv.inner = (void*)(orig & (~1));
18127 orig_conv.is_owned = false;
18128 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
18129 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18130 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18131 uint64_t ret_ref = (uint64_t)ret_var.inner;
18132 if (ret_var.is_owned) {
18138 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
18139 LDKUpdateFee this_obj_conv;
18140 this_obj_conv.inner = (void*)(this_obj & (~1));
18141 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18142 UpdateFee_free(this_obj_conv);
18145 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
18146 LDKUpdateFee this_ptr_conv;
18147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18148 this_ptr_conv.is_owned = false;
18149 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18150 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
18154 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18155 LDKUpdateFee this_ptr_conv;
18156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18157 this_ptr_conv.is_owned = false;
18158 LDKThirtyTwoBytes val_ref;
18159 CHECK(*((uint32_t*)val) == 32);
18160 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18161 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
18164 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
18165 LDKUpdateFee this_ptr_conv;
18166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18167 this_ptr_conv.is_owned = false;
18168 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
18172 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
18173 LDKUpdateFee this_ptr_conv;
18174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18175 this_ptr_conv.is_owned = false;
18176 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
18179 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
18180 LDKThirtyTwoBytes channel_id_arg_ref;
18181 CHECK(*((uint32_t*)channel_id_arg) == 32);
18182 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18183 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
18184 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18185 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18186 uint64_t ret_ref = (uint64_t)ret_var.inner;
18187 if (ret_var.is_owned) {
18193 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
18194 LDKUpdateFee orig_conv;
18195 orig_conv.inner = (void*)(orig & (~1));
18196 orig_conv.is_owned = false;
18197 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
18198 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18199 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18200 uint64_t ret_ref = (uint64_t)ret_var.inner;
18201 if (ret_var.is_owned) {
18207 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
18208 LDKDataLossProtect this_obj_conv;
18209 this_obj_conv.inner = (void*)(this_obj & (~1));
18210 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18211 DataLossProtect_free(this_obj_conv);
18214 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
18215 LDKDataLossProtect this_ptr_conv;
18216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18217 this_ptr_conv.is_owned = false;
18218 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18219 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
18223 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
18224 LDKDataLossProtect this_ptr_conv;
18225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18226 this_ptr_conv.is_owned = false;
18227 LDKThirtyTwoBytes val_ref;
18228 CHECK(*((uint32_t*)val) == 32);
18229 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18230 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
18233 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
18234 LDKDataLossProtect this_ptr_conv;
18235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18236 this_ptr_conv.is_owned = false;
18237 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18238 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
18242 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
18243 LDKDataLossProtect this_ptr_conv;
18244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18245 this_ptr_conv.is_owned = false;
18246 LDKPublicKey val_ref;
18247 CHECK(*((uint32_t*)val) == 33);
18248 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18249 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
18252 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
18253 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
18254 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
18255 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
18256 LDKPublicKey my_current_per_commitment_point_arg_ref;
18257 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
18258 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
18259 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
18260 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18261 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18262 uint64_t ret_ref = (uint64_t)ret_var.inner;
18263 if (ret_var.is_owned) {
18269 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
18270 LDKDataLossProtect orig_conv;
18271 orig_conv.inner = (void*)(orig & (~1));
18272 orig_conv.is_owned = false;
18273 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
18274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18276 uint64_t ret_ref = (uint64_t)ret_var.inner;
18277 if (ret_var.is_owned) {
18283 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
18284 LDKChannelReestablish this_obj_conv;
18285 this_obj_conv.inner = (void*)(this_obj & (~1));
18286 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18287 ChannelReestablish_free(this_obj_conv);
18290 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
18291 LDKChannelReestablish this_ptr_conv;
18292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18293 this_ptr_conv.is_owned = false;
18294 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18295 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
18299 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18300 LDKChannelReestablish this_ptr_conv;
18301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18302 this_ptr_conv.is_owned = false;
18303 LDKThirtyTwoBytes val_ref;
18304 CHECK(*((uint32_t*)val) == 32);
18305 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18306 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
18309 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
18310 LDKChannelReestablish this_ptr_conv;
18311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18312 this_ptr_conv.is_owned = false;
18313 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
18317 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
18318 LDKChannelReestablish this_ptr_conv;
18319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18320 this_ptr_conv.is_owned = false;
18321 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
18324 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
18325 LDKChannelReestablish this_ptr_conv;
18326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18327 this_ptr_conv.is_owned = false;
18328 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
18332 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
18333 LDKChannelReestablish this_ptr_conv;
18334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18335 this_ptr_conv.is_owned = false;
18336 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
18339 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
18340 LDKChannelReestablish orig_conv;
18341 orig_conv.inner = (void*)(orig & (~1));
18342 orig_conv.is_owned = false;
18343 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
18344 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18345 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18346 uint64_t ret_ref = (uint64_t)ret_var.inner;
18347 if (ret_var.is_owned) {
18353 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
18354 LDKAnnouncementSignatures this_obj_conv;
18355 this_obj_conv.inner = (void*)(this_obj & (~1));
18356 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18357 AnnouncementSignatures_free(this_obj_conv);
18360 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
18361 LDKAnnouncementSignatures this_ptr_conv;
18362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18363 this_ptr_conv.is_owned = false;
18364 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18365 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
18369 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18370 LDKAnnouncementSignatures this_ptr_conv;
18371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18372 this_ptr_conv.is_owned = false;
18373 LDKThirtyTwoBytes val_ref;
18374 CHECK(*((uint32_t*)val) == 32);
18375 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18376 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
18379 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
18380 LDKAnnouncementSignatures this_ptr_conv;
18381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18382 this_ptr_conv.is_owned = false;
18383 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
18387 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
18388 LDKAnnouncementSignatures this_ptr_conv;
18389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18390 this_ptr_conv.is_owned = false;
18391 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
18394 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
18395 LDKAnnouncementSignatures this_ptr_conv;
18396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18397 this_ptr_conv.is_owned = false;
18398 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18399 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
18403 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
18404 LDKAnnouncementSignatures this_ptr_conv;
18405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18406 this_ptr_conv.is_owned = false;
18407 LDKSignature val_ref;
18408 CHECK(*((uint32_t*)val) == 64);
18409 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18410 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
18413 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
18414 LDKAnnouncementSignatures this_ptr_conv;
18415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18416 this_ptr_conv.is_owned = false;
18417 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18418 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
18422 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
18423 LDKAnnouncementSignatures this_ptr_conv;
18424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18425 this_ptr_conv.is_owned = false;
18426 LDKSignature val_ref;
18427 CHECK(*((uint32_t*)val) == 64);
18428 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18429 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
18432 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) {
18433 LDKThirtyTwoBytes channel_id_arg_ref;
18434 CHECK(*((uint32_t*)channel_id_arg) == 32);
18435 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18436 LDKSignature node_signature_arg_ref;
18437 CHECK(*((uint32_t*)node_signature_arg) == 64);
18438 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
18439 LDKSignature bitcoin_signature_arg_ref;
18440 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
18441 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
18442 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
18443 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18444 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18445 uint64_t ret_ref = (uint64_t)ret_var.inner;
18446 if (ret_var.is_owned) {
18452 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
18453 LDKAnnouncementSignatures orig_conv;
18454 orig_conv.inner = (void*)(orig & (~1));
18455 orig_conv.is_owned = false;
18456 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_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_NetAddress_free(uint32_t this_ptr) {
18467 if ((this_ptr & 1) != 0) return;
18468 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
18469 FREE((void*)this_ptr);
18470 NetAddress_free(this_ptr_conv);
18473 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
18474 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
18475 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18476 *ret_copy = NetAddress_clone(orig_conv);
18477 uint64_t ret_ref = (uint64_t)ret_copy;
18481 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
18482 LDKFourBytes addr_ref;
18483 CHECK(*((uint32_t*)addr) == 4);
18484 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 4);
18485 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18486 *ret_copy = NetAddress_ipv4(addr_ref, port);
18487 uint64_t ret_ref = (uint64_t)ret_copy;
18491 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
18492 LDKSixteenBytes addr_ref;
18493 CHECK(*((uint32_t*)addr) == 16);
18494 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 16);
18495 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18496 *ret_copy = NetAddress_ipv6(addr_ref, port);
18497 uint64_t ret_ref = (uint64_t)ret_copy;
18501 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray addr, int16_t port) {
18502 LDKTenBytes addr_ref;
18503 CHECK(*((uint32_t*)addr) == 10);
18504 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 10);
18505 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18506 *ret_copy = NetAddress_onion_v2(addr_ref, port);
18507 uint64_t ret_ref = (uint64_t)ret_copy;
18511 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
18512 LDKThirtyTwoBytes ed25519_pubkey_ref;
18513 CHECK(*((uint32_t*)ed25519_pubkey) == 32);
18514 memcpy(ed25519_pubkey_ref.data, (uint8_t*)(ed25519_pubkey + 4), 32);
18515 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18516 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
18517 uint64_t ret_ref = (uint64_t)ret_copy;
18521 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
18522 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
18523 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
18524 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18525 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18526 CVec_u8Z_free(ret_var);
18530 uint32_t __attribute__((visibility("default"))) TS_Result_read(int8_tArray ser) {
18531 LDKu8slice ser_ref;
18532 ser_ref.datalen = *((uint32_t*)ser);
18533 ser_ref.data = (int8_t*)(ser + 4);
18534 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
18535 *ret_conv = Result_read(ser_ref);
18536 return (uint64_t)ret_conv;
18539 uint32_t __attribute__((visibility("default"))) TS_NetAddress_read(int8_tArray ser) {
18540 LDKu8slice ser_ref;
18541 ser_ref.datalen = *((uint32_t*)ser);
18542 ser_ref.data = (int8_t*)(ser + 4);
18543 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18544 *ret_conv = NetAddress_read(ser_ref);
18545 return (uint64_t)ret_conv;
18548 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
18549 LDKUnsignedNodeAnnouncement this_obj_conv;
18550 this_obj_conv.inner = (void*)(this_obj & (~1));
18551 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18552 UnsignedNodeAnnouncement_free(this_obj_conv);
18555 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
18556 LDKUnsignedNodeAnnouncement this_ptr_conv;
18557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18558 this_ptr_conv.is_owned = false;
18559 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
18560 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18561 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18562 uint64_t ret_ref = (uint64_t)ret_var.inner;
18563 if (ret_var.is_owned) {
18569 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
18570 LDKUnsignedNodeAnnouncement this_ptr_conv;
18571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18572 this_ptr_conv.is_owned = false;
18573 LDKNodeFeatures val_conv;
18574 val_conv.inner = (void*)(val & (~1));
18575 val_conv.is_owned = (val & 1) || (val == 0);
18576 val_conv = NodeFeatures_clone(&val_conv);
18577 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
18580 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
18581 LDKUnsignedNodeAnnouncement this_ptr_conv;
18582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18583 this_ptr_conv.is_owned = false;
18584 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
18588 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
18589 LDKUnsignedNodeAnnouncement this_ptr_conv;
18590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18591 this_ptr_conv.is_owned = false;
18592 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
18595 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
18596 LDKUnsignedNodeAnnouncement this_ptr_conv;
18597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18598 this_ptr_conv.is_owned = false;
18599 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18600 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
18604 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
18605 LDKUnsignedNodeAnnouncement this_ptr_conv;
18606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18607 this_ptr_conv.is_owned = false;
18608 LDKPublicKey val_ref;
18609 CHECK(*((uint32_t*)val) == 33);
18610 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18611 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
18614 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
18615 LDKUnsignedNodeAnnouncement this_ptr_conv;
18616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18617 this_ptr_conv.is_owned = false;
18618 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
18619 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
18623 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
18624 LDKUnsignedNodeAnnouncement this_ptr_conv;
18625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18626 this_ptr_conv.is_owned = false;
18627 LDKThreeBytes val_ref;
18628 CHECK(*((uint32_t*)val) == 3);
18629 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
18630 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
18633 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
18634 LDKUnsignedNodeAnnouncement this_ptr_conv;
18635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18636 this_ptr_conv.is_owned = false;
18637 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18638 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
18642 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
18643 LDKUnsignedNodeAnnouncement this_ptr_conv;
18644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18645 this_ptr_conv.is_owned = false;
18646 LDKThirtyTwoBytes val_ref;
18647 CHECK(*((uint32_t*)val) == 32);
18648 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18649 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
18652 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
18653 LDKUnsignedNodeAnnouncement this_ptr_conv;
18654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18655 this_ptr_conv.is_owned = false;
18656 LDKCVec_NetAddressZ val_constr;
18657 val_constr.datalen = *((uint32_t*)val);
18658 if (val_constr.datalen > 0)
18659 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18661 val_constr.data = NULL;
18662 uint32_t* val_vals = (uint32_t*)(val + 4);
18663 for (size_t m = 0; m < val_constr.datalen; m++) {
18664 uint32_t val_conv_12 = val_vals[m];
18665 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
18666 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
18667 val_constr.data[m] = val_conv_12_conv;
18669 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
18672 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
18673 LDKUnsignedNodeAnnouncement orig_conv;
18674 orig_conv.inner = (void*)(orig & (~1));
18675 orig_conv.is_owned = false;
18676 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
18677 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18678 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18679 uint64_t ret_ref = (uint64_t)ret_var.inner;
18680 if (ret_var.is_owned) {
18686 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
18687 LDKNodeAnnouncement this_obj_conv;
18688 this_obj_conv.inner = (void*)(this_obj & (~1));
18689 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18690 NodeAnnouncement_free(this_obj_conv);
18693 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
18694 LDKNodeAnnouncement this_ptr_conv;
18695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18696 this_ptr_conv.is_owned = false;
18697 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18698 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
18702 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
18703 LDKNodeAnnouncement this_ptr_conv;
18704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18705 this_ptr_conv.is_owned = false;
18706 LDKSignature val_ref;
18707 CHECK(*((uint32_t*)val) == 64);
18708 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18709 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
18712 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
18713 LDKNodeAnnouncement this_ptr_conv;
18714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18715 this_ptr_conv.is_owned = false;
18716 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
18717 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18718 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18719 uint64_t ret_ref = (uint64_t)ret_var.inner;
18720 if (ret_var.is_owned) {
18726 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
18727 LDKNodeAnnouncement this_ptr_conv;
18728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18729 this_ptr_conv.is_owned = false;
18730 LDKUnsignedNodeAnnouncement val_conv;
18731 val_conv.inner = (void*)(val & (~1));
18732 val_conv.is_owned = (val & 1) || (val == 0);
18733 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
18734 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
18737 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
18738 LDKSignature signature_arg_ref;
18739 CHECK(*((uint32_t*)signature_arg) == 64);
18740 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
18741 LDKUnsignedNodeAnnouncement contents_arg_conv;
18742 contents_arg_conv.inner = (void*)(contents_arg & (~1));
18743 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
18744 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
18745 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
18746 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18747 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18748 uint64_t ret_ref = (uint64_t)ret_var.inner;
18749 if (ret_var.is_owned) {
18755 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
18756 LDKNodeAnnouncement orig_conv;
18757 orig_conv.inner = (void*)(orig & (~1));
18758 orig_conv.is_owned = false;
18759 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
18760 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18761 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18762 uint64_t ret_ref = (uint64_t)ret_var.inner;
18763 if (ret_var.is_owned) {
18769 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
18770 LDKUnsignedChannelAnnouncement this_obj_conv;
18771 this_obj_conv.inner = (void*)(this_obj & (~1));
18772 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18773 UnsignedChannelAnnouncement_free(this_obj_conv);
18776 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
18777 LDKUnsignedChannelAnnouncement this_ptr_conv;
18778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18779 this_ptr_conv.is_owned = false;
18780 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
18781 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18782 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18783 uint64_t ret_ref = (uint64_t)ret_var.inner;
18784 if (ret_var.is_owned) {
18790 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
18791 LDKUnsignedChannelAnnouncement this_ptr_conv;
18792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18793 this_ptr_conv.is_owned = false;
18794 LDKChannelFeatures val_conv;
18795 val_conv.inner = (void*)(val & (~1));
18796 val_conv.is_owned = (val & 1) || (val == 0);
18797 val_conv = ChannelFeatures_clone(&val_conv);
18798 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
18801 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
18802 LDKUnsignedChannelAnnouncement this_ptr_conv;
18803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18804 this_ptr_conv.is_owned = false;
18805 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18806 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
18810 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
18811 LDKUnsignedChannelAnnouncement this_ptr_conv;
18812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18813 this_ptr_conv.is_owned = false;
18814 LDKThirtyTwoBytes val_ref;
18815 CHECK(*((uint32_t*)val) == 32);
18816 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18817 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
18820 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
18821 LDKUnsignedChannelAnnouncement this_ptr_conv;
18822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18823 this_ptr_conv.is_owned = false;
18824 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
18828 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
18829 LDKUnsignedChannelAnnouncement this_ptr_conv;
18830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18831 this_ptr_conv.is_owned = false;
18832 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
18835 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
18836 LDKUnsignedChannelAnnouncement this_ptr_conv;
18837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18838 this_ptr_conv.is_owned = false;
18839 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18840 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
18844 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
18845 LDKUnsignedChannelAnnouncement this_ptr_conv;
18846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18847 this_ptr_conv.is_owned = false;
18848 LDKPublicKey val_ref;
18849 CHECK(*((uint32_t*)val) == 33);
18850 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18851 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
18854 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
18855 LDKUnsignedChannelAnnouncement this_ptr_conv;
18856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18857 this_ptr_conv.is_owned = false;
18858 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18859 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
18863 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
18864 LDKUnsignedChannelAnnouncement this_ptr_conv;
18865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18866 this_ptr_conv.is_owned = false;
18867 LDKPublicKey val_ref;
18868 CHECK(*((uint32_t*)val) == 33);
18869 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18870 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
18873 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
18874 LDKUnsignedChannelAnnouncement this_ptr_conv;
18875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18876 this_ptr_conv.is_owned = false;
18877 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18878 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
18882 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
18883 LDKUnsignedChannelAnnouncement this_ptr_conv;
18884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18885 this_ptr_conv.is_owned = false;
18886 LDKPublicKey val_ref;
18887 CHECK(*((uint32_t*)val) == 33);
18888 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18889 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
18892 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
18893 LDKUnsignedChannelAnnouncement this_ptr_conv;
18894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18895 this_ptr_conv.is_owned = false;
18896 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18897 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
18901 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
18902 LDKUnsignedChannelAnnouncement this_ptr_conv;
18903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18904 this_ptr_conv.is_owned = false;
18905 LDKPublicKey val_ref;
18906 CHECK(*((uint32_t*)val) == 33);
18907 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18908 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
18911 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
18912 LDKUnsignedChannelAnnouncement orig_conv;
18913 orig_conv.inner = (void*)(orig & (~1));
18914 orig_conv.is_owned = false;
18915 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
18916 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18917 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18918 uint64_t ret_ref = (uint64_t)ret_var.inner;
18919 if (ret_var.is_owned) {
18925 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
18926 LDKChannelAnnouncement this_obj_conv;
18927 this_obj_conv.inner = (void*)(this_obj & (~1));
18928 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18929 ChannelAnnouncement_free(this_obj_conv);
18932 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
18933 LDKChannelAnnouncement this_ptr_conv;
18934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18935 this_ptr_conv.is_owned = false;
18936 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18937 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
18941 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
18942 LDKChannelAnnouncement this_ptr_conv;
18943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18944 this_ptr_conv.is_owned = false;
18945 LDKSignature val_ref;
18946 CHECK(*((uint32_t*)val) == 64);
18947 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18948 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
18951 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
18952 LDKChannelAnnouncement this_ptr_conv;
18953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18954 this_ptr_conv.is_owned = false;
18955 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18956 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
18960 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
18961 LDKChannelAnnouncement this_ptr_conv;
18962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18963 this_ptr_conv.is_owned = false;
18964 LDKSignature val_ref;
18965 CHECK(*((uint32_t*)val) == 64);
18966 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18967 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
18970 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
18971 LDKChannelAnnouncement this_ptr_conv;
18972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18973 this_ptr_conv.is_owned = false;
18974 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18975 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
18979 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
18980 LDKChannelAnnouncement this_ptr_conv;
18981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18982 this_ptr_conv.is_owned = false;
18983 LDKSignature val_ref;
18984 CHECK(*((uint32_t*)val) == 64);
18985 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18986 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
18989 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
18990 LDKChannelAnnouncement this_ptr_conv;
18991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18992 this_ptr_conv.is_owned = false;
18993 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18994 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
18998 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
18999 LDKChannelAnnouncement this_ptr_conv;
19000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19001 this_ptr_conv.is_owned = false;
19002 LDKSignature val_ref;
19003 CHECK(*((uint32_t*)val) == 64);
19004 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19005 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
19008 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
19009 LDKChannelAnnouncement this_ptr_conv;
19010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19011 this_ptr_conv.is_owned = false;
19012 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
19013 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19014 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19015 uint64_t ret_ref = (uint64_t)ret_var.inner;
19016 if (ret_var.is_owned) {
19022 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
19023 LDKChannelAnnouncement this_ptr_conv;
19024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19025 this_ptr_conv.is_owned = false;
19026 LDKUnsignedChannelAnnouncement val_conv;
19027 val_conv.inner = (void*)(val & (~1));
19028 val_conv.is_owned = (val & 1) || (val == 0);
19029 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
19030 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
19033 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) {
19034 LDKSignature node_signature_1_arg_ref;
19035 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
19036 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
19037 LDKSignature node_signature_2_arg_ref;
19038 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
19039 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
19040 LDKSignature bitcoin_signature_1_arg_ref;
19041 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
19042 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
19043 LDKSignature bitcoin_signature_2_arg_ref;
19044 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
19045 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
19046 LDKUnsignedChannelAnnouncement contents_arg_conv;
19047 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19048 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19049 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
19050 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);
19051 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19052 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19053 uint64_t ret_ref = (uint64_t)ret_var.inner;
19054 if (ret_var.is_owned) {
19060 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
19061 LDKChannelAnnouncement orig_conv;
19062 orig_conv.inner = (void*)(orig & (~1));
19063 orig_conv.is_owned = false;
19064 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
19065 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19066 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19067 uint64_t ret_ref = (uint64_t)ret_var.inner;
19068 if (ret_var.is_owned) {
19074 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
19075 LDKUnsignedChannelUpdate this_obj_conv;
19076 this_obj_conv.inner = (void*)(this_obj & (~1));
19077 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19078 UnsignedChannelUpdate_free(this_obj_conv);
19081 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
19082 LDKUnsignedChannelUpdate this_ptr_conv;
19083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19084 this_ptr_conv.is_owned = false;
19085 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19086 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
19090 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19091 LDKUnsignedChannelUpdate this_ptr_conv;
19092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19093 this_ptr_conv.is_owned = false;
19094 LDKThirtyTwoBytes val_ref;
19095 CHECK(*((uint32_t*)val) == 32);
19096 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19097 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
19100 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
19101 LDKUnsignedChannelUpdate this_ptr_conv;
19102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19103 this_ptr_conv.is_owned = false;
19104 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
19108 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
19109 LDKUnsignedChannelUpdate this_ptr_conv;
19110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19111 this_ptr_conv.is_owned = false;
19112 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
19115 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
19116 LDKUnsignedChannelUpdate this_ptr_conv;
19117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19118 this_ptr_conv.is_owned = false;
19119 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
19123 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
19124 LDKUnsignedChannelUpdate this_ptr_conv;
19125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19126 this_ptr_conv.is_owned = false;
19127 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
19130 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
19131 LDKUnsignedChannelUpdate this_ptr_conv;
19132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19133 this_ptr_conv.is_owned = false;
19134 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
19138 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
19139 LDKUnsignedChannelUpdate this_ptr_conv;
19140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19141 this_ptr_conv.is_owned = false;
19142 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
19145 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
19146 LDKUnsignedChannelUpdate this_ptr_conv;
19147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19148 this_ptr_conv.is_owned = false;
19149 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
19153 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
19154 LDKUnsignedChannelUpdate this_ptr_conv;
19155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19156 this_ptr_conv.is_owned = false;
19157 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
19160 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
19161 LDKUnsignedChannelUpdate this_ptr_conv;
19162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19163 this_ptr_conv.is_owned = false;
19164 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
19168 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
19169 LDKUnsignedChannelUpdate this_ptr_conv;
19170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19171 this_ptr_conv.is_owned = false;
19172 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
19175 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
19176 LDKUnsignedChannelUpdate this_ptr_conv;
19177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19178 this_ptr_conv.is_owned = false;
19179 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
19183 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
19184 LDKUnsignedChannelUpdate this_ptr_conv;
19185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19186 this_ptr_conv.is_owned = false;
19187 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
19190 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
19191 LDKUnsignedChannelUpdate this_ptr_conv;
19192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19193 this_ptr_conv.is_owned = false;
19194 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
19198 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
19199 LDKUnsignedChannelUpdate this_ptr_conv;
19200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19201 this_ptr_conv.is_owned = false;
19202 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
19205 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
19206 LDKUnsignedChannelUpdate orig_conv;
19207 orig_conv.inner = (void*)(orig & (~1));
19208 orig_conv.is_owned = false;
19209 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
19210 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19211 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19212 uint64_t ret_ref = (uint64_t)ret_var.inner;
19213 if (ret_var.is_owned) {
19219 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
19220 LDKChannelUpdate this_obj_conv;
19221 this_obj_conv.inner = (void*)(this_obj & (~1));
19222 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19223 ChannelUpdate_free(this_obj_conv);
19226 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
19227 LDKChannelUpdate this_ptr_conv;
19228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19229 this_ptr_conv.is_owned = false;
19230 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19231 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
19235 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
19236 LDKChannelUpdate this_ptr_conv;
19237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19238 this_ptr_conv.is_owned = false;
19239 LDKSignature val_ref;
19240 CHECK(*((uint32_t*)val) == 64);
19241 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19242 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
19245 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
19246 LDKChannelUpdate this_ptr_conv;
19247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19248 this_ptr_conv.is_owned = false;
19249 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
19250 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19251 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19252 uint64_t ret_ref = (uint64_t)ret_var.inner;
19253 if (ret_var.is_owned) {
19259 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
19260 LDKChannelUpdate this_ptr_conv;
19261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19262 this_ptr_conv.is_owned = false;
19263 LDKUnsignedChannelUpdate val_conv;
19264 val_conv.inner = (void*)(val & (~1));
19265 val_conv.is_owned = (val & 1) || (val == 0);
19266 val_conv = UnsignedChannelUpdate_clone(&val_conv);
19267 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
19270 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
19271 LDKSignature signature_arg_ref;
19272 CHECK(*((uint32_t*)signature_arg) == 64);
19273 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
19274 LDKUnsignedChannelUpdate contents_arg_conv;
19275 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19276 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19277 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
19278 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
19279 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19280 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19281 uint64_t ret_ref = (uint64_t)ret_var.inner;
19282 if (ret_var.is_owned) {
19288 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
19289 LDKChannelUpdate orig_conv;
19290 orig_conv.inner = (void*)(orig & (~1));
19291 orig_conv.is_owned = false;
19292 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
19293 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19294 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19295 uint64_t ret_ref = (uint64_t)ret_var.inner;
19296 if (ret_var.is_owned) {
19302 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
19303 LDKQueryChannelRange this_obj_conv;
19304 this_obj_conv.inner = (void*)(this_obj & (~1));
19305 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19306 QueryChannelRange_free(this_obj_conv);
19309 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
19310 LDKQueryChannelRange this_ptr_conv;
19311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19312 this_ptr_conv.is_owned = false;
19313 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19314 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
19318 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19319 LDKQueryChannelRange this_ptr_conv;
19320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19321 this_ptr_conv.is_owned = false;
19322 LDKThirtyTwoBytes val_ref;
19323 CHECK(*((uint32_t*)val) == 32);
19324 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19325 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19328 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
19329 LDKQueryChannelRange this_ptr_conv;
19330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19331 this_ptr_conv.is_owned = false;
19332 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
19336 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
19337 LDKQueryChannelRange this_ptr_conv;
19338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19339 this_ptr_conv.is_owned = false;
19340 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
19343 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
19344 LDKQueryChannelRange this_ptr_conv;
19345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19346 this_ptr_conv.is_owned = false;
19347 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
19351 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
19352 LDKQueryChannelRange this_ptr_conv;
19353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19354 this_ptr_conv.is_owned = false;
19355 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19358 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
19359 LDKThirtyTwoBytes chain_hash_arg_ref;
19360 CHECK(*((uint32_t*)chain_hash_arg) == 32);
19361 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
19362 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
19363 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19364 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19365 uint64_t ret_ref = (uint64_t)ret_var.inner;
19366 if (ret_var.is_owned) {
19372 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
19373 LDKQueryChannelRange orig_conv;
19374 orig_conv.inner = (void*)(orig & (~1));
19375 orig_conv.is_owned = false;
19376 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
19377 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19378 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19379 uint64_t ret_ref = (uint64_t)ret_var.inner;
19380 if (ret_var.is_owned) {
19386 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
19387 LDKReplyChannelRange this_obj_conv;
19388 this_obj_conv.inner = (void*)(this_obj & (~1));
19389 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19390 ReplyChannelRange_free(this_obj_conv);
19393 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
19394 LDKReplyChannelRange this_ptr_conv;
19395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19396 this_ptr_conv.is_owned = false;
19397 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19398 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
19402 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19403 LDKReplyChannelRange this_ptr_conv;
19404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19405 this_ptr_conv.is_owned = false;
19406 LDKThirtyTwoBytes val_ref;
19407 CHECK(*((uint32_t*)val) == 32);
19408 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19409 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19412 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
19413 LDKReplyChannelRange this_ptr_conv;
19414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19415 this_ptr_conv.is_owned = false;
19416 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
19420 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
19421 LDKReplyChannelRange this_ptr_conv;
19422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19423 this_ptr_conv.is_owned = false;
19424 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
19427 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
19428 LDKReplyChannelRange this_ptr_conv;
19429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19430 this_ptr_conv.is_owned = false;
19431 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
19435 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
19436 LDKReplyChannelRange this_ptr_conv;
19437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19438 this_ptr_conv.is_owned = false;
19439 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19442 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
19443 LDKReplyChannelRange this_ptr_conv;
19444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19445 this_ptr_conv.is_owned = false;
19446 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
19450 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
19451 LDKReplyChannelRange this_ptr_conv;
19452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19453 this_ptr_conv.is_owned = false;
19454 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
19457 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
19458 LDKReplyChannelRange this_ptr_conv;
19459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19460 this_ptr_conv.is_owned = false;
19461 LDKCVec_u64Z val_constr;
19462 val_constr.datalen = *((uint32_t*)val);
19463 if (val_constr.datalen > 0)
19464 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19466 val_constr.data = NULL;
19467 int64_t* val_vals = (int64_t*)(val + 4);
19468 for (size_t i = 0; i < val_constr.datalen; i++) {
19469 int64_t val_conv_8 = val_vals[i];
19470 val_constr.data[i] = val_conv_8;
19472 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
19475 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) {
19476 LDKThirtyTwoBytes chain_hash_arg_ref;
19477 CHECK(*((uint32_t*)chain_hash_arg) == 32);
19478 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
19479 LDKCVec_u64Z short_channel_ids_arg_constr;
19480 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
19481 if (short_channel_ids_arg_constr.datalen > 0)
19482 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19484 short_channel_ids_arg_constr.data = NULL;
19485 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
19486 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
19487 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
19488 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
19490 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
19491 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19492 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19493 uint64_t ret_ref = (uint64_t)ret_var.inner;
19494 if (ret_var.is_owned) {
19500 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
19501 LDKReplyChannelRange orig_conv;
19502 orig_conv.inner = (void*)(orig & (~1));
19503 orig_conv.is_owned = false;
19504 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
19505 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19506 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19507 uint64_t ret_ref = (uint64_t)ret_var.inner;
19508 if (ret_var.is_owned) {
19514 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
19515 LDKQueryShortChannelIds this_obj_conv;
19516 this_obj_conv.inner = (void*)(this_obj & (~1));
19517 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19518 QueryShortChannelIds_free(this_obj_conv);
19521 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
19522 LDKQueryShortChannelIds this_ptr_conv;
19523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19524 this_ptr_conv.is_owned = false;
19525 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19526 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
19530 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19531 LDKQueryShortChannelIds this_ptr_conv;
19532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19533 this_ptr_conv.is_owned = false;
19534 LDKThirtyTwoBytes val_ref;
19535 CHECK(*((uint32_t*)val) == 32);
19536 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19537 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
19540 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
19541 LDKQueryShortChannelIds this_ptr_conv;
19542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19543 this_ptr_conv.is_owned = false;
19544 LDKCVec_u64Z val_constr;
19545 val_constr.datalen = *((uint32_t*)val);
19546 if (val_constr.datalen > 0)
19547 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19549 val_constr.data = NULL;
19550 int64_t* val_vals = (int64_t*)(val + 4);
19551 for (size_t i = 0; i < val_constr.datalen; i++) {
19552 int64_t val_conv_8 = val_vals[i];
19553 val_constr.data[i] = val_conv_8;
19555 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
19558 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
19559 LDKThirtyTwoBytes chain_hash_arg_ref;
19560 CHECK(*((uint32_t*)chain_hash_arg) == 32);
19561 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
19562 LDKCVec_u64Z short_channel_ids_arg_constr;
19563 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
19564 if (short_channel_ids_arg_constr.datalen > 0)
19565 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19567 short_channel_ids_arg_constr.data = NULL;
19568 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
19569 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
19570 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
19571 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
19573 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
19574 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19575 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19576 uint64_t ret_ref = (uint64_t)ret_var.inner;
19577 if (ret_var.is_owned) {
19583 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
19584 LDKQueryShortChannelIds orig_conv;
19585 orig_conv.inner = (void*)(orig & (~1));
19586 orig_conv.is_owned = false;
19587 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
19588 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19589 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19590 uint64_t ret_ref = (uint64_t)ret_var.inner;
19591 if (ret_var.is_owned) {
19597 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
19598 LDKReplyShortChannelIdsEnd this_obj_conv;
19599 this_obj_conv.inner = (void*)(this_obj & (~1));
19600 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19601 ReplyShortChannelIdsEnd_free(this_obj_conv);
19604 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
19605 LDKReplyShortChannelIdsEnd this_ptr_conv;
19606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19607 this_ptr_conv.is_owned = false;
19608 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19609 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
19613 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19614 LDKReplyShortChannelIdsEnd this_ptr_conv;
19615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19616 this_ptr_conv.is_owned = false;
19617 LDKThirtyTwoBytes val_ref;
19618 CHECK(*((uint32_t*)val) == 32);
19619 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19620 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
19623 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
19624 LDKReplyShortChannelIdsEnd this_ptr_conv;
19625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19626 this_ptr_conv.is_owned = false;
19627 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
19631 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
19632 LDKReplyShortChannelIdsEnd this_ptr_conv;
19633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19634 this_ptr_conv.is_owned = false;
19635 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
19638 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
19639 LDKThirtyTwoBytes chain_hash_arg_ref;
19640 CHECK(*((uint32_t*)chain_hash_arg) == 32);
19641 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
19642 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
19643 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19644 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19645 uint64_t ret_ref = (uint64_t)ret_var.inner;
19646 if (ret_var.is_owned) {
19652 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
19653 LDKReplyShortChannelIdsEnd orig_conv;
19654 orig_conv.inner = (void*)(orig & (~1));
19655 orig_conv.is_owned = false;
19656 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
19657 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19658 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19659 uint64_t ret_ref = (uint64_t)ret_var.inner;
19660 if (ret_var.is_owned) {
19666 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
19667 LDKGossipTimestampFilter this_obj_conv;
19668 this_obj_conv.inner = (void*)(this_obj & (~1));
19669 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19670 GossipTimestampFilter_free(this_obj_conv);
19673 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
19674 LDKGossipTimestampFilter this_ptr_conv;
19675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19676 this_ptr_conv.is_owned = false;
19677 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19678 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
19682 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19683 LDKGossipTimestampFilter this_ptr_conv;
19684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19685 this_ptr_conv.is_owned = false;
19686 LDKThirtyTwoBytes val_ref;
19687 CHECK(*((uint32_t*)val) == 32);
19688 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19689 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
19692 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
19693 LDKGossipTimestampFilter this_ptr_conv;
19694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19695 this_ptr_conv.is_owned = false;
19696 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
19700 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
19701 LDKGossipTimestampFilter this_ptr_conv;
19702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19703 this_ptr_conv.is_owned = false;
19704 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
19707 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
19708 LDKGossipTimestampFilter this_ptr_conv;
19709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19710 this_ptr_conv.is_owned = false;
19711 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
19715 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
19716 LDKGossipTimestampFilter this_ptr_conv;
19717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19718 this_ptr_conv.is_owned = false;
19719 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
19722 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
19723 LDKThirtyTwoBytes chain_hash_arg_ref;
19724 CHECK(*((uint32_t*)chain_hash_arg) == 32);
19725 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
19726 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
19727 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19728 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19729 uint64_t ret_ref = (uint64_t)ret_var.inner;
19730 if (ret_var.is_owned) {
19736 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
19737 LDKGossipTimestampFilter orig_conv;
19738 orig_conv.inner = (void*)(orig & (~1));
19739 orig_conv.is_owned = false;
19740 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
19741 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19742 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19743 uint64_t ret_ref = (uint64_t)ret_var.inner;
19744 if (ret_var.is_owned) {
19750 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
19751 if ((this_ptr & 1) != 0) return;
19752 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
19753 FREE((void*)this_ptr);
19754 ErrorAction_free(this_ptr_conv);
19757 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
19758 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
19759 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19760 *ret_copy = ErrorAction_clone(orig_conv);
19761 uint64_t ret_ref = (uint64_t)ret_copy;
19765 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
19766 LDKErrorMessage msg_conv;
19767 msg_conv.inner = (void*)(msg & (~1));
19768 msg_conv.is_owned = (msg & 1) || (msg == 0);
19769 msg_conv = ErrorMessage_clone(&msg_conv);
19770 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19771 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
19772 uint64_t ret_ref = (uint64_t)ret_copy;
19776 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_error() {
19777 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19778 *ret_copy = ErrorAction_ignore_error();
19779 uint64_t ret_ref = (uint64_t)ret_copy;
19783 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
19784 LDKLevel a_conv = LDKLevel_from_js(a);
19785 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19786 *ret_copy = ErrorAction_ignore_and_log(a_conv);
19787 uint64_t ret_ref = (uint64_t)ret_copy;
19791 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) {
19792 LDKErrorMessage msg_conv;
19793 msg_conv.inner = (void*)(msg & (~1));
19794 msg_conv.is_owned = (msg & 1) || (msg == 0);
19795 msg_conv = ErrorMessage_clone(&msg_conv);
19796 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19797 *ret_copy = ErrorAction_send_error_message(msg_conv);
19798 uint64_t ret_ref = (uint64_t)ret_copy;
19802 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
19803 LDKLightningError this_obj_conv;
19804 this_obj_conv.inner = (void*)(this_obj & (~1));
19805 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19806 LightningError_free(this_obj_conv);
19809 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
19810 LDKLightningError this_ptr_conv;
19811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19812 this_ptr_conv.is_owned = false;
19813 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
19814 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
19819 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
19820 LDKLightningError this_ptr_conv;
19821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19822 this_ptr_conv.is_owned = false;
19823 LDKStr val_conv = str_ref_to_owned_c(val);
19824 LightningError_set_err(&this_ptr_conv, val_conv);
19827 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
19828 LDKLightningError this_ptr_conv;
19829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19830 this_ptr_conv.is_owned = false;
19831 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19832 *ret_copy = LightningError_get_action(&this_ptr_conv);
19833 uint64_t ret_ref = (uint64_t)ret_copy;
19837 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
19838 LDKLightningError this_ptr_conv;
19839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19840 this_ptr_conv.is_owned = false;
19841 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
19842 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
19843 LightningError_set_action(&this_ptr_conv, val_conv);
19846 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
19847 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
19848 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
19849 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
19850 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
19851 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19852 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19853 uint64_t ret_ref = (uint64_t)ret_var.inner;
19854 if (ret_var.is_owned) {
19860 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
19861 LDKLightningError orig_conv;
19862 orig_conv.inner = (void*)(orig & (~1));
19863 orig_conv.is_owned = false;
19864 LDKLightningError ret_var = LightningError_clone(&orig_conv);
19865 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19866 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19867 uint64_t ret_ref = (uint64_t)ret_var.inner;
19868 if (ret_var.is_owned) {
19874 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
19875 LDKCommitmentUpdate this_obj_conv;
19876 this_obj_conv.inner = (void*)(this_obj & (~1));
19877 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19878 CommitmentUpdate_free(this_obj_conv);
19881 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
19882 LDKCommitmentUpdate this_ptr_conv;
19883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19884 this_ptr_conv.is_owned = false;
19885 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
19886 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19887 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19888 for (size_t p = 0; p < ret_var.datalen; p++) {
19889 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
19890 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19891 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19892 uint64_t ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
19893 if (ret_conv_15_var.is_owned) {
19894 ret_conv_15_ref |= 1;
19896 ret_arr_ptr[p] = ret_conv_15_ref;
19898 FREE(ret_var.data);
19902 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
19903 LDKCommitmentUpdate this_ptr_conv;
19904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19905 this_ptr_conv.is_owned = false;
19906 LDKCVec_UpdateAddHTLCZ val_constr;
19907 val_constr.datalen = *((uint32_t*)val);
19908 if (val_constr.datalen > 0)
19909 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19911 val_constr.data = NULL;
19912 uint32_t* val_vals = (uint32_t*)(val + 4);
19913 for (size_t p = 0; p < val_constr.datalen; p++) {
19914 uint32_t val_conv_15 = val_vals[p];
19915 LDKUpdateAddHTLC val_conv_15_conv;
19916 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
19917 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
19918 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
19919 val_constr.data[p] = val_conv_15_conv;
19921 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
19924 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
19925 LDKCommitmentUpdate this_ptr_conv;
19926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19927 this_ptr_conv.is_owned = false;
19928 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
19929 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19930 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19931 for (size_t t = 0; t < ret_var.datalen; t++) {
19932 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
19933 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19934 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19935 uint64_t ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
19936 if (ret_conv_19_var.is_owned) {
19937 ret_conv_19_ref |= 1;
19939 ret_arr_ptr[t] = ret_conv_19_ref;
19941 FREE(ret_var.data);
19945 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
19946 LDKCommitmentUpdate this_ptr_conv;
19947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19948 this_ptr_conv.is_owned = false;
19949 LDKCVec_UpdateFulfillHTLCZ val_constr;
19950 val_constr.datalen = *((uint32_t*)val);
19951 if (val_constr.datalen > 0)
19952 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19954 val_constr.data = NULL;
19955 uint32_t* val_vals = (uint32_t*)(val + 4);
19956 for (size_t t = 0; t < val_constr.datalen; t++) {
19957 uint32_t val_conv_19 = val_vals[t];
19958 LDKUpdateFulfillHTLC val_conv_19_conv;
19959 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
19960 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
19961 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
19962 val_constr.data[t] = val_conv_19_conv;
19964 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
19967 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
19968 LDKCommitmentUpdate this_ptr_conv;
19969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19970 this_ptr_conv.is_owned = false;
19971 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
19972 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19973 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19974 for (size_t q = 0; q < ret_var.datalen; q++) {
19975 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
19976 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19977 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19978 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
19979 if (ret_conv_16_var.is_owned) {
19980 ret_conv_16_ref |= 1;
19982 ret_arr_ptr[q] = ret_conv_16_ref;
19984 FREE(ret_var.data);
19988 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
19989 LDKCommitmentUpdate this_ptr_conv;
19990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19991 this_ptr_conv.is_owned = false;
19992 LDKCVec_UpdateFailHTLCZ val_constr;
19993 val_constr.datalen = *((uint32_t*)val);
19994 if (val_constr.datalen > 0)
19995 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19997 val_constr.data = NULL;
19998 uint32_t* val_vals = (uint32_t*)(val + 4);
19999 for (size_t q = 0; q < val_constr.datalen; q++) {
20000 uint32_t val_conv_16 = val_vals[q];
20001 LDKUpdateFailHTLC val_conv_16_conv;
20002 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
20003 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
20004 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
20005 val_constr.data[q] = val_conv_16_conv;
20007 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
20010 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
20011 LDKCommitmentUpdate this_ptr_conv;
20012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20013 this_ptr_conv.is_owned = false;
20014 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
20015 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
20016 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
20017 for (size_t z = 0; z < ret_var.datalen; z++) {
20018 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
20019 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20020 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20021 uint64_t ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
20022 if (ret_conv_25_var.is_owned) {
20023 ret_conv_25_ref |= 1;
20025 ret_arr_ptr[z] = ret_conv_25_ref;
20027 FREE(ret_var.data);
20031 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
20032 LDKCommitmentUpdate this_ptr_conv;
20033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20034 this_ptr_conv.is_owned = false;
20035 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
20036 val_constr.datalen = *((uint32_t*)val);
20037 if (val_constr.datalen > 0)
20038 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
20040 val_constr.data = NULL;
20041 uint32_t* val_vals = (uint32_t*)(val + 4);
20042 for (size_t z = 0; z < val_constr.datalen; z++) {
20043 uint32_t val_conv_25 = val_vals[z];
20044 LDKUpdateFailMalformedHTLC val_conv_25_conv;
20045 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
20046 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
20047 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
20048 val_constr.data[z] = val_conv_25_conv;
20050 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
20053 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
20054 LDKCommitmentUpdate this_ptr_conv;
20055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20056 this_ptr_conv.is_owned = false;
20057 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
20058 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20059 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20060 uint64_t ret_ref = (uint64_t)ret_var.inner;
20061 if (ret_var.is_owned) {
20067 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
20068 LDKCommitmentUpdate this_ptr_conv;
20069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20070 this_ptr_conv.is_owned = false;
20071 LDKUpdateFee val_conv;
20072 val_conv.inner = (void*)(val & (~1));
20073 val_conv.is_owned = (val & 1) || (val == 0);
20074 val_conv = UpdateFee_clone(&val_conv);
20075 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
20078 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
20079 LDKCommitmentUpdate this_ptr_conv;
20080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20081 this_ptr_conv.is_owned = false;
20082 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
20083 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20084 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20085 uint64_t ret_ref = (uint64_t)ret_var.inner;
20086 if (ret_var.is_owned) {
20092 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
20093 LDKCommitmentUpdate this_ptr_conv;
20094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20095 this_ptr_conv.is_owned = false;
20096 LDKCommitmentSigned val_conv;
20097 val_conv.inner = (void*)(val & (~1));
20098 val_conv.is_owned = (val & 1) || (val == 0);
20099 val_conv = CommitmentSigned_clone(&val_conv);
20100 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
20103 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) {
20104 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
20105 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
20106 if (update_add_htlcs_arg_constr.datalen > 0)
20107 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
20109 update_add_htlcs_arg_constr.data = NULL;
20110 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
20111 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
20112 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
20113 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
20114 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
20115 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
20116 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
20117 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
20119 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
20120 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
20121 if (update_fulfill_htlcs_arg_constr.datalen > 0)
20122 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
20124 update_fulfill_htlcs_arg_constr.data = NULL;
20125 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
20126 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
20127 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
20128 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
20129 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
20130 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
20131 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
20132 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
20134 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
20135 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
20136 if (update_fail_htlcs_arg_constr.datalen > 0)
20137 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
20139 update_fail_htlcs_arg_constr.data = NULL;
20140 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
20141 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
20142 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
20143 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
20144 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
20145 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
20146 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
20147 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
20149 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
20150 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
20151 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
20152 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
20154 update_fail_malformed_htlcs_arg_constr.data = NULL;
20155 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
20156 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
20157 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
20158 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
20159 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
20160 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);
20161 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
20162 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
20164 LDKUpdateFee update_fee_arg_conv;
20165 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
20166 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
20167 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
20168 LDKCommitmentSigned commitment_signed_arg_conv;
20169 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
20170 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
20171 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
20172 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);
20173 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20174 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20175 uint64_t ret_ref = (uint64_t)ret_var.inner;
20176 if (ret_var.is_owned) {
20182 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
20183 LDKCommitmentUpdate orig_conv;
20184 orig_conv.inner = (void*)(orig & (~1));
20185 orig_conv.is_owned = false;
20186 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
20187 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20188 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20189 uint64_t ret_ref = (uint64_t)ret_var.inner;
20190 if (ret_var.is_owned) {
20196 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
20197 if ((this_ptr & 1) != 0) return;
20198 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
20199 FREE((void*)this_ptr);
20200 ChannelMessageHandler_free(this_ptr_conv);
20203 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
20204 if ((this_ptr & 1) != 0) return;
20205 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
20206 FREE((void*)this_ptr);
20207 RoutingMessageHandler_free(this_ptr_conv);
20210 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
20211 LDKAcceptChannel obj_conv;
20212 obj_conv.inner = (void*)(obj & (~1));
20213 obj_conv.is_owned = false;
20214 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
20215 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20216 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20217 CVec_u8Z_free(ret_var);
20221 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
20222 LDKu8slice ser_ref;
20223 ser_ref.datalen = *((uint32_t*)ser);
20224 ser_ref.data = (int8_t*)(ser + 4);
20225 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20226 *ret_conv = AcceptChannel_read(ser_ref);
20227 return (uint64_t)ret_conv;
20230 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
20231 LDKAnnouncementSignatures obj_conv;
20232 obj_conv.inner = (void*)(obj & (~1));
20233 obj_conv.is_owned = false;
20234 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
20235 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20236 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20237 CVec_u8Z_free(ret_var);
20241 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
20242 LDKu8slice ser_ref;
20243 ser_ref.datalen = *((uint32_t*)ser);
20244 ser_ref.data = (int8_t*)(ser + 4);
20245 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20246 *ret_conv = AnnouncementSignatures_read(ser_ref);
20247 return (uint64_t)ret_conv;
20250 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
20251 LDKChannelReestablish obj_conv;
20252 obj_conv.inner = (void*)(obj & (~1));
20253 obj_conv.is_owned = false;
20254 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
20255 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20256 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20257 CVec_u8Z_free(ret_var);
20261 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
20262 LDKu8slice ser_ref;
20263 ser_ref.datalen = *((uint32_t*)ser);
20264 ser_ref.data = (int8_t*)(ser + 4);
20265 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20266 *ret_conv = ChannelReestablish_read(ser_ref);
20267 return (uint64_t)ret_conv;
20270 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
20271 LDKClosingSigned obj_conv;
20272 obj_conv.inner = (void*)(obj & (~1));
20273 obj_conv.is_owned = false;
20274 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
20275 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20276 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20277 CVec_u8Z_free(ret_var);
20281 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
20282 LDKu8slice ser_ref;
20283 ser_ref.datalen = *((uint32_t*)ser);
20284 ser_ref.data = (int8_t*)(ser + 4);
20285 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20286 *ret_conv = ClosingSigned_read(ser_ref);
20287 return (uint64_t)ret_conv;
20290 int8_tArray __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
20291 LDKClosingSignedFeeRange obj_conv;
20292 obj_conv.inner = (void*)(obj & (~1));
20293 obj_conv.is_owned = false;
20294 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
20295 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20296 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20297 CVec_u8Z_free(ret_var);
20301 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
20302 LDKu8slice ser_ref;
20303 ser_ref.datalen = *((uint32_t*)ser);
20304 ser_ref.data = (int8_t*)(ser + 4);
20305 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20306 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
20307 return (uint64_t)ret_conv;
20310 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
20311 LDKCommitmentSigned obj_conv;
20312 obj_conv.inner = (void*)(obj & (~1));
20313 obj_conv.is_owned = false;
20314 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
20315 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20316 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20317 CVec_u8Z_free(ret_var);
20321 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
20322 LDKu8slice ser_ref;
20323 ser_ref.datalen = *((uint32_t*)ser);
20324 ser_ref.data = (int8_t*)(ser + 4);
20325 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20326 *ret_conv = CommitmentSigned_read(ser_ref);
20327 return (uint64_t)ret_conv;
20330 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
20331 LDKFundingCreated obj_conv;
20332 obj_conv.inner = (void*)(obj & (~1));
20333 obj_conv.is_owned = false;
20334 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
20335 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20336 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20337 CVec_u8Z_free(ret_var);
20341 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
20342 LDKu8slice ser_ref;
20343 ser_ref.datalen = *((uint32_t*)ser);
20344 ser_ref.data = (int8_t*)(ser + 4);
20345 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20346 *ret_conv = FundingCreated_read(ser_ref);
20347 return (uint64_t)ret_conv;
20350 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
20351 LDKFundingSigned obj_conv;
20352 obj_conv.inner = (void*)(obj & (~1));
20353 obj_conv.is_owned = false;
20354 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
20355 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20356 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20357 CVec_u8Z_free(ret_var);
20361 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
20362 LDKu8slice ser_ref;
20363 ser_ref.datalen = *((uint32_t*)ser);
20364 ser_ref.data = (int8_t*)(ser + 4);
20365 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20366 *ret_conv = FundingSigned_read(ser_ref);
20367 return (uint64_t)ret_conv;
20370 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
20371 LDKFundingLocked obj_conv;
20372 obj_conv.inner = (void*)(obj & (~1));
20373 obj_conv.is_owned = false;
20374 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
20375 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20376 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20377 CVec_u8Z_free(ret_var);
20381 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
20382 LDKu8slice ser_ref;
20383 ser_ref.datalen = *((uint32_t*)ser);
20384 ser_ref.data = (int8_t*)(ser + 4);
20385 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
20386 *ret_conv = FundingLocked_read(ser_ref);
20387 return (uint64_t)ret_conv;
20390 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
20392 obj_conv.inner = (void*)(obj & (~1));
20393 obj_conv.is_owned = false;
20394 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
20395 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20396 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20397 CVec_u8Z_free(ret_var);
20401 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
20402 LDKu8slice ser_ref;
20403 ser_ref.datalen = *((uint32_t*)ser);
20404 ser_ref.data = (int8_t*)(ser + 4);
20405 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20406 *ret_conv = Init_read(ser_ref);
20407 return (uint64_t)ret_conv;
20410 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
20411 LDKOpenChannel obj_conv;
20412 obj_conv.inner = (void*)(obj & (~1));
20413 obj_conv.is_owned = false;
20414 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
20415 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20416 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20417 CVec_u8Z_free(ret_var);
20421 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
20422 LDKu8slice ser_ref;
20423 ser_ref.datalen = *((uint32_t*)ser);
20424 ser_ref.data = (int8_t*)(ser + 4);
20425 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20426 *ret_conv = OpenChannel_read(ser_ref);
20427 return (uint64_t)ret_conv;
20430 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
20431 LDKRevokeAndACK obj_conv;
20432 obj_conv.inner = (void*)(obj & (~1));
20433 obj_conv.is_owned = false;
20434 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
20435 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20436 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20437 CVec_u8Z_free(ret_var);
20441 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
20442 LDKu8slice ser_ref;
20443 ser_ref.datalen = *((uint32_t*)ser);
20444 ser_ref.data = (int8_t*)(ser + 4);
20445 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20446 *ret_conv = RevokeAndACK_read(ser_ref);
20447 return (uint64_t)ret_conv;
20450 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
20451 LDKShutdown obj_conv;
20452 obj_conv.inner = (void*)(obj & (~1));
20453 obj_conv.is_owned = false;
20454 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
20455 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20456 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20457 CVec_u8Z_free(ret_var);
20461 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
20462 LDKu8slice ser_ref;
20463 ser_ref.datalen = *((uint32_t*)ser);
20464 ser_ref.data = (int8_t*)(ser + 4);
20465 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20466 *ret_conv = Shutdown_read(ser_ref);
20467 return (uint64_t)ret_conv;
20470 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
20471 LDKUpdateFailHTLC obj_conv;
20472 obj_conv.inner = (void*)(obj & (~1));
20473 obj_conv.is_owned = false;
20474 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
20475 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20476 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20477 CVec_u8Z_free(ret_var);
20481 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
20482 LDKu8slice ser_ref;
20483 ser_ref.datalen = *((uint32_t*)ser);
20484 ser_ref.data = (int8_t*)(ser + 4);
20485 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20486 *ret_conv = UpdateFailHTLC_read(ser_ref);
20487 return (uint64_t)ret_conv;
20490 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
20491 LDKUpdateFailMalformedHTLC obj_conv;
20492 obj_conv.inner = (void*)(obj & (~1));
20493 obj_conv.is_owned = false;
20494 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
20495 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20496 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20497 CVec_u8Z_free(ret_var);
20501 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
20502 LDKu8slice ser_ref;
20503 ser_ref.datalen = *((uint32_t*)ser);
20504 ser_ref.data = (int8_t*)(ser + 4);
20505 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20506 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
20507 return (uint64_t)ret_conv;
20510 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
20511 LDKUpdateFee obj_conv;
20512 obj_conv.inner = (void*)(obj & (~1));
20513 obj_conv.is_owned = false;
20514 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
20515 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20516 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20517 CVec_u8Z_free(ret_var);
20521 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
20522 LDKu8slice ser_ref;
20523 ser_ref.datalen = *((uint32_t*)ser);
20524 ser_ref.data = (int8_t*)(ser + 4);
20525 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20526 *ret_conv = UpdateFee_read(ser_ref);
20527 return (uint64_t)ret_conv;
20530 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
20531 LDKUpdateFulfillHTLC obj_conv;
20532 obj_conv.inner = (void*)(obj & (~1));
20533 obj_conv.is_owned = false;
20534 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
20535 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20536 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20537 CVec_u8Z_free(ret_var);
20541 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
20542 LDKu8slice ser_ref;
20543 ser_ref.datalen = *((uint32_t*)ser);
20544 ser_ref.data = (int8_t*)(ser + 4);
20545 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20546 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
20547 return (uint64_t)ret_conv;
20550 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
20551 LDKUpdateAddHTLC obj_conv;
20552 obj_conv.inner = (void*)(obj & (~1));
20553 obj_conv.is_owned = false;
20554 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
20555 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20556 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20557 CVec_u8Z_free(ret_var);
20561 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
20562 LDKu8slice ser_ref;
20563 ser_ref.datalen = *((uint32_t*)ser);
20564 ser_ref.data = (int8_t*)(ser + 4);
20565 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20566 *ret_conv = UpdateAddHTLC_read(ser_ref);
20567 return (uint64_t)ret_conv;
20570 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
20572 obj_conv.inner = (void*)(obj & (~1));
20573 obj_conv.is_owned = false;
20574 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
20575 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20576 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20577 CVec_u8Z_free(ret_var);
20581 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
20582 LDKu8slice ser_ref;
20583 ser_ref.datalen = *((uint32_t*)ser);
20584 ser_ref.data = (int8_t*)(ser + 4);
20585 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20586 *ret_conv = Ping_read(ser_ref);
20587 return (uint64_t)ret_conv;
20590 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
20592 obj_conv.inner = (void*)(obj & (~1));
20593 obj_conv.is_owned = false;
20594 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
20595 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20596 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20597 CVec_u8Z_free(ret_var);
20601 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
20602 LDKu8slice ser_ref;
20603 ser_ref.datalen = *((uint32_t*)ser);
20604 ser_ref.data = (int8_t*)(ser + 4);
20605 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20606 *ret_conv = Pong_read(ser_ref);
20607 return (uint64_t)ret_conv;
20610 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
20611 LDKUnsignedChannelAnnouncement obj_conv;
20612 obj_conv.inner = (void*)(obj & (~1));
20613 obj_conv.is_owned = false;
20614 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
20615 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20616 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20617 CVec_u8Z_free(ret_var);
20621 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
20622 LDKu8slice ser_ref;
20623 ser_ref.datalen = *((uint32_t*)ser);
20624 ser_ref.data = (int8_t*)(ser + 4);
20625 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20626 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
20627 return (uint64_t)ret_conv;
20630 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
20631 LDKChannelAnnouncement obj_conv;
20632 obj_conv.inner = (void*)(obj & (~1));
20633 obj_conv.is_owned = false;
20634 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
20635 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20636 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20637 CVec_u8Z_free(ret_var);
20641 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
20642 LDKu8slice ser_ref;
20643 ser_ref.datalen = *((uint32_t*)ser);
20644 ser_ref.data = (int8_t*)(ser + 4);
20645 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20646 *ret_conv = ChannelAnnouncement_read(ser_ref);
20647 return (uint64_t)ret_conv;
20650 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
20651 LDKUnsignedChannelUpdate obj_conv;
20652 obj_conv.inner = (void*)(obj & (~1));
20653 obj_conv.is_owned = false;
20654 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
20655 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20656 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20657 CVec_u8Z_free(ret_var);
20661 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
20662 LDKu8slice ser_ref;
20663 ser_ref.datalen = *((uint32_t*)ser);
20664 ser_ref.data = (int8_t*)(ser + 4);
20665 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20666 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
20667 return (uint64_t)ret_conv;
20670 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
20671 LDKChannelUpdate obj_conv;
20672 obj_conv.inner = (void*)(obj & (~1));
20673 obj_conv.is_owned = false;
20674 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
20675 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20676 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20677 CVec_u8Z_free(ret_var);
20681 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
20682 LDKu8slice ser_ref;
20683 ser_ref.datalen = *((uint32_t*)ser);
20684 ser_ref.data = (int8_t*)(ser + 4);
20685 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20686 *ret_conv = ChannelUpdate_read(ser_ref);
20687 return (uint64_t)ret_conv;
20690 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
20691 LDKErrorMessage obj_conv;
20692 obj_conv.inner = (void*)(obj & (~1));
20693 obj_conv.is_owned = false;
20694 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
20695 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20696 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20697 CVec_u8Z_free(ret_var);
20701 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
20702 LDKu8slice ser_ref;
20703 ser_ref.datalen = *((uint32_t*)ser);
20704 ser_ref.data = (int8_t*)(ser + 4);
20705 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20706 *ret_conv = ErrorMessage_read(ser_ref);
20707 return (uint64_t)ret_conv;
20710 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
20711 LDKUnsignedNodeAnnouncement obj_conv;
20712 obj_conv.inner = (void*)(obj & (~1));
20713 obj_conv.is_owned = false;
20714 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
20715 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20716 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20717 CVec_u8Z_free(ret_var);
20721 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
20722 LDKu8slice ser_ref;
20723 ser_ref.datalen = *((uint32_t*)ser);
20724 ser_ref.data = (int8_t*)(ser + 4);
20725 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20726 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
20727 return (uint64_t)ret_conv;
20730 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
20731 LDKNodeAnnouncement obj_conv;
20732 obj_conv.inner = (void*)(obj & (~1));
20733 obj_conv.is_owned = false;
20734 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
20735 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20736 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20737 CVec_u8Z_free(ret_var);
20741 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
20742 LDKu8slice ser_ref;
20743 ser_ref.datalen = *((uint32_t*)ser);
20744 ser_ref.data = (int8_t*)(ser + 4);
20745 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20746 *ret_conv = NodeAnnouncement_read(ser_ref);
20747 return (uint64_t)ret_conv;
20750 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
20751 LDKu8slice ser_ref;
20752 ser_ref.datalen = *((uint32_t*)ser);
20753 ser_ref.data = (int8_t*)(ser + 4);
20754 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20755 *ret_conv = QueryShortChannelIds_read(ser_ref);
20756 return (uint64_t)ret_conv;
20759 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
20760 LDKQueryShortChannelIds obj_conv;
20761 obj_conv.inner = (void*)(obj & (~1));
20762 obj_conv.is_owned = false;
20763 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
20764 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20765 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20766 CVec_u8Z_free(ret_var);
20770 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
20771 LDKReplyShortChannelIdsEnd obj_conv;
20772 obj_conv.inner = (void*)(obj & (~1));
20773 obj_conv.is_owned = false;
20774 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
20775 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20776 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20777 CVec_u8Z_free(ret_var);
20781 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
20782 LDKu8slice ser_ref;
20783 ser_ref.datalen = *((uint32_t*)ser);
20784 ser_ref.data = (int8_t*)(ser + 4);
20785 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20786 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
20787 return (uint64_t)ret_conv;
20790 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
20791 LDKQueryChannelRange this_arg_conv;
20792 this_arg_conv.inner = (void*)(this_arg & (~1));
20793 this_arg_conv.is_owned = false;
20794 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
20798 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
20799 LDKQueryChannelRange obj_conv;
20800 obj_conv.inner = (void*)(obj & (~1));
20801 obj_conv.is_owned = false;
20802 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
20803 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20804 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20805 CVec_u8Z_free(ret_var);
20809 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
20810 LDKu8slice ser_ref;
20811 ser_ref.datalen = *((uint32_t*)ser);
20812 ser_ref.data = (int8_t*)(ser + 4);
20813 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20814 *ret_conv = QueryChannelRange_read(ser_ref);
20815 return (uint64_t)ret_conv;
20818 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
20819 LDKu8slice ser_ref;
20820 ser_ref.datalen = *((uint32_t*)ser);
20821 ser_ref.data = (int8_t*)(ser + 4);
20822 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20823 *ret_conv = ReplyChannelRange_read(ser_ref);
20824 return (uint64_t)ret_conv;
20827 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
20828 LDKReplyChannelRange obj_conv;
20829 obj_conv.inner = (void*)(obj & (~1));
20830 obj_conv.is_owned = false;
20831 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
20832 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20833 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20834 CVec_u8Z_free(ret_var);
20838 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
20839 LDKGossipTimestampFilter obj_conv;
20840 obj_conv.inner = (void*)(obj & (~1));
20841 obj_conv.is_owned = false;
20842 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
20843 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20844 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20845 CVec_u8Z_free(ret_var);
20849 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
20850 LDKu8slice ser_ref;
20851 ser_ref.datalen = *((uint32_t*)ser);
20852 ser_ref.data = (int8_t*)(ser + 4);
20853 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20854 *ret_conv = GossipTimestampFilter_read(ser_ref);
20855 return (uint64_t)ret_conv;
20858 void __attribute__((visibility("default"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
20859 if ((this_ptr & 1) != 0) return;
20860 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(((uint64_t)this_ptr) & ~1);
20861 FREE((void*)this_ptr);
20862 CustomMessageHandler_free(this_ptr_conv);
20865 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
20866 LDKIgnoringMessageHandler this_obj_conv;
20867 this_obj_conv.inner = (void*)(this_obj & (~1));
20868 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20869 IgnoringMessageHandler_free(this_obj_conv);
20872 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
20873 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
20874 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20875 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20876 uint64_t ret_ref = (uint64_t)ret_var.inner;
20877 if (ret_var.is_owned) {
20883 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
20884 LDKIgnoringMessageHandler this_arg_conv;
20885 this_arg_conv.inner = (void*)(this_arg & (~1));
20886 this_arg_conv.is_owned = false;
20887 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20888 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20889 return (uint64_t)ret_ret;
20892 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
20893 LDKIgnoringMessageHandler this_arg_conv;
20894 this_arg_conv.inner = (void*)(this_arg & (~1));
20895 this_arg_conv.is_owned = false;
20896 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
20897 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
20898 return (uint64_t)ret_ret;
20901 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
20902 LDKIgnoringMessageHandler this_arg_conv;
20903 this_arg_conv.inner = (void*)(this_arg & (~1));
20904 this_arg_conv.is_owned = false;
20905 LDKCustomMessageReader* ret_ret =MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
20906 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
20907 return (uint64_t)ret_ret;
20910 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
20911 LDKIgnoringMessageHandler this_arg_conv;
20912 this_arg_conv.inner = (void*)(this_arg & (~1));
20913 this_arg_conv.is_owned = false;
20914 LDKCustomMessageHandler* ret_ret =MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
20915 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
20916 return (uint64_t)ret_ret;
20919 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
20920 LDKErroringMessageHandler this_obj_conv;
20921 this_obj_conv.inner = (void*)(this_obj & (~1));
20922 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20923 ErroringMessageHandler_free(this_obj_conv);
20926 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
20927 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
20928 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20929 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20930 uint64_t ret_ref = (uint64_t)ret_var.inner;
20931 if (ret_var.is_owned) {
20937 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
20938 LDKErroringMessageHandler this_arg_conv;
20939 this_arg_conv.inner = (void*)(this_arg & (~1));
20940 this_arg_conv.is_owned = false;
20941 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20942 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20943 return (uint64_t)ret_ret;
20946 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
20947 LDKErroringMessageHandler this_arg_conv;
20948 this_arg_conv.inner = (void*)(this_arg & (~1));
20949 this_arg_conv.is_owned = false;
20950 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
20951 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
20952 return (uint64_t)ret_ret;
20955 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
20956 LDKMessageHandler this_obj_conv;
20957 this_obj_conv.inner = (void*)(this_obj & (~1));
20958 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20959 MessageHandler_free(this_obj_conv);
20962 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
20963 LDKMessageHandler this_ptr_conv;
20964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20965 this_ptr_conv.is_owned = false;
20966 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
20970 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
20971 LDKMessageHandler this_ptr_conv;
20972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20973 this_ptr_conv.is_owned = false;
20974 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
20975 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
20978 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
20979 LDKMessageHandler this_ptr_conv;
20980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20981 this_ptr_conv.is_owned = false;
20982 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
20986 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
20987 LDKMessageHandler this_ptr_conv;
20988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20989 this_ptr_conv.is_owned = false;
20990 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
20991 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
20994 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
20995 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
20996 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
20997 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
20998 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20999 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21000 uint64_t ret_ref = (uint64_t)ret_var.inner;
21001 if (ret_var.is_owned) {
21007 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
21008 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
21009 LDKSocketDescriptor* ret_ret =MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
21010 *ret_ret = SocketDescriptor_clone(orig_conv);
21011 return (uint64_t)ret_ret;
21014 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
21015 if ((this_ptr & 1) != 0) return;
21016 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
21017 FREE((void*)this_ptr);
21018 SocketDescriptor_free(this_ptr_conv);
21021 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
21022 LDKPeerHandleError this_obj_conv;
21023 this_obj_conv.inner = (void*)(this_obj & (~1));
21024 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21025 PeerHandleError_free(this_obj_conv);
21028 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
21029 LDKPeerHandleError this_ptr_conv;
21030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21031 this_ptr_conv.is_owned = false;
21032 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
21036 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
21037 LDKPeerHandleError this_ptr_conv;
21038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21039 this_ptr_conv.is_owned = false;
21040 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
21043 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
21044 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
21045 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21046 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21047 uint64_t ret_ref = (uint64_t)ret_var.inner;
21048 if (ret_var.is_owned) {
21054 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
21055 LDKPeerHandleError orig_conv;
21056 orig_conv.inner = (void*)(orig & (~1));
21057 orig_conv.is_owned = false;
21058 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
21059 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21060 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21061 uint64_t ret_ref = (uint64_t)ret_var.inner;
21062 if (ret_var.is_owned) {
21068 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
21069 LDKPeerManager this_obj_conv;
21070 this_obj_conv.inner = (void*)(this_obj & (~1));
21071 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21072 PeerManager_free(this_obj_conv);
21075 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) {
21076 LDKMessageHandler message_handler_conv;
21077 message_handler_conv.inner = (void*)(message_handler & (~1));
21078 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
21079 // Warning: we need a move here but no clone is available for LDKMessageHandler
21080 LDKSecretKey our_node_secret_ref;
21081 CHECK(*((uint32_t*)our_node_secret) == 32);
21082 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
21083 unsigned char ephemeral_random_data_arr[32];
21084 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
21085 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
21086 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
21087 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
21088 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(((uint64_t)custom_message_handler) & ~1);
21089 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
21090 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21091 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21092 uint64_t ret_ref = (uint64_t)ret_var.inner;
21093 if (ret_var.is_owned) {
21099 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
21100 LDKPeerManager this_arg_conv;
21101 this_arg_conv.inner = (void*)(this_arg & (~1));
21102 this_arg_conv.is_owned = false;
21103 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
21104 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
21105 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
21106 for (size_t m = 0; m < ret_var.datalen; m++) {
21107 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21108 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
21109 ret_arr_ptr[m] = ret_conv_12_arr;
21111 FREE(ret_var.data);
21115 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
21116 LDKPeerManager this_arg_conv;
21117 this_arg_conv.inner = (void*)(this_arg & (~1));
21118 this_arg_conv.is_owned = false;
21119 LDKPublicKey their_node_id_ref;
21120 CHECK(*((uint32_t*)their_node_id) == 33);
21121 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
21122 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21123 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
21124 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
21125 return (uint64_t)ret_conv;
21128 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
21129 LDKPeerManager this_arg_conv;
21130 this_arg_conv.inner = (void*)(this_arg & (~1));
21131 this_arg_conv.is_owned = false;
21132 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21133 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21134 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
21135 return (uint64_t)ret_conv;
21138 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
21139 LDKPeerManager this_arg_conv;
21140 this_arg_conv.inner = (void*)(this_arg & (~1));
21141 this_arg_conv.is_owned = false;
21142 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21143 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21144 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
21145 return (uint64_t)ret_conv;
21148 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
21149 LDKPeerManager this_arg_conv;
21150 this_arg_conv.inner = (void*)(this_arg & (~1));
21151 this_arg_conv.is_owned = false;
21152 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
21153 LDKu8slice data_ref;
21154 data_ref.datalen = *((uint32_t*)data);
21155 data_ref.data = (int8_t*)(data + 4);
21156 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21157 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
21158 return (uint64_t)ret_conv;
21161 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
21162 LDKPeerManager this_arg_conv;
21163 this_arg_conv.inner = (void*)(this_arg & (~1));
21164 this_arg_conv.is_owned = false;
21165 PeerManager_process_events(&this_arg_conv);
21168 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
21169 LDKPeerManager this_arg_conv;
21170 this_arg_conv.inner = (void*)(this_arg & (~1));
21171 this_arg_conv.is_owned = false;
21172 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21173 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
21176 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
21177 LDKPeerManager this_arg_conv;
21178 this_arg_conv.inner = (void*)(this_arg & (~1));
21179 this_arg_conv.is_owned = false;
21180 LDKPublicKey node_id_ref;
21181 CHECK(*((uint32_t*)node_id) == 33);
21182 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
21183 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
21186 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
21187 LDKPeerManager this_arg_conv;
21188 this_arg_conv.inner = (void*)(this_arg & (~1));
21189 this_arg_conv.is_owned = false;
21190 PeerManager_timer_tick_occurred(&this_arg_conv);
21193 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
21194 unsigned char commitment_seed_arr[32];
21195 CHECK(*((uint32_t*)commitment_seed) == 32);
21196 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
21197 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
21198 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
21199 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
21203 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) {
21204 LDKCVec_u8Z to_holder_script_ref;
21205 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
21206 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
21207 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
21208 LDKCVec_u8Z to_counterparty_script_ref;
21209 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
21210 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
21211 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
21212 LDKOutPoint funding_outpoint_conv;
21213 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
21214 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
21215 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
21216 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);
21217 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21218 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21219 Transaction_free(ret_var);
21223 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
21224 LDKPublicKey per_commitment_point_ref;
21225 CHECK(*((uint32_t*)per_commitment_point) == 33);
21226 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21227 unsigned char base_secret_arr[32];
21228 CHECK(*((uint32_t*)base_secret) == 32);
21229 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
21230 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
21231 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
21232 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
21233 return (uint64_t)ret_conv;
21236 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
21237 LDKPublicKey per_commitment_point_ref;
21238 CHECK(*((uint32_t*)per_commitment_point) == 33);
21239 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21240 LDKPublicKey base_point_ref;
21241 CHECK(*((uint32_t*)base_point) == 33);
21242 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
21243 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21244 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
21245 return (uint64_t)ret_conv;
21248 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
21249 unsigned char per_commitment_secret_arr[32];
21250 CHECK(*((uint32_t*)per_commitment_secret) == 32);
21251 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
21252 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
21253 unsigned char countersignatory_revocation_base_secret_arr[32];
21254 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
21255 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
21256 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
21257 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
21258 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
21259 return (uint64_t)ret_conv;
21262 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
21263 LDKPublicKey per_commitment_point_ref;
21264 CHECK(*((uint32_t*)per_commitment_point) == 33);
21265 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21266 LDKPublicKey countersignatory_revocation_base_point_ref;
21267 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
21268 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
21269 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21270 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
21271 return (uint64_t)ret_conv;
21274 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
21275 LDKTxCreationKeys this_obj_conv;
21276 this_obj_conv.inner = (void*)(this_obj & (~1));
21277 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21278 TxCreationKeys_free(this_obj_conv);
21281 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
21282 LDKTxCreationKeys this_ptr_conv;
21283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21284 this_ptr_conv.is_owned = false;
21285 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21286 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
21290 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
21291 LDKTxCreationKeys this_ptr_conv;
21292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21293 this_ptr_conv.is_owned = false;
21294 LDKPublicKey val_ref;
21295 CHECK(*((uint32_t*)val) == 33);
21296 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21297 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
21300 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
21301 LDKTxCreationKeys this_ptr_conv;
21302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21303 this_ptr_conv.is_owned = false;
21304 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21305 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
21309 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
21310 LDKTxCreationKeys this_ptr_conv;
21311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21312 this_ptr_conv.is_owned = false;
21313 LDKPublicKey val_ref;
21314 CHECK(*((uint32_t*)val) == 33);
21315 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21316 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
21319 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
21320 LDKTxCreationKeys this_ptr_conv;
21321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21322 this_ptr_conv.is_owned = false;
21323 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21324 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
21328 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
21329 LDKTxCreationKeys this_ptr_conv;
21330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21331 this_ptr_conv.is_owned = false;
21332 LDKPublicKey val_ref;
21333 CHECK(*((uint32_t*)val) == 33);
21334 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21335 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
21338 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
21339 LDKTxCreationKeys this_ptr_conv;
21340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21341 this_ptr_conv.is_owned = false;
21342 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21343 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
21347 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
21348 LDKTxCreationKeys this_ptr_conv;
21349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21350 this_ptr_conv.is_owned = false;
21351 LDKPublicKey val_ref;
21352 CHECK(*((uint32_t*)val) == 33);
21353 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21354 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
21357 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
21358 LDKTxCreationKeys this_ptr_conv;
21359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21360 this_ptr_conv.is_owned = false;
21361 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21362 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
21366 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
21367 LDKTxCreationKeys this_ptr_conv;
21368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21369 this_ptr_conv.is_owned = false;
21370 LDKPublicKey val_ref;
21371 CHECK(*((uint32_t*)val) == 33);
21372 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21373 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
21376 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) {
21377 LDKPublicKey per_commitment_point_arg_ref;
21378 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
21379 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
21380 LDKPublicKey revocation_key_arg_ref;
21381 CHECK(*((uint32_t*)revocation_key_arg) == 33);
21382 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
21383 LDKPublicKey broadcaster_htlc_key_arg_ref;
21384 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
21385 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
21386 LDKPublicKey countersignatory_htlc_key_arg_ref;
21387 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
21388 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
21389 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
21390 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
21391 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
21392 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);
21393 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21394 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21395 uint64_t ret_ref = (uint64_t)ret_var.inner;
21396 if (ret_var.is_owned) {
21402 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
21403 LDKTxCreationKeys orig_conv;
21404 orig_conv.inner = (void*)(orig & (~1));
21405 orig_conv.is_owned = false;
21406 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
21407 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21408 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21409 uint64_t ret_ref = (uint64_t)ret_var.inner;
21410 if (ret_var.is_owned) {
21416 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
21417 LDKTxCreationKeys obj_conv;
21418 obj_conv.inner = (void*)(obj & (~1));
21419 obj_conv.is_owned = false;
21420 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
21421 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21422 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21423 CVec_u8Z_free(ret_var);
21427 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
21428 LDKu8slice ser_ref;
21429 ser_ref.datalen = *((uint32_t*)ser);
21430 ser_ref.data = (int8_t*)(ser + 4);
21431 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
21432 *ret_conv = TxCreationKeys_read(ser_ref);
21433 return (uint64_t)ret_conv;
21436 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
21437 LDKChannelPublicKeys this_obj_conv;
21438 this_obj_conv.inner = (void*)(this_obj & (~1));
21439 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21440 ChannelPublicKeys_free(this_obj_conv);
21443 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
21444 LDKChannelPublicKeys this_ptr_conv;
21445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21446 this_ptr_conv.is_owned = false;
21447 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21448 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
21452 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
21453 LDKChannelPublicKeys this_ptr_conv;
21454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21455 this_ptr_conv.is_owned = false;
21456 LDKPublicKey val_ref;
21457 CHECK(*((uint32_t*)val) == 33);
21458 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21459 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
21462 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
21463 LDKChannelPublicKeys this_ptr_conv;
21464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21465 this_ptr_conv.is_owned = false;
21466 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21467 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
21471 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
21472 LDKChannelPublicKeys this_ptr_conv;
21473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21474 this_ptr_conv.is_owned = false;
21475 LDKPublicKey val_ref;
21476 CHECK(*((uint32_t*)val) == 33);
21477 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21478 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
21481 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
21482 LDKChannelPublicKeys this_ptr_conv;
21483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21484 this_ptr_conv.is_owned = false;
21485 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21486 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
21490 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
21491 LDKChannelPublicKeys this_ptr_conv;
21492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21493 this_ptr_conv.is_owned = false;
21494 LDKPublicKey val_ref;
21495 CHECK(*((uint32_t*)val) == 33);
21496 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21497 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
21500 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
21501 LDKChannelPublicKeys this_ptr_conv;
21502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21503 this_ptr_conv.is_owned = false;
21504 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21505 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
21509 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
21510 LDKChannelPublicKeys this_ptr_conv;
21511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21512 this_ptr_conv.is_owned = false;
21513 LDKPublicKey val_ref;
21514 CHECK(*((uint32_t*)val) == 33);
21515 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21516 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
21519 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
21520 LDKChannelPublicKeys this_ptr_conv;
21521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21522 this_ptr_conv.is_owned = false;
21523 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21524 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
21528 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
21529 LDKChannelPublicKeys this_ptr_conv;
21530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21531 this_ptr_conv.is_owned = false;
21532 LDKPublicKey val_ref;
21533 CHECK(*((uint32_t*)val) == 33);
21534 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21535 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
21538 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) {
21539 LDKPublicKey funding_pubkey_arg_ref;
21540 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
21541 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
21542 LDKPublicKey revocation_basepoint_arg_ref;
21543 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
21544 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
21545 LDKPublicKey payment_point_arg_ref;
21546 CHECK(*((uint32_t*)payment_point_arg) == 33);
21547 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
21548 LDKPublicKey delayed_payment_basepoint_arg_ref;
21549 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
21550 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
21551 LDKPublicKey htlc_basepoint_arg_ref;
21552 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
21553 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
21554 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);
21555 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21556 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21557 uint64_t ret_ref = (uint64_t)ret_var.inner;
21558 if (ret_var.is_owned) {
21564 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
21565 LDKChannelPublicKeys orig_conv;
21566 orig_conv.inner = (void*)(orig & (~1));
21567 orig_conv.is_owned = false;
21568 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
21569 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21570 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21571 uint64_t ret_ref = (uint64_t)ret_var.inner;
21572 if (ret_var.is_owned) {
21578 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
21579 LDKChannelPublicKeys obj_conv;
21580 obj_conv.inner = (void*)(obj & (~1));
21581 obj_conv.is_owned = false;
21582 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
21583 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21584 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21585 CVec_u8Z_free(ret_var);
21589 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
21590 LDKu8slice ser_ref;
21591 ser_ref.datalen = *((uint32_t*)ser);
21592 ser_ref.data = (int8_t*)(ser + 4);
21593 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
21594 *ret_conv = ChannelPublicKeys_read(ser_ref);
21595 return (uint64_t)ret_conv;
21598 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) {
21599 LDKPublicKey per_commitment_point_ref;
21600 CHECK(*((uint32_t*)per_commitment_point) == 33);
21601 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21602 LDKPublicKey broadcaster_delayed_payment_base_ref;
21603 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
21604 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
21605 LDKPublicKey broadcaster_htlc_base_ref;
21606 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
21607 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
21608 LDKPublicKey countersignatory_revocation_base_ref;
21609 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
21610 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
21611 LDKPublicKey countersignatory_htlc_base_ref;
21612 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
21613 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
21614 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21615 *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);
21616 return (uint64_t)ret_conv;
21619 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
21620 LDKPublicKey per_commitment_point_ref;
21621 CHECK(*((uint32_t*)per_commitment_point) == 33);
21622 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21623 LDKChannelPublicKeys broadcaster_keys_conv;
21624 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
21625 broadcaster_keys_conv.is_owned = false;
21626 LDKChannelPublicKeys countersignatory_keys_conv;
21627 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
21628 countersignatory_keys_conv.is_owned = false;
21629 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21630 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
21631 return (uint64_t)ret_conv;
21634 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
21635 LDKPublicKey revocation_key_ref;
21636 CHECK(*((uint32_t*)revocation_key) == 33);
21637 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
21638 LDKPublicKey broadcaster_delayed_payment_key_ref;
21639 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
21640 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
21641 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
21642 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21643 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21644 CVec_u8Z_free(ret_var);
21648 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
21649 LDKHTLCOutputInCommitment this_obj_conv;
21650 this_obj_conv.inner = (void*)(this_obj & (~1));
21651 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21652 HTLCOutputInCommitment_free(this_obj_conv);
21655 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
21656 LDKHTLCOutputInCommitment this_ptr_conv;
21657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21658 this_ptr_conv.is_owned = false;
21659 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
21663 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
21664 LDKHTLCOutputInCommitment this_ptr_conv;
21665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21666 this_ptr_conv.is_owned = false;
21667 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
21670 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
21671 LDKHTLCOutputInCommitment this_ptr_conv;
21672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21673 this_ptr_conv.is_owned = false;
21674 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
21678 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
21679 LDKHTLCOutputInCommitment this_ptr_conv;
21680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21681 this_ptr_conv.is_owned = false;
21682 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
21685 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
21686 LDKHTLCOutputInCommitment this_ptr_conv;
21687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21688 this_ptr_conv.is_owned = false;
21689 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
21693 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
21694 LDKHTLCOutputInCommitment this_ptr_conv;
21695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21696 this_ptr_conv.is_owned = false;
21697 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
21700 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
21701 LDKHTLCOutputInCommitment this_ptr_conv;
21702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21703 this_ptr_conv.is_owned = false;
21704 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
21705 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
21709 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
21710 LDKHTLCOutputInCommitment this_ptr_conv;
21711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21712 this_ptr_conv.is_owned = false;
21713 LDKThirtyTwoBytes val_ref;
21714 CHECK(*((uint32_t*)val) == 32);
21715 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
21716 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
21719 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
21720 LDKHTLCOutputInCommitment this_ptr_conv;
21721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21722 this_ptr_conv.is_owned = false;
21723 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21724 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
21725 uint64_t ret_ref = (uint64_t)ret_copy;
21729 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
21730 LDKHTLCOutputInCommitment this_ptr_conv;
21731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21732 this_ptr_conv.is_owned = false;
21733 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
21734 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
21735 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
21738 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) {
21739 LDKThirtyTwoBytes payment_hash_arg_ref;
21740 CHECK(*((uint32_t*)payment_hash_arg) == 32);
21741 memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
21742 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
21743 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
21744 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
21745 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21746 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21747 uint64_t ret_ref = (uint64_t)ret_var.inner;
21748 if (ret_var.is_owned) {
21754 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
21755 LDKHTLCOutputInCommitment orig_conv;
21756 orig_conv.inner = (void*)(orig & (~1));
21757 orig_conv.is_owned = false;
21758 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
21759 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21760 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21761 uint64_t ret_ref = (uint64_t)ret_var.inner;
21762 if (ret_var.is_owned) {
21768 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
21769 LDKHTLCOutputInCommitment obj_conv;
21770 obj_conv.inner = (void*)(obj & (~1));
21771 obj_conv.is_owned = false;
21772 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
21773 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21774 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21775 CVec_u8Z_free(ret_var);
21779 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
21780 LDKu8slice ser_ref;
21781 ser_ref.datalen = *((uint32_t*)ser);
21782 ser_ref.data = (int8_t*)(ser + 4);
21783 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
21784 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
21785 return (uint64_t)ret_conv;
21788 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
21789 LDKHTLCOutputInCommitment htlc_conv;
21790 htlc_conv.inner = (void*)(htlc & (~1));
21791 htlc_conv.is_owned = false;
21792 LDKTxCreationKeys keys_conv;
21793 keys_conv.inner = (void*)(keys & (~1));
21794 keys_conv.is_owned = false;
21795 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
21796 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21797 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21798 CVec_u8Z_free(ret_var);
21802 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
21803 LDKPublicKey broadcaster_ref;
21804 CHECK(*((uint32_t*)broadcaster) == 33);
21805 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
21806 LDKPublicKey countersignatory_ref;
21807 CHECK(*((uint32_t*)countersignatory) == 33);
21808 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
21809 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
21810 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21811 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21812 CVec_u8Z_free(ret_var);
21816 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) {
21817 unsigned char commitment_txid_arr[32];
21818 CHECK(*((uint32_t*)commitment_txid) == 32);
21819 memcpy(commitment_txid_arr, (uint8_t*)(commitment_txid + 4), 32);
21820 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
21821 LDKHTLCOutputInCommitment htlc_conv;
21822 htlc_conv.inner = (void*)(htlc & (~1));
21823 htlc_conv.is_owned = false;
21824 LDKPublicKey broadcaster_delayed_payment_key_ref;
21825 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
21826 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
21827 LDKPublicKey revocation_key_ref;
21828 CHECK(*((uint32_t*)revocation_key) == 33);
21829 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
21830 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
21831 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21832 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21833 Transaction_free(ret_var);
21837 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
21838 LDKChannelTransactionParameters this_obj_conv;
21839 this_obj_conv.inner = (void*)(this_obj & (~1));
21840 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21841 ChannelTransactionParameters_free(this_obj_conv);
21844 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
21845 LDKChannelTransactionParameters this_ptr_conv;
21846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21847 this_ptr_conv.is_owned = false;
21848 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
21849 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21850 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21851 uint64_t ret_ref = (uint64_t)ret_var.inner;
21852 if (ret_var.is_owned) {
21858 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
21859 LDKChannelTransactionParameters this_ptr_conv;
21860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21861 this_ptr_conv.is_owned = false;
21862 LDKChannelPublicKeys val_conv;
21863 val_conv.inner = (void*)(val & (~1));
21864 val_conv.is_owned = (val & 1) || (val == 0);
21865 val_conv = ChannelPublicKeys_clone(&val_conv);
21866 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
21869 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
21870 LDKChannelTransactionParameters this_ptr_conv;
21871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21872 this_ptr_conv.is_owned = false;
21873 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
21877 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
21878 LDKChannelTransactionParameters this_ptr_conv;
21879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21880 this_ptr_conv.is_owned = false;
21881 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
21884 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
21885 LDKChannelTransactionParameters this_ptr_conv;
21886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21887 this_ptr_conv.is_owned = false;
21888 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
21892 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
21893 LDKChannelTransactionParameters this_ptr_conv;
21894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21895 this_ptr_conv.is_owned = false;
21896 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
21899 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
21900 LDKChannelTransactionParameters this_ptr_conv;
21901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21902 this_ptr_conv.is_owned = false;
21903 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
21904 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21905 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21906 uint64_t ret_ref = (uint64_t)ret_var.inner;
21907 if (ret_var.is_owned) {
21913 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
21914 LDKChannelTransactionParameters this_ptr_conv;
21915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21916 this_ptr_conv.is_owned = false;
21917 LDKCounterpartyChannelTransactionParameters val_conv;
21918 val_conv.inner = (void*)(val & (~1));
21919 val_conv.is_owned = (val & 1) || (val == 0);
21920 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
21921 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
21924 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
21925 LDKChannelTransactionParameters this_ptr_conv;
21926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21927 this_ptr_conv.is_owned = false;
21928 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
21929 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21930 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21931 uint64_t ret_ref = (uint64_t)ret_var.inner;
21932 if (ret_var.is_owned) {
21938 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
21939 LDKChannelTransactionParameters this_ptr_conv;
21940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21941 this_ptr_conv.is_owned = false;
21942 LDKOutPoint val_conv;
21943 val_conv.inner = (void*)(val & (~1));
21944 val_conv.is_owned = (val & 1) || (val == 0);
21945 val_conv = OutPoint_clone(&val_conv);
21946 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
21949 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) {
21950 LDKChannelPublicKeys holder_pubkeys_arg_conv;
21951 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
21952 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
21953 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
21954 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
21955 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
21956 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
21957 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
21958 LDKOutPoint funding_outpoint_arg_conv;
21959 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
21960 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
21961 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
21962 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);
21963 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21964 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21965 uint64_t ret_ref = (uint64_t)ret_var.inner;
21966 if (ret_var.is_owned) {
21972 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
21973 LDKChannelTransactionParameters orig_conv;
21974 orig_conv.inner = (void*)(orig & (~1));
21975 orig_conv.is_owned = false;
21976 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
21977 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21978 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21979 uint64_t ret_ref = (uint64_t)ret_var.inner;
21980 if (ret_var.is_owned) {
21986 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
21987 LDKCounterpartyChannelTransactionParameters this_obj_conv;
21988 this_obj_conv.inner = (void*)(this_obj & (~1));
21989 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21990 CounterpartyChannelTransactionParameters_free(this_obj_conv);
21993 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
21994 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21996 this_ptr_conv.is_owned = false;
21997 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
21998 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21999 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22000 uint64_t ret_ref = (uint64_t)ret_var.inner;
22001 if (ret_var.is_owned) {
22007 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
22008 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
22009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22010 this_ptr_conv.is_owned = false;
22011 LDKChannelPublicKeys val_conv;
22012 val_conv.inner = (void*)(val & (~1));
22013 val_conv.is_owned = (val & 1) || (val == 0);
22014 val_conv = ChannelPublicKeys_clone(&val_conv);
22015 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
22018 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
22019 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
22020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22021 this_ptr_conv.is_owned = false;
22022 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
22026 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
22027 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
22028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22029 this_ptr_conv.is_owned = false;
22030 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
22033 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
22034 LDKChannelPublicKeys pubkeys_arg_conv;
22035 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
22036 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
22037 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
22038 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
22039 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22040 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22041 uint64_t ret_ref = (uint64_t)ret_var.inner;
22042 if (ret_var.is_owned) {
22048 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
22049 LDKCounterpartyChannelTransactionParameters orig_conv;
22050 orig_conv.inner = (void*)(orig & (~1));
22051 orig_conv.is_owned = false;
22052 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
22053 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22054 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22055 uint64_t ret_ref = (uint64_t)ret_var.inner;
22056 if (ret_var.is_owned) {
22062 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
22063 LDKChannelTransactionParameters this_arg_conv;
22064 this_arg_conv.inner = (void*)(this_arg & (~1));
22065 this_arg_conv.is_owned = false;
22066 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
22070 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
22071 LDKChannelTransactionParameters this_arg_conv;
22072 this_arg_conv.inner = (void*)(this_arg & (~1));
22073 this_arg_conv.is_owned = false;
22074 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
22075 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22076 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22077 uint64_t ret_ref = (uint64_t)ret_var.inner;
22078 if (ret_var.is_owned) {
22084 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
22085 LDKChannelTransactionParameters this_arg_conv;
22086 this_arg_conv.inner = (void*)(this_arg & (~1));
22087 this_arg_conv.is_owned = false;
22088 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
22089 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22090 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22091 uint64_t ret_ref = (uint64_t)ret_var.inner;
22092 if (ret_var.is_owned) {
22098 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
22099 LDKCounterpartyChannelTransactionParameters obj_conv;
22100 obj_conv.inner = (void*)(obj & (~1));
22101 obj_conv.is_owned = false;
22102 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
22103 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22104 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22105 CVec_u8Z_free(ret_var);
22109 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
22110 LDKu8slice ser_ref;
22111 ser_ref.datalen = *((uint32_t*)ser);
22112 ser_ref.data = (int8_t*)(ser + 4);
22113 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
22114 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
22115 return (uint64_t)ret_conv;
22118 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
22119 LDKChannelTransactionParameters obj_conv;
22120 obj_conv.inner = (void*)(obj & (~1));
22121 obj_conv.is_owned = false;
22122 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
22123 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22124 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22125 CVec_u8Z_free(ret_var);
22129 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
22130 LDKu8slice ser_ref;
22131 ser_ref.datalen = *((uint32_t*)ser);
22132 ser_ref.data = (int8_t*)(ser + 4);
22133 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
22134 *ret_conv = ChannelTransactionParameters_read(ser_ref);
22135 return (uint64_t)ret_conv;
22138 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
22139 LDKDirectedChannelTransactionParameters this_obj_conv;
22140 this_obj_conv.inner = (void*)(this_obj & (~1));
22141 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22142 DirectedChannelTransactionParameters_free(this_obj_conv);
22145 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
22146 LDKDirectedChannelTransactionParameters this_arg_conv;
22147 this_arg_conv.inner = (void*)(this_arg & (~1));
22148 this_arg_conv.is_owned = false;
22149 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
22150 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22151 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22152 uint64_t ret_ref = (uint64_t)ret_var.inner;
22153 if (ret_var.is_owned) {
22159 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
22160 LDKDirectedChannelTransactionParameters this_arg_conv;
22161 this_arg_conv.inner = (void*)(this_arg & (~1));
22162 this_arg_conv.is_owned = false;
22163 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
22164 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22165 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22166 uint64_t ret_ref = (uint64_t)ret_var.inner;
22167 if (ret_var.is_owned) {
22173 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
22174 LDKDirectedChannelTransactionParameters this_arg_conv;
22175 this_arg_conv.inner = (void*)(this_arg & (~1));
22176 this_arg_conv.is_owned = false;
22177 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
22181 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
22182 LDKDirectedChannelTransactionParameters this_arg_conv;
22183 this_arg_conv.inner = (void*)(this_arg & (~1));
22184 this_arg_conv.is_owned = false;
22185 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
22189 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
22190 LDKDirectedChannelTransactionParameters this_arg_conv;
22191 this_arg_conv.inner = (void*)(this_arg & (~1));
22192 this_arg_conv.is_owned = false;
22193 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
22194 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22195 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22196 uint64_t ret_ref = (uint64_t)ret_var.inner;
22197 if (ret_var.is_owned) {
22203 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
22204 LDKHolderCommitmentTransaction this_obj_conv;
22205 this_obj_conv.inner = (void*)(this_obj & (~1));
22206 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22207 HolderCommitmentTransaction_free(this_obj_conv);
22210 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
22211 LDKHolderCommitmentTransaction this_ptr_conv;
22212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22213 this_ptr_conv.is_owned = false;
22214 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
22215 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
22219 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
22220 LDKHolderCommitmentTransaction this_ptr_conv;
22221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22222 this_ptr_conv.is_owned = false;
22223 LDKSignature val_ref;
22224 CHECK(*((uint32_t*)val) == 64);
22225 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
22226 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
22229 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
22230 LDKHolderCommitmentTransaction this_ptr_conv;
22231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22232 this_ptr_conv.is_owned = false;
22233 LDKCVec_SignatureZ val_constr;
22234 val_constr.datalen = *((uint32_t*)val);
22235 if (val_constr.datalen > 0)
22236 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
22238 val_constr.data = NULL;
22239 int8_tArray* val_vals = (int8_tArray*)(val + 4);
22240 for (size_t m = 0; m < val_constr.datalen; m++) {
22241 int8_tArray val_conv_12 = val_vals[m];
22242 LDKSignature val_conv_12_ref;
22243 CHECK(*((uint32_t*)val_conv_12) == 64);
22244 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
22245 val_constr.data[m] = val_conv_12_ref;
22247 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
22250 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
22251 LDKHolderCommitmentTransaction orig_conv;
22252 orig_conv.inner = (void*)(orig & (~1));
22253 orig_conv.is_owned = false;
22254 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
22255 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22256 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22257 uint64_t ret_ref = (uint64_t)ret_var.inner;
22258 if (ret_var.is_owned) {
22264 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
22265 LDKHolderCommitmentTransaction obj_conv;
22266 obj_conv.inner = (void*)(obj & (~1));
22267 obj_conv.is_owned = false;
22268 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
22269 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22270 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22271 CVec_u8Z_free(ret_var);
22275 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
22276 LDKu8slice ser_ref;
22277 ser_ref.datalen = *((uint32_t*)ser);
22278 ser_ref.data = (int8_t*)(ser + 4);
22279 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
22280 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
22281 return (uint64_t)ret_conv;
22284 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) {
22285 LDKCommitmentTransaction commitment_tx_conv;
22286 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
22287 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
22288 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
22289 LDKSignature counterparty_sig_ref;
22290 CHECK(*((uint32_t*)counterparty_sig) == 64);
22291 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
22292 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
22293 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
22294 if (counterparty_htlc_sigs_constr.datalen > 0)
22295 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
22297 counterparty_htlc_sigs_constr.data = NULL;
22298 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
22299 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
22300 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
22301 LDKSignature counterparty_htlc_sigs_conv_12_ref;
22302 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
22303 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
22304 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
22306 LDKPublicKey holder_funding_key_ref;
22307 CHECK(*((uint32_t*)holder_funding_key) == 33);
22308 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
22309 LDKPublicKey counterparty_funding_key_ref;
22310 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
22311 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
22312 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
22313 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22314 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22315 uint64_t ret_ref = (uint64_t)ret_var.inner;
22316 if (ret_var.is_owned) {
22322 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
22323 LDKBuiltCommitmentTransaction this_obj_conv;
22324 this_obj_conv.inner = (void*)(this_obj & (~1));
22325 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22326 BuiltCommitmentTransaction_free(this_obj_conv);
22329 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
22330 LDKBuiltCommitmentTransaction this_ptr_conv;
22331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22332 this_ptr_conv.is_owned = false;
22333 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
22334 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22335 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22336 Transaction_free(ret_var);
22340 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
22341 LDKBuiltCommitmentTransaction this_ptr_conv;
22342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22343 this_ptr_conv.is_owned = false;
22344 LDKTransaction val_ref;
22345 val_ref.datalen = *((uint32_t*)val);
22346 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
22347 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
22348 val_ref.data_is_owned = true;
22349 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
22352 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
22353 LDKBuiltCommitmentTransaction this_ptr_conv;
22354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22355 this_ptr_conv.is_owned = false;
22356 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22357 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
22361 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
22362 LDKBuiltCommitmentTransaction this_ptr_conv;
22363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22364 this_ptr_conv.is_owned = false;
22365 LDKThirtyTwoBytes val_ref;
22366 CHECK(*((uint32_t*)val) == 32);
22367 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22368 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
22371 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
22372 LDKTransaction transaction_arg_ref;
22373 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
22374 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
22375 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
22376 transaction_arg_ref.data_is_owned = true;
22377 LDKThirtyTwoBytes txid_arg_ref;
22378 CHECK(*((uint32_t*)txid_arg) == 32);
22379 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
22380 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
22381 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22382 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22383 uint64_t ret_ref = (uint64_t)ret_var.inner;
22384 if (ret_var.is_owned) {
22390 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
22391 LDKBuiltCommitmentTransaction orig_conv;
22392 orig_conv.inner = (void*)(orig & (~1));
22393 orig_conv.is_owned = false;
22394 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
22395 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22396 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22397 uint64_t ret_ref = (uint64_t)ret_var.inner;
22398 if (ret_var.is_owned) {
22404 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
22405 LDKBuiltCommitmentTransaction obj_conv;
22406 obj_conv.inner = (void*)(obj & (~1));
22407 obj_conv.is_owned = false;
22408 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
22409 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22410 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22411 CVec_u8Z_free(ret_var);
22415 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
22416 LDKu8slice ser_ref;
22417 ser_ref.datalen = *((uint32_t*)ser);
22418 ser_ref.data = (int8_t*)(ser + 4);
22419 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
22420 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
22421 return (uint64_t)ret_conv;
22424 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
22425 LDKBuiltCommitmentTransaction this_arg_conv;
22426 this_arg_conv.inner = (void*)(this_arg & (~1));
22427 this_arg_conv.is_owned = false;
22428 LDKu8slice funding_redeemscript_ref;
22429 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
22430 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
22431 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22432 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
22436 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) {
22437 LDKBuiltCommitmentTransaction this_arg_conv;
22438 this_arg_conv.inner = (void*)(this_arg & (~1));
22439 this_arg_conv.is_owned = false;
22440 unsigned char funding_key_arr[32];
22441 CHECK(*((uint32_t*)funding_key) == 32);
22442 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
22443 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
22444 LDKu8slice funding_redeemscript_ref;
22445 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
22446 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
22447 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
22448 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
22452 void __attribute__((visibility("default"))) TS_ClosingTransaction_free(uint32_t this_obj) {
22453 LDKClosingTransaction this_obj_conv;
22454 this_obj_conv.inner = (void*)(this_obj & (~1));
22455 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22456 ClosingTransaction_free(this_obj_conv);
22459 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) {
22460 LDKCVec_u8Z to_holder_script_ref;
22461 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
22462 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
22463 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
22464 LDKCVec_u8Z to_counterparty_script_ref;
22465 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
22466 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
22467 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
22468 LDKOutPoint funding_outpoint_conv;
22469 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
22470 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
22471 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
22472 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
22473 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22474 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22475 uint64_t ret_ref = (uint64_t)ret_var.inner;
22476 if (ret_var.is_owned) {
22482 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
22483 LDKClosingTransaction this_arg_conv;
22484 this_arg_conv.inner = (void*)(this_arg & (~1));
22485 this_arg_conv.is_owned = false;
22486 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
22487 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22488 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22489 uint64_t ret_ref = (uint64_t)ret_var.inner;
22490 if (ret_var.is_owned) {
22496 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
22497 LDKClosingTransaction this_arg_conv;
22498 this_arg_conv.inner = (void*)(this_arg & (~1));
22499 this_arg_conv.is_owned = false;
22500 LDKOutPoint funding_outpoint_conv;
22501 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
22502 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
22503 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
22504 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
22505 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
22506 return (uint64_t)ret_conv;
22509 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
22510 LDKClosingTransaction this_arg_conv;
22511 this_arg_conv.inner = (void*)(this_arg & (~1));
22512 this_arg_conv.is_owned = false;
22513 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
22517 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
22518 LDKClosingTransaction this_arg_conv;
22519 this_arg_conv.inner = (void*)(this_arg & (~1));
22520 this_arg_conv.is_owned = false;
22521 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
22525 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
22526 LDKClosingTransaction this_arg_conv;
22527 this_arg_conv.inner = (void*)(this_arg & (~1));
22528 this_arg_conv.is_owned = false;
22529 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
22530 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22531 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22535 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
22536 LDKClosingTransaction this_arg_conv;
22537 this_arg_conv.inner = (void*)(this_arg & (~1));
22538 this_arg_conv.is_owned = false;
22539 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
22540 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22541 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22545 void __attribute__((visibility("default"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
22546 LDKTrustedClosingTransaction this_obj_conv;
22547 this_obj_conv.inner = (void*)(this_obj & (~1));
22548 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22549 TrustedClosingTransaction_free(this_obj_conv);
22552 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
22553 LDKTrustedClosingTransaction this_arg_conv;
22554 this_arg_conv.inner = (void*)(this_arg & (~1));
22555 this_arg_conv.is_owned = false;
22556 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
22557 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22558 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22559 Transaction_free(ret_var);
22563 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
22564 LDKTrustedClosingTransaction this_arg_conv;
22565 this_arg_conv.inner = (void*)(this_arg & (~1));
22566 this_arg_conv.is_owned = false;
22567 LDKu8slice funding_redeemscript_ref;
22568 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
22569 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
22570 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22571 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
22575 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) {
22576 LDKTrustedClosingTransaction this_arg_conv;
22577 this_arg_conv.inner = (void*)(this_arg & (~1));
22578 this_arg_conv.is_owned = false;
22579 unsigned char funding_key_arr[32];
22580 CHECK(*((uint32_t*)funding_key) == 32);
22581 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
22582 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
22583 LDKu8slice funding_redeemscript_ref;
22584 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
22585 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
22586 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
22587 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
22591 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
22592 LDKCommitmentTransaction this_obj_conv;
22593 this_obj_conv.inner = (void*)(this_obj & (~1));
22594 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22595 CommitmentTransaction_free(this_obj_conv);
22598 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
22599 LDKCommitmentTransaction orig_conv;
22600 orig_conv.inner = (void*)(orig & (~1));
22601 orig_conv.is_owned = false;
22602 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
22603 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22604 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22605 uint64_t ret_ref = (uint64_t)ret_var.inner;
22606 if (ret_var.is_owned) {
22612 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
22613 LDKCommitmentTransaction obj_conv;
22614 obj_conv.inner = (void*)(obj & (~1));
22615 obj_conv.is_owned = false;
22616 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
22617 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22618 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22619 CVec_u8Z_free(ret_var);
22623 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
22624 LDKu8slice ser_ref;
22625 ser_ref.datalen = *((uint32_t*)ser);
22626 ser_ref.data = (int8_t*)(ser + 4);
22627 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
22628 *ret_conv = CommitmentTransaction_read(ser_ref);
22629 return (uint64_t)ret_conv;
22632 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
22633 LDKCommitmentTransaction this_arg_conv;
22634 this_arg_conv.inner = (void*)(this_arg & (~1));
22635 this_arg_conv.is_owned = false;
22636 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
22640 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
22641 LDKCommitmentTransaction this_arg_conv;
22642 this_arg_conv.inner = (void*)(this_arg & (~1));
22643 this_arg_conv.is_owned = false;
22644 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
22648 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
22649 LDKCommitmentTransaction this_arg_conv;
22650 this_arg_conv.inner = (void*)(this_arg & (~1));
22651 this_arg_conv.is_owned = false;
22652 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
22656 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
22657 LDKCommitmentTransaction this_arg_conv;
22658 this_arg_conv.inner = (void*)(this_arg & (~1));
22659 this_arg_conv.is_owned = false;
22660 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
22664 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
22665 LDKCommitmentTransaction this_arg_conv;
22666 this_arg_conv.inner = (void*)(this_arg & (~1));
22667 this_arg_conv.is_owned = false;
22668 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
22669 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22670 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22671 uint64_t ret_ref = (uint64_t)ret_var.inner;
22672 if (ret_var.is_owned) {
22678 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
22679 LDKCommitmentTransaction this_arg_conv;
22680 this_arg_conv.inner = (void*)(this_arg & (~1));
22681 this_arg_conv.is_owned = false;
22682 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22683 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22684 channel_parameters_conv.is_owned = false;
22685 LDKChannelPublicKeys broadcaster_keys_conv;
22686 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
22687 broadcaster_keys_conv.is_owned = false;
22688 LDKChannelPublicKeys countersignatory_keys_conv;
22689 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
22690 countersignatory_keys_conv.is_owned = false;
22691 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
22692 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
22693 return (uint64_t)ret_conv;
22696 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
22697 LDKTrustedCommitmentTransaction this_obj_conv;
22698 this_obj_conv.inner = (void*)(this_obj & (~1));
22699 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22700 TrustedCommitmentTransaction_free(this_obj_conv);
22703 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
22704 LDKTrustedCommitmentTransaction this_arg_conv;
22705 this_arg_conv.inner = (void*)(this_arg & (~1));
22706 this_arg_conv.is_owned = false;
22707 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22708 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
22712 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
22713 LDKTrustedCommitmentTransaction this_arg_conv;
22714 this_arg_conv.inner = (void*)(this_arg & (~1));
22715 this_arg_conv.is_owned = false;
22716 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
22717 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22718 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22719 uint64_t ret_ref = (uint64_t)ret_var.inner;
22720 if (ret_var.is_owned) {
22726 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
22727 LDKTrustedCommitmentTransaction this_arg_conv;
22728 this_arg_conv.inner = (void*)(this_arg & (~1));
22729 this_arg_conv.is_owned = false;
22730 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
22731 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22732 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22733 uint64_t ret_ref = (uint64_t)ret_var.inner;
22734 if (ret_var.is_owned) {
22740 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
22741 LDKTrustedCommitmentTransaction this_arg_conv;
22742 this_arg_conv.inner = (void*)(this_arg & (~1));
22743 this_arg_conv.is_owned = false;
22744 unsigned char htlc_base_key_arr[32];
22745 CHECK(*((uint32_t*)htlc_base_key) == 32);
22746 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
22747 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
22748 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22749 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22750 channel_parameters_conv.is_owned = false;
22751 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
22752 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
22753 return (uint64_t)ret_conv;
22756 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) {
22757 LDKPublicKey broadcaster_payment_basepoint_ref;
22758 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
22759 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
22760 LDKPublicKey countersignatory_payment_basepoint_ref;
22761 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
22762 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
22763 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
22767 jboolean __attribute__((visibility("default"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
22768 LDKInitFeatures a_conv;
22769 a_conv.inner = (void*)(a & (~1));
22770 a_conv.is_owned = false;
22771 LDKInitFeatures b_conv;
22772 b_conv.inner = (void*)(b & (~1));
22773 b_conv.is_owned = false;
22774 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
22778 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
22779 LDKNodeFeatures a_conv;
22780 a_conv.inner = (void*)(a & (~1));
22781 a_conv.is_owned = false;
22782 LDKNodeFeatures b_conv;
22783 b_conv.inner = (void*)(b & (~1));
22784 b_conv.is_owned = false;
22785 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
22789 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
22790 LDKChannelFeatures a_conv;
22791 a_conv.inner = (void*)(a & (~1));
22792 a_conv.is_owned = false;
22793 LDKChannelFeatures b_conv;
22794 b_conv.inner = (void*)(b & (~1));
22795 b_conv.is_owned = false;
22796 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
22800 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
22801 LDKInvoiceFeatures a_conv;
22802 a_conv.inner = (void*)(a & (~1));
22803 a_conv.is_owned = false;
22804 LDKInvoiceFeatures b_conv;
22805 b_conv.inner = (void*)(b & (~1));
22806 b_conv.is_owned = false;
22807 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
22811 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
22812 LDKInitFeatures orig_conv;
22813 orig_conv.inner = (void*)(orig & (~1));
22814 orig_conv.is_owned = false;
22815 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
22816 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22817 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22818 uint64_t ret_ref = (uint64_t)ret_var.inner;
22819 if (ret_var.is_owned) {
22825 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
22826 LDKNodeFeatures orig_conv;
22827 orig_conv.inner = (void*)(orig & (~1));
22828 orig_conv.is_owned = false;
22829 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
22830 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22831 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22832 uint64_t ret_ref = (uint64_t)ret_var.inner;
22833 if (ret_var.is_owned) {
22839 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
22840 LDKChannelFeatures orig_conv;
22841 orig_conv.inner = (void*)(orig & (~1));
22842 orig_conv.is_owned = false;
22843 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
22844 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22845 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22846 uint64_t ret_ref = (uint64_t)ret_var.inner;
22847 if (ret_var.is_owned) {
22853 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
22854 LDKInvoiceFeatures orig_conv;
22855 orig_conv.inner = (void*)(orig & (~1));
22856 orig_conv.is_owned = false;
22857 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
22858 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22859 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22860 uint64_t ret_ref = (uint64_t)ret_var.inner;
22861 if (ret_var.is_owned) {
22867 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
22868 LDKInitFeatures this_obj_conv;
22869 this_obj_conv.inner = (void*)(this_obj & (~1));
22870 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22871 InitFeatures_free(this_obj_conv);
22874 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
22875 LDKNodeFeatures this_obj_conv;
22876 this_obj_conv.inner = (void*)(this_obj & (~1));
22877 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22878 NodeFeatures_free(this_obj_conv);
22881 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
22882 LDKChannelFeatures this_obj_conv;
22883 this_obj_conv.inner = (void*)(this_obj & (~1));
22884 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22885 ChannelFeatures_free(this_obj_conv);
22888 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
22889 LDKInvoiceFeatures this_obj_conv;
22890 this_obj_conv.inner = (void*)(this_obj & (~1));
22891 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22892 InvoiceFeatures_free(this_obj_conv);
22895 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
22896 LDKInitFeatures ret_var = InitFeatures_empty();
22897 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22898 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22899 uint64_t ret_ref = (uint64_t)ret_var.inner;
22900 if (ret_var.is_owned) {
22906 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
22907 LDKInitFeatures ret_var = InitFeatures_known();
22908 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22909 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22910 uint64_t ret_ref = (uint64_t)ret_var.inner;
22911 if (ret_var.is_owned) {
22917 jboolean __attribute__((visibility("default"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
22918 LDKInitFeatures this_arg_conv;
22919 this_arg_conv.inner = (void*)(this_arg & (~1));
22920 this_arg_conv.is_owned = false;
22921 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
22925 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
22926 LDKNodeFeatures ret_var = NodeFeatures_empty();
22927 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22928 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22929 uint64_t ret_ref = (uint64_t)ret_var.inner;
22930 if (ret_var.is_owned) {
22936 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
22937 LDKNodeFeatures ret_var = NodeFeatures_known();
22938 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22939 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22940 uint64_t ret_ref = (uint64_t)ret_var.inner;
22941 if (ret_var.is_owned) {
22947 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
22948 LDKNodeFeatures this_arg_conv;
22949 this_arg_conv.inner = (void*)(this_arg & (~1));
22950 this_arg_conv.is_owned = false;
22951 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
22955 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
22956 LDKChannelFeatures ret_var = ChannelFeatures_empty();
22957 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22958 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22959 uint64_t ret_ref = (uint64_t)ret_var.inner;
22960 if (ret_var.is_owned) {
22966 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
22967 LDKChannelFeatures ret_var = ChannelFeatures_known();
22968 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22969 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22970 uint64_t ret_ref = (uint64_t)ret_var.inner;
22971 if (ret_var.is_owned) {
22977 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
22978 LDKChannelFeatures this_arg_conv;
22979 this_arg_conv.inner = (void*)(this_arg & (~1));
22980 this_arg_conv.is_owned = false;
22981 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
22985 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
22986 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
22987 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22988 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22989 uint64_t ret_ref = (uint64_t)ret_var.inner;
22990 if (ret_var.is_owned) {
22996 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
22997 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
22998 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22999 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23000 uint64_t ret_ref = (uint64_t)ret_var.inner;
23001 if (ret_var.is_owned) {
23007 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
23008 LDKInvoiceFeatures this_arg_conv;
23009 this_arg_conv.inner = (void*)(this_arg & (~1));
23010 this_arg_conv.is_owned = false;
23011 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
23015 jboolean __attribute__((visibility("default"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
23016 LDKInitFeatures this_arg_conv;
23017 this_arg_conv.inner = (void*)(this_arg & (~1));
23018 this_arg_conv.is_owned = false;
23019 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
23023 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) {
23024 LDKNodeFeatures this_arg_conv;
23025 this_arg_conv.inner = (void*)(this_arg & (~1));
23026 this_arg_conv.is_owned = false;
23027 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
23031 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) {
23032 LDKInvoiceFeatures this_arg_conv;
23033 this_arg_conv.inner = (void*)(this_arg & (~1));
23034 this_arg_conv.is_owned = false;
23035 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
23039 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
23040 LDKInitFeatures obj_conv;
23041 obj_conv.inner = (void*)(obj & (~1));
23042 obj_conv.is_owned = false;
23043 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
23044 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23045 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23046 CVec_u8Z_free(ret_var);
23050 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
23051 LDKNodeFeatures obj_conv;
23052 obj_conv.inner = (void*)(obj & (~1));
23053 obj_conv.is_owned = false;
23054 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
23055 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23056 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23057 CVec_u8Z_free(ret_var);
23061 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
23062 LDKChannelFeatures obj_conv;
23063 obj_conv.inner = (void*)(obj & (~1));
23064 obj_conv.is_owned = false;
23065 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
23066 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23067 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23068 CVec_u8Z_free(ret_var);
23072 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
23073 LDKInvoiceFeatures obj_conv;
23074 obj_conv.inner = (void*)(obj & (~1));
23075 obj_conv.is_owned = false;
23076 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
23077 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23078 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23079 CVec_u8Z_free(ret_var);
23083 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
23084 LDKu8slice ser_ref;
23085 ser_ref.datalen = *((uint32_t*)ser);
23086 ser_ref.data = (int8_t*)(ser + 4);
23087 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
23088 *ret_conv = InitFeatures_read(ser_ref);
23089 return (uint64_t)ret_conv;
23092 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
23093 LDKu8slice ser_ref;
23094 ser_ref.datalen = *((uint32_t*)ser);
23095 ser_ref.data = (int8_t*)(ser + 4);
23096 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
23097 *ret_conv = NodeFeatures_read(ser_ref);
23098 return (uint64_t)ret_conv;
23101 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
23102 LDKu8slice ser_ref;
23103 ser_ref.datalen = *((uint32_t*)ser);
23104 ser_ref.data = (int8_t*)(ser + 4);
23105 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
23106 *ret_conv = ChannelFeatures_read(ser_ref);
23107 return (uint64_t)ret_conv;
23110 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
23111 LDKu8slice ser_ref;
23112 ser_ref.datalen = *((uint32_t*)ser);
23113 ser_ref.data = (int8_t*)(ser + 4);
23114 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
23115 *ret_conv = InvoiceFeatures_read(ser_ref);
23116 return (uint64_t)ret_conv;
23119 void __attribute__((visibility("default"))) TS_ShutdownScript_free(uint32_t this_obj) {
23120 LDKShutdownScript this_obj_conv;
23121 this_obj_conv.inner = (void*)(this_obj & (~1));
23122 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23123 ShutdownScript_free(this_obj_conv);
23126 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_clone(uint32_t orig) {
23127 LDKShutdownScript orig_conv;
23128 orig_conv.inner = (void*)(orig & (~1));
23129 orig_conv.is_owned = false;
23130 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
23131 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23132 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23133 uint64_t ret_ref = (uint64_t)ret_var.inner;
23134 if (ret_var.is_owned) {
23140 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
23141 LDKInvalidShutdownScript this_obj_conv;
23142 this_obj_conv.inner = (void*)(this_obj & (~1));
23143 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23144 InvalidShutdownScript_free(this_obj_conv);
23147 int8_tArray __attribute__((visibility("default"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
23148 LDKInvalidShutdownScript this_ptr_conv;
23149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23150 this_ptr_conv.is_owned = false;
23151 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
23152 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23153 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23157 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
23158 LDKInvalidShutdownScript this_ptr_conv;
23159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23160 this_ptr_conv.is_owned = false;
23161 LDKCVec_u8Z val_ref;
23162 val_ref.datalen = *((uint32_t*)val);
23163 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
23164 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
23165 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
23168 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
23169 LDKCVec_u8Z script_arg_ref;
23170 script_arg_ref.datalen = *((uint32_t*)script_arg);
23171 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
23172 memcpy(script_arg_ref.data, (uint8_t*)(script_arg + 4), script_arg_ref.datalen);
23173 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
23174 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23175 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23176 uint64_t ret_ref = (uint64_t)ret_var.inner;
23177 if (ret_var.is_owned) {
23183 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_write(uint32_t obj) {
23184 LDKShutdownScript obj_conv;
23185 obj_conv.inner = (void*)(obj & (~1));
23186 obj_conv.is_owned = false;
23187 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
23188 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23189 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23190 CVec_u8Z_free(ret_var);
23194 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_read(int8_tArray ser) {
23195 LDKu8slice ser_ref;
23196 ser_ref.datalen = *((uint32_t*)ser);
23197 ser_ref.data = (int8_t*)(ser + 4);
23198 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
23199 *ret_conv = ShutdownScript_read(ser_ref);
23200 return (uint64_t)ret_conv;
23203 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2pkh(int8_tArray pubkey_hash) {
23204 unsigned char pubkey_hash_arr[20];
23205 CHECK(*((uint32_t*)pubkey_hash) == 20);
23206 memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
23207 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
23208 LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref);
23209 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23210 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23211 uint64_t ret_ref = (uint64_t)ret_var.inner;
23212 if (ret_var.is_owned) {
23218 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2sh(int8_tArray script_hash) {
23219 unsigned char script_hash_arr[20];
23220 CHECK(*((uint32_t*)script_hash) == 20);
23221 memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 20);
23222 unsigned char (*script_hash_ref)[20] = &script_hash_arr;
23223 LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref);
23224 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23225 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23226 uint64_t ret_ref = (uint64_t)ret_var.inner;
23227 if (ret_var.is_owned) {
23233 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
23234 unsigned char pubkey_hash_arr[20];
23235 CHECK(*((uint32_t*)pubkey_hash) == 20);
23236 memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
23237 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
23238 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
23239 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23240 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23241 uint64_t ret_ref = (uint64_t)ret_var.inner;
23242 if (ret_var.is_owned) {
23248 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
23249 unsigned char script_hash_arr[32];
23250 CHECK(*((uint32_t*)script_hash) == 32);
23251 memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 32);
23252 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
23253 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
23254 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23255 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23256 uint64_t ret_ref = (uint64_t)ret_var.inner;
23257 if (ret_var.is_owned) {
23263 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
23264 LDKu8slice program_ref;
23265 program_ref.datalen = *((uint32_t*)program);
23266 program_ref.data = (int8_t*)(program + 4);
23267 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
23268 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
23269 return (uint64_t)ret_conv;
23272 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
23273 LDKShutdownScript this_arg_conv;
23274 this_arg_conv.inner = (void*)(this_arg & (~1));
23275 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
23276 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
23277 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
23278 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23279 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23280 CVec_u8Z_free(ret_var);
23284 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
23285 LDKShutdownScript this_arg_conv;
23286 this_arg_conv.inner = (void*)(this_arg & (~1));
23287 this_arg_conv.is_owned = false;
23288 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23289 memcpy((uint8_t*)(ret_arr + 4), ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
23293 jboolean __attribute__((visibility("default"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
23294 LDKShutdownScript this_arg_conv;
23295 this_arg_conv.inner = (void*)(this_arg & (~1));
23296 this_arg_conv.is_owned = false;
23297 LDKInitFeatures features_conv;
23298 features_conv.inner = (void*)(features & (~1));
23299 features_conv.is_owned = false;
23300 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
23304 void __attribute__((visibility("default"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
23305 if ((this_ptr & 1) != 0) return;
23306 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(((uint64_t)this_ptr) & ~1);
23307 FREE((void*)this_ptr);
23308 CustomMessageReader_free(this_ptr_conv);
23311 uint32_t __attribute__((visibility("default"))) TS_Type_clone(uint32_t orig) {
23312 LDKType* orig_conv = (LDKType*)(((uint64_t)orig) & ~1);
23313 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
23314 *ret_ret = Type_clone(orig_conv);
23315 return (uint64_t)ret_ret;
23318 void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) {
23319 if ((this_ptr & 1) != 0) return;
23320 LDKType this_ptr_conv = *(LDKType*)(((uint64_t)this_ptr) & ~1);
23321 FREE((void*)this_ptr);
23322 Type_free(this_ptr_conv);
23325 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
23326 LDKRouteHop this_obj_conv;
23327 this_obj_conv.inner = (void*)(this_obj & (~1));
23328 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23329 RouteHop_free(this_obj_conv);
23332 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
23333 LDKRouteHop this_ptr_conv;
23334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23335 this_ptr_conv.is_owned = false;
23336 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23337 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
23341 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
23342 LDKRouteHop this_ptr_conv;
23343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23344 this_ptr_conv.is_owned = false;
23345 LDKPublicKey val_ref;
23346 CHECK(*((uint32_t*)val) == 33);
23347 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23348 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
23351 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
23352 LDKRouteHop this_ptr_conv;
23353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23354 this_ptr_conv.is_owned = false;
23355 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
23356 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23357 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23358 uint64_t ret_ref = (uint64_t)ret_var.inner;
23359 if (ret_var.is_owned) {
23365 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
23366 LDKRouteHop this_ptr_conv;
23367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23368 this_ptr_conv.is_owned = false;
23369 LDKNodeFeatures val_conv;
23370 val_conv.inner = (void*)(val & (~1));
23371 val_conv.is_owned = (val & 1) || (val == 0);
23372 val_conv = NodeFeatures_clone(&val_conv);
23373 RouteHop_set_node_features(&this_ptr_conv, val_conv);
23376 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
23377 LDKRouteHop this_ptr_conv;
23378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23379 this_ptr_conv.is_owned = false;
23380 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
23384 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
23385 LDKRouteHop this_ptr_conv;
23386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23387 this_ptr_conv.is_owned = false;
23388 RouteHop_set_short_channel_id(&this_ptr_conv, val);
23391 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
23392 LDKRouteHop this_ptr_conv;
23393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23394 this_ptr_conv.is_owned = false;
23395 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
23396 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23397 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23398 uint64_t ret_ref = (uint64_t)ret_var.inner;
23399 if (ret_var.is_owned) {
23405 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
23406 LDKRouteHop this_ptr_conv;
23407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23408 this_ptr_conv.is_owned = false;
23409 LDKChannelFeatures val_conv;
23410 val_conv.inner = (void*)(val & (~1));
23411 val_conv.is_owned = (val & 1) || (val == 0);
23412 val_conv = ChannelFeatures_clone(&val_conv);
23413 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
23416 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
23417 LDKRouteHop this_ptr_conv;
23418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23419 this_ptr_conv.is_owned = false;
23420 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
23424 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
23425 LDKRouteHop this_ptr_conv;
23426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23427 this_ptr_conv.is_owned = false;
23428 RouteHop_set_fee_msat(&this_ptr_conv, val);
23431 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
23432 LDKRouteHop this_ptr_conv;
23433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23434 this_ptr_conv.is_owned = false;
23435 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
23439 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
23440 LDKRouteHop this_ptr_conv;
23441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23442 this_ptr_conv.is_owned = false;
23443 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
23446 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) {
23447 LDKPublicKey pubkey_arg_ref;
23448 CHECK(*((uint32_t*)pubkey_arg) == 33);
23449 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
23450 LDKNodeFeatures node_features_arg_conv;
23451 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
23452 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
23453 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
23454 LDKChannelFeatures channel_features_arg_conv;
23455 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
23456 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
23457 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
23458 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);
23459 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23460 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23461 uint64_t ret_ref = (uint64_t)ret_var.inner;
23462 if (ret_var.is_owned) {
23468 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
23469 LDKRouteHop orig_conv;
23470 orig_conv.inner = (void*)(orig & (~1));
23471 orig_conv.is_owned = false;
23472 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
23473 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23474 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23475 uint64_t ret_ref = (uint64_t)ret_var.inner;
23476 if (ret_var.is_owned) {
23482 int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) {
23483 LDKRouteHop o_conv;
23484 o_conv.inner = (void*)(o & (~1));
23485 o_conv.is_owned = false;
23486 int64_t ret_val = RouteHop_hash(&o_conv);
23490 jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
23491 LDKRouteHop a_conv;
23492 a_conv.inner = (void*)(a & (~1));
23493 a_conv.is_owned = false;
23494 LDKRouteHop b_conv;
23495 b_conv.inner = (void*)(b & (~1));
23496 b_conv.is_owned = false;
23497 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
23501 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
23502 LDKRouteHop obj_conv;
23503 obj_conv.inner = (void*)(obj & (~1));
23504 obj_conv.is_owned = false;
23505 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
23506 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23507 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23508 CVec_u8Z_free(ret_var);
23512 uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) {
23513 LDKu8slice ser_ref;
23514 ser_ref.datalen = *((uint32_t*)ser);
23515 ser_ref.data = (int8_t*)(ser + 4);
23516 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
23517 *ret_conv = RouteHop_read(ser_ref);
23518 return (uint64_t)ret_conv;
23521 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
23522 LDKRoute this_obj_conv;
23523 this_obj_conv.inner = (void*)(this_obj & (~1));
23524 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23525 Route_free(this_obj_conv);
23528 ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) {
23529 LDKRoute this_ptr_conv;
23530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23531 this_ptr_conv.is_owned = false;
23532 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
23533 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
23534 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4);
23535 for (size_t m = 0; m < ret_var.datalen; m++) {
23536 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
23537 uint32_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
23538 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4);
23539 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
23540 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
23541 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23542 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23543 uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
23544 if (ret_conv_12_conv_10_var.is_owned) {
23545 ret_conv_12_conv_10_ref |= 1;
23547 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
23549 FREE(ret_conv_12_var.data);
23550 ret_arr_ptr[m] = ret_conv_12_arr;
23552 FREE(ret_var.data);
23556 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
23557 LDKRoute this_ptr_conv;
23558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23559 this_ptr_conv.is_owned = false;
23560 LDKCVec_CVec_RouteHopZZ val_constr;
23561 val_constr.datalen = *((uint32_t*)val);
23562 if (val_constr.datalen > 0)
23563 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
23565 val_constr.data = NULL;
23566 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
23567 for (size_t m = 0; m < val_constr.datalen; m++) {
23568 uint32_tArray val_conv_12 = val_vals[m];
23569 LDKCVec_RouteHopZ val_conv_12_constr;
23570 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
23571 if (val_conv_12_constr.datalen > 0)
23572 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23574 val_conv_12_constr.data = NULL;
23575 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
23576 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
23577 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
23578 LDKRouteHop val_conv_12_conv_10_conv;
23579 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
23580 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
23581 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
23582 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
23584 val_constr.data[m] = val_conv_12_constr;
23586 Route_set_paths(&this_ptr_conv, val_constr);
23589 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) {
23590 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
23591 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
23592 if (paths_arg_constr.datalen > 0)
23593 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
23595 paths_arg_constr.data = NULL;
23596 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
23597 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
23598 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
23599 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
23600 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
23601 if (paths_arg_conv_12_constr.datalen > 0)
23602 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23604 paths_arg_conv_12_constr.data = NULL;
23605 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
23606 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
23607 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
23608 LDKRouteHop paths_arg_conv_12_conv_10_conv;
23609 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
23610 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
23611 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
23612 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
23614 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
23616 LDKRoute ret_var = Route_new(paths_arg_constr);
23617 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23618 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23619 uint64_t ret_ref = (uint64_t)ret_var.inner;
23620 if (ret_var.is_owned) {
23626 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
23627 LDKRoute orig_conv;
23628 orig_conv.inner = (void*)(orig & (~1));
23629 orig_conv.is_owned = false;
23630 LDKRoute ret_var = Route_clone(&orig_conv);
23631 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23632 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23633 uint64_t ret_ref = (uint64_t)ret_var.inner;
23634 if (ret_var.is_owned) {
23640 int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) {
23642 o_conv.inner = (void*)(o & (~1));
23643 o_conv.is_owned = false;
23644 int64_t ret_val = Route_hash(&o_conv);
23648 jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) {
23650 a_conv.inner = (void*)(a & (~1));
23651 a_conv.is_owned = false;
23653 b_conv.inner = (void*)(b & (~1));
23654 b_conv.is_owned = false;
23655 jboolean ret_val = Route_eq(&a_conv, &b_conv);
23659 int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) {
23660 LDKRoute this_arg_conv;
23661 this_arg_conv.inner = (void*)(this_arg & (~1));
23662 this_arg_conv.is_owned = false;
23663 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
23667 int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) {
23668 LDKRoute this_arg_conv;
23669 this_arg_conv.inner = (void*)(this_arg & (~1));
23670 this_arg_conv.is_owned = false;
23671 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
23675 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
23677 obj_conv.inner = (void*)(obj & (~1));
23678 obj_conv.is_owned = false;
23679 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
23680 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23681 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23682 CVec_u8Z_free(ret_var);
23686 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
23687 LDKu8slice ser_ref;
23688 ser_ref.datalen = *((uint32_t*)ser);
23689 ser_ref.data = (int8_t*)(ser + 4);
23690 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
23691 *ret_conv = Route_read(ser_ref);
23692 return (uint64_t)ret_conv;
23695 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
23696 LDKRouteHint this_obj_conv;
23697 this_obj_conv.inner = (void*)(this_obj & (~1));
23698 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23699 RouteHint_free(this_obj_conv);
23702 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
23703 LDKRouteHint orig_conv;
23704 orig_conv.inner = (void*)(orig & (~1));
23705 orig_conv.is_owned = false;
23706 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
23707 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23708 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23709 uint64_t ret_ref = (uint64_t)ret_var.inner;
23710 if (ret_var.is_owned) {
23716 int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) {
23717 LDKRouteHint o_conv;
23718 o_conv.inner = (void*)(o & (~1));
23719 o_conv.is_owned = false;
23720 int64_t ret_val = RouteHint_hash(&o_conv);
23724 jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
23725 LDKRouteHint a_conv;
23726 a_conv.inner = (void*)(a & (~1));
23727 a_conv.is_owned = false;
23728 LDKRouteHint b_conv;
23729 b_conv.inner = (void*)(b & (~1));
23730 b_conv.is_owned = false;
23731 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
23735 void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
23736 LDKRouteHintHop this_obj_conv;
23737 this_obj_conv.inner = (void*)(this_obj & (~1));
23738 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23739 RouteHintHop_free(this_obj_conv);
23742 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
23743 LDKRouteHintHop this_ptr_conv;
23744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23745 this_ptr_conv.is_owned = false;
23746 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23747 memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
23751 void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
23752 LDKRouteHintHop this_ptr_conv;
23753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23754 this_ptr_conv.is_owned = false;
23755 LDKPublicKey val_ref;
23756 CHECK(*((uint32_t*)val) == 33);
23757 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23758 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
23761 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
23762 LDKRouteHintHop this_ptr_conv;
23763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23764 this_ptr_conv.is_owned = false;
23765 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
23769 void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
23770 LDKRouteHintHop this_ptr_conv;
23771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23772 this_ptr_conv.is_owned = false;
23773 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
23776 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
23777 LDKRouteHintHop this_ptr_conv;
23778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23779 this_ptr_conv.is_owned = false;
23780 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
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 void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
23791 LDKRouteHintHop this_ptr_conv;
23792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23793 this_ptr_conv.is_owned = false;
23794 LDKRoutingFees val_conv;
23795 val_conv.inner = (void*)(val & (~1));
23796 val_conv.is_owned = (val & 1) || (val == 0);
23797 val_conv = RoutingFees_clone(&val_conv);
23798 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
23801 int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
23802 LDKRouteHintHop this_ptr_conv;
23803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23804 this_ptr_conv.is_owned = false;
23805 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
23809 void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
23810 LDKRouteHintHop this_ptr_conv;
23811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23812 this_ptr_conv.is_owned = false;
23813 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
23816 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
23817 LDKRouteHintHop this_ptr_conv;
23818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23819 this_ptr_conv.is_owned = false;
23820 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23821 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
23822 uint64_t ret_ref = (uint64_t)ret_copy;
23826 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
23827 LDKRouteHintHop this_ptr_conv;
23828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23829 this_ptr_conv.is_owned = false;
23830 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23831 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
23832 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
23835 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
23836 LDKRouteHintHop this_ptr_conv;
23837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23838 this_ptr_conv.is_owned = false;
23839 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23840 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
23841 uint64_t ret_ref = (uint64_t)ret_copy;
23845 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
23846 LDKRouteHintHop this_ptr_conv;
23847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23848 this_ptr_conv.is_owned = false;
23849 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23850 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
23851 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
23854 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) {
23855 LDKPublicKey src_node_id_arg_ref;
23856 CHECK(*((uint32_t*)src_node_id_arg) == 33);
23857 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
23858 LDKRoutingFees fees_arg_conv;
23859 fees_arg_conv.inner = (void*)(fees_arg & (~1));
23860 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
23861 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
23862 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
23863 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
23864 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
23865 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
23866 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);
23867 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23868 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23869 uint64_t ret_ref = (uint64_t)ret_var.inner;
23870 if (ret_var.is_owned) {
23876 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
23877 LDKRouteHintHop orig_conv;
23878 orig_conv.inner = (void*)(orig & (~1));
23879 orig_conv.is_owned = false;
23880 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
23881 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23882 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23883 uint64_t ret_ref = (uint64_t)ret_var.inner;
23884 if (ret_var.is_owned) {
23890 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) {
23891 LDKRouteHintHop o_conv;
23892 o_conv.inner = (void*)(o & (~1));
23893 o_conv.is_owned = false;
23894 int64_t ret_val = RouteHintHop_hash(&o_conv);
23898 jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
23899 LDKRouteHintHop a_conv;
23900 a_conv.inner = (void*)(a & (~1));
23901 a_conv.is_owned = false;
23902 LDKRouteHintHop b_conv;
23903 b_conv.inner = (void*)(b & (~1));
23904 b_conv.is_owned = false;
23905 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
23909 uint32_t __attribute__((visibility("default"))) TS_get_keysend_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
23910 LDKPublicKey our_node_id_ref;
23911 CHECK(*((uint32_t*)our_node_id) == 33);
23912 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
23913 LDKNetworkGraph network_conv;
23914 network_conv.inner = (void*)(network & (~1));
23915 network_conv.is_owned = false;
23916 LDKPublicKey payee_ref;
23917 CHECK(*((uint32_t*)payee) == 33);
23918 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
23919 LDKCVec_ChannelDetailsZ first_hops_constr;
23920 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
23921 if (first_hops != 0) {
23922 first_hops_constr.datalen = *((uint32_t*)first_hops);
23923 if (first_hops_constr.datalen > 0)
23924 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23926 first_hops_constr.data = NULL;
23927 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
23928 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
23929 uint32_t first_hops_conv_16 = first_hops_vals[q];
23930 LDKChannelDetails first_hops_conv_16_conv;
23931 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
23932 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
23933 first_hops_constr.data[q] = first_hops_conv_16_conv;
23935 first_hops_ptr = &first_hops_constr;
23937 LDKCVec_RouteHintZ last_hops_constr;
23938 last_hops_constr.datalen = *((uint32_t*)last_hops);
23939 if (last_hops_constr.datalen > 0)
23940 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
23942 last_hops_constr.data = NULL;
23943 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
23944 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
23945 uint32_t last_hops_conv_11 = last_hops_vals[l];
23946 LDKRouteHint last_hops_conv_11_conv;
23947 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
23948 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
23949 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
23950 last_hops_constr.data[l] = last_hops_conv_11_conv;
23952 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23953 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
23954 *ret_conv = get_keysend_route(our_node_id_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
23955 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
23956 return (uint64_t)ret_conv;
23959 uint32_t __attribute__((visibility("default"))) TS_get_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_t payee_features, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
23960 LDKPublicKey our_node_id_ref;
23961 CHECK(*((uint32_t*)our_node_id) == 33);
23962 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
23963 LDKNetworkGraph network_conv;
23964 network_conv.inner = (void*)(network & (~1));
23965 network_conv.is_owned = false;
23966 LDKPublicKey payee_ref;
23967 CHECK(*((uint32_t*)payee) == 33);
23968 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
23969 LDKInvoiceFeatures payee_features_conv;
23970 payee_features_conv.inner = (void*)(payee_features & (~1));
23971 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
23972 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
23973 LDKCVec_ChannelDetailsZ first_hops_constr;
23974 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
23975 if (first_hops != 0) {
23976 first_hops_constr.datalen = *((uint32_t*)first_hops);
23977 if (first_hops_constr.datalen > 0)
23978 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23980 first_hops_constr.data = NULL;
23981 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
23982 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
23983 uint32_t first_hops_conv_16 = first_hops_vals[q];
23984 LDKChannelDetails first_hops_conv_16_conv;
23985 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
23986 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
23987 first_hops_constr.data[q] = first_hops_conv_16_conv;
23989 first_hops_ptr = &first_hops_constr;
23991 LDKCVec_RouteHintZ last_hops_constr;
23992 last_hops_constr.datalen = *((uint32_t*)last_hops);
23993 if (last_hops_constr.datalen > 0)
23994 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
23996 last_hops_constr.data = NULL;
23997 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
23998 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
23999 uint32_t last_hops_conv_11 = last_hops_vals[l];
24000 LDKRouteHint last_hops_conv_11_conv;
24001 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
24002 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
24003 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
24004 last_hops_constr.data[l] = last_hops_conv_11_conv;
24006 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
24007 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
24008 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
24009 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
24010 return (uint64_t)ret_conv;
24013 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
24014 LDKNetworkGraph this_obj_conv;
24015 this_obj_conv.inner = (void*)(this_obj & (~1));
24016 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24017 NetworkGraph_free(this_obj_conv);
24020 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
24021 LDKNetworkGraph orig_conv;
24022 orig_conv.inner = (void*)(orig & (~1));
24023 orig_conv.is_owned = false;
24024 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
24025 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24026 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24027 uint64_t ret_ref = (uint64_t)ret_var.inner;
24028 if (ret_var.is_owned) {
24034 void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
24035 LDKReadOnlyNetworkGraph this_obj_conv;
24036 this_obj_conv.inner = (void*)(this_obj & (~1));
24037 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24038 ReadOnlyNetworkGraph_free(this_obj_conv);
24041 void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
24042 if ((this_ptr & 1) != 0) return;
24043 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1);
24044 FREE((void*)this_ptr);
24045 NetworkUpdate_free(this_ptr_conv);
24048 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) {
24049 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
24050 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
24051 *ret_copy = NetworkUpdate_clone(orig_conv);
24052 uint64_t ret_ref = (uint64_t)ret_copy;
24056 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
24057 LDKChannelUpdate msg_conv;
24058 msg_conv.inner = (void*)(msg & (~1));
24059 msg_conv.is_owned = (msg & 1) || (msg == 0);
24060 msg_conv = ChannelUpdate_clone(&msg_conv);
24061 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
24062 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
24063 uint64_t ret_ref = (uint64_t)ret_copy;
24067 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
24068 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
24069 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
24070 uint64_t ret_ref = (uint64_t)ret_copy;
24074 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
24075 LDKPublicKey node_id_ref;
24076 CHECK(*((uint32_t*)node_id) == 33);
24077 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
24078 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
24079 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
24080 uint64_t ret_ref = (uint64_t)ret_copy;
24084 int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) {
24085 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
24086 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
24087 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24088 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24089 CVec_u8Z_free(ret_var);
24093 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
24094 LDKNetGraphMsgHandler this_arg_conv;
24095 this_arg_conv.inner = (void*)(this_arg & (~1));
24096 this_arg_conv.is_owned = false;
24097 LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
24098 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
24099 return (uint64_t)ret_ret;
24102 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
24103 LDKNetGraphMsgHandler this_obj_conv;
24104 this_obj_conv.inner = (void*)(this_obj & (~1));
24105 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24106 NetGraphMsgHandler_free(this_obj_conv);
24109 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_get_network_graph(uint32_t this_ptr) {
24110 LDKNetGraphMsgHandler this_ptr_conv;
24111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24112 this_ptr_conv.is_owned = false;
24113 LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv);
24114 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24115 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24116 uint64_t ret_ref = (uint64_t)ret_var.inner;
24117 if (ret_var.is_owned) {
24123 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_set_network_graph(uint32_t this_ptr, uint32_t val) {
24124 LDKNetGraphMsgHandler this_ptr_conv;
24125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24126 this_ptr_conv.is_owned = false;
24127 LDKNetworkGraph val_conv;
24128 val_conv.inner = (void*)(val & (~1));
24129 val_conv.is_owned = (val & 1) || (val == 0);
24130 val_conv = NetworkGraph_clone(&val_conv);
24131 NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv);
24134 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
24135 LDKNetworkGraph network_graph_conv;
24136 network_graph_conv.inner = (void*)(network_graph & (~1));
24137 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
24138 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
24139 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
24140 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
24141 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
24142 // Manually implement clone for Java trait instances
24144 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
24145 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv);
24146 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24147 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24148 uint64_t ret_ref = (uint64_t)ret_var.inner;
24149 if (ret_var.is_owned) {
24155 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
24156 LDKNetGraphMsgHandler this_arg_conv;
24157 this_arg_conv.inner = (void*)(this_arg & (~1));
24158 this_arg_conv.is_owned = false;
24159 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
24160 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
24161 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
24162 // Manually implement clone for Java trait instances
24164 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
24167 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
24168 LDKNetGraphMsgHandler this_arg_conv;
24169 this_arg_conv.inner = (void*)(this_arg & (~1));
24170 this_arg_conv.is_owned = false;
24171 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
24172 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
24173 return (uint64_t)ret_ret;
24176 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
24177 LDKNetGraphMsgHandler this_arg_conv;
24178 this_arg_conv.inner = (void*)(this_arg & (~1));
24179 this_arg_conv.is_owned = false;
24180 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
24181 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
24182 return (uint64_t)ret_ret;
24185 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
24186 LDKDirectionalChannelInfo this_obj_conv;
24187 this_obj_conv.inner = (void*)(this_obj & (~1));
24188 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24189 DirectionalChannelInfo_free(this_obj_conv);
24192 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
24193 LDKDirectionalChannelInfo this_ptr_conv;
24194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24195 this_ptr_conv.is_owned = false;
24196 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
24200 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
24201 LDKDirectionalChannelInfo this_ptr_conv;
24202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24203 this_ptr_conv.is_owned = false;
24204 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
24207 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
24208 LDKDirectionalChannelInfo this_ptr_conv;
24209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24210 this_ptr_conv.is_owned = false;
24211 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
24215 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
24216 LDKDirectionalChannelInfo this_ptr_conv;
24217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24218 this_ptr_conv.is_owned = false;
24219 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
24222 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
24223 LDKDirectionalChannelInfo this_ptr_conv;
24224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24225 this_ptr_conv.is_owned = false;
24226 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
24230 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
24231 LDKDirectionalChannelInfo this_ptr_conv;
24232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24233 this_ptr_conv.is_owned = false;
24234 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
24237 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
24238 LDKDirectionalChannelInfo this_ptr_conv;
24239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24240 this_ptr_conv.is_owned = false;
24241 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
24245 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
24246 LDKDirectionalChannelInfo this_ptr_conv;
24247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24248 this_ptr_conv.is_owned = false;
24249 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
24252 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
24253 LDKDirectionalChannelInfo this_ptr_conv;
24254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24255 this_ptr_conv.is_owned = false;
24256 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24257 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
24258 uint64_t ret_ref = (uint64_t)ret_copy;
24262 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
24263 LDKDirectionalChannelInfo this_ptr_conv;
24264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24265 this_ptr_conv.is_owned = false;
24266 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
24267 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
24268 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
24271 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
24272 LDKDirectionalChannelInfo this_ptr_conv;
24273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24274 this_ptr_conv.is_owned = false;
24275 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
24276 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24277 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24278 uint64_t ret_ref = (uint64_t)ret_var.inner;
24279 if (ret_var.is_owned) {
24285 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
24286 LDKDirectionalChannelInfo this_ptr_conv;
24287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24288 this_ptr_conv.is_owned = false;
24289 LDKRoutingFees val_conv;
24290 val_conv.inner = (void*)(val & (~1));
24291 val_conv.is_owned = (val & 1) || (val == 0);
24292 val_conv = RoutingFees_clone(&val_conv);
24293 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
24296 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
24297 LDKDirectionalChannelInfo this_ptr_conv;
24298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24299 this_ptr_conv.is_owned = false;
24300 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
24301 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24302 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24303 uint64_t ret_ref = (uint64_t)ret_var.inner;
24304 if (ret_var.is_owned) {
24310 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
24311 LDKDirectionalChannelInfo this_ptr_conv;
24312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24313 this_ptr_conv.is_owned = false;
24314 LDKChannelUpdate val_conv;
24315 val_conv.inner = (void*)(val & (~1));
24316 val_conv.is_owned = (val & 1) || (val == 0);
24317 val_conv = ChannelUpdate_clone(&val_conv);
24318 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
24321 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) {
24322 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
24323 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
24324 LDKRoutingFees fees_arg_conv;
24325 fees_arg_conv.inner = (void*)(fees_arg & (~1));
24326 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
24327 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
24328 LDKChannelUpdate last_update_message_arg_conv;
24329 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
24330 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
24331 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
24332 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);
24333 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24334 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24335 uint64_t ret_ref = (uint64_t)ret_var.inner;
24336 if (ret_var.is_owned) {
24342 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
24343 LDKDirectionalChannelInfo orig_conv;
24344 orig_conv.inner = (void*)(orig & (~1));
24345 orig_conv.is_owned = false;
24346 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
24347 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24348 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24349 uint64_t ret_ref = (uint64_t)ret_var.inner;
24350 if (ret_var.is_owned) {
24356 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
24357 LDKDirectionalChannelInfo obj_conv;
24358 obj_conv.inner = (void*)(obj & (~1));
24359 obj_conv.is_owned = false;
24360 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
24361 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24362 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24363 CVec_u8Z_free(ret_var);
24367 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
24368 LDKu8slice ser_ref;
24369 ser_ref.datalen = *((uint32_t*)ser);
24370 ser_ref.data = (int8_t*)(ser + 4);
24371 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
24372 *ret_conv = DirectionalChannelInfo_read(ser_ref);
24373 return (uint64_t)ret_conv;
24376 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
24377 LDKChannelInfo this_obj_conv;
24378 this_obj_conv.inner = (void*)(this_obj & (~1));
24379 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24380 ChannelInfo_free(this_obj_conv);
24383 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
24384 LDKChannelInfo this_ptr_conv;
24385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24386 this_ptr_conv.is_owned = false;
24387 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
24388 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24389 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24390 uint64_t ret_ref = (uint64_t)ret_var.inner;
24391 if (ret_var.is_owned) {
24397 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
24398 LDKChannelInfo this_ptr_conv;
24399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24400 this_ptr_conv.is_owned = false;
24401 LDKChannelFeatures val_conv;
24402 val_conv.inner = (void*)(val & (~1));
24403 val_conv.is_owned = (val & 1) || (val == 0);
24404 val_conv = ChannelFeatures_clone(&val_conv);
24405 ChannelInfo_set_features(&this_ptr_conv, val_conv);
24408 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
24409 LDKChannelInfo this_ptr_conv;
24410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24411 this_ptr_conv.is_owned = false;
24412 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24413 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
24417 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, int8_tArray val) {
24418 LDKChannelInfo this_ptr_conv;
24419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24420 this_ptr_conv.is_owned = false;
24421 LDKPublicKey val_ref;
24422 CHECK(*((uint32_t*)val) == 33);
24423 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
24424 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
24427 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_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 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_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_one_to_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 LDKDirectionalChannelInfo val_conv;
24446 val_conv.inner = (void*)(val & (~1));
24447 val_conv.is_owned = (val & 1) || (val == 0);
24448 val_conv = DirectionalChannelInfo_clone(&val_conv);
24449 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
24452 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(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 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24457 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
24461 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, int8_tArray val) {
24462 LDKChannelInfo this_ptr_conv;
24463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24464 this_ptr_conv.is_owned = false;
24465 LDKPublicKey val_ref;
24466 CHECK(*((uint32_t*)val) == 33);
24467 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
24468 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
24471 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
24472 LDKChannelInfo this_ptr_conv;
24473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24474 this_ptr_conv.is_owned = false;
24475 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
24476 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24477 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24478 uint64_t ret_ref = (uint64_t)ret_var.inner;
24479 if (ret_var.is_owned) {
24485 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
24486 LDKChannelInfo this_ptr_conv;
24487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24488 this_ptr_conv.is_owned = false;
24489 LDKDirectionalChannelInfo val_conv;
24490 val_conv.inner = (void*)(val & (~1));
24491 val_conv.is_owned = (val & 1) || (val == 0);
24492 val_conv = DirectionalChannelInfo_clone(&val_conv);
24493 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
24496 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(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 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24501 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
24502 uint64_t ret_ref = (uint64_t)ret_copy;
24506 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
24507 LDKChannelInfo this_ptr_conv;
24508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24509 this_ptr_conv.is_owned = false;
24510 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
24511 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
24512 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
24515 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
24516 LDKChannelInfo this_ptr_conv;
24517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24518 this_ptr_conv.is_owned = false;
24519 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
24520 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24521 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24522 uint64_t ret_ref = (uint64_t)ret_var.inner;
24523 if (ret_var.is_owned) {
24529 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
24530 LDKChannelInfo this_ptr_conv;
24531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24532 this_ptr_conv.is_owned = false;
24533 LDKChannelAnnouncement val_conv;
24534 val_conv.inner = (void*)(val & (~1));
24535 val_conv.is_owned = (val & 1) || (val == 0);
24536 val_conv = ChannelAnnouncement_clone(&val_conv);
24537 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
24540 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_new(uint32_t features_arg, int8_tArray node_one_arg, uint32_t one_to_two_arg, int8_tArray node_two_arg, uint32_t two_to_one_arg, uint32_t capacity_sats_arg, uint32_t announcement_message_arg) {
24541 LDKChannelFeatures features_arg_conv;
24542 features_arg_conv.inner = (void*)(features_arg & (~1));
24543 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24544 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
24545 LDKPublicKey node_one_arg_ref;
24546 CHECK(*((uint32_t*)node_one_arg) == 33);
24547 memcpy(node_one_arg_ref.compressed_form, (uint8_t*)(node_one_arg + 4), 33);
24548 LDKDirectionalChannelInfo one_to_two_arg_conv;
24549 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
24550 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
24551 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
24552 LDKPublicKey node_two_arg_ref;
24553 CHECK(*((uint32_t*)node_two_arg) == 33);
24554 memcpy(node_two_arg_ref.compressed_form, (uint8_t*)(node_two_arg + 4), 33);
24555 LDKDirectionalChannelInfo two_to_one_arg_conv;
24556 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
24557 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
24558 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
24559 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
24560 capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
24561 LDKChannelAnnouncement announcement_message_arg_conv;
24562 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24563 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24564 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
24565 LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_ref, one_to_two_arg_conv, node_two_arg_ref, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv);
24566 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24567 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24568 uint64_t ret_ref = (uint64_t)ret_var.inner;
24569 if (ret_var.is_owned) {
24575 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
24576 LDKChannelInfo orig_conv;
24577 orig_conv.inner = (void*)(orig & (~1));
24578 orig_conv.is_owned = false;
24579 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
24580 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24581 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24582 uint64_t ret_ref = (uint64_t)ret_var.inner;
24583 if (ret_var.is_owned) {
24589 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
24590 LDKChannelInfo obj_conv;
24591 obj_conv.inner = (void*)(obj & (~1));
24592 obj_conv.is_owned = false;
24593 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
24594 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24595 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24596 CVec_u8Z_free(ret_var);
24600 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
24601 LDKu8slice ser_ref;
24602 ser_ref.datalen = *((uint32_t*)ser);
24603 ser_ref.data = (int8_t*)(ser + 4);
24604 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
24605 *ret_conv = ChannelInfo_read(ser_ref);
24606 return (uint64_t)ret_conv;
24609 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
24610 LDKRoutingFees this_obj_conv;
24611 this_obj_conv.inner = (void*)(this_obj & (~1));
24612 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24613 RoutingFees_free(this_obj_conv);
24616 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
24617 LDKRoutingFees this_ptr_conv;
24618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24619 this_ptr_conv.is_owned = false;
24620 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
24624 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
24625 LDKRoutingFees this_ptr_conv;
24626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24627 this_ptr_conv.is_owned = false;
24628 RoutingFees_set_base_msat(&this_ptr_conv, val);
24631 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
24632 LDKRoutingFees this_ptr_conv;
24633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24634 this_ptr_conv.is_owned = false;
24635 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
24639 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
24640 LDKRoutingFees this_ptr_conv;
24641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24642 this_ptr_conv.is_owned = false;
24643 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
24646 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
24647 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
24648 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24649 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24650 uint64_t ret_ref = (uint64_t)ret_var.inner;
24651 if (ret_var.is_owned) {
24657 jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
24658 LDKRoutingFees a_conv;
24659 a_conv.inner = (void*)(a & (~1));
24660 a_conv.is_owned = false;
24661 LDKRoutingFees b_conv;
24662 b_conv.inner = (void*)(b & (~1));
24663 b_conv.is_owned = false;
24664 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
24668 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
24669 LDKRoutingFees orig_conv;
24670 orig_conv.inner = (void*)(orig & (~1));
24671 orig_conv.is_owned = false;
24672 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
24673 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24674 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24675 uint64_t ret_ref = (uint64_t)ret_var.inner;
24676 if (ret_var.is_owned) {
24682 int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) {
24683 LDKRoutingFees o_conv;
24684 o_conv.inner = (void*)(o & (~1));
24685 o_conv.is_owned = false;
24686 int64_t ret_val = RoutingFees_hash(&o_conv);
24690 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
24691 LDKRoutingFees obj_conv;
24692 obj_conv.inner = (void*)(obj & (~1));
24693 obj_conv.is_owned = false;
24694 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
24695 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24696 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24697 CVec_u8Z_free(ret_var);
24701 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
24702 LDKu8slice ser_ref;
24703 ser_ref.datalen = *((uint32_t*)ser);
24704 ser_ref.data = (int8_t*)(ser + 4);
24705 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
24706 *ret_conv = RoutingFees_read(ser_ref);
24707 return (uint64_t)ret_conv;
24710 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
24711 LDKNodeAnnouncementInfo this_obj_conv;
24712 this_obj_conv.inner = (void*)(this_obj & (~1));
24713 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24714 NodeAnnouncementInfo_free(this_obj_conv);
24717 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
24718 LDKNodeAnnouncementInfo this_ptr_conv;
24719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24720 this_ptr_conv.is_owned = false;
24721 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
24722 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24723 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24724 uint64_t ret_ref = (uint64_t)ret_var.inner;
24725 if (ret_var.is_owned) {
24731 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
24732 LDKNodeAnnouncementInfo this_ptr_conv;
24733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24734 this_ptr_conv.is_owned = false;
24735 LDKNodeFeatures val_conv;
24736 val_conv.inner = (void*)(val & (~1));
24737 val_conv.is_owned = (val & 1) || (val == 0);
24738 val_conv = NodeFeatures_clone(&val_conv);
24739 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
24742 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
24743 LDKNodeAnnouncementInfo this_ptr_conv;
24744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24745 this_ptr_conv.is_owned = false;
24746 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
24750 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
24751 LDKNodeAnnouncementInfo this_ptr_conv;
24752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24753 this_ptr_conv.is_owned = false;
24754 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
24757 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
24758 LDKNodeAnnouncementInfo this_ptr_conv;
24759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24760 this_ptr_conv.is_owned = false;
24761 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
24762 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
24766 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
24767 LDKNodeAnnouncementInfo this_ptr_conv;
24768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24769 this_ptr_conv.is_owned = false;
24770 LDKThreeBytes val_ref;
24771 CHECK(*((uint32_t*)val) == 3);
24772 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
24773 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
24776 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
24777 LDKNodeAnnouncementInfo this_ptr_conv;
24778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24779 this_ptr_conv.is_owned = false;
24780 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24781 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
24785 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
24786 LDKNodeAnnouncementInfo this_ptr_conv;
24787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24788 this_ptr_conv.is_owned = false;
24789 LDKThirtyTwoBytes val_ref;
24790 CHECK(*((uint32_t*)val) == 32);
24791 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24792 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
24795 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
24796 LDKNodeAnnouncementInfo this_ptr_conv;
24797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24798 this_ptr_conv.is_owned = false;
24799 LDKCVec_NetAddressZ val_constr;
24800 val_constr.datalen = *((uint32_t*)val);
24801 if (val_constr.datalen > 0)
24802 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24804 val_constr.data = NULL;
24805 uint32_t* val_vals = (uint32_t*)(val + 4);
24806 for (size_t m = 0; m < val_constr.datalen; m++) {
24807 uint32_t val_conv_12 = val_vals[m];
24808 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
24809 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
24810 val_constr.data[m] = val_conv_12_conv;
24812 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
24815 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
24816 LDKNodeAnnouncementInfo this_ptr_conv;
24817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24818 this_ptr_conv.is_owned = false;
24819 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
24820 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24821 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24822 uint64_t ret_ref = (uint64_t)ret_var.inner;
24823 if (ret_var.is_owned) {
24829 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
24830 LDKNodeAnnouncementInfo this_ptr_conv;
24831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24832 this_ptr_conv.is_owned = false;
24833 LDKNodeAnnouncement val_conv;
24834 val_conv.inner = (void*)(val & (~1));
24835 val_conv.is_owned = (val & 1) || (val == 0);
24836 val_conv = NodeAnnouncement_clone(&val_conv);
24837 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
24840 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) {
24841 LDKNodeFeatures features_arg_conv;
24842 features_arg_conv.inner = (void*)(features_arg & (~1));
24843 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24844 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
24845 LDKThreeBytes rgb_arg_ref;
24846 CHECK(*((uint32_t*)rgb_arg) == 3);
24847 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
24848 LDKThirtyTwoBytes alias_arg_ref;
24849 CHECK(*((uint32_t*)alias_arg) == 32);
24850 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
24851 LDKCVec_NetAddressZ addresses_arg_constr;
24852 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
24853 if (addresses_arg_constr.datalen > 0)
24854 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24856 addresses_arg_constr.data = NULL;
24857 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
24858 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
24859 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
24860 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
24861 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
24863 LDKNodeAnnouncement announcement_message_arg_conv;
24864 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24865 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24866 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
24867 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
24868 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24869 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24870 uint64_t ret_ref = (uint64_t)ret_var.inner;
24871 if (ret_var.is_owned) {
24877 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
24878 LDKNodeAnnouncementInfo orig_conv;
24879 orig_conv.inner = (void*)(orig & (~1));
24880 orig_conv.is_owned = false;
24881 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
24882 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24883 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24884 uint64_t ret_ref = (uint64_t)ret_var.inner;
24885 if (ret_var.is_owned) {
24891 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
24892 LDKNodeAnnouncementInfo obj_conv;
24893 obj_conv.inner = (void*)(obj & (~1));
24894 obj_conv.is_owned = false;
24895 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
24896 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24897 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24898 CVec_u8Z_free(ret_var);
24902 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
24903 LDKu8slice ser_ref;
24904 ser_ref.datalen = *((uint32_t*)ser);
24905 ser_ref.data = (int8_t*)(ser + 4);
24906 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24907 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
24908 return (uint64_t)ret_conv;
24911 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
24912 LDKNodeInfo this_obj_conv;
24913 this_obj_conv.inner = (void*)(this_obj & (~1));
24914 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24915 NodeInfo_free(this_obj_conv);
24918 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
24919 LDKNodeInfo this_ptr_conv;
24920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24921 this_ptr_conv.is_owned = false;
24922 LDKCVec_u64Z val_constr;
24923 val_constr.datalen = *((uint32_t*)val);
24924 if (val_constr.datalen > 0)
24925 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24927 val_constr.data = NULL;
24928 int64_t* val_vals = (int64_t*)(val + 4);
24929 for (size_t i = 0; i < val_constr.datalen; i++) {
24930 int64_t val_conv_8 = val_vals[i];
24931 val_constr.data[i] = val_conv_8;
24933 NodeInfo_set_channels(&this_ptr_conv, val_constr);
24936 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
24937 LDKNodeInfo this_ptr_conv;
24938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24939 this_ptr_conv.is_owned = false;
24940 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
24941 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24942 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24943 uint64_t ret_ref = (uint64_t)ret_var.inner;
24944 if (ret_var.is_owned) {
24950 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
24951 LDKNodeInfo this_ptr_conv;
24952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24953 this_ptr_conv.is_owned = false;
24954 LDKRoutingFees val_conv;
24955 val_conv.inner = (void*)(val & (~1));
24956 val_conv.is_owned = (val & 1) || (val == 0);
24957 val_conv = RoutingFees_clone(&val_conv);
24958 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
24961 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
24962 LDKNodeInfo this_ptr_conv;
24963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24964 this_ptr_conv.is_owned = false;
24965 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
24966 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24967 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24968 uint64_t ret_ref = (uint64_t)ret_var.inner;
24969 if (ret_var.is_owned) {
24975 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
24976 LDKNodeInfo this_ptr_conv;
24977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24978 this_ptr_conv.is_owned = false;
24979 LDKNodeAnnouncementInfo val_conv;
24980 val_conv.inner = (void*)(val & (~1));
24981 val_conv.is_owned = (val & 1) || (val == 0);
24982 val_conv = NodeAnnouncementInfo_clone(&val_conv);
24983 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
24986 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
24987 LDKCVec_u64Z channels_arg_constr;
24988 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
24989 if (channels_arg_constr.datalen > 0)
24990 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24992 channels_arg_constr.data = NULL;
24993 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
24994 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
24995 int64_t channels_arg_conv_8 = channels_arg_vals[i];
24996 channels_arg_constr.data[i] = channels_arg_conv_8;
24998 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
24999 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
25000 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
25001 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
25002 LDKNodeAnnouncementInfo announcement_info_arg_conv;
25003 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
25004 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
25005 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
25006 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
25007 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25008 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25009 uint64_t ret_ref = (uint64_t)ret_var.inner;
25010 if (ret_var.is_owned) {
25016 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
25017 LDKNodeInfo orig_conv;
25018 orig_conv.inner = (void*)(orig & (~1));
25019 orig_conv.is_owned = false;
25020 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
25021 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25022 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25023 uint64_t ret_ref = (uint64_t)ret_var.inner;
25024 if (ret_var.is_owned) {
25030 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
25031 LDKNodeInfo obj_conv;
25032 obj_conv.inner = (void*)(obj & (~1));
25033 obj_conv.is_owned = false;
25034 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
25035 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25036 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25037 CVec_u8Z_free(ret_var);
25041 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
25042 LDKu8slice ser_ref;
25043 ser_ref.datalen = *((uint32_t*)ser);
25044 ser_ref.data = (int8_t*)(ser + 4);
25045 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
25046 *ret_conv = NodeInfo_read(ser_ref);
25047 return (uint64_t)ret_conv;
25050 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
25051 LDKNetworkGraph obj_conv;
25052 obj_conv.inner = (void*)(obj & (~1));
25053 obj_conv.is_owned = false;
25054 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
25055 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25056 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25057 CVec_u8Z_free(ret_var);
25061 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
25062 LDKu8slice ser_ref;
25063 ser_ref.datalen = *((uint32_t*)ser);
25064 ser_ref.data = (int8_t*)(ser + 4);
25065 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
25066 *ret_conv = NetworkGraph_read(ser_ref);
25067 return (uint64_t)ret_conv;
25070 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
25071 LDKThirtyTwoBytes genesis_hash_ref;
25072 CHECK(*((uint32_t*)genesis_hash) == 32);
25073 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
25074 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
25075 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25076 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25077 uint64_t ret_ref = (uint64_t)ret_var.inner;
25078 if (ret_var.is_owned) {
25084 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
25085 LDKNetworkGraph this_arg_conv;
25086 this_arg_conv.inner = (void*)(this_arg & (~1));
25087 this_arg_conv.is_owned = false;
25088 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
25089 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25090 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25091 uint64_t ret_ref = (uint64_t)ret_var.inner;
25092 if (ret_var.is_owned) {
25098 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
25099 LDKNetworkGraph this_arg_conv;
25100 this_arg_conv.inner = (void*)(this_arg & (~1));
25101 this_arg_conv.is_owned = false;
25102 LDKNodeAnnouncement msg_conv;
25103 msg_conv.inner = (void*)(msg & (~1));
25104 msg_conv.is_owned = false;
25105 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25106 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
25107 return (uint64_t)ret_conv;
25110 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
25111 LDKNetworkGraph this_arg_conv;
25112 this_arg_conv.inner = (void*)(this_arg & (~1));
25113 this_arg_conv.is_owned = false;
25114 LDKUnsignedNodeAnnouncement msg_conv;
25115 msg_conv.inner = (void*)(msg & (~1));
25116 msg_conv.is_owned = false;
25117 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25118 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
25119 return (uint64_t)ret_conv;
25122 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_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 LDKChannelAnnouncement 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_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
25136 return (uint64_t)ret_conv;
25139 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
25140 LDKNetworkGraph this_arg_conv;
25141 this_arg_conv.inner = (void*)(this_arg & (~1));
25142 this_arg_conv.is_owned = false;
25143 LDKUnsignedChannelAnnouncement msg_conv;
25144 msg_conv.inner = (void*)(msg & (~1));
25145 msg_conv.is_owned = false;
25146 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
25147 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
25148 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
25149 // Manually implement clone for Java trait instances
25151 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25152 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
25153 return (uint64_t)ret_conv;
25156 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
25157 LDKNetworkGraph this_arg_conv;
25158 this_arg_conv.inner = (void*)(this_arg & (~1));
25159 this_arg_conv.is_owned = false;
25160 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
25163 void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
25164 LDKNetworkGraph this_arg_conv;
25165 this_arg_conv.inner = (void*)(this_arg & (~1));
25166 this_arg_conv.is_owned = false;
25167 LDKPublicKey _node_id_ref;
25168 CHECK(*((uint32_t*)_node_id) == 33);
25169 memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33);
25170 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
25173 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
25174 LDKNetworkGraph this_arg_conv;
25175 this_arg_conv.inner = (void*)(this_arg & (~1));
25176 this_arg_conv.is_owned = false;
25177 LDKChannelUpdate msg_conv;
25178 msg_conv.inner = (void*)(msg & (~1));
25179 msg_conv.is_owned = false;
25180 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25181 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
25182 return (uint64_t)ret_conv;
25185 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
25186 LDKNetworkGraph this_arg_conv;
25187 this_arg_conv.inner = (void*)(this_arg & (~1));
25188 this_arg_conv.is_owned = false;
25189 LDKUnsignedChannelUpdate msg_conv;
25190 msg_conv.inner = (void*)(msg & (~1));
25191 msg_conv.is_owned = false;
25192 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25193 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
25194 return (uint64_t)ret_conv;
25197 void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) {
25198 LDKFilesystemPersister this_obj_conv;
25199 this_obj_conv.inner = (void*)(this_obj & (~1));
25200 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25201 FilesystemPersister_free(this_obj_conv);
25204 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_new(jstring path_to_channel_data) {
25205 LDKStr path_to_channel_data_conv = str_ref_to_owned_c(path_to_channel_data);
25206 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
25207 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25208 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25209 uint64_t ret_ref = (uint64_t)ret_var.inner;
25210 if (ret_var.is_owned) {
25216 jstring __attribute__((visibility("default"))) TS_FilesystemPersister_get_data_dir(uint32_t this_arg) {
25217 LDKFilesystemPersister this_arg_conv;
25218 this_arg_conv.inner = (void*)(this_arg & (~1));
25219 this_arg_conv.is_owned = false;
25220 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
25221 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
25226 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_persist_manager(jstring data_dir, uint32_t manager) {
25227 LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
25228 LDKChannelManager manager_conv;
25229 manager_conv.inner = (void*)(manager & (~1));
25230 manager_conv.is_owned = false;
25231 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
25232 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
25233 return (uint64_t)ret_conv;
25236 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_read_channelmonitors(uint32_t this_arg, uint32_t keys_manager) {
25237 LDKFilesystemPersister this_arg_conv;
25238 this_arg_conv.inner = (void*)(this_arg & (~1));
25239 this_arg_conv.is_owned = false;
25240 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
25241 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
25242 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
25243 return (uint64_t)ret_conv;
25246 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_as_Persist(uint32_t this_arg) {
25247 LDKFilesystemPersister this_arg_conv;
25248 this_arg_conv.inner = (void*)(this_arg & (~1));
25249 this_arg_conv.is_owned = false;
25250 LDKPersist* ret_ret =MALLOC(sizeof(LDKPersist), "LDKPersist");
25251 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
25252 return (uint64_t)ret_ret;
25255 void __attribute__((visibility("default"))) TS_BackgroundProcessor_free(uint32_t this_obj) {
25256 LDKBackgroundProcessor this_obj_conv;
25257 this_obj_conv.inner = (void*)(this_obj & (~1));
25258 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25259 BackgroundProcessor_free(this_obj_conv);
25262 void __attribute__((visibility("default"))) TS_ChannelManagerPersister_free(uint32_t this_ptr) {
25263 if ((this_ptr & 1) != 0) return;
25264 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
25265 FREE((void*)this_ptr);
25266 ChannelManagerPersister_free(this_ptr_conv);
25269 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) {
25270 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
25271 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
25272 LDKChainMonitor chain_monitor_conv;
25273 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
25274 chain_monitor_conv.is_owned = false;
25275 LDKChannelManager channel_manager_conv;
25276 channel_manager_conv.inner = (void*)(channel_manager & (~1));
25277 channel_manager_conv.is_owned = false;
25278 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
25279 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
25280 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
25281 LDKPeerManager peer_manager_conv;
25282 peer_manager_conv.inner = (void*)(peer_manager & (~1));
25283 peer_manager_conv.is_owned = false;
25284 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
25285 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);
25286 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25287 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25288 uint64_t ret_ref = (uint64_t)ret_var.inner;
25289 if (ret_var.is_owned) {
25295 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_join(uint32_t this_arg) {
25296 LDKBackgroundProcessor this_arg_conv;
25297 this_arg_conv.inner = (void*)(this_arg & (~1));
25298 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25299 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
25300 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
25301 *ret_conv = BackgroundProcessor_join(this_arg_conv);
25302 return (uint64_t)ret_conv;
25305 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_stop(uint32_t this_arg) {
25306 LDKBackgroundProcessor this_arg_conv;
25307 this_arg_conv.inner = (void*)(this_arg & (~1));
25308 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25309 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
25310 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
25311 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
25312 return (uint64_t)ret_conv;
25315 void __attribute__((visibility("default"))) TS_check_platform() {
25319 void __attribute__((visibility("default"))) TS_Invoice_free(uint32_t this_obj) {
25320 LDKInvoice this_obj_conv;
25321 this_obj_conv.inner = (void*)(this_obj & (~1));
25322 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25323 Invoice_free(this_obj_conv);
25326 jboolean __attribute__((visibility("default"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
25328 a_conv.inner = (void*)(a & (~1));
25329 a_conv.is_owned = false;
25331 b_conv.inner = (void*)(b & (~1));
25332 b_conv.is_owned = false;
25333 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
25337 uint32_t __attribute__((visibility("default"))) TS_Invoice_clone(uint32_t orig) {
25338 LDKInvoice orig_conv;
25339 orig_conv.inner = (void*)(orig & (~1));
25340 orig_conv.is_owned = false;
25341 LDKInvoice ret_var = Invoice_clone(&orig_conv);
25342 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25343 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25344 uint64_t ret_ref = (uint64_t)ret_var.inner;
25345 if (ret_var.is_owned) {
25351 void __attribute__((visibility("default"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
25352 LDKSignedRawInvoice this_obj_conv;
25353 this_obj_conv.inner = (void*)(this_obj & (~1));
25354 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25355 SignedRawInvoice_free(this_obj_conv);
25358 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
25359 LDKSignedRawInvoice a_conv;
25360 a_conv.inner = (void*)(a & (~1));
25361 a_conv.is_owned = false;
25362 LDKSignedRawInvoice b_conv;
25363 b_conv.inner = (void*)(b & (~1));
25364 b_conv.is_owned = false;
25365 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
25369 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_clone(uint32_t orig) {
25370 LDKSignedRawInvoice orig_conv;
25371 orig_conv.inner = (void*)(orig & (~1));
25372 orig_conv.is_owned = false;
25373 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
25374 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25375 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25376 uint64_t ret_ref = (uint64_t)ret_var.inner;
25377 if (ret_var.is_owned) {
25383 void __attribute__((visibility("default"))) TS_RawInvoice_free(uint32_t this_obj) {
25384 LDKRawInvoice this_obj_conv;
25385 this_obj_conv.inner = (void*)(this_obj & (~1));
25386 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25387 RawInvoice_free(this_obj_conv);
25390 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
25391 LDKRawInvoice this_ptr_conv;
25392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25393 this_ptr_conv.is_owned = false;
25394 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
25395 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25396 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25397 uint64_t ret_ref = (uint64_t)ret_var.inner;
25398 if (ret_var.is_owned) {
25404 void __attribute__((visibility("default"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
25405 LDKRawInvoice this_ptr_conv;
25406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25407 this_ptr_conv.is_owned = false;
25408 LDKRawDataPart val_conv;
25409 val_conv.inner = (void*)(val & (~1));
25410 val_conv.is_owned = (val & 1) || (val == 0);
25411 val_conv = RawDataPart_clone(&val_conv);
25412 RawInvoice_set_data(&this_ptr_conv, val_conv);
25415 jboolean __attribute__((visibility("default"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
25416 LDKRawInvoice a_conv;
25417 a_conv.inner = (void*)(a & (~1));
25418 a_conv.is_owned = false;
25419 LDKRawInvoice b_conv;
25420 b_conv.inner = (void*)(b & (~1));
25421 b_conv.is_owned = false;
25422 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
25426 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_clone(uint32_t orig) {
25427 LDKRawInvoice orig_conv;
25428 orig_conv.inner = (void*)(orig & (~1));
25429 orig_conv.is_owned = false;
25430 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
25431 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25432 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25433 uint64_t ret_ref = (uint64_t)ret_var.inner;
25434 if (ret_var.is_owned) {
25440 void __attribute__((visibility("default"))) TS_RawDataPart_free(uint32_t this_obj) {
25441 LDKRawDataPart this_obj_conv;
25442 this_obj_conv.inner = (void*)(this_obj & (~1));
25443 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25444 RawDataPart_free(this_obj_conv);
25447 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
25448 LDKRawDataPart this_ptr_conv;
25449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25450 this_ptr_conv.is_owned = false;
25451 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
25452 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25453 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25454 uint64_t ret_ref = (uint64_t)ret_var.inner;
25455 if (ret_var.is_owned) {
25461 void __attribute__((visibility("default"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
25462 LDKRawDataPart this_ptr_conv;
25463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25464 this_ptr_conv.is_owned = false;
25465 LDKPositiveTimestamp val_conv;
25466 val_conv.inner = (void*)(val & (~1));
25467 val_conv.is_owned = (val & 1) || (val == 0);
25468 val_conv = PositiveTimestamp_clone(&val_conv);
25469 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
25472 jboolean __attribute__((visibility("default"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
25473 LDKRawDataPart a_conv;
25474 a_conv.inner = (void*)(a & (~1));
25475 a_conv.is_owned = false;
25476 LDKRawDataPart b_conv;
25477 b_conv.inner = (void*)(b & (~1));
25478 b_conv.is_owned = false;
25479 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
25483 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_clone(uint32_t orig) {
25484 LDKRawDataPart orig_conv;
25485 orig_conv.inner = (void*)(orig & (~1));
25486 orig_conv.is_owned = false;
25487 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
25488 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25489 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25490 uint64_t ret_ref = (uint64_t)ret_var.inner;
25491 if (ret_var.is_owned) {
25497 void __attribute__((visibility("default"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
25498 LDKPositiveTimestamp this_obj_conv;
25499 this_obj_conv.inner = (void*)(this_obj & (~1));
25500 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25501 PositiveTimestamp_free(this_obj_conv);
25504 jboolean __attribute__((visibility("default"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
25505 LDKPositiveTimestamp a_conv;
25506 a_conv.inner = (void*)(a & (~1));
25507 a_conv.is_owned = false;
25508 LDKPositiveTimestamp b_conv;
25509 b_conv.inner = (void*)(b & (~1));
25510 b_conv.is_owned = false;
25511 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
25515 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_clone(uint32_t orig) {
25516 LDKPositiveTimestamp orig_conv;
25517 orig_conv.inner = (void*)(orig & (~1));
25518 orig_conv.is_owned = false;
25519 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
25520 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25521 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25522 uint64_t ret_ref = (uint64_t)ret_var.inner;
25523 if (ret_var.is_owned) {
25529 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_clone(uint32_t orig) {
25530 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
25531 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
25535 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_milli() {
25536 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
25540 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_micro() {
25541 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
25545 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_nano() {
25546 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
25550 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_pico() {
25551 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
25555 jboolean __attribute__((visibility("default"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
25556 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
25557 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
25558 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
25562 int64_t __attribute__((visibility("default"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
25563 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
25564 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
25568 uint32_t __attribute__((visibility("default"))) TS_Currency_clone(uint32_t orig) {
25569 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
25570 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
25574 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin() {
25575 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
25579 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin_testnet() {
25580 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
25584 uint32_t __attribute__((visibility("default"))) TS_Currency_regtest() {
25585 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
25589 uint32_t __attribute__((visibility("default"))) TS_Currency_simnet() {
25590 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
25594 uint32_t __attribute__((visibility("default"))) TS_Currency_signet() {
25595 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
25599 int64_t __attribute__((visibility("default"))) TS_Currency_hash(uint32_t o) {
25600 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
25601 int64_t ret_val = Currency_hash(o_conv);
25605 jboolean __attribute__((visibility("default"))) TS_Currency_eq(uint32_t a, uint32_t b) {
25606 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
25607 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
25608 jboolean ret_val = Currency_eq(a_conv, b_conv);
25612 void __attribute__((visibility("default"))) TS_Sha256_free(uint32_t this_obj) {
25613 LDKSha256 this_obj_conv;
25614 this_obj_conv.inner = (void*)(this_obj & (~1));
25615 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25616 Sha256_free(this_obj_conv);
25619 uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
25620 LDKSha256 orig_conv;
25621 orig_conv.inner = (void*)(orig & (~1));
25622 orig_conv.is_owned = false;
25623 LDKSha256 ret_var = Sha256_clone(&orig_conv);
25624 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25625 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25626 uint64_t ret_ref = (uint64_t)ret_var.inner;
25627 if (ret_var.is_owned) {
25633 int64_t __attribute__((visibility("default"))) TS_Sha256_hash(uint32_t o) {
25635 o_conv.inner = (void*)(o & (~1));
25636 o_conv.is_owned = false;
25637 int64_t ret_val = Sha256_hash(&o_conv);
25641 jboolean __attribute__((visibility("default"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
25643 a_conv.inner = (void*)(a & (~1));
25644 a_conv.is_owned = false;
25646 b_conv.inner = (void*)(b & (~1));
25647 b_conv.is_owned = false;
25648 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
25652 void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
25653 LDKDescription this_obj_conv;
25654 this_obj_conv.inner = (void*)(this_obj & (~1));
25655 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25656 Description_free(this_obj_conv);
25659 uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
25660 LDKDescription orig_conv;
25661 orig_conv.inner = (void*)(orig & (~1));
25662 orig_conv.is_owned = false;
25663 LDKDescription ret_var = Description_clone(&orig_conv);
25664 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25665 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25666 uint64_t ret_ref = (uint64_t)ret_var.inner;
25667 if (ret_var.is_owned) {
25673 int64_t __attribute__((visibility("default"))) TS_Description_hash(uint32_t o) {
25674 LDKDescription o_conv;
25675 o_conv.inner = (void*)(o & (~1));
25676 o_conv.is_owned = false;
25677 int64_t ret_val = Description_hash(&o_conv);
25681 jboolean __attribute__((visibility("default"))) TS_Description_eq(uint32_t a, uint32_t b) {
25682 LDKDescription a_conv;
25683 a_conv.inner = (void*)(a & (~1));
25684 a_conv.is_owned = false;
25685 LDKDescription b_conv;
25686 b_conv.inner = (void*)(b & (~1));
25687 b_conv.is_owned = false;
25688 jboolean ret_val = Description_eq(&a_conv, &b_conv);
25692 void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
25693 LDKPayeePubKey this_obj_conv;
25694 this_obj_conv.inner = (void*)(this_obj & (~1));
25695 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25696 PayeePubKey_free(this_obj_conv);
25699 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
25700 LDKPayeePubKey orig_conv;
25701 orig_conv.inner = (void*)(orig & (~1));
25702 orig_conv.is_owned = false;
25703 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
25704 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25705 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25706 uint64_t ret_ref = (uint64_t)ret_var.inner;
25707 if (ret_var.is_owned) {
25713 int64_t __attribute__((visibility("default"))) TS_PayeePubKey_hash(uint32_t o) {
25714 LDKPayeePubKey o_conv;
25715 o_conv.inner = (void*)(o & (~1));
25716 o_conv.is_owned = false;
25717 int64_t ret_val = PayeePubKey_hash(&o_conv);
25721 jboolean __attribute__((visibility("default"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
25722 LDKPayeePubKey a_conv;
25723 a_conv.inner = (void*)(a & (~1));
25724 a_conv.is_owned = false;
25725 LDKPayeePubKey b_conv;
25726 b_conv.inner = (void*)(b & (~1));
25727 b_conv.is_owned = false;
25728 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
25732 void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
25733 LDKExpiryTime this_obj_conv;
25734 this_obj_conv.inner = (void*)(this_obj & (~1));
25735 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25736 ExpiryTime_free(this_obj_conv);
25739 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
25740 LDKExpiryTime orig_conv;
25741 orig_conv.inner = (void*)(orig & (~1));
25742 orig_conv.is_owned = false;
25743 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
25744 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25745 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25746 uint64_t ret_ref = (uint64_t)ret_var.inner;
25747 if (ret_var.is_owned) {
25753 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_hash(uint32_t o) {
25754 LDKExpiryTime o_conv;
25755 o_conv.inner = (void*)(o & (~1));
25756 o_conv.is_owned = false;
25757 int64_t ret_val = ExpiryTime_hash(&o_conv);
25761 jboolean __attribute__((visibility("default"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
25762 LDKExpiryTime a_conv;
25763 a_conv.inner = (void*)(a & (~1));
25764 a_conv.is_owned = false;
25765 LDKExpiryTime b_conv;
25766 b_conv.inner = (void*)(b & (~1));
25767 b_conv.is_owned = false;
25768 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
25772 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
25773 LDKMinFinalCltvExpiry this_obj_conv;
25774 this_obj_conv.inner = (void*)(this_obj & (~1));
25775 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25776 MinFinalCltvExpiry_free(this_obj_conv);
25779 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
25780 LDKMinFinalCltvExpiry orig_conv;
25781 orig_conv.inner = (void*)(orig & (~1));
25782 orig_conv.is_owned = false;
25783 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
25784 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25785 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25786 uint64_t ret_ref = (uint64_t)ret_var.inner;
25787 if (ret_var.is_owned) {
25793 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
25794 LDKMinFinalCltvExpiry o_conv;
25795 o_conv.inner = (void*)(o & (~1));
25796 o_conv.is_owned = false;
25797 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
25801 jboolean __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
25802 LDKMinFinalCltvExpiry a_conv;
25803 a_conv.inner = (void*)(a & (~1));
25804 a_conv.is_owned = false;
25805 LDKMinFinalCltvExpiry b_conv;
25806 b_conv.inner = (void*)(b & (~1));
25807 b_conv.is_owned = false;
25808 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
25812 void __attribute__((visibility("default"))) TS_Fallback_free(uint32_t this_ptr) {
25813 if ((this_ptr & 1) != 0) return;
25814 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
25815 FREE((void*)this_ptr);
25816 Fallback_free(this_ptr_conv);
25819 uint32_t __attribute__((visibility("default"))) TS_Fallback_clone(uint32_t orig) {
25820 LDKFallback* orig_conv = (LDKFallback*)orig;
25821 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
25822 *ret_copy = Fallback_clone(orig_conv);
25823 uint64_t ret_ref = (uint64_t)ret_copy;
25827 uint32_t __attribute__((visibility("default"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
25829 LDKCVec_u8Z program_ref;
25830 program_ref.datalen = *((uint32_t*)program);
25831 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
25832 memcpy(program_ref.data, (uint8_t*)(program + 4), program_ref.datalen);
25833 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
25834 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
25835 uint64_t ret_ref = (uint64_t)ret_copy;
25839 uint32_t __attribute__((visibility("default"))) TS_Fallback_pub_key_hash(int8_tArray a) {
25840 LDKTwentyBytes a_ref;
25841 CHECK(*((uint32_t*)a) == 20);
25842 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
25843 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
25844 *ret_copy = Fallback_pub_key_hash(a_ref);
25845 uint64_t ret_ref = (uint64_t)ret_copy;
25849 uint32_t __attribute__((visibility("default"))) TS_Fallback_script_hash(int8_tArray a) {
25850 LDKTwentyBytes a_ref;
25851 CHECK(*((uint32_t*)a) == 20);
25852 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
25853 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
25854 *ret_copy = Fallback_script_hash(a_ref);
25855 uint64_t ret_ref = (uint64_t)ret_copy;
25859 int64_t __attribute__((visibility("default"))) TS_Fallback_hash(uint32_t o) {
25860 LDKFallback* o_conv = (LDKFallback*)o;
25861 int64_t ret_val = Fallback_hash(o_conv);
25865 jboolean __attribute__((visibility("default"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
25866 LDKFallback* a_conv = (LDKFallback*)a;
25867 LDKFallback* b_conv = (LDKFallback*)b;
25868 jboolean ret_val = Fallback_eq(a_conv, b_conv);
25872 void __attribute__((visibility("default"))) TS_InvoiceSignature_free(uint32_t this_obj) {
25873 LDKInvoiceSignature this_obj_conv;
25874 this_obj_conv.inner = (void*)(this_obj & (~1));
25875 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25876 InvoiceSignature_free(this_obj_conv);
25879 uint32_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone(uint32_t orig) {
25880 LDKInvoiceSignature orig_conv;
25881 orig_conv.inner = (void*)(orig & (~1));
25882 orig_conv.is_owned = false;
25883 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
25884 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25885 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25886 uint64_t ret_ref = (uint64_t)ret_var.inner;
25887 if (ret_var.is_owned) {
25893 jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
25894 LDKInvoiceSignature a_conv;
25895 a_conv.inner = (void*)(a & (~1));
25896 a_conv.is_owned = false;
25897 LDKInvoiceSignature b_conv;
25898 b_conv.inner = (void*)(b & (~1));
25899 b_conv.is_owned = false;
25900 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
25904 void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
25905 LDKPrivateRoute this_obj_conv;
25906 this_obj_conv.inner = (void*)(this_obj & (~1));
25907 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25908 PrivateRoute_free(this_obj_conv);
25911 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_clone(uint32_t orig) {
25912 LDKPrivateRoute orig_conv;
25913 orig_conv.inner = (void*)(orig & (~1));
25914 orig_conv.is_owned = false;
25915 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
25916 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25917 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25918 uint64_t ret_ref = (uint64_t)ret_var.inner;
25919 if (ret_var.is_owned) {
25925 int64_t __attribute__((visibility("default"))) TS_PrivateRoute_hash(uint32_t o) {
25926 LDKPrivateRoute o_conv;
25927 o_conv.inner = (void*)(o & (~1));
25928 o_conv.is_owned = false;
25929 int64_t ret_val = PrivateRoute_hash(&o_conv);
25933 jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
25934 LDKPrivateRoute a_conv;
25935 a_conv.inner = (void*)(a & (~1));
25936 a_conv.is_owned = false;
25937 LDKPrivateRoute b_conv;
25938 b_conv.inner = (void*)(b & (~1));
25939 b_conv.is_owned = false;
25940 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
25944 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
25945 LDKSignedRawInvoice this_arg_conv;
25946 this_arg_conv.inner = (void*)(this_arg & (~1));
25947 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25948 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
25949 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
25950 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
25951 return ((uint64_t)ret_conv);
25954 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
25955 LDKSignedRawInvoice this_arg_conv;
25956 this_arg_conv.inner = (void*)(this_arg & (~1));
25957 this_arg_conv.is_owned = false;
25958 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
25959 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25960 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25961 uint64_t ret_ref = (uint64_t)ret_var.inner;
25962 if (ret_var.is_owned) {
25968 int8_tArray __attribute__((visibility("default"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
25969 LDKSignedRawInvoice this_arg_conv;
25970 this_arg_conv.inner = (void*)(this_arg & (~1));
25971 this_arg_conv.is_owned = false;
25972 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25973 memcpy((uint8_t*)(ret_arr + 4), *SignedRawInvoice_hash(&this_arg_conv), 32);
25977 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
25978 LDKSignedRawInvoice this_arg_conv;
25979 this_arg_conv.inner = (void*)(this_arg & (~1));
25980 this_arg_conv.is_owned = false;
25981 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
25982 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25983 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25984 uint64_t ret_ref = (uint64_t)ret_var.inner;
25985 if (ret_var.is_owned) {
25991 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
25992 LDKSignedRawInvoice this_arg_conv;
25993 this_arg_conv.inner = (void*)(this_arg & (~1));
25994 this_arg_conv.is_owned = false;
25995 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
25996 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
25997 return (uint64_t)ret_conv;
26000 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
26001 LDKSignedRawInvoice this_arg_conv;
26002 this_arg_conv.inner = (void*)(this_arg & (~1));
26003 this_arg_conv.is_owned = false;
26004 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
26008 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_hash(uint32_t this_arg) {
26009 LDKRawInvoice this_arg_conv;
26010 this_arg_conv.inner = (void*)(this_arg & (~1));
26011 this_arg_conv.is_owned = false;
26012 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26013 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_hash(&this_arg_conv).data, 32);
26017 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
26018 LDKRawInvoice this_arg_conv;
26019 this_arg_conv.inner = (void*)(this_arg & (~1));
26020 this_arg_conv.is_owned = false;
26021 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
26022 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26023 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26024 uint64_t ret_ref = (uint64_t)ret_var.inner;
26025 if (ret_var.is_owned) {
26031 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description(uint32_t this_arg) {
26032 LDKRawInvoice this_arg_conv;
26033 this_arg_conv.inner = (void*)(this_arg & (~1));
26034 this_arg_conv.is_owned = false;
26035 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
26036 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26037 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26038 uint64_t ret_ref = (uint64_t)ret_var.inner;
26039 if (ret_var.is_owned) {
26045 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
26046 LDKRawInvoice this_arg_conv;
26047 this_arg_conv.inner = (void*)(this_arg & (~1));
26048 this_arg_conv.is_owned = false;
26049 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
26050 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26051 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26052 uint64_t ret_ref = (uint64_t)ret_var.inner;
26053 if (ret_var.is_owned) {
26059 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
26060 LDKRawInvoice this_arg_conv;
26061 this_arg_conv.inner = (void*)(this_arg & (~1));
26062 this_arg_conv.is_owned = false;
26063 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
26064 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26065 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26066 uint64_t ret_ref = (uint64_t)ret_var.inner;
26067 if (ret_var.is_owned) {
26073 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
26074 LDKRawInvoice this_arg_conv;
26075 this_arg_conv.inner = (void*)(this_arg & (~1));
26076 this_arg_conv.is_owned = false;
26077 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
26078 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26079 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26080 uint64_t ret_ref = (uint64_t)ret_var.inner;
26081 if (ret_var.is_owned) {
26087 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
26088 LDKRawInvoice this_arg_conv;
26089 this_arg_conv.inner = (void*)(this_arg & (~1));
26090 this_arg_conv.is_owned = false;
26091 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
26092 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26093 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26094 uint64_t ret_ref = (uint64_t)ret_var.inner;
26095 if (ret_var.is_owned) {
26101 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
26102 LDKRawInvoice this_arg_conv;
26103 this_arg_conv.inner = (void*)(this_arg & (~1));
26104 this_arg_conv.is_owned = false;
26105 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26106 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_payment_secret(&this_arg_conv).data, 32);
26110 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_features(uint32_t this_arg) {
26111 LDKRawInvoice this_arg_conv;
26112 this_arg_conv.inner = (void*)(this_arg & (~1));
26113 this_arg_conv.is_owned = false;
26114 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
26115 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26116 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26117 uint64_t ret_ref = (uint64_t)ret_var.inner;
26118 if (ret_var.is_owned) {
26124 uint32_tArray __attribute__((visibility("default"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
26125 LDKRawInvoice this_arg_conv;
26126 this_arg_conv.inner = (void*)(this_arg & (~1));
26127 this_arg_conv.is_owned = false;
26128 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
26129 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26130 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26131 for (size_t o = 0; o < ret_var.datalen; o++) {
26132 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
26133 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26134 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26135 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
26136 if (ret_conv_14_var.is_owned) {
26137 ret_conv_14_ref |= 1;
26139 ret_arr_ptr[o] = ret_conv_14_ref;
26141 FREE(ret_var.data);
26145 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
26146 LDKRawInvoice this_arg_conv;
26147 this_arg_conv.inner = (void*)(this_arg & (~1));
26148 this_arg_conv.is_owned = false;
26149 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26150 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
26151 uint64_t ret_ref = (uint64_t)ret_copy;
26155 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_currency(uint32_t this_arg) {
26156 LDKRawInvoice this_arg_conv;
26157 this_arg_conv.inner = (void*)(this_arg & (~1));
26158 this_arg_conv.is_owned = false;
26159 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
26163 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
26164 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
26165 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
26166 return (uint64_t)ret_conv;
26169 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_system_time(int64_t time) {
26170 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
26171 *ret_conv = PositiveTimestamp_from_system_time(time);
26172 return (uint64_t)ret_conv;
26175 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
26176 LDKPositiveTimestamp this_arg_conv;
26177 this_arg_conv.inner = (void*)(this_arg & (~1));
26178 this_arg_conv.is_owned = false;
26179 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
26183 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_time(uint32_t this_arg) {
26184 LDKPositiveTimestamp this_arg_conv;
26185 this_arg_conv.inner = (void*)(this_arg & (~1));
26186 this_arg_conv.is_owned = false;
26187 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
26191 uint32_t __attribute__((visibility("default"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
26192 LDKInvoice this_arg_conv;
26193 this_arg_conv.inner = (void*)(this_arg & (~1));
26194 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26195 this_arg_conv = Invoice_clone(&this_arg_conv);
26196 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
26197 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26198 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26199 uint64_t ret_ref = (uint64_t)ret_var.inner;
26200 if (ret_var.is_owned) {
26206 uint32_t __attribute__((visibility("default"))) TS_Invoice_check_signature(uint32_t this_arg) {
26207 LDKInvoice this_arg_conv;
26208 this_arg_conv.inner = (void*)(this_arg & (~1));
26209 this_arg_conv.is_owned = false;
26210 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
26211 *ret_conv = Invoice_check_signature(&this_arg_conv);
26212 return (uint64_t)ret_conv;
26215 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
26216 LDKSignedRawInvoice signed_invoice_conv;
26217 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
26218 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
26219 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
26220 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
26221 *ret_conv = Invoice_from_signed(signed_invoice_conv);
26222 return (uint64_t)ret_conv;
26225 int64_t __attribute__((visibility("default"))) TS_Invoice_timestamp(uint32_t this_arg) {
26226 LDKInvoice this_arg_conv;
26227 this_arg_conv.inner = (void*)(this_arg & (~1));
26228 this_arg_conv.is_owned = false;
26229 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
26233 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_hash(uint32_t this_arg) {
26234 LDKInvoice this_arg_conv;
26235 this_arg_conv.inner = (void*)(this_arg & (~1));
26236 this_arg_conv.is_owned = false;
26237 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26238 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_hash(&this_arg_conv), 32);
26242 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
26243 LDKInvoice this_arg_conv;
26244 this_arg_conv.inner = (void*)(this_arg & (~1));
26245 this_arg_conv.is_owned = false;
26246 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
26247 memcpy((uint8_t*)(ret_arr + 4), Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
26251 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_secret(uint32_t this_arg) {
26252 LDKInvoice this_arg_conv;
26253 this_arg_conv.inner = (void*)(this_arg & (~1));
26254 this_arg_conv.is_owned = false;
26255 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26256 memcpy((uint8_t*)(ret_arr + 4), Invoice_payment_secret(&this_arg_conv).data, 32);
26260 uint32_t __attribute__((visibility("default"))) TS_Invoice_features(uint32_t this_arg) {
26261 LDKInvoice this_arg_conv;
26262 this_arg_conv.inner = (void*)(this_arg & (~1));
26263 this_arg_conv.is_owned = false;
26264 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
26265 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26266 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26267 uint64_t ret_ref = (uint64_t)ret_var.inner;
26268 if (ret_var.is_owned) {
26274 int8_tArray __attribute__((visibility("default"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
26275 LDKInvoice this_arg_conv;
26276 this_arg_conv.inner = (void*)(this_arg & (~1));
26277 this_arg_conv.is_owned = false;
26278 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
26279 memcpy((uint8_t*)(ret_arr + 4), Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
26283 int64_t __attribute__((visibility("default"))) TS_Invoice_expiry_time(uint32_t this_arg) {
26284 LDKInvoice this_arg_conv;
26285 this_arg_conv.inner = (void*)(this_arg & (~1));
26286 this_arg_conv.is_owned = false;
26287 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
26291 int64_t __attribute__((visibility("default"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
26292 LDKInvoice this_arg_conv;
26293 this_arg_conv.inner = (void*)(this_arg & (~1));
26294 this_arg_conv.is_owned = false;
26295 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
26299 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_private_routes(uint32_t this_arg) {
26300 LDKInvoice this_arg_conv;
26301 this_arg_conv.inner = (void*)(this_arg & (~1));
26302 this_arg_conv.is_owned = false;
26303 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
26304 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26305 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26306 for (size_t o = 0; o < ret_var.datalen; o++) {
26307 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
26308 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26309 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26310 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
26311 if (ret_conv_14_var.is_owned) {
26312 ret_conv_14_ref |= 1;
26314 ret_arr_ptr[o] = ret_conv_14_ref;
26316 FREE(ret_var.data);
26320 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_route_hints(uint32_t this_arg) {
26321 LDKInvoice this_arg_conv;
26322 this_arg_conv.inner = (void*)(this_arg & (~1));
26323 this_arg_conv.is_owned = false;
26324 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
26325 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26326 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26327 for (size_t l = 0; l < ret_var.datalen; l++) {
26328 LDKRouteHint ret_conv_11_var = ret_var.data[l];
26329 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26330 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26331 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
26332 if (ret_conv_11_var.is_owned) {
26333 ret_conv_11_ref |= 1;
26335 ret_arr_ptr[l] = ret_conv_11_ref;
26337 FREE(ret_var.data);
26341 uint32_t __attribute__((visibility("default"))) TS_Invoice_currency(uint32_t this_arg) {
26342 LDKInvoice this_arg_conv;
26343 this_arg_conv.inner = (void*)(this_arg & (~1));
26344 this_arg_conv.is_owned = false;
26345 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
26349 uint32_t __attribute__((visibility("default"))) TS_Invoice_amount_pico_btc(uint32_t this_arg) {
26350 LDKInvoice this_arg_conv;
26351 this_arg_conv.inner = (void*)(this_arg & (~1));
26352 this_arg_conv.is_owned = false;
26353 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26354 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
26355 uint64_t ret_ref = (uint64_t)ret_copy;
26359 uint32_t __attribute__((visibility("default"))) TS_Description_new(jstring description) {
26360 LDKStr description_conv = str_ref_to_owned_c(description);
26361 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
26362 *ret_conv = Description_new(description_conv);
26363 return (uint64_t)ret_conv;
26366 jstring __attribute__((visibility("default"))) TS_Description_into_inner(uint32_t this_arg) {
26367 LDKDescription this_arg_conv;
26368 this_arg_conv.inner = (void*)(this_arg & (~1));
26369 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26370 this_arg_conv = Description_clone(&this_arg_conv);
26371 LDKStr ret_str = Description_into_inner(this_arg_conv);
26372 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26377 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
26378 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
26379 *ret_conv = ExpiryTime_from_seconds(seconds);
26380 return (uint64_t)ret_conv;
26383 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_duration(int64_t duration) {
26384 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
26385 *ret_conv = ExpiryTime_from_duration(duration);
26386 return (uint64_t)ret_conv;
26389 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
26390 LDKExpiryTime this_arg_conv;
26391 this_arg_conv.inner = (void*)(this_arg & (~1));
26392 this_arg_conv.is_owned = false;
26393 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
26397 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
26398 LDKExpiryTime this_arg_conv;
26399 this_arg_conv.inner = (void*)(this_arg & (~1));
26400 this_arg_conv.is_owned = false;
26401 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
26405 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_new(uint32_t hops) {
26406 LDKRouteHint hops_conv;
26407 hops_conv.inner = (void*)(hops & (~1));
26408 hops_conv.is_owned = (hops & 1) || (hops == 0);
26409 hops_conv = RouteHint_clone(&hops_conv);
26410 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
26411 *ret_conv = PrivateRoute_new(hops_conv);
26412 return (uint64_t)ret_conv;
26415 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
26416 LDKPrivateRoute this_arg_conv;
26417 this_arg_conv.inner = (void*)(this_arg & (~1));
26418 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26419 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
26420 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
26421 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26422 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26423 uint64_t ret_ref = (uint64_t)ret_var.inner;
26424 if (ret_var.is_owned) {
26430 uint32_t __attribute__((visibility("default"))) TS_CreationError_clone(uint32_t orig) {
26431 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
26432 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
26436 uint32_t __attribute__((visibility("default"))) TS_CreationError_description_too_long() {
26437 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
26441 uint32_t __attribute__((visibility("default"))) TS_CreationError_route_too_long() {
26442 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
26446 uint32_t __attribute__((visibility("default"))) TS_CreationError_timestamp_out_of_bounds() {
26447 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
26451 uint32_t __attribute__((visibility("default"))) TS_CreationError_expiry_time_out_of_bounds() {
26452 uint32_t ret_conv = LDKCreationError_to_js(CreationError_expiry_time_out_of_bounds());
26456 jboolean __attribute__((visibility("default"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
26457 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
26458 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
26459 jboolean ret_val = CreationError_eq(a_conv, b_conv);
26463 jstring __attribute__((visibility("default"))) TS_CreationError_to_str(uint32_t o) {
26464 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
26465 LDKStr ret_str = CreationError_to_str(o_conv);
26466 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26471 uint32_t __attribute__((visibility("default"))) TS_SemanticError_clone(uint32_t orig) {
26472 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
26473 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
26477 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_hash() {
26478 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
26482 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_hashes() {
26483 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
26487 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_description() {
26488 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
26492 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_descriptions() {
26493 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
26497 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_secret() {
26498 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
26502 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_secrets() {
26503 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
26507 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_features() {
26508 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
26512 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_recovery_id() {
26513 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
26517 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_signature() {
26518 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
26522 uint32_t __attribute__((visibility("default"))) TS_SemanticError_imprecise_amount() {
26523 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
26527 jboolean __attribute__((visibility("default"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
26528 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
26529 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
26530 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
26534 jstring __attribute__((visibility("default"))) TS_SemanticError_to_str(uint32_t o) {
26535 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
26536 LDKStr ret_str = SemanticError_to_str(o_conv);
26537 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26542 void __attribute__((visibility("default"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
26543 if ((this_ptr & 1) != 0) return;
26544 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
26545 FREE((void*)this_ptr);
26546 SignOrCreationError_free(this_ptr_conv);
26549 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_clone(uint32_t orig) {
26550 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
26551 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
26552 *ret_copy = SignOrCreationError_clone(orig_conv);
26553 uint64_t ret_ref = (uint64_t)ret_copy;
26557 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_sign_error() {
26558 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
26559 *ret_copy = SignOrCreationError_sign_error();
26560 uint64_t ret_ref = (uint64_t)ret_copy;
26564 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_creation_error(uint32_t a) {
26565 LDKCreationError a_conv = LDKCreationError_from_js(a);
26566 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
26567 *ret_copy = SignOrCreationError_creation_error(a_conv);
26568 uint64_t ret_ref = (uint64_t)ret_copy;
26572 jboolean __attribute__((visibility("default"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
26573 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
26574 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
26575 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
26579 jstring __attribute__((visibility("default"))) TS_SignOrCreationError_to_str(uint32_t o) {
26580 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
26581 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
26582 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26587 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) {
26588 LDKChannelManager channelmanager_conv;
26589 channelmanager_conv.inner = (void*)(channelmanager & (~1));
26590 channelmanager_conv.is_owned = false;
26591 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
26592 LDKCurrency network_conv = LDKCurrency_from_js(network);
26593 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
26594 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
26595 LDKStr description_conv = str_ref_to_owned_c(description);
26596 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
26597 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
26598 return (uint64_t)ret_conv;
26601 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_from_str(jstring s) {
26602 LDKStr s_conv = str_ref_to_owned_c(s);
26603 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
26604 *ret_conv = SiPrefix_from_str(s_conv);
26605 return (uint64_t)ret_conv;
26608 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_str(jstring s) {
26609 LDKStr s_conv = str_ref_to_owned_c(s);
26610 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
26611 *ret_conv = Invoice_from_str(s_conv);
26612 return (uint64_t)ret_conv;
26615 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_from_str(jstring s) {
26616 LDKStr s_conv = str_ref_to_owned_c(s);
26617 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
26618 *ret_conv = SignedRawInvoice_from_str(s_conv);
26619 return (uint64_t)ret_conv;
26622 jstring __attribute__((visibility("default"))) TS_Invoice_to_str(uint32_t o) {
26624 o_conv.inner = (void*)(o & (~1));
26625 o_conv.is_owned = false;
26626 LDKStr ret_str = Invoice_to_str(&o_conv);
26627 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26632 jstring __attribute__((visibility("default"))) TS_SignedRawInvoice_to_str(uint32_t o) {
26633 LDKSignedRawInvoice o_conv;
26634 o_conv.inner = (void*)(o & (~1));
26635 o_conv.is_owned = false;
26636 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
26637 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26642 jstring __attribute__((visibility("default"))) TS_Currency_to_str(uint32_t o) {
26643 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
26644 LDKStr ret_str = Currency_to_str(o_conv);
26645 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26650 jstring __attribute__((visibility("default"))) TS_SiPrefix_to_str(uint32_t o) {
26651 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
26652 LDKStr ret_str = SiPrefix_to_str(o_conv);
26653 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);