5 // These should be provided...somehow...
6 void *memset(void *s, int c, size_t n);
7 void *memcpy(void *dest, const void *src, size_t n);
8 int memcmp(const void *s1, const void *s2, size_t n);
10 void __attribute__((noreturn)) abort(void);
11 static inline void assert(bool expression) {
12 if (!expression) { abort(); }
15 void *malloc(size_t size);
18 #define MALLOC(a, _) malloc(a)
19 #define FREE(p) if ((unsigned long)(p) > 1024) { free(p); }
20 #define DO_ASSERT(a) (void)(a)
22 #define CHECK_ACCESS(p)
24 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
25 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
26 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
27 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
29 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
31 typedef uint32_t int64_tArray;
32 typedef uint32_t int8_tArray;
33 typedef uint32_t uint32_tArray;
34 typedef uint32_t ptrArray;
35 typedef uint32_t jstring;
37 static inline uint32_t init_arr(size_t arr_len, size_t elem_size, const char *type_desc) {
38 uint32_t *elems = (uint32_t*)MALLOC(arr_len * elem_size + 4, type_desc);
40 return (uint32_t)elems;
43 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
44 char* err_buf = MALLOC(len + 4, "str conv buf");
45 *((uint32_t*)err_buf) = len;
46 memcpy(err_buf + 4, chars, len);
47 return (uint32_t) err_buf;
49 static inline LDKStr str_ref_to_owned_c(jstring str) {
50 uint32_t *str_len = (uint32_t*)str;
51 char* newchars = MALLOC(*str_len + 1, "String chars");
52 memcpy(newchars, (const char*)(str + 4), *str_len);
53 newchars[*str_len] = 0;
57 .chars_is_owned = true
62 typedef bool jboolean;
64 uint32_t __attribute__((visibility("default"))) TS_malloc(uint32_t size) {
65 return (uint32_t)MALLOC(size, "JS-Called malloc");
67 void __attribute__((visibility("default"))) TS_free(uint32_t ptr) {
70 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
71 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
73 case 0: return LDKAccessError_UnknownChain;
74 case 1: return LDKAccessError_UnknownTx;
78 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
80 case LDKAccessError_UnknownChain: return 0;
81 case LDKAccessError_UnknownTx: return 1;
85 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
87 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
88 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
92 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
94 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
95 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
99 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
101 case 0: return LDKConfirmationTarget_Background;
102 case 1: return LDKConfirmationTarget_Normal;
103 case 2: return LDKConfirmationTarget_HighPriority;
107 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
109 case LDKConfirmationTarget_Background: return 0;
110 case LDKConfirmationTarget_Normal: return 1;
111 case LDKConfirmationTarget_HighPriority: return 2;
115 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
117 case 0: return LDKCreationError_DescriptionTooLong;
118 case 1: return LDKCreationError_RouteTooLong;
119 case 2: return LDKCreationError_TimestampOutOfBounds;
120 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
124 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
126 case LDKCreationError_DescriptionTooLong: return 0;
127 case LDKCreationError_RouteTooLong: return 1;
128 case LDKCreationError_TimestampOutOfBounds: return 2;
129 case LDKCreationError_ExpiryTimeOutOfBounds: return 3;
133 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
135 case 0: return LDKCurrency_Bitcoin;
136 case 1: return LDKCurrency_BitcoinTestnet;
137 case 2: return LDKCurrency_Regtest;
138 case 3: return LDKCurrency_Simnet;
139 case 4: return LDKCurrency_Signet;
143 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
145 case LDKCurrency_Bitcoin: return 0;
146 case LDKCurrency_BitcoinTestnet: return 1;
147 case LDKCurrency_Regtest: return 2;
148 case LDKCurrency_Simnet: return 3;
149 case LDKCurrency_Signet: return 4;
153 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
155 case 0: return LDKIOError_NotFound;
156 case 1: return LDKIOError_PermissionDenied;
157 case 2: return LDKIOError_ConnectionRefused;
158 case 3: return LDKIOError_ConnectionReset;
159 case 4: return LDKIOError_ConnectionAborted;
160 case 5: return LDKIOError_NotConnected;
161 case 6: return LDKIOError_AddrInUse;
162 case 7: return LDKIOError_AddrNotAvailable;
163 case 8: return LDKIOError_BrokenPipe;
164 case 9: return LDKIOError_AlreadyExists;
165 case 10: return LDKIOError_WouldBlock;
166 case 11: return LDKIOError_InvalidInput;
167 case 12: return LDKIOError_InvalidData;
168 case 13: return LDKIOError_TimedOut;
169 case 14: return LDKIOError_WriteZero;
170 case 15: return LDKIOError_Interrupted;
171 case 16: return LDKIOError_Other;
172 case 17: return LDKIOError_UnexpectedEof;
176 static inline int32_t LDKIOError_to_js(LDKIOError val) {
178 case LDKIOError_NotFound: return 0;
179 case LDKIOError_PermissionDenied: return 1;
180 case LDKIOError_ConnectionRefused: return 2;
181 case LDKIOError_ConnectionReset: return 3;
182 case LDKIOError_ConnectionAborted: return 4;
183 case LDKIOError_NotConnected: return 5;
184 case LDKIOError_AddrInUse: return 6;
185 case LDKIOError_AddrNotAvailable: return 7;
186 case LDKIOError_BrokenPipe: return 8;
187 case LDKIOError_AlreadyExists: return 9;
188 case LDKIOError_WouldBlock: return 10;
189 case LDKIOError_InvalidInput: return 11;
190 case LDKIOError_InvalidData: return 12;
191 case LDKIOError_TimedOut: return 13;
192 case LDKIOError_WriteZero: return 14;
193 case LDKIOError_Interrupted: return 15;
194 case LDKIOError_Other: return 16;
195 case LDKIOError_UnexpectedEof: return 17;
199 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
201 case 0: return LDKLevel_Trace;
202 case 1: return LDKLevel_Debug;
203 case 2: return LDKLevel_Info;
204 case 3: return LDKLevel_Warn;
205 case 4: return LDKLevel_Error;
209 static inline int32_t LDKLevel_to_js(LDKLevel val) {
211 case LDKLevel_Trace: return 0;
212 case LDKLevel_Debug: return 1;
213 case LDKLevel_Info: return 2;
214 case LDKLevel_Warn: return 3;
215 case LDKLevel_Error: return 4;
219 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
221 case 0: return LDKNetwork_Bitcoin;
222 case 1: return LDKNetwork_Testnet;
223 case 2: return LDKNetwork_Regtest;
224 case 3: return LDKNetwork_Signet;
228 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
230 case LDKNetwork_Bitcoin: return 0;
231 case LDKNetwork_Testnet: return 1;
232 case LDKNetwork_Regtest: return 2;
233 case LDKNetwork_Signet: return 3;
237 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
239 case 0: return LDKSecp256k1Error_IncorrectSignature;
240 case 1: return LDKSecp256k1Error_InvalidMessage;
241 case 2: return LDKSecp256k1Error_InvalidPublicKey;
242 case 3: return LDKSecp256k1Error_InvalidSignature;
243 case 4: return LDKSecp256k1Error_InvalidSecretKey;
244 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
245 case 6: return LDKSecp256k1Error_InvalidTweak;
246 case 7: return LDKSecp256k1Error_TweakCheckFailed;
247 case 8: return LDKSecp256k1Error_NotEnoughMemory;
251 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
253 case LDKSecp256k1Error_IncorrectSignature: return 0;
254 case LDKSecp256k1Error_InvalidMessage: return 1;
255 case LDKSecp256k1Error_InvalidPublicKey: return 2;
256 case LDKSecp256k1Error_InvalidSignature: return 3;
257 case LDKSecp256k1Error_InvalidSecretKey: return 4;
258 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
259 case LDKSecp256k1Error_InvalidTweak: return 6;
260 case LDKSecp256k1Error_TweakCheckFailed: return 7;
261 case LDKSecp256k1Error_NotEnoughMemory: return 8;
265 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
267 case 0: return LDKSemanticError_NoPaymentHash;
268 case 1: return LDKSemanticError_MultiplePaymentHashes;
269 case 2: return LDKSemanticError_NoDescription;
270 case 3: return LDKSemanticError_MultipleDescriptions;
271 case 4: return LDKSemanticError_NoPaymentSecret;
272 case 5: return LDKSemanticError_MultiplePaymentSecrets;
273 case 6: return LDKSemanticError_InvalidFeatures;
274 case 7: return LDKSemanticError_InvalidRecoveryId;
275 case 8: return LDKSemanticError_InvalidSignature;
276 case 9: return LDKSemanticError_ImpreciseAmount;
280 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
282 case LDKSemanticError_NoPaymentHash: return 0;
283 case LDKSemanticError_MultiplePaymentHashes: return 1;
284 case LDKSemanticError_NoDescription: return 2;
285 case LDKSemanticError_MultipleDescriptions: return 3;
286 case LDKSemanticError_NoPaymentSecret: return 4;
287 case LDKSemanticError_MultiplePaymentSecrets: return 5;
288 case LDKSemanticError_InvalidFeatures: return 6;
289 case LDKSemanticError_InvalidRecoveryId: return 7;
290 case LDKSemanticError_InvalidSignature: return 8;
291 case LDKSemanticError_ImpreciseAmount: return 9;
295 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
297 case 0: return LDKSiPrefix_Milli;
298 case 1: return LDKSiPrefix_Micro;
299 case 2: return LDKSiPrefix_Nano;
300 case 3: return LDKSiPrefix_Pico;
304 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
306 case LDKSiPrefix_Milli: return 0;
307 case LDKSiPrefix_Micro: return 1;
308 case LDKSiPrefix_Nano: return 2;
309 case LDKSiPrefix_Pico: return 3;
313 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u8Z_new(int8_tArray elems) {
314 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
315 ret->datalen = *((uint32_t*)elems);
316 if (ret->datalen == 0) {
319 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
320 int8_t *java_elems = (int8_t*)(elems + 4);
321 for (size_t i = 0; i < ret->datalen; i++) {
322 ret->data[i] = java_elems[i];
325 return (uint64_t)ret;
327 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
328 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
329 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
332 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) {
333 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
334 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
335 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
336 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
337 CVec_u8Z_free(ret_var);
341 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t __attribute__((visibility("default"))) TS_TxOut_get_value(uint32_t thing) {
342 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
343 int64_t ret_val = TxOut_get_value(thing_conv);
347 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_result_ok(uint32_t arg) {
348 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
350 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_ok(uint32_t arg) {
351 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
352 CHECK(val->result_ok);
353 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
354 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).bytes, 32);
357 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_err(uint32_t arg) {
358 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
359 CHECK(!val->result_ok);
360 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
363 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_result_ok(uint32_t arg) {
364 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
366 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_ok(uint32_t arg) {
367 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
368 CHECK(val->result_ok);
369 int8_tArray res_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
370 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compressed_form, 33);
373 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_err(uint32_t arg) {
374 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
375 CHECK(!val->result_ok);
376 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
379 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_result_ok(uint32_t arg) {
380 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
382 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t arg) {
383 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
384 CHECK(val->result_ok);
385 LDKTxCreationKeys res_var = (*val->contents.result);
386 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
387 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
388 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
391 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t arg) {
392 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
393 CHECK(!val->result_ok);
394 LDKDecodeError err_var = (*val->contents.err);
395 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
396 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
397 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
400 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_result_ok(uint32_t arg) {
401 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
403 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t arg) {
404 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
405 CHECK(val->result_ok);
406 LDKChannelPublicKeys res_var = (*val->contents.result);
407 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
408 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
409 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
412 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t arg) {
413 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
414 CHECK(!val->result_ok);
415 LDKDecodeError err_var = (*val->contents.err);
416 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
417 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
418 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
421 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_result_ok(uint32_t arg) {
422 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
424 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_ok(uint32_t arg) {
425 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
426 CHECK(val->result_ok);
427 LDKTxCreationKeys res_var = (*val->contents.result);
428 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
429 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
430 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
433 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_err(uint32_t arg) {
434 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
435 CHECK(!val->result_ok);
436 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
439 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u32Z_ref_from_ptr(uint32_t ptr) {
440 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
442 case LDKCOption_u32Z_Some: {
443 return 0 /* LDKCOption_u32Z - Some */; (void) obj->some;
445 case LDKCOption_u32Z_None: {
446 return 0 /* LDKCOption_u32Z - None */;
451 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_result_ok(uint32_t arg) {
452 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
454 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
455 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
456 CHECK(val->result_ok);
457 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
458 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
459 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
460 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
463 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
464 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
465 CHECK(!val->result_ok);
466 LDKDecodeError err_var = (*val->contents.err);
467 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
468 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
469 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
472 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
473 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
475 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
476 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
477 CHECK(val->result_ok);
478 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
479 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
480 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
481 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
484 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
485 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
486 CHECK(!val->result_ok);
487 LDKDecodeError err_var = (*val->contents.err);
488 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
489 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
490 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
493 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
494 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
496 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
497 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
498 CHECK(val->result_ok);
499 LDKChannelTransactionParameters res_var = (*val->contents.result);
500 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
501 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
502 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
505 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
506 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
507 CHECK(!val->result_ok);
508 LDKDecodeError err_var = (*val->contents.err);
509 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
510 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
511 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
514 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
515 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
517 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
518 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
519 CHECK(val->result_ok);
520 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
521 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
522 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
523 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
526 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
527 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
528 CHECK(!val->result_ok);
529 LDKDecodeError err_var = (*val->contents.err);
530 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
531 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
532 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
535 jboolean __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
536 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
538 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
539 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
540 CHECK(val->result_ok);
541 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
542 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
543 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
544 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
547 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
548 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
549 CHECK(!val->result_ok);
550 LDKDecodeError err_var = (*val->contents.err);
551 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
552 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
553 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
556 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_result_ok(uint32_t arg) {
557 return ((LDKCResult_TrustedClosingTransactionNoneZ*)arg)->result_ok;
559 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t arg) {
560 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
561 CHECK(val->result_ok);
562 LDKTrustedClosingTransaction res_var = (*val->contents.result);
563 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
564 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
565 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
568 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_err(uint32_t arg) {
569 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
570 CHECK(!val->result_ok);
571 return *val->contents.err;
573 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
574 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
576 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
577 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
578 CHECK(val->result_ok);
579 LDKCommitmentTransaction res_var = (*val->contents.result);
580 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
581 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
582 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
585 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
586 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
587 CHECK(!val->result_ok);
588 LDKDecodeError err_var = (*val->contents.err);
589 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
590 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
591 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
594 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_result_ok(uint32_t arg) {
595 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
597 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
598 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
599 CHECK(val->result_ok);
600 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
601 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
602 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
603 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
606 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
607 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
608 CHECK(!val->result_ok);
609 return *val->contents.err;
611 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_result_ok(uint32_t arg) {
612 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
614 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
615 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
616 CHECK(val->result_ok);
617 LDKCVec_SignatureZ res_var = (*val->contents.result);
618 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
619 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
620 for (size_t m = 0; m < res_var.datalen; m++) {
621 int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
622 memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64);
623 res_arr_ptr[m] = res_conv_12_arr;
627 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
628 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
629 CHECK(!val->result_ok);
630 return *val->contents.err;
632 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_result_ok(uint32_t arg) {
633 return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
635 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t arg) {
636 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
637 CHECK(val->result_ok);
638 LDKShutdownScript res_var = (*val->contents.result);
639 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
640 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
641 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
644 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t arg) {
645 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
646 CHECK(!val->result_ok);
647 LDKDecodeError err_var = (*val->contents.err);
648 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
649 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
650 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
653 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_result_ok(uint32_t arg) {
654 return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
656 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t arg) {
657 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
658 CHECK(val->result_ok);
659 LDKShutdownScript res_var = (*val->contents.result);
660 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
661 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
662 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
665 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t arg) {
666 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
667 CHECK(!val->result_ok);
668 LDKInvalidShutdownScript err_var = (*val->contents.err);
669 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
670 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
671 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
674 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_result_ok(uint32_t arg) {
675 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
677 void __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_ok(uint32_t arg) {
678 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
679 CHECK(val->result_ok);
680 return *val->contents.result;
682 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_err(uint32_t arg) {
683 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
684 CHECK(!val->result_ok);
685 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
688 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_result_ok(uint32_t arg) {
689 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
691 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_ok(uint32_t arg) {
692 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
693 CHECK(val->result_ok);
694 LDKRouteHop res_var = (*val->contents.result);
695 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
696 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
697 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
700 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_err(uint32_t arg) {
701 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
702 CHECK(!val->result_ok);
703 LDKDecodeError err_var = (*val->contents.err);
704 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
705 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
706 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
709 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) {
710 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
711 ret->datalen = *((uint32_t*)elems);
712 if (ret->datalen == 0) {
715 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
716 uint32_t *java_elems = (uint32_t*)(elems + 4);
717 for (size_t i = 0; i < ret->datalen; i++) {
718 uint32_t arr_elem = java_elems[i];
719 LDKRouteHop arr_elem_conv;
720 arr_elem_conv.inner = (void*)(arr_elem & (~1));
721 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
722 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
723 ret->data[i] = arr_elem_conv;
726 return (uint64_t)ret;
728 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
729 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
730 for (size_t i = 0; i < ret.datalen; i++) {
731 ret.data[i] = RouteHop_clone(&orig->data[i]);
735 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
736 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
737 for (size_t i = 0; i < ret.datalen; i++) {
738 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
742 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_result_ok(uint32_t arg) {
743 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
745 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
746 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
747 CHECK(val->result_ok);
748 LDKRoute res_var = (*val->contents.result);
749 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
750 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
751 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
754 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
755 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
756 CHECK(!val->result_ok);
757 LDKDecodeError err_var = (*val->contents.err);
758 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
759 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
760 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
763 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
764 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
766 case LDKCOption_u64Z_Some: {
767 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
769 case LDKCOption_u64Z_None: {
770 return 0 /* LDKCOption_u64Z - None */;
775 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) {
776 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
777 ret->datalen = *((uint32_t*)elems);
778 if (ret->datalen == 0) {
781 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
782 uint32_t *java_elems = (uint32_t*)(elems + 4);
783 for (size_t i = 0; i < ret->datalen; i++) {
784 uint32_t arr_elem = java_elems[i];
785 LDKChannelDetails arr_elem_conv;
786 arr_elem_conv.inner = (void*)(arr_elem & (~1));
787 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
788 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
789 ret->data[i] = arr_elem_conv;
792 return (uint64_t)ret;
794 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
795 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
796 for (size_t i = 0; i < ret.datalen; i++) {
797 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
801 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintZ_new(uint32_tArray elems) {
802 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
803 ret->datalen = *((uint32_t*)elems);
804 if (ret->datalen == 0) {
807 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
808 uint32_t *java_elems = (uint32_t*)(elems + 4);
809 for (size_t i = 0; i < ret->datalen; i++) {
810 uint32_t arr_elem = java_elems[i];
811 LDKRouteHint arr_elem_conv;
812 arr_elem_conv.inner = (void*)(arr_elem & (~1));
813 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
814 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
815 ret->data[i] = arr_elem_conv;
818 return (uint64_t)ret;
820 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
821 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
822 for (size_t i = 0; i < ret.datalen; i++) {
823 ret.data[i] = RouteHint_clone(&orig->data[i]);
827 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_result_ok(uint32_t arg) {
828 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
830 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
831 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
832 CHECK(val->result_ok);
833 LDKRoute res_var = (*val->contents.result);
834 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
835 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
836 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
839 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
840 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
841 CHECK(!val->result_ok);
842 LDKLightningError err_var = (*val->contents.err);
843 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
844 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
845 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
848 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_result_ok(uint32_t arg) {
849 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
851 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
852 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
853 CHECK(val->result_ok);
854 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
855 return (uint64_t)res_ref;
857 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
858 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
859 CHECK(!val->result_ok);
860 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
863 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
866 int64_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_a(uint32_t tuple) {
867 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
868 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(tuple_conv);
872 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
875 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_b(uint32_t tuple) {
876 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
877 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(tuple_conv);
878 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
879 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
880 Transaction_free(ret_var);
884 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_usizeTransactionZZ_new(uint32_tArray elems) {
885 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
886 ret->datalen = *((uint32_t*)elems);
887 if (ret->datalen == 0) {
890 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
891 uint32_t *java_elems = (uint32_t*)(elems + 4);
892 for (size_t i = 0; i < ret->datalen; i++) {
893 uint32_t arr_elem = java_elems[i];
894 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
895 CHECK_ACCESS(arr_elem_ptr);
896 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(arr_elem_ptr);
897 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
898 ret->data[i] = arr_elem_conv;
901 return (uint64_t)ret;
903 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
904 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
905 for (size_t i = 0; i < ret.datalen; i++) {
906 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
910 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
911 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
912 for (size_t i = 0; i < ret.datalen; i++) {
913 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
917 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(uint32_t arg) {
918 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
920 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
921 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
922 CHECK(val->result_ok);
923 return *val->contents.result;
925 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
926 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
927 CHECK(!val->result_ok);
928 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
931 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
932 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
934 case LDKMonitorEvent_HTLCEvent: {
935 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
936 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
937 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
938 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
939 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
941 case LDKMonitorEvent_CommitmentTxConfirmed: {
942 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
943 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
944 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
945 uint64_t commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
946 return 0 /* LDKMonitorEvent - CommitmentTxConfirmed */; (void) commitment_tx_confirmed_ref;
951 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) {
952 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
953 ret->datalen = *((uint32_t*)elems);
954 if (ret->datalen == 0) {
957 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
958 uint32_t *java_elems = (uint32_t*)(elems + 4);
959 for (size_t i = 0; i < ret->datalen; i++) {
960 uint32_t arr_elem = java_elems[i];
961 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
962 CHECK_ACCESS(arr_elem_ptr);
963 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(arr_elem_ptr);
964 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
965 ret->data[i] = arr_elem_conv;
968 return (uint64_t)ret;
970 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
971 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
972 for (size_t i = 0; i < ret.datalen; i++) {
973 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
977 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
978 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
980 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
981 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
982 *some_conv = obj->some;
983 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
984 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) ((uint64_t)some_conv);
986 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
987 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
992 uint32_t __attribute__((visibility("default"))) TS_LDKNetworkUpdate_ref_from_ptr(uint32_t ptr) {
993 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
995 case LDKNetworkUpdate_ChannelUpdateMessage: {
996 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
997 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
998 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
999 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1000 return 0 /* LDKNetworkUpdate - ChannelUpdateMessage */; (void) msg_ref;
1002 case LDKNetworkUpdate_ChannelClosed: {
1003 return 0 /* LDKNetworkUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
1005 case LDKNetworkUpdate_NodeFailure: {
1006 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1007 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
1008 return 0 /* LDKNetworkUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
1013 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_NetworkUpdateZ_ref_from_ptr(uint32_t ptr) {
1014 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1016 case LDKCOption_NetworkUpdateZ_Some: {
1017 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1018 return 0 /* LDKCOption_NetworkUpdateZ - Some */; (void) some_ref;
1020 case LDKCOption_NetworkUpdateZ_None: {
1021 return 0 /* LDKCOption_NetworkUpdateZ - None */;
1026 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
1027 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1029 case LDKSpendableOutputDescriptor_StaticOutput: {
1030 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1031 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1032 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1033 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1034 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1035 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (uint64_t)output_ref;
1037 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1038 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1039 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1040 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1041 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1042 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
1044 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1045 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1046 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1047 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1048 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1049 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
1054 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_SpendableOutputDescriptorZ_new(uint32_tArray elems) {
1055 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1056 ret->datalen = *((uint32_t*)elems);
1057 if (ret->datalen == 0) {
1060 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1061 uint32_t *java_elems = (uint32_t*)(elems + 4);
1062 for (size_t i = 0; i < ret->datalen; i++) {
1063 uint32_t arr_elem = java_elems[i];
1064 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
1065 CHECK_ACCESS(arr_elem_ptr);
1066 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(arr_elem_ptr);
1067 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1068 ret->data[i] = arr_elem_conv;
1071 return (uint64_t)ret;
1073 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1074 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1075 for (size_t i = 0; i < ret.datalen; i++) {
1076 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1080 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
1081 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1083 case LDKErrorAction_DisconnectPeer: {
1084 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1085 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1086 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1087 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1088 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
1090 case LDKErrorAction_IgnoreError: {
1091 return 0 /* LDKErrorAction - IgnoreError */;
1093 case LDKErrorAction_IgnoreAndLog: {
1094 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
1095 return 0 /* LDKErrorAction - IgnoreAndLog */; (void) ignore_and_log_conv;
1097 case LDKErrorAction_SendErrorMessage: {
1098 LDKErrorMessage msg_var = obj->send_error_message.msg;
1099 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1100 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1101 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1102 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
1107 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
1108 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1110 case LDKMessageSendEvent_SendAcceptChannel: {
1111 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1112 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
1113 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1114 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1115 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1116 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1117 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
1119 case LDKMessageSendEvent_SendOpenChannel: {
1120 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1121 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
1122 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1123 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1124 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1125 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1126 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
1128 case LDKMessageSendEvent_SendFundingCreated: {
1129 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1130 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
1131 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1132 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1133 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1134 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1135 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
1137 case LDKMessageSendEvent_SendFundingSigned: {
1138 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1139 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
1140 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1141 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1142 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1143 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1144 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
1146 case LDKMessageSendEvent_SendFundingLocked: {
1147 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1148 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
1149 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1150 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1151 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1152 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1153 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
1155 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1156 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1157 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
1158 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1159 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1160 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1161 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1162 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
1164 case LDKMessageSendEvent_UpdateHTLCs: {
1165 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1166 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
1167 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1168 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1169 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1170 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1171 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
1173 case LDKMessageSendEvent_SendRevokeAndACK: {
1174 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1175 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
1176 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1177 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1178 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1179 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1180 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
1182 case LDKMessageSendEvent_SendClosingSigned: {
1183 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1184 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
1185 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1186 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1187 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1188 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1189 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
1191 case LDKMessageSendEvent_SendShutdown: {
1192 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1193 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
1194 LDKShutdown msg_var = obj->send_shutdown.msg;
1195 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1196 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1197 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1198 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
1200 case LDKMessageSendEvent_SendChannelReestablish: {
1201 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1202 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
1203 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1204 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1205 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1206 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1207 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
1209 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1210 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1211 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1212 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1213 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1214 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1215 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1216 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1217 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1218 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
1220 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1221 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1222 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1223 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1224 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1225 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
1227 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1228 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1229 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1230 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1231 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1232 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
1234 case LDKMessageSendEvent_SendChannelUpdate: {
1235 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1236 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_update.node_id.compressed_form, 33);
1237 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1238 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1239 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1240 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1241 return 0 /* LDKMessageSendEvent - SendChannelUpdate */; (void) node_id_arr; (void) msg_ref;
1243 case LDKMessageSendEvent_HandleError: {
1244 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1245 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
1246 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1247 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
1249 case LDKMessageSendEvent_SendChannelRangeQuery: {
1250 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1251 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
1252 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1253 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1254 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1255 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1256 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
1258 case LDKMessageSendEvent_SendShortIdsQuery: {
1259 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1260 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
1261 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1262 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1263 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1264 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1265 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
1267 case LDKMessageSendEvent_SendReplyChannelRange: {
1268 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1269 memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33);
1270 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1271 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1272 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1273 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1274 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
1279 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MessageSendEventZ_new(uint32_tArray elems) {
1280 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1281 ret->datalen = *((uint32_t*)elems);
1282 if (ret->datalen == 0) {
1285 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1286 uint32_t *java_elems = (uint32_t*)(elems + 4);
1287 for (size_t i = 0; i < ret->datalen; i++) {
1288 uint32_t arr_elem = java_elems[i];
1289 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
1290 CHECK_ACCESS(arr_elem_ptr);
1291 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(arr_elem_ptr);
1292 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1293 ret->data[i] = arr_elem_conv;
1296 return (uint64_t)ret;
1298 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1299 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1300 for (size_t i = 0; i < ret.datalen; i++) {
1301 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1305 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1306 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1308 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1309 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1310 CHECK(val->result_ok);
1311 LDKInitFeatures res_var = (*val->contents.result);
1312 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1313 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1314 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1317 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1318 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1319 CHECK(!val->result_ok);
1320 LDKDecodeError err_var = (*val->contents.err);
1321 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1322 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1323 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1326 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1327 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1329 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1330 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1331 CHECK(val->result_ok);
1332 LDKNodeFeatures res_var = (*val->contents.result);
1333 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1334 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1335 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1338 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1339 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1340 CHECK(!val->result_ok);
1341 LDKDecodeError err_var = (*val->contents.err);
1342 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1343 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1344 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1347 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1348 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1350 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1351 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1352 CHECK(val->result_ok);
1353 LDKChannelFeatures res_var = (*val->contents.result);
1354 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1355 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1356 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1359 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1360 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1361 CHECK(!val->result_ok);
1362 LDKDecodeError err_var = (*val->contents.err);
1363 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1364 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1365 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1368 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1369 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1371 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1372 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1373 CHECK(val->result_ok);
1374 LDKInvoiceFeatures res_var = (*val->contents.result);
1375 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1376 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1377 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1380 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1381 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1382 CHECK(!val->result_ok);
1383 LDKDecodeError err_var = (*val->contents.err);
1384 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1385 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1386 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1389 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1390 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1392 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1393 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1394 CHECK(val->result_ok);
1395 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1396 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1397 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1398 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1401 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1402 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1403 CHECK(!val->result_ok);
1404 LDKDecodeError err_var = (*val->contents.err);
1405 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1406 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1407 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1410 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1411 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1413 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1414 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1415 CHECK(val->result_ok);
1416 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1417 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1418 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1419 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1422 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1423 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1424 CHECK(!val->result_ok);
1425 LDKDecodeError err_var = (*val->contents.err);
1426 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1427 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1428 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1431 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1432 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1434 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1435 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1436 CHECK(val->result_ok);
1437 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1440 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1441 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1442 CHECK(!val->result_ok);
1443 LDKDecodeError err_var = (*val->contents.err);
1444 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1445 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1446 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1449 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_result_ok(uint32_t arg) {
1450 return ((LDKCResult_NoneNoneZ*)arg)->result_ok;
1452 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_ok(uint32_t arg) {
1453 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1454 CHECK(val->result_ok);
1455 return *val->contents.result;
1457 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_err(uint32_t arg) {
1458 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1459 CHECK(!val->result_ok);
1460 return *val->contents.err;
1462 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
1465 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t tuple) {
1466 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
1467 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1468 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_SignatureCVec_SignatureZZ_get_a(tuple_conv).compact_form, 64);
1472 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
1475 ptrArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t tuple) {
1476 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
1477 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(tuple_conv);
1478 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1479 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
1480 for (size_t m = 0; m < ret_var.datalen; m++) {
1481 int8_tArray ret_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1482 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compact_form, 64);
1483 ret_arr_ptr[m] = ret_conv_12_arr;
1489 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(uint32_t arg) {
1490 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1492 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1493 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1494 CHECK(val->result_ok);
1495 LDKC2Tuple_SignatureCVec_SignatureZZ* res_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1496 *res_conv = (*val->contents.result);
1497 *res_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(res_conv);
1498 return ((uint64_t)res_conv);
1500 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1501 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1502 CHECK(!val->result_ok);
1503 return *val->contents.err;
1505 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_result_ok(uint32_t arg) {
1506 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1508 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1509 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1510 CHECK(val->result_ok);
1511 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1512 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1515 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1516 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1517 CHECK(!val->result_ok);
1518 return *val->contents.err;
1520 typedef struct LDKBaseSign_JCalls {
1521 atomic_size_t refcnt;
1522 uint32_t get_per_commitment_point_meth;
1523 uint32_t release_commitment_secret_meth;
1524 uint32_t validate_holder_commitment_meth;
1525 uint32_t channel_keys_id_meth;
1526 uint32_t sign_counterparty_commitment_meth;
1527 uint32_t validate_counterparty_revocation_meth;
1528 uint32_t sign_holder_commitment_and_htlcs_meth;
1529 uint32_t sign_justice_revoked_output_meth;
1530 uint32_t sign_justice_revoked_htlc_meth;
1531 uint32_t sign_counterparty_htlc_transaction_meth;
1532 uint32_t sign_closing_transaction_meth;
1533 uint32_t sign_channel_announcement_meth;
1534 uint32_t ready_channel_meth;
1535 } LDKBaseSign_JCalls;
1536 static void LDKBaseSign_JCalls_free(void* this_arg) {
1537 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1538 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1539 js_free(j_calls->get_per_commitment_point_meth);
1540 js_free(j_calls->release_commitment_secret_meth);
1541 js_free(j_calls->validate_holder_commitment_meth);
1542 js_free(j_calls->channel_keys_id_meth);
1543 js_free(j_calls->sign_counterparty_commitment_meth);
1544 js_free(j_calls->validate_counterparty_revocation_meth);
1545 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1546 js_free(j_calls->sign_justice_revoked_output_meth);
1547 js_free(j_calls->sign_justice_revoked_htlc_meth);
1548 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1549 js_free(j_calls->sign_closing_transaction_meth);
1550 js_free(j_calls->sign_channel_announcement_meth);
1551 js_free(j_calls->ready_channel_meth);
1555 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1556 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1557 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1558 LDKPublicKey ret_ref;
1559 CHECK(*((uint32_t*)ret) == 33);
1560 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1563 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1564 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1565 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1566 LDKThirtyTwoBytes ret_ref;
1567 CHECK(*((uint32_t*)ret) == 32);
1568 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1571 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
1572 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1573 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1574 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
1575 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1576 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1577 uint64_t holder_tx_ref = (uint64_t)holder_tx_var.inner;
1578 if (holder_tx_var.is_owned) {
1581 uint32_t ret = js_invoke_function_1(j_calls->validate_holder_commitment_meth, holder_tx_ref);
1582 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1583 CHECK_ACCESS(ret_ptr);
1584 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1585 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
1588 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1589 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1590 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1591 LDKThirtyTwoBytes ret_ref;
1592 CHECK(*((uint32_t*)ret) == 32);
1593 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1596 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1597 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1598 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1599 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1600 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1601 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1602 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1603 if (commitment_tx_var.is_owned) {
1604 commitment_tx_ref |= 1;
1606 uint32_t ret = js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1607 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1608 CHECK_ACCESS(ret_ptr);
1609 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1610 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1613 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1614 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1615 int8_tArray secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1616 memcpy((uint8_t*)(secret_arr + 4), *secret, 32);
1617 uint32_t ret = js_invoke_function_2(j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
1618 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1619 CHECK_ACCESS(ret_ptr);
1620 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1621 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
1624 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1625 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1626 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1627 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1628 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1629 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1630 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1631 if (commitment_tx_var.is_owned) {
1632 commitment_tx_ref |= 1;
1634 uint32_t ret = js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1635 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1636 CHECK_ACCESS(ret_ptr);
1637 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1638 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1641 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]) {
1642 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1643 LDKTransaction justice_tx_var = justice_tx;
1644 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1645 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1646 Transaction_free(justice_tx_var);
1647 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1648 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1649 uint32_t ret = js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
1650 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1651 CHECK_ACCESS(ret_ptr);
1652 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1653 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1656 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) {
1657 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1658 LDKTransaction justice_tx_var = justice_tx;
1659 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1660 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1661 Transaction_free(justice_tx_var);
1662 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1663 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1664 LDKHTLCOutputInCommitment htlc_var = *htlc;
1665 htlc_var = HTLCOutputInCommitment_clone(htlc);
1666 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1667 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1668 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
1669 if (htlc_var.is_owned) {
1672 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);
1673 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1674 CHECK_ACCESS(ret_ptr);
1675 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1676 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1679 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) {
1680 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1681 LDKTransaction htlc_tx_var = htlc_tx;
1682 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1683 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1684 Transaction_free(htlc_tx_var);
1685 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1686 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1687 LDKHTLCOutputInCommitment htlc_var = *htlc;
1688 htlc_var = HTLCOutputInCommitment_clone(htlc);
1689 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1690 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1691 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
1692 if (htlc_var.is_owned) {
1695 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);
1696 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1697 CHECK_ACCESS(ret_ptr);
1698 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1699 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1702 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
1703 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1704 LDKClosingTransaction closing_tx_var = *closing_tx;
1705 closing_tx_var = ClosingTransaction_clone(closing_tx);
1706 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1707 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1708 uint64_t closing_tx_ref = (uint64_t)closing_tx_var.inner;
1709 if (closing_tx_var.is_owned) {
1710 closing_tx_ref |= 1;
1712 uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_ref);
1713 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1714 CHECK_ACCESS(ret_ptr);
1715 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1716 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1719 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1720 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1721 LDKUnsignedChannelAnnouncement msg_var = *msg;
1722 msg_var = UnsignedChannelAnnouncement_clone(msg);
1723 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1724 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1725 uint64_t msg_ref = (uint64_t)msg_var.inner;
1726 if (msg_var.is_owned) {
1729 uint32_t ret = js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
1730 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1731 CHECK_ACCESS(ret_ptr);
1732 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1733 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1736 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1737 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1738 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1739 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1740 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1741 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1742 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
1743 if (channel_parameters_var.is_owned) {
1744 channel_parameters_ref |= 1;
1746 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
1748 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
1749 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
1750 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1752 static inline LDKBaseSign LDKBaseSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1753 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
1754 atomic_init(&calls->refcnt, 1);
1755 //TODO: Assign calls->o from o
1757 LDKChannelPublicKeys pubkeys_conv;
1758 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1759 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1760 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1763 .this_arg = (void*) calls,
1764 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
1765 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
1766 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
1767 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
1768 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
1769 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
1770 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
1771 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
1772 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
1773 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
1774 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
1775 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
1776 .ready_channel = ready_channel_LDKBaseSign_jcall,
1777 .free = LDKBaseSign_JCalls_free,
1778 .pubkeys = pubkeys_conv,
1779 .set_pubkeys = NULL,
1783 long __attribute__((visibility("default"))) TS_LDKBaseSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1784 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
1785 *res_ptr = LDKBaseSign_init(o, pubkeys);
1786 return (long)res_ptr;
1788 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
1789 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1790 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1791 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1792 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1793 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1797 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
1798 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1799 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1800 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1801 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1802 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1806 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx) {
1807 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1808 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1809 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1810 LDKHolderCommitmentTransaction holder_tx_conv;
1811 holder_tx_conv.inner = (void*)(holder_tx & (~1));
1812 holder_tx_conv.is_owned = false;
1813 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1814 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
1815 return (uint64_t)ret_conv;
1818 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
1819 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1820 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1821 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1822 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1823 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1827 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
1828 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1829 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1830 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1831 LDKCommitmentTransaction commitment_tx_conv;
1832 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1833 commitment_tx_conv.is_owned = false;
1834 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1835 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1836 return (uint64_t)ret_conv;
1839 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_counterparty_revocation(uint32_t this_arg, int64_t idx, int8_tArray secret) {
1840 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1841 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1842 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1843 unsigned char secret_arr[32];
1844 CHECK(*((uint32_t*)secret) == 32);
1845 memcpy(secret_arr, (uint8_t*)(secret + 4), 32);
1846 unsigned char (*secret_ref)[32] = &secret_arr;
1847 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1848 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
1849 return (uint64_t)ret_conv;
1852 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
1853 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1854 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1855 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1856 LDKHolderCommitmentTransaction commitment_tx_conv;
1857 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1858 commitment_tx_conv.is_owned = false;
1859 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1860 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1861 return (uint64_t)ret_conv;
1864 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) {
1865 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1866 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1867 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1868 LDKTransaction justice_tx_ref;
1869 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1870 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1871 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1872 justice_tx_ref.data_is_owned = true;
1873 unsigned char per_commitment_key_arr[32];
1874 CHECK(*((uint32_t*)per_commitment_key) == 32);
1875 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1876 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1877 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1878 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
1879 return (uint64_t)ret_conv;
1882 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) {
1883 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1884 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1885 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1886 LDKTransaction justice_tx_ref;
1887 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1888 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1889 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1890 justice_tx_ref.data_is_owned = true;
1891 unsigned char per_commitment_key_arr[32];
1892 CHECK(*((uint32_t*)per_commitment_key) == 32);
1893 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1894 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1895 LDKHTLCOutputInCommitment htlc_conv;
1896 htlc_conv.inner = (void*)(htlc & (~1));
1897 htlc_conv.is_owned = false;
1898 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1899 *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);
1900 return (uint64_t)ret_conv;
1903 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) {
1904 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1905 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1906 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1907 LDKTransaction htlc_tx_ref;
1908 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
1909 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1910 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
1911 htlc_tx_ref.data_is_owned = true;
1912 LDKPublicKey per_commitment_point_ref;
1913 CHECK(*((uint32_t*)per_commitment_point) == 33);
1914 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
1915 LDKHTLCOutputInCommitment htlc_conv;
1916 htlc_conv.inner = (void*)(htlc & (~1));
1917 htlc_conv.is_owned = false;
1918 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1919 *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);
1920 return (uint64_t)ret_conv;
1923 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
1924 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1925 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1926 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1927 LDKClosingTransaction closing_tx_conv;
1928 closing_tx_conv.inner = (void*)(closing_tx & (~1));
1929 closing_tx_conv.is_owned = false;
1930 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1931 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
1932 return (uint64_t)ret_conv;
1935 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
1936 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1937 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1938 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1939 LDKUnsignedChannelAnnouncement msg_conv;
1940 msg_conv.inner = (void*)(msg & (~1));
1941 msg_conv.is_owned = false;
1942 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1943 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1944 return (uint64_t)ret_conv;
1947 void __attribute__((visibility("default"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
1948 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1949 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1950 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1951 LDKChannelTransactionParameters channel_parameters_conv;
1952 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1953 channel_parameters_conv.is_owned = false;
1954 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1957 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
1958 if (this_arg->set_pubkeys != NULL)
1959 this_arg->set_pubkeys(this_arg);
1960 return this_arg->pubkeys;
1962 uint32_t __attribute__((visibility("default"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
1963 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1964 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1965 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1966 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
1967 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1968 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1969 uint64_t ret_ref = (uint64_t)ret_var.inner;
1970 if (ret_var.is_owned) {
1976 typedef struct LDKSign_JCalls {
1977 atomic_size_t refcnt;
1978 LDKBaseSign_JCalls* BaseSign;
1979 uint32_t write_meth;
1981 static void LDKSign_JCalls_free(void* this_arg) {
1982 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1983 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1984 js_free(j_calls->write_meth);
1988 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
1989 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1990 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
1991 LDKCVec_u8Z ret_ref;
1992 ret_ref.datalen = *((uint32_t*)ret);
1993 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
1994 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
1997 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
1998 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
1999 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2000 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2002 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* BaseSign, uint32_t pubkeys) {
2003 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2004 atomic_init(&calls->refcnt, 1);
2005 //TODO: Assign calls->o from o
2007 LDKChannelPublicKeys pubkeys_conv;
2008 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2009 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2010 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2013 .this_arg = (void*) calls,
2014 .write = write_LDKSign_jcall,
2015 .cloned = LDKSign_JCalls_cloned,
2016 .free = LDKSign_JCalls_free,
2017 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
2019 calls->BaseSign = ret.BaseSign.this_arg;
2022 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* BaseSign, uint32_t pubkeys) {
2023 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2024 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
2025 return (long)res_ptr;
2027 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
2028 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2029 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2030 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
2031 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2032 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2033 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2034 CVec_u8Z_free(ret_var);
2038 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_result_ok(uint32_t arg) {
2039 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2041 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
2042 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2043 CHECK(val->result_ok);
2044 LDKSign* res_ret =MALLOC(sizeof(LDKSign), "LDKSign");
2045 *res_ret = Sign_clone(&(*val->contents.result));
2046 return (uint64_t)res_ret;
2048 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
2049 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2050 CHECK(!val->result_ok);
2051 LDKDecodeError err_var = (*val->contents.err);
2052 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2053 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2054 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2057 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_result_ok(uint32_t arg) {
2058 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2060 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_ok(uint32_t arg) {
2061 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2062 CHECK(val->result_ok);
2063 int8_tArray es_arr = init_arr(68, sizeof(uint8_t), "Native int8_tArray Bytes");
2064 memcpy((uint8_t*)(es_arr + 4), (*val->contents.result).serialized_form, 68);
2067 void __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_err(uint32_t arg) {
2068 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2069 CHECK(!val->result_ok);
2070 return *val->contents.err;
2072 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2073 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2074 for (size_t i = 0; i < ret.datalen; i++) {
2075 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2079 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(uint32_t arg) {
2080 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2082 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
2083 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2084 CHECK(val->result_ok);
2085 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2086 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
2087 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
2088 for (size_t m = 0; m < res_var.datalen; m++) {
2089 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
2090 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2091 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
2092 res_arr_ptr[m] = res_conv_12_arr;
2096 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
2097 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2098 CHECK(!val->result_ok);
2099 return *val->contents.err;
2101 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_result_ok(uint32_t arg) {
2102 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2104 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
2105 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2106 CHECK(val->result_ok);
2107 LDKInMemorySigner res_var = (*val->contents.result);
2108 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2109 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2110 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2113 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
2114 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2115 CHECK(!val->result_ok);
2116 LDKDecodeError err_var = (*val->contents.err);
2117 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2118 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2119 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2122 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_TxOutZ_new(uint32_tArray elems) {
2123 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2124 ret->datalen = *((uint32_t*)elems);
2125 if (ret->datalen == 0) {
2128 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2129 uint32_t *java_elems = (uint32_t*)(elems + 4);
2130 for (size_t i = 0; i < ret->datalen; i++) {
2131 uint32_t arr_elem = java_elems[i];
2132 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
2133 CHECK_ACCESS(arr_elem_ptr);
2134 LDKTxOut arr_elem_conv = *(LDKTxOut*)(arr_elem_ptr);
2135 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
2136 ret->data[i] = arr_elem_conv;
2139 return (uint64_t)ret;
2141 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2142 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2143 for (size_t i = 0; i < ret.datalen; i++) {
2144 ret.data[i] = TxOut_clone(&orig->data[i]);
2148 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_result_ok(uint32_t arg) {
2149 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2151 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
2152 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2153 CHECK(val->result_ok);
2154 LDKTransaction res_var = (*val->contents.result);
2155 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2156 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
2159 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
2160 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2161 CHECK(!val->result_ok);
2162 return *val->contents.err;
2164 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
2165 return ThirtyTwoBytes_clone(&tuple->a);
2167 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t tuple) {
2168 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
2169 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2170 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_BlockHashChannelMonitorZ_get_a(tuple_conv).data, 32);
2174 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
2175 return ChannelMonitor_clone(&tuple->b);
2177 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t tuple) {
2178 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
2179 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(tuple_conv);
2180 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2181 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2182 uint64_t ret_ref = (uint64_t)ret_var.inner;
2183 if (ret_var.is_owned) {
2189 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_BlockHashChannelMonitorZZ_new(uint32_tArray elems) {
2190 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2191 ret->datalen = *((uint32_t*)elems);
2192 if (ret->datalen == 0) {
2195 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2196 uint32_t *java_elems = (uint32_t*)(elems + 4);
2197 for (size_t i = 0; i < ret->datalen; i++) {
2198 uint32_t arr_elem = java_elems[i];
2199 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
2200 CHECK_ACCESS(arr_elem_ptr);
2201 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(arr_elem_ptr);
2202 arr_elem_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1));
2203 ret->data[i] = arr_elem_conv;
2206 return (uint64_t)ret;
2208 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
2209 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
2210 for (size_t i = 0; i < ret.datalen; i++) {
2211 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
2215 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_result_ok(uint32_t arg) {
2216 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
2218 uint32_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(uint32_t arg) {
2219 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2220 CHECK(val->result_ok);
2221 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2222 uint32_tArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2223 uint32_t *res_arr_ptr = (uint32_t*)(res_arr + 4);
2224 for (size_t j = 0; j < res_var.datalen; j++) {
2225 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2226 *res_conv_35_conv = res_var.data[j];
2227 *res_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv_35_conv);
2228 res_arr_ptr[j] = ((uint64_t)res_conv_35_conv);
2232 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(uint32_t arg) {
2233 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2234 CHECK(!val->result_ok);
2235 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
2238 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdDecodeErrorZ_result_ok(uint32_t arg) {
2239 return ((LDKCResult_PaymentIdDecodeErrorZ*)arg)->result_ok;
2241 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdDecodeErrorZ_get_ok(uint32_t arg) {
2242 LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1);
2243 CHECK(val->result_ok);
2244 LDKPaymentId res_var = (*val->contents.result);
2245 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2246 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2247 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2250 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdDecodeErrorZ_get_err(uint32_t arg) {
2251 LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1);
2252 CHECK(!val->result_ok);
2253 LDKDecodeError err_var = (*val->contents.err);
2254 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2255 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2256 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2259 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) {
2260 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
2262 case LDKCOption_u16Z_Some: {
2263 return 0 /* LDKCOption_u16Z - Some */; (void) obj->some;
2265 case LDKCOption_u16Z_None: {
2266 return 0 /* LDKCOption_u16Z - None */;
2271 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2272 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2274 case LDKAPIError_APIMisuseError: {
2275 LDKStr err_str = obj->api_misuse_error.err;
2276 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2277 return 0 /* LDKAPIError - APIMisuseError */; (void) err_conv;
2279 case LDKAPIError_FeeRateTooHigh: {
2280 LDKStr err_str = obj->fee_rate_too_high.err;
2281 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2282 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_conv; (void) obj->fee_rate_too_high.feerate;
2284 case LDKAPIError_RouteError: {
2285 LDKStr err_str = obj->route_error.err;
2286 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2287 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2289 case LDKAPIError_ChannelUnavailable: {
2290 LDKStr err_str = obj->channel_unavailable.err;
2291 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2292 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_conv;
2294 case LDKAPIError_MonitorUpdateFailed: {
2295 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2297 case LDKAPIError_IncompatibleShutdownScript: {
2298 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
2299 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2300 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2301 uint64_t script_ref = (uint64_t)script_var.inner & ~1;
2302 return 0 /* LDKAPIError - IncompatibleShutdownScript */; (void) script_ref;
2307 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
2308 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2310 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2311 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2312 CHECK(val->result_ok);
2313 return *val->contents.result;
2315 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2316 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2317 CHECK(!val->result_ok);
2318 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2321 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) {
2322 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2323 ret->datalen = *((uint32_t*)elems);
2324 if (ret->datalen == 0) {
2327 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2328 uint32_t *java_elems = (uint32_t*)(elems + 4);
2329 for (size_t i = 0; i < ret->datalen; i++) {
2330 uint32_t arr_elem = java_elems[i];
2331 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
2332 CHECK_ACCESS(arr_elem_ptr);
2333 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(arr_elem_ptr);
2334 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
2335 ret->data[i] = arr_elem_conv;
2338 return (uint64_t)ret;
2340 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2341 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2342 for (size_t i = 0; i < ret.datalen; i++) {
2343 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2347 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) {
2348 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2349 ret->datalen = *((uint32_t*)elems);
2350 if (ret->datalen == 0) {
2353 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2354 uint32_t *java_elems = (uint32_t*)(elems + 4);
2355 for (size_t i = 0; i < ret->datalen; i++) {
2356 uint32_t arr_elem = java_elems[i];
2357 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
2358 CHECK_ACCESS(arr_elem_ptr);
2359 LDKAPIError arr_elem_conv = *(LDKAPIError*)(arr_elem_ptr);
2360 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
2361 ret->data[i] = arr_elem_conv;
2364 return (uint64_t)ret;
2366 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2367 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2368 for (size_t i = 0; i < ret.datalen; i++) {
2369 ret.data[i] = APIError_clone(&orig->data[i]);
2373 jboolean __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_result_ok(uint32_t arg) {
2374 return ((LDKCResult__u832APIErrorZ*)arg)->result_ok;
2376 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_ok(uint32_t arg) {
2377 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
2378 CHECK(val->result_ok);
2379 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2380 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2383 uint32_t __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_err(uint32_t arg) {
2384 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
2385 CHECK(!val->result_ok);
2386 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2389 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2390 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
2392 case LDKPaymentSendFailure_ParameterError: {
2393 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
2394 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
2396 case LDKPaymentSendFailure_PathParameterError: {
2397 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
2398 uint32_tArray path_parameter_error_arr = init_arr(path_parameter_error_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2399 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
2400 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
2401 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2402 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
2403 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
2404 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
2406 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
2408 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2409 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
2410 uint32_tArray all_failed_retry_safe_arr = init_arr(all_failed_retry_safe_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2411 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
2412 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
2413 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
2414 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
2416 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
2418 case LDKPaymentSendFailure_PartialFailure: {
2419 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
2420 uint32_tArray partial_failure_arr = init_arr(partial_failure_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2421 uint32_t *partial_failure_arr_ptr = (uint32_t*)(partial_failure_arr + 4);
2422 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
2423 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2424 *partial_failure_conv_22_conv = partial_failure_var.data[w];
2425 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
2426 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
2428 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) partial_failure_arr;
2433 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_result_ok(uint32_t arg) {
2434 return ((LDKCResult_PaymentIdPaymentSendFailureZ*)arg)->result_ok;
2436 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t arg) {
2437 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
2438 CHECK(val->result_ok);
2439 LDKPaymentId res_var = (*val->contents.result);
2440 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2441 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2442 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2445 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t arg) {
2446 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
2447 CHECK(!val->result_ok);
2448 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2451 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
2452 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2454 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2455 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2456 CHECK(val->result_ok);
2457 return *val->contents.result;
2459 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2460 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2461 CHECK(!val->result_ok);
2462 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2465 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
2466 return ThirtyTwoBytes_clone(&tuple->a);
2468 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t tuple) {
2469 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
2470 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2471 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentIdZ_get_a(tuple_conv).data, 32);
2475 static inline struct LDKPaymentId C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
2476 return PaymentId_clone(&tuple->b);
2478 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t tuple) {
2479 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
2480 LDKPaymentId ret_var = C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv);
2481 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2482 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2483 uint64_t ret_ref = (uint64_t)ret_var.inner;
2484 if (ret_var.is_owned) {
2490 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_result_ok(uint32_t arg) {
2491 return ((LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)arg)->result_ok;
2493 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t arg) {
2494 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
2495 CHECK(val->result_ok);
2496 LDKC2Tuple_PaymentHashPaymentIdZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
2497 *res_conv = (*val->contents.result);
2498 *res_conv = C2Tuple_PaymentHashPaymentIdZ_clone(res_conv);
2499 return ((uint64_t)res_conv);
2501 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t arg) {
2502 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
2503 CHECK(!val->result_ok);
2504 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2507 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
2508 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
2510 case LDKNetAddress_IPv4: {
2511 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
2512 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
2513 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
2515 case LDKNetAddress_IPv6: {
2516 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
2517 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
2518 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
2520 case LDKNetAddress_OnionV2: {
2521 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
2522 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
2523 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
2525 case LDKNetAddress_OnionV3: {
2526 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2527 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
2528 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
2533 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
2534 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2535 ret->datalen = *((uint32_t*)elems);
2536 if (ret->datalen == 0) {
2539 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2540 uint32_t *java_elems = (uint32_t*)(elems + 4);
2541 for (size_t i = 0; i < ret->datalen; i++) {
2542 uint32_t arr_elem = java_elems[i];
2543 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
2544 CHECK_ACCESS(arr_elem_ptr);
2545 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(arr_elem_ptr);
2546 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
2547 ret->data[i] = arr_elem_conv;
2550 return (uint64_t)ret;
2552 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2553 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2554 for (size_t i = 0; i < ret.datalen; i++) {
2555 ret.data[i] = NetAddress_clone(&orig->data[i]);
2559 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
2560 return ThirtyTwoBytes_clone(&tuple->a);
2562 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t tuple) {
2563 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
2564 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2565 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentSecretZ_get_a(tuple_conv).data, 32);
2569 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
2570 return ThirtyTwoBytes_clone(&tuple->b);
2572 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t tuple) {
2573 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
2574 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2575 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentSecretZ_get_b(tuple_conv).data, 32);
2579 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_result_ok(uint32_t arg) {
2580 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
2582 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_ok(uint32_t arg) {
2583 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2584 CHECK(val->result_ok);
2585 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2586 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2589 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_err(uint32_t arg) {
2590 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2591 CHECK(!val->result_ok);
2592 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2595 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
2596 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2597 ret->datalen = *((uint32_t*)elems);
2598 if (ret->datalen == 0) {
2601 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2602 uint32_t *java_elems = (uint32_t*)(elems + 4);
2603 for (size_t i = 0; i < ret->datalen; i++) {
2604 uint32_t arr_elem = java_elems[i];
2605 LDKChannelMonitor arr_elem_conv;
2606 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2607 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2608 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2609 ret->data[i] = arr_elem_conv;
2612 return (uint64_t)ret;
2614 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2615 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2616 for (size_t i = 0; i < ret.datalen; i++) {
2617 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2621 typedef struct LDKWatch_JCalls {
2622 atomic_size_t refcnt;
2623 uint32_t watch_channel_meth;
2624 uint32_t update_channel_meth;
2625 uint32_t release_pending_monitor_events_meth;
2627 static void LDKWatch_JCalls_free(void* this_arg) {
2628 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2629 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2630 js_free(j_calls->watch_channel_meth);
2631 js_free(j_calls->update_channel_meth);
2632 js_free(j_calls->release_pending_monitor_events_meth);
2636 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2637 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2638 LDKOutPoint funding_txo_var = funding_txo;
2639 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2640 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2641 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2642 if (funding_txo_var.is_owned) {
2643 funding_txo_ref |= 1;
2645 LDKChannelMonitor monitor_var = monitor;
2646 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2647 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2648 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
2649 if (monitor_var.is_owned) {
2652 uint32_t ret = js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2653 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2654 CHECK_ACCESS(ret_ptr);
2655 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
2656 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2659 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2660 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2661 LDKOutPoint funding_txo_var = funding_txo;
2662 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2663 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2664 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2665 if (funding_txo_var.is_owned) {
2666 funding_txo_ref |= 1;
2668 LDKChannelMonitorUpdate update_var = update;
2669 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2670 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2671 uint64_t update_ref = (uint64_t)update_var.inner;
2672 if (update_var.is_owned) {
2675 uint32_t ret = js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2676 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2677 CHECK_ACCESS(ret_ptr);
2678 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
2679 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2682 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
2683 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2684 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2685 LDKCVec_MonitorEventZ ret_constr;
2686 ret_constr.datalen = *((uint32_t*)ret);
2687 if (ret_constr.datalen > 0)
2688 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2690 ret_constr.data = NULL;
2691 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2692 for (size_t o = 0; o < ret_constr.datalen; o++) {
2693 uint32_t ret_conv_14 = ret_vals[o];
2694 void* ret_conv_14_ptr = (void*)(((uint64_t)ret_conv_14) & ~1);
2695 CHECK_ACCESS(ret_conv_14_ptr);
2696 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
2697 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
2698 ret_constr.data[o] = ret_conv_14_conv;
2702 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
2703 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
2704 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2706 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2707 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2708 atomic_init(&calls->refcnt, 1);
2709 //TODO: Assign calls->o from o
2712 .this_arg = (void*) calls,
2713 .watch_channel = watch_channel_LDKWatch_jcall,
2714 .update_channel = update_channel_LDKWatch_jcall,
2715 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
2716 .free = LDKWatch_JCalls_free,
2720 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2721 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2722 *res_ptr = LDKWatch_init(o);
2723 return (long)res_ptr;
2725 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2726 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2727 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2728 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
2729 LDKOutPoint funding_txo_conv;
2730 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2731 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2732 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2733 LDKChannelMonitor monitor_conv;
2734 monitor_conv.inner = (void*)(monitor & (~1));
2735 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2736 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2737 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2738 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2739 return (uint64_t)ret_conv;
2742 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
2743 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2744 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2745 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
2746 LDKOutPoint funding_txo_conv;
2747 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2748 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2749 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2750 LDKChannelMonitorUpdate update_conv;
2751 update_conv.inner = (void*)(update & (~1));
2752 update_conv.is_owned = (update & 1) || (update == 0);
2753 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2754 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2755 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2756 return (uint64_t)ret_conv;
2759 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
2760 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2761 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2762 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
2763 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2764 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2765 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
2766 for (size_t o = 0; o < ret_var.datalen; o++) {
2767 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2768 *ret_conv_14_copy = ret_var.data[o];
2769 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
2770 ret_arr_ptr[o] = ret_conv_14_ref;
2776 typedef struct LDKBroadcasterInterface_JCalls {
2777 atomic_size_t refcnt;
2778 uint32_t broadcast_transaction_meth;
2779 } LDKBroadcasterInterface_JCalls;
2780 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2781 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2782 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2783 js_free(j_calls->broadcast_transaction_meth);
2787 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
2788 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2789 LDKTransaction tx_var = tx;
2790 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2791 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
2792 Transaction_free(tx_var);
2793 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
2795 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
2796 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
2797 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2799 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
2800 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2801 atomic_init(&calls->refcnt, 1);
2802 //TODO: Assign calls->o from o
2804 LDKBroadcasterInterface ret = {
2805 .this_arg = (void*) calls,
2806 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
2807 .free = LDKBroadcasterInterface_JCalls_free,
2811 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
2812 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2813 *res_ptr = LDKBroadcasterInterface_init(o);
2814 return (long)res_ptr;
2816 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
2817 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2818 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2819 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
2820 LDKTransaction tx_ref;
2821 tx_ref.datalen = *((uint32_t*)tx);
2822 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2823 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
2824 tx_ref.data_is_owned = true;
2825 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2828 typedef struct LDKKeysInterface_JCalls {
2829 atomic_size_t refcnt;
2830 uint32_t get_node_secret_meth;
2831 uint32_t get_destination_script_meth;
2832 uint32_t get_shutdown_scriptpubkey_meth;
2833 uint32_t get_channel_signer_meth;
2834 uint32_t get_secure_random_bytes_meth;
2835 uint32_t read_chan_signer_meth;
2836 uint32_t sign_invoice_meth;
2837 } LDKKeysInterface_JCalls;
2838 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2839 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2840 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2841 js_free(j_calls->get_node_secret_meth);
2842 js_free(j_calls->get_destination_script_meth);
2843 js_free(j_calls->get_shutdown_scriptpubkey_meth);
2844 js_free(j_calls->get_channel_signer_meth);
2845 js_free(j_calls->get_secure_random_bytes_meth);
2846 js_free(j_calls->read_chan_signer_meth);
2847 js_free(j_calls->sign_invoice_meth);
2851 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
2852 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2853 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
2854 LDKSecretKey ret_ref;
2855 CHECK(*((uint32_t*)ret) == 32);
2856 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
2859 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
2860 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2861 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
2862 LDKCVec_u8Z ret_ref;
2863 ret_ref.datalen = *((uint32_t*)ret);
2864 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2865 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2868 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
2869 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2870 uint32_t ret = js_invoke_function_0(j_calls->get_shutdown_scriptpubkey_meth);
2871 LDKShutdownScript ret_conv;
2872 ret_conv.inner = (void*)(ret & (~1));
2873 ret_conv.is_owned = (ret & 1) || (ret == 0);
2874 ret_conv = ShutdownScript_clone(&ret_conv);
2877 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2878 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2879 uint32_t ret = js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
2880 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2881 CHECK_ACCESS(ret_ptr);
2882 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
2883 ret_conv = Sign_clone(&ret_conv);
2886 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
2887 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2888 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
2889 LDKThirtyTwoBytes ret_ref;
2890 CHECK(*((uint32_t*)ret) == 32);
2891 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
2894 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
2895 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2896 LDKu8slice reader_var = reader;
2897 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2898 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
2899 uint32_t ret = js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
2900 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2901 CHECK_ACCESS(ret_ptr);
2902 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
2903 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
2906 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
2907 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2908 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
2909 int8_tArray invoice_preimage_arr = init_arr(invoice_preimage_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2910 memcpy((uint8_t*)(invoice_preimage_arr + 4), invoice_preimage_var.data, invoice_preimage_var.datalen);
2911 CVec_u8Z_free(invoice_preimage_var);
2912 uint32_t ret = js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
2913 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2914 CHECK_ACCESS(ret_ptr);
2915 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
2916 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
2919 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
2920 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
2921 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2923 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
2924 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2925 atomic_init(&calls->refcnt, 1);
2926 //TODO: Assign calls->o from o
2928 LDKKeysInterface ret = {
2929 .this_arg = (void*) calls,
2930 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
2931 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
2932 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
2933 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
2934 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
2935 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
2936 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
2937 .free = LDKKeysInterface_JCalls_free,
2941 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
2942 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2943 *res_ptr = LDKKeysInterface_init(o);
2944 return (long)res_ptr;
2946 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
2947 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2948 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2949 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
2950 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2951 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
2955 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
2956 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2957 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2958 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
2959 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2960 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2961 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2962 CVec_u8Z_free(ret_var);
2966 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
2967 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2968 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2969 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
2970 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
2971 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2972 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2973 uint64_t ret_ref = (uint64_t)ret_var.inner;
2974 if (ret_var.is_owned) {
2980 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2981 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2982 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2983 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
2984 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
2985 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2986 return (uint64_t)ret_ret;
2989 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
2990 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2991 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2992 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
2993 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2994 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
2998 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
2999 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3000 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3001 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3002 LDKu8slice reader_ref;
3003 reader_ref.datalen = *((uint32_t*)reader);
3004 reader_ref.data = (int8_t*)(reader + 4);
3005 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3006 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3007 return (uint64_t)ret_conv;
3010 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
3011 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3012 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3013 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3014 LDKCVec_u8Z invoice_preimage_ref;
3015 invoice_preimage_ref.datalen = *((uint32_t*)invoice_preimage);
3016 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
3017 memcpy(invoice_preimage_ref.data, (uint8_t*)(invoice_preimage + 4), invoice_preimage_ref.datalen);
3018 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
3019 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
3020 return (uint64_t)ret_conv;
3023 typedef struct LDKFeeEstimator_JCalls {
3024 atomic_size_t refcnt;
3025 uint32_t get_est_sat_per_1000_weight_meth;
3026 } LDKFeeEstimator_JCalls;
3027 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3028 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3029 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3030 js_free(j_calls->get_est_sat_per_1000_weight_meth);
3034 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3035 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3036 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
3037 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3039 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
3040 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
3041 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3043 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
3044 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3045 atomic_init(&calls->refcnt, 1);
3046 //TODO: Assign calls->o from o
3048 LDKFeeEstimator ret = {
3049 .this_arg = (void*) calls,
3050 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3051 .free = LDKFeeEstimator_JCalls_free,
3055 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
3056 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3057 *res_ptr = LDKFeeEstimator_init(o);
3058 return (long)res_ptr;
3060 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
3061 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3062 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3063 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
3064 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
3065 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3069 typedef struct LDKLogger_JCalls {
3070 atomic_size_t refcnt;
3073 static void LDKLogger_JCalls_free(void* this_arg) {
3074 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3075 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3076 js_free(j_calls->log_meth);
3080 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
3081 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3082 const char* record_str = record;
3083 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
3084 js_invoke_function_1(j_calls->log_meth, record_conv);
3086 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3087 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3088 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3090 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
3091 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3092 atomic_init(&calls->refcnt, 1);
3093 //TODO: Assign calls->o from o
3096 .this_arg = (void*) calls,
3097 .log = log_LDKLogger_jcall,
3098 .free = LDKLogger_JCalls_free,
3102 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
3103 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3104 *res_ptr = LDKLogger_init(o);
3105 return (long)res_ptr;
3107 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
3108 return ThirtyTwoBytes_clone(&tuple->a);
3110 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t tuple) {
3111 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
3112 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3113 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_BlockHashChannelManagerZ_get_a(tuple_conv).data, 32);
3117 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
3120 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t tuple) {
3121 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
3122 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(tuple_conv);
3123 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3124 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3125 uint64_t ret_ref = (uint64_t)ret_var.inner & ~1;
3129 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
3130 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
3132 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
3133 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3134 CHECK(val->result_ok);
3135 LDKC2Tuple_BlockHashChannelManagerZ* res_conv = &(*val->contents.result);
3136 // Warning: we really need to clone here, but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
3137 return ((uint64_t)res_conv) | 1;
3139 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
3140 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3141 CHECK(!val->result_ok);
3142 LDKDecodeError err_var = (*val->contents.err);
3143 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3144 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3145 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3148 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
3149 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
3151 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
3152 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
3153 CHECK(val->result_ok);
3154 LDKChannelConfig res_var = (*val->contents.result);
3155 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3156 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3157 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3160 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
3161 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
3162 CHECK(!val->result_ok);
3163 LDKDecodeError err_var = (*val->contents.err);
3164 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3165 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3166 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3169 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
3170 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
3172 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
3173 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3174 CHECK(val->result_ok);
3175 LDKOutPoint res_var = (*val->contents.result);
3176 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3177 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3178 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3181 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
3182 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3183 CHECK(!val->result_ok);
3184 LDKDecodeError err_var = (*val->contents.err);
3185 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3186 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3187 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3190 typedef struct LDKType_JCalls {
3191 atomic_size_t refcnt;
3192 uint32_t type_id_meth;
3193 uint32_t debug_str_meth;
3194 uint32_t write_meth;
3196 static void LDKType_JCalls_free(void* this_arg) {
3197 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3198 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3199 js_free(j_calls->type_id_meth);
3200 js_free(j_calls->debug_str_meth);
3201 js_free(j_calls->write_meth);
3205 uint16_t type_id_LDKType_jcall(const void* this_arg) {
3206 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3207 return js_invoke_function_0(j_calls->type_id_meth);
3209 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
3210 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3211 uint32_t ret = js_invoke_function_0(j_calls->debug_str_meth);
3212 LDKStr ret_conv = str_ref_to_owned_c(ret);
3215 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
3216 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3217 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
3218 LDKCVec_u8Z ret_ref;
3219 ret_ref.datalen = *((uint32_t*)ret);
3220 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3221 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
3224 static void LDKType_JCalls_cloned(LDKType* new_obj) {
3225 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
3226 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3228 static inline LDKType LDKType_init (/*TODO: JS Object Reference */void* o) {
3229 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
3230 atomic_init(&calls->refcnt, 1);
3231 //TODO: Assign calls->o from o
3234 .this_arg = (void*) calls,
3235 .type_id = type_id_LDKType_jcall,
3236 .debug_str = debug_str_LDKType_jcall,
3237 .write = write_LDKType_jcall,
3238 .cloned = LDKType_JCalls_cloned,
3239 .free = LDKType_JCalls_free,
3243 long __attribute__((visibility("default"))) TS_LDKType_new(/*TODO: JS Object Reference */void* o) {
3244 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
3245 *res_ptr = LDKType_init(o);
3246 return (long)res_ptr;
3248 int16_t __attribute__((visibility("default"))) TS_Type_type_id(uint32_t this_arg) {
3249 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3250 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3251 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3252 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
3256 jstring __attribute__((visibility("default"))) TS_Type_debug_str(uint32_t this_arg) {
3257 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3258 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3259 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3260 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
3261 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
3266 int8_tArray __attribute__((visibility("default"))) TS_Type_write(uint32_t this_arg) {
3267 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3268 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3269 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3270 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3271 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3272 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3273 CVec_u8Z_free(ret_var);
3277 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_TypeZ_ref_from_ptr(uint32_t ptr) {
3278 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
3280 case LDKCOption_TypeZ_Some: {
3281 LDKType* some_ret =MALLOC(sizeof(LDKType), "LDKType");
3282 *some_ret = Type_clone(&obj->some);
3283 return 0 /* LDKCOption_TypeZ - Some */; (void) (uint64_t)some_ret;
3285 case LDKCOption_TypeZ_None: {
3286 return 0 /* LDKCOption_TypeZ - None */;
3291 jboolean __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_result_ok(uint32_t arg) {
3292 return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
3294 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t arg) {
3295 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3296 CHECK(val->result_ok);
3297 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3300 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_err(uint32_t arg) {
3301 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3302 CHECK(!val->result_ok);
3303 LDKDecodeError err_var = (*val->contents.err);
3304 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3305 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3306 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3309 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_result_ok(uint32_t arg) {
3310 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
3312 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_ok(uint32_t arg) {
3313 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3314 CHECK(val->result_ok);
3315 uint32_t res_conv = LDKSiPrefix_to_js((*val->contents.result));
3318 void __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_err(uint32_t arg) {
3319 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3320 CHECK(!val->result_ok);
3321 return *val->contents.err;
3323 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_result_ok(uint32_t arg) {
3324 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
3326 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_ok(uint32_t arg) {
3327 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3328 CHECK(val->result_ok);
3329 LDKInvoice res_var = (*val->contents.result);
3330 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3331 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3332 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3335 void __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_err(uint32_t arg) {
3336 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3337 CHECK(!val->result_ok);
3338 return *val->contents.err;
3340 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_result_ok(uint32_t arg) {
3341 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
3343 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_ok(uint32_t arg) {
3344 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3345 CHECK(val->result_ok);
3346 LDKSignedRawInvoice res_var = (*val->contents.result);
3347 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3348 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3349 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3352 void __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_err(uint32_t arg) {
3353 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3354 CHECK(!val->result_ok);
3355 return *val->contents.err;
3357 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3358 return RawInvoice_clone(&tuple->a);
3360 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t tuple) {
3361 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3362 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(tuple_conv);
3363 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3364 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3365 uint64_t ret_ref = (uint64_t)ret_var.inner;
3366 if (ret_var.is_owned) {
3372 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3373 return ThirtyTwoBytes_clone(&tuple->b);
3375 int8_tArray __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t tuple) {
3376 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3377 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3378 memcpy((uint8_t*)(ret_arr + 4), C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(tuple_conv).data, 32);
3382 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3383 return InvoiceSignature_clone(&tuple->c);
3385 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t tuple) {
3386 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3387 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(tuple_conv);
3388 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3389 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3390 uint64_t ret_ref = (uint64_t)ret_var.inner;
3391 if (ret_var.is_owned) {
3397 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_result_ok(uint32_t arg) {
3398 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
3400 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_ok(uint32_t arg) {
3401 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3402 CHECK(val->result_ok);
3403 LDKPayeePubKey res_var = (*val->contents.result);
3404 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3405 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3406 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3409 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_err(uint32_t arg) {
3410 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3411 CHECK(!val->result_ok);
3412 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3415 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_PrivateRouteZ_new(uint32_tArray elems) {
3416 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
3417 ret->datalen = *((uint32_t*)elems);
3418 if (ret->datalen == 0) {
3421 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
3422 uint32_t *java_elems = (uint32_t*)(elems + 4);
3423 for (size_t i = 0; i < ret->datalen; i++) {
3424 uint32_t arr_elem = java_elems[i];
3425 LDKPrivateRoute arr_elem_conv;
3426 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3427 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3428 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
3429 ret->data[i] = arr_elem_conv;
3432 return (uint64_t)ret;
3434 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
3435 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
3436 for (size_t i = 0; i < ret.datalen; i++) {
3437 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
3441 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_result_ok(uint32_t arg) {
3442 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
3444 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t arg) {
3445 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3446 CHECK(val->result_ok);
3447 LDKPositiveTimestamp res_var = (*val->contents.result);
3448 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3449 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3450 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3453 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_err(uint32_t arg) {
3454 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3455 CHECK(!val->result_ok);
3456 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3459 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_result_ok(uint32_t arg) {
3460 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
3462 void __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_ok(uint32_t arg) {
3463 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3464 CHECK(val->result_ok);
3465 return *val->contents.result;
3467 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_err(uint32_t arg) {
3468 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3469 CHECK(!val->result_ok);
3470 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3473 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_result_ok(uint32_t arg) {
3474 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
3476 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_ok(uint32_t arg) {
3477 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3478 CHECK(val->result_ok);
3479 LDKInvoice res_var = (*val->contents.result);
3480 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3481 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3482 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3485 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_err(uint32_t arg) {
3486 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3487 CHECK(!val->result_ok);
3488 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3491 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_result_ok(uint32_t arg) {
3492 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
3494 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_ok(uint32_t arg) {
3495 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3496 CHECK(val->result_ok);
3497 LDKDescription res_var = (*val->contents.result);
3498 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3499 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3500 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3503 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_err(uint32_t arg) {
3504 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3505 CHECK(!val->result_ok);
3506 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3509 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_result_ok(uint32_t arg) {
3510 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
3512 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_ok(uint32_t arg) {
3513 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3514 CHECK(val->result_ok);
3515 LDKExpiryTime res_var = (*val->contents.result);
3516 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3517 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3518 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3521 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_err(uint32_t arg) {
3522 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3523 CHECK(!val->result_ok);
3524 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3527 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_result_ok(uint32_t arg) {
3528 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
3530 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_ok(uint32_t arg) {
3531 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3532 CHECK(val->result_ok);
3533 LDKPrivateRoute res_var = (*val->contents.result);
3534 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3535 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3536 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3539 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_err(uint32_t arg) {
3540 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3541 CHECK(!val->result_ok);
3542 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3545 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_result_ok(uint32_t arg) {
3546 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
3548 jstring __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_ok(uint32_t arg) {
3549 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3550 CHECK(val->result_ok);
3551 LDKStr res_str = (*val->contents.result);
3552 jstring res_conv = str_ref_to_ts(res_str.chars, res_str.len);
3555 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_err(uint32_t arg) {
3556 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3557 CHECK(!val->result_ok);
3558 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3561 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3562 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
3564 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3565 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3566 CHECK(val->result_ok);
3567 LDKChannelMonitorUpdate res_var = (*val->contents.result);
3568 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3569 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3570 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3573 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
3574 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3575 CHECK(!val->result_ok);
3576 LDKDecodeError err_var = (*val->contents.err);
3577 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3578 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3579 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3582 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3583 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
3585 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3586 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3587 CHECK(val->result_ok);
3588 LDKHTLCUpdate res_var = (*val->contents.result);
3589 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3590 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3591 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3594 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
3595 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3596 CHECK(!val->result_ok);
3597 LDKDecodeError err_var = (*val->contents.err);
3598 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3599 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3600 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3603 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
3604 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
3606 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
3607 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3608 CHECK(val->result_ok);
3609 return *val->contents.result;
3611 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
3612 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3613 CHECK(!val->result_ok);
3614 LDKMonitorUpdateError err_var = (*val->contents.err);
3615 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3616 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3617 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3620 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
3621 return OutPoint_clone(&tuple->a);
3623 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t tuple) {
3624 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
3625 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(tuple_conv);
3626 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3627 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3628 uint64_t ret_ref = (uint64_t)ret_var.inner;
3629 if (ret_var.is_owned) {
3635 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
3636 return CVec_u8Z_clone(&tuple->b);
3638 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t tuple) {
3639 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
3640 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(tuple_conv);
3641 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3642 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3643 CVec_u8Z_free(ret_var);
3647 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
3650 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t tuple) {
3651 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
3652 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(tuple_conv);
3656 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
3657 return CVec_u8Z_clone(&tuple->b);
3659 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t tuple) {
3660 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
3661 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(tuple_conv);
3662 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3663 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3664 CVec_u8Z_free(ret_var);
3668 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32ScriptZZ_new(uint32_tArray elems) {
3669 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
3670 ret->datalen = *((uint32_t*)elems);
3671 if (ret->datalen == 0) {
3674 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
3675 uint32_t *java_elems = (uint32_t*)(elems + 4);
3676 for (size_t i = 0; i < ret->datalen; i++) {
3677 uint32_t arr_elem = java_elems[i];
3678 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3679 CHECK_ACCESS(arr_elem_ptr);
3680 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(arr_elem_ptr);
3681 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
3682 ret->data[i] = arr_elem_conv;
3685 return (uint64_t)ret;
3687 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
3688 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
3689 for (size_t i = 0; i < ret.datalen; i++) {
3690 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
3694 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
3695 return ThirtyTwoBytes_clone(&tuple->a);
3697 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t tuple) {
3698 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
3699 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3700 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(tuple_conv).data, 32);
3704 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
3705 return CVec_C2Tuple_u32ScriptZZ_clone(&tuple->b);
3707 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t tuple) {
3708 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
3709 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(tuple_conv);
3710 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3711 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3712 for (size_t v = 0; v < ret_var.datalen; v++) {
3713 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
3714 *ret_conv_21_conv = ret_var.data[v];
3715 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv);
3721 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_new(uint32_tArray elems) {
3722 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
3723 ret->datalen = *((uint32_t*)elems);
3724 if (ret->datalen == 0) {
3727 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
3728 uint32_t *java_elems = (uint32_t*)(elems + 4);
3729 for (size_t i = 0; i < ret->datalen; i++) {
3730 uint32_t arr_elem = java_elems[i];
3731 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3732 CHECK_ACCESS(arr_elem_ptr);
3733 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arr_elem_ptr);
3734 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
3735 ret->data[i] = arr_elem_conv;
3738 return (uint64_t)ret;
3740 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
3741 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 };
3742 for (size_t i = 0; i < ret.datalen; i++) {
3743 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
3747 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_ptr(uint32_t ptr) {
3748 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
3750 case LDKPaymentPurpose_InvoicePayment: {
3751 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3752 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->invoice_payment.payment_preimage.data, 32);
3753 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3754 memcpy((uint8_t*)(payment_secret_arr + 4), obj->invoice_payment.payment_secret.data, 32);
3755 return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->invoice_payment.user_payment_id;
3757 case LDKPaymentPurpose_SpontaneousPayment: {
3758 int8_tArray spontaneous_payment_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3759 memcpy((uint8_t*)(spontaneous_payment_arr + 4), obj->spontaneous_payment.data, 32);
3760 return 0 /* LDKPaymentPurpose - SpontaneousPayment */; (void) spontaneous_payment_arr;
3765 uint32_t __attribute__((visibility("default"))) TS_LDKClosureReason_ref_from_ptr(uint32_t ptr) {
3766 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
3768 case LDKClosureReason_CounterpartyForceClosed: {
3769 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
3770 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
3771 return 0 /* LDKClosureReason - CounterpartyForceClosed */; (void) peer_msg_conv;
3773 case LDKClosureReason_HolderForceClosed: {
3774 return 0 /* LDKClosureReason - HolderForceClosed */;
3776 case LDKClosureReason_CooperativeClosure: {
3777 return 0 /* LDKClosureReason - CooperativeClosure */;
3779 case LDKClosureReason_CommitmentTxConfirmed: {
3780 return 0 /* LDKClosureReason - CommitmentTxConfirmed */;
3782 case LDKClosureReason_ProcessingError: {
3783 LDKStr err_str = obj->processing_error.err;
3784 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3785 return 0 /* LDKClosureReason - ProcessingError */; (void) err_conv;
3787 case LDKClosureReason_DisconnectedPeer: {
3788 return 0 /* LDKClosureReason - DisconnectedPeer */;
3790 case LDKClosureReason_OutdatedChannelManager: {
3791 return 0 /* LDKClosureReason - OutdatedChannelManager */;
3796 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
3797 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
3799 case LDKEvent_FundingGenerationReady: {
3800 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3801 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
3802 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
3803 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3804 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
3805 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;
3807 case LDKEvent_PaymentReceived: {
3808 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3809 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
3810 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
3811 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) obj->payment_received.amt; (void) purpose_ref;
3813 case LDKEvent_PaymentSent: {
3814 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3815 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
3816 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3817 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_sent.payment_hash.data, 32);
3818 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr; (void) payment_hash_arr;
3820 case LDKEvent_PaymentPathFailed: {
3821 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3822 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_path_failed.payment_hash.data, 32);
3823 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
3824 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
3825 uint32_tArray path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3826 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
3827 for (size_t k = 0; k < path_var.datalen; k++) {
3828 LDKRouteHop path_conv_10_var = path_var.data[k];
3829 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3830 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3831 uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
3832 path_arr_ptr[k] = path_conv_10_ref;
3834 uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1;
3835 return 0 /* LDKEvent - PaymentPathFailed */; (void) payment_hash_arr; (void) obj->payment_path_failed.rejected_by_dest; (void) network_update_ref; (void) obj->payment_path_failed.all_paths_failed; (void) path_arr; (void) short_channel_id_ref;
3837 case LDKEvent_PendingHTLCsForwardable: {
3838 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
3840 case LDKEvent_SpendableOutputs: {
3841 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
3842 uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3843 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
3844 for (size_t b = 0; b < outputs_var.datalen; b++) {
3845 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
3846 outputs_arr_ptr[b] = outputs_conv_27_ref;
3848 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
3850 case LDKEvent_PaymentForwarded: {
3851 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
3852 return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
3854 case LDKEvent_ChannelClosed: {
3855 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3856 memcpy((uint8_t*)(channel_id_arr + 4), obj->channel_closed.channel_id.data, 32);
3857 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
3858 return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) obj->channel_closed.user_channel_id; (void) reason_ref;
3860 case LDKEvent_DiscardFunding: {
3861 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3862 memcpy((uint8_t*)(channel_id_arr + 4), obj->discard_funding.channel_id.data, 32);
3863 LDKTransaction transaction_var = obj->discard_funding.transaction;
3864 int8_tArray transaction_arr = init_arr(transaction_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3865 memcpy((uint8_t*)(transaction_arr + 4), transaction_var.data, transaction_var.datalen);
3866 return 0 /* LDKEvent - DiscardFunding */; (void) channel_id_arr; (void) transaction_arr;
3871 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
3872 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
3873 ret->datalen = *((uint32_t*)elems);
3874 if (ret->datalen == 0) {
3877 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
3878 uint32_t *java_elems = (uint32_t*)(elems + 4);
3879 for (size_t i = 0; i < ret->datalen; i++) {
3880 uint32_t arr_elem = java_elems[i];
3881 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3882 CHECK_ACCESS(arr_elem_ptr);
3883 LDKEvent arr_elem_conv = *(LDKEvent*)(arr_elem_ptr);
3884 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
3885 ret->data[i] = arr_elem_conv;
3888 return (uint64_t)ret;
3890 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
3891 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
3892 for (size_t i = 0; i < ret.datalen; i++) {
3893 ret.data[i] = Event_clone(&orig->data[i]);
3897 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
3900 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t tuple) {
3901 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
3902 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(tuple_conv);
3906 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
3907 return TxOut_clone(&tuple->b);
3909 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t tuple) {
3910 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
3911 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3912 *ret_ref = C2Tuple_u32TxOutZ_get_b(tuple_conv);
3913 return (uint64_t)ret_ref;
3916 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
3917 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
3918 ret->datalen = *((uint32_t*)elems);
3919 if (ret->datalen == 0) {
3922 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
3923 uint32_t *java_elems = (uint32_t*)(elems + 4);
3924 for (size_t i = 0; i < ret->datalen; i++) {
3925 uint32_t arr_elem = java_elems[i];
3926 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3927 CHECK_ACCESS(arr_elem_ptr);
3928 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(arr_elem_ptr);
3929 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
3930 ret->data[i] = arr_elem_conv;
3933 return (uint64_t)ret;
3935 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
3936 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
3937 for (size_t i = 0; i < ret.datalen; i++) {
3938 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
3942 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
3943 return ThirtyTwoBytes_clone(&tuple->a);
3945 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t tuple) {
3946 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
3947 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3948 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(tuple_conv).data, 32);
3952 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
3953 return CVec_C2Tuple_u32TxOutZZ_clone(&tuple->b);
3955 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t tuple) {
3956 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
3957 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(tuple_conv);
3958 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3959 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3960 for (size_t u = 0; u < ret_var.datalen; u++) {
3961 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
3962 *ret_conv_20_conv = ret_var.data[u];
3963 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
3969 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
3970 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
3971 ret->datalen = *((uint32_t*)elems);
3972 if (ret->datalen == 0) {
3975 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ 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 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3980 CHECK_ACCESS(arr_elem_ptr);
3981 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arr_elem_ptr);
3982 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
3983 ret->data[i] = arr_elem_conv;
3986 return (uint64_t)ret;
3988 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
3989 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 };
3990 for (size_t i = 0; i < ret.datalen; i++) {
3991 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
3995 uint32_t __attribute__((visibility("default"))) TS_LDKBalance_ref_from_ptr(uint32_t ptr) {
3996 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
3998 case LDKBalance_ClaimableOnChannelClose: {
3999 return 0 /* LDKBalance - ClaimableOnChannelClose */; (void) obj->claimable_on_channel_close.claimable_amount_satoshis;
4001 case LDKBalance_ClaimableAwaitingConfirmations: {
4002 return 0 /* LDKBalance - ClaimableAwaitingConfirmations */; (void) obj->claimable_awaiting_confirmations.claimable_amount_satoshis; (void) obj->claimable_awaiting_confirmations.confirmation_height;
4004 case LDKBalance_ContentiousClaimable: {
4005 return 0 /* LDKBalance - ContentiousClaimable */; (void) obj->contentious_claimable.claimable_amount_satoshis; (void) obj->contentious_claimable.timeout_height;
4007 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
4008 return 0 /* LDKBalance - MaybeClaimableHTLCAwaitingTimeout */; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
4013 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_BalanceZ_new(uint32_tArray elems) {
4014 LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
4015 ret->datalen = *((uint32_t*)elems);
4016 if (ret->datalen == 0) {
4019 ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
4020 uint32_t *java_elems = (uint32_t*)(elems + 4);
4021 for (size_t i = 0; i < ret->datalen; i++) {
4022 uint32_t arr_elem = java_elems[i];
4023 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
4024 CHECK_ACCESS(arr_elem_ptr);
4025 LDKBalance arr_elem_conv = *(LDKBalance*)(arr_elem_ptr);
4026 arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
4027 ret->data[i] = arr_elem_conv;
4030 return (uint64_t)ret;
4032 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
4033 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
4034 for (size_t i = 0; i < ret.datalen; i++) {
4035 ret.data[i] = Balance_clone(&orig->data[i]);
4039 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
4040 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
4042 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
4043 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4044 CHECK(val->result_ok);
4045 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
4046 *res_conv = (*val->contents.result);
4047 *res_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv);
4048 return ((uint64_t)res_conv);
4050 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
4051 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4052 CHECK(!val->result_ok);
4053 LDKDecodeError err_var = (*val->contents.err);
4054 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4055 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4056 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4059 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
4060 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
4062 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
4063 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4064 CHECK(val->result_ok);
4065 return *val->contents.result;
4067 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
4068 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4069 CHECK(!val->result_ok);
4070 LDKLightningError err_var = (*val->contents.err);
4071 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4072 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4073 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4076 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
4079 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t tuple) {
4080 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
4081 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4082 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PublicKeyTypeZ_get_a(tuple_conv).compressed_form, 33);
4086 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
4087 return Type_clone(&tuple->b);
4089 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t tuple) {
4090 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
4091 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
4092 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(tuple_conv);
4093 return (uint64_t)ret_ret;
4096 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_PublicKeyTypeZZ_new(uint32_tArray elems) {
4097 LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
4098 ret->datalen = *((uint32_t*)elems);
4099 if (ret->datalen == 0) {
4102 ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
4103 uint32_t *java_elems = (uint32_t*)(elems + 4);
4104 for (size_t i = 0; i < ret->datalen; i++) {
4105 uint32_t arr_elem = java_elems[i];
4106 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
4107 CHECK_ACCESS(arr_elem_ptr);
4108 LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(arr_elem_ptr);
4109 arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
4110 ret->data[i] = arr_elem_conv;
4113 return (uint64_t)ret;
4115 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
4116 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
4117 for (size_t i = 0; i < ret.datalen; i++) {
4118 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
4122 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
4123 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
4125 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
4126 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4127 CHECK(val->result_ok);
4128 return *val->contents.result;
4130 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
4131 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4132 CHECK(!val->result_ok);
4133 LDKLightningError err_var = (*val->contents.err);
4134 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4135 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4136 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4139 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4140 return ChannelAnnouncement_clone(&tuple->a);
4142 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t tuple) {
4143 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4144 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(tuple_conv);
4145 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4146 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4147 uint64_t ret_ref = (uint64_t)ret_var.inner;
4148 if (ret_var.is_owned) {
4154 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4155 return ChannelUpdate_clone(&tuple->b);
4157 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t tuple) {
4158 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4159 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(tuple_conv);
4160 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4161 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4162 uint64_t ret_ref = (uint64_t)ret_var.inner;
4163 if (ret_var.is_owned) {
4169 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4170 return ChannelUpdate_clone(&tuple->c);
4172 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t tuple) {
4173 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4174 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(tuple_conv);
4175 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4176 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4177 uint64_t ret_ref = (uint64_t)ret_var.inner;
4178 if (ret_var.is_owned) {
4184 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
4185 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
4186 ret->datalen = *((uint32_t*)elems);
4187 if (ret->datalen == 0) {
4190 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
4191 uint32_t *java_elems = (uint32_t*)(elems + 4);
4192 for (size_t i = 0; i < ret->datalen; i++) {
4193 uint32_t arr_elem = java_elems[i];
4194 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
4195 CHECK_ACCESS(arr_elem_ptr);
4196 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arr_elem_ptr);
4197 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
4198 ret->data[i] = arr_elem_conv;
4201 return (uint64_t)ret;
4203 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4204 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4205 for (size_t i = 0; i < ret.datalen; i++) {
4206 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4210 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
4211 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
4212 ret->datalen = *((uint32_t*)elems);
4213 if (ret->datalen == 0) {
4216 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
4217 uint32_t *java_elems = (uint32_t*)(elems + 4);
4218 for (size_t i = 0; i < ret->datalen; i++) {
4219 uint32_t arr_elem = java_elems[i];
4220 LDKNodeAnnouncement arr_elem_conv;
4221 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4222 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4223 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
4224 ret->data[i] = arr_elem_conv;
4227 return (uint64_t)ret;
4229 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4230 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4231 for (size_t i = 0; i < ret.datalen; i++) {
4232 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4236 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
4237 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4239 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
4240 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4241 CHECK(val->result_ok);
4242 LDKCVec_u8Z res_var = (*val->contents.result);
4243 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4244 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
4247 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
4248 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4249 CHECK(!val->result_ok);
4250 LDKPeerHandleError err_var = (*val->contents.err);
4251 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4252 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4253 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4256 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
4257 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
4259 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
4260 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4261 CHECK(val->result_ok);
4262 return *val->contents.result;
4264 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
4265 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4266 CHECK(!val->result_ok);
4267 LDKPeerHandleError err_var = (*val->contents.err);
4268 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4269 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4270 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4273 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
4274 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4276 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
4277 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4278 CHECK(val->result_ok);
4279 return *val->contents.result;
4281 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
4282 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4283 CHECK(!val->result_ok);
4284 LDKPeerHandleError err_var = (*val->contents.err);
4285 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4286 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4287 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4290 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_result_ok(uint32_t arg) {
4291 return ((LDKCResult_NodeIdDecodeErrorZ*)arg)->result_ok;
4293 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_ok(uint32_t arg) {
4294 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
4295 CHECK(val->result_ok);
4296 LDKNodeId res_var = (*val->contents.result);
4297 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4298 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4299 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4302 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_err(uint32_t arg) {
4303 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
4304 CHECK(!val->result_ok);
4305 LDKDecodeError err_var = (*val->contents.err);
4306 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4307 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4308 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4311 typedef struct LDKAccess_JCalls {
4312 atomic_size_t refcnt;
4313 uint32_t get_utxo_meth;
4315 static void LDKAccess_JCalls_free(void* this_arg) {
4316 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4317 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4318 js_free(j_calls->get_utxo_meth);
4322 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4323 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4324 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4325 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
4326 uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4327 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4328 CHECK_ACCESS(ret_ptr);
4329 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
4330 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
4333 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
4334 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
4335 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4337 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
4338 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4339 atomic_init(&calls->refcnt, 1);
4340 //TODO: Assign calls->o from o
4343 .this_arg = (void*) calls,
4344 .get_utxo = get_utxo_LDKAccess_jcall,
4345 .free = LDKAccess_JCalls_free,
4349 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
4350 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4351 *res_ptr = LDKAccess_init(o);
4352 return (long)res_ptr;
4354 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4355 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4356 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4357 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
4358 unsigned char genesis_hash_arr[32];
4359 CHECK(*((uint32_t*)genesis_hash) == 32);
4360 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
4361 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4362 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4363 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4364 return (uint64_t)ret_conv;
4367 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_AccessZ_ref_from_ptr(uint32_t ptr) {
4368 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
4370 case LDKCOption_AccessZ_Some: {
4371 LDKAccess* some_ret =MALLOC(sizeof(LDKAccess), "LDKAccess");
4372 *some_ret = obj->some;
4373 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
4374 return 0 /* LDKCOption_AccessZ - Some */; (void) (uint64_t)some_ret;
4376 case LDKCOption_AccessZ_None: {
4377 return 0 /* LDKCOption_AccessZ - None */;
4382 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
4383 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
4385 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4386 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4387 CHECK(val->result_ok);
4388 LDKDirectionalChannelInfo res_var = (*val->contents.result);
4389 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4390 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4391 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4394 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4395 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4396 CHECK(!val->result_ok);
4397 LDKDecodeError err_var = (*val->contents.err);
4398 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4399 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4400 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4403 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
4404 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
4406 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4407 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4408 CHECK(val->result_ok);
4409 LDKChannelInfo res_var = (*val->contents.result);
4410 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4411 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4412 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4415 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4416 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4417 CHECK(!val->result_ok);
4418 LDKDecodeError err_var = (*val->contents.err);
4419 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4420 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4421 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4424 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
4425 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
4427 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
4428 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4429 CHECK(val->result_ok);
4430 LDKRoutingFees res_var = (*val->contents.result);
4431 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4432 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4433 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4436 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
4437 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4438 CHECK(!val->result_ok);
4439 LDKDecodeError err_var = (*val->contents.err);
4440 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4441 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4442 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4445 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
4446 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
4448 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
4449 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4450 CHECK(val->result_ok);
4451 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
4452 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4453 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4454 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4457 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
4458 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4459 CHECK(!val->result_ok);
4460 LDKDecodeError err_var = (*val->contents.err);
4461 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4462 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4463 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4466 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
4467 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
4468 ret->datalen = *((uint32_t*)elems);
4469 if (ret->datalen == 0) {
4472 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
4473 int64_t *java_elems = (int64_t*)(elems + 4);
4474 for (size_t i = 0; i < ret->datalen; i++) {
4475 ret->data[i] = java_elems[i];
4478 return (uint64_t)ret;
4480 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4481 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4482 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4485 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
4486 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
4488 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
4489 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4490 CHECK(val->result_ok);
4491 LDKNodeInfo res_var = (*val->contents.result);
4492 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4493 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4494 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4497 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
4498 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4499 CHECK(!val->result_ok);
4500 LDKDecodeError err_var = (*val->contents.err);
4501 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4502 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4503 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4506 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
4507 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
4509 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
4510 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4511 CHECK(val->result_ok);
4512 LDKNetworkGraph res_var = (*val->contents.result);
4513 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4514 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4515 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4518 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
4519 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4520 CHECK(!val->result_ok);
4521 LDKDecodeError err_var = (*val->contents.err);
4522 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4523 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4524 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4527 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_CVec_NetAddressZZ_ref_from_ptr(uint32_t ptr) {
4528 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
4530 case LDKCOption_CVec_NetAddressZZ_Some: {
4531 LDKCVec_NetAddressZ some_var = obj->some;
4532 uint32_tArray some_arr = init_arr(some_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4533 uint32_t *some_arr_ptr = (uint32_t*)(some_arr + 4);
4534 for (size_t m = 0; m < some_var.datalen; m++) {
4535 uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1;
4536 some_arr_ptr[m] = some_conv_12_ref;
4538 return 0 /* LDKCOption_CVec_NetAddressZZ - Some */; (void) some_arr;
4540 case LDKCOption_CVec_NetAddressZZ_None: {
4541 return 0 /* LDKCOption_CVec_NetAddressZZ - None */;
4546 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) {
4547 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
4549 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_ok(uint32_t arg) {
4550 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
4551 CHECK(val->result_ok);
4552 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4555 int8_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_err(uint32_t arg) {
4556 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
4557 CHECK(!val->result_ok);
4558 return *val->contents.err;
4560 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_result_ok(uint32_t arg) {
4561 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
4563 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_ok(uint32_t arg) {
4564 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
4565 CHECK(val->result_ok);
4566 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
4567 *res_conv = (*val->contents.result);
4568 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
4569 return (uint64_t)res_conv;
4571 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_err(uint32_t arg) {
4572 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
4573 CHECK(!val->result_ok);
4574 LDKDecodeError err_var = (*val->contents.err);
4575 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4576 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4577 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4580 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_result_ok(uint32_t arg) {
4581 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
4583 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_ok(uint32_t arg) {
4584 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4585 CHECK(val->result_ok);
4586 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4589 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_err(uint32_t arg) {
4590 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4591 CHECK(!val->result_ok);
4592 LDKDecodeError err_var = (*val->contents.err);
4593 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4594 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4595 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4598 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
4599 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
4600 ret->datalen = *((uint32_t*)elems);
4601 if (ret->datalen == 0) {
4604 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
4605 uint32_t *java_elems = (uint32_t*)(elems + 4);
4606 for (size_t i = 0; i < ret->datalen; i++) {
4607 uint32_t arr_elem = java_elems[i];
4608 LDKUpdateAddHTLC arr_elem_conv;
4609 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4610 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4611 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
4612 ret->data[i] = arr_elem_conv;
4615 return (uint64_t)ret;
4617 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
4618 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
4619 for (size_t i = 0; i < ret.datalen; i++) {
4620 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
4624 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
4625 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
4626 ret->datalen = *((uint32_t*)elems);
4627 if (ret->datalen == 0) {
4630 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
4631 uint32_t *java_elems = (uint32_t*)(elems + 4);
4632 for (size_t i = 0; i < ret->datalen; i++) {
4633 uint32_t arr_elem = java_elems[i];
4634 LDKUpdateFulfillHTLC arr_elem_conv;
4635 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4636 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4637 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
4638 ret->data[i] = arr_elem_conv;
4641 return (uint64_t)ret;
4643 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
4644 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
4645 for (size_t i = 0; i < ret.datalen; i++) {
4646 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
4650 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
4651 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
4652 ret->datalen = *((uint32_t*)elems);
4653 if (ret->datalen == 0) {
4656 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
4657 uint32_t *java_elems = (uint32_t*)(elems + 4);
4658 for (size_t i = 0; i < ret->datalen; i++) {
4659 uint32_t arr_elem = java_elems[i];
4660 LDKUpdateFailHTLC arr_elem_conv;
4661 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4662 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4663 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
4664 ret->data[i] = arr_elem_conv;
4667 return (uint64_t)ret;
4669 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
4670 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
4671 for (size_t i = 0; i < ret.datalen; i++) {
4672 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
4676 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
4677 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
4678 ret->datalen = *((uint32_t*)elems);
4679 if (ret->datalen == 0) {
4682 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
4683 uint32_t *java_elems = (uint32_t*)(elems + 4);
4684 for (size_t i = 0; i < ret->datalen; i++) {
4685 uint32_t arr_elem = java_elems[i];
4686 LDKUpdateFailMalformedHTLC arr_elem_conv;
4687 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4688 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4689 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
4690 ret->data[i] = arr_elem_conv;
4693 return (uint64_t)ret;
4695 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
4696 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
4697 for (size_t i = 0; i < ret.datalen; i++) {
4698 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
4702 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
4703 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
4705 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
4706 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4707 CHECK(val->result_ok);
4708 LDKAcceptChannel res_var = (*val->contents.result);
4709 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4710 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4711 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4714 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
4715 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4716 CHECK(!val->result_ok);
4717 LDKDecodeError err_var = (*val->contents.err);
4718 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4719 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4720 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4723 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
4724 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
4726 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
4727 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4728 CHECK(val->result_ok);
4729 LDKAnnouncementSignatures res_var = (*val->contents.result);
4730 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4731 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4732 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4735 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
4736 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4737 CHECK(!val->result_ok);
4738 LDKDecodeError err_var = (*val->contents.err);
4739 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4740 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4741 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4744 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
4745 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
4747 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
4748 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4749 CHECK(val->result_ok);
4750 LDKChannelReestablish res_var = (*val->contents.result);
4751 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4752 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4753 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4756 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
4757 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4758 CHECK(!val->result_ok);
4759 LDKDecodeError err_var = (*val->contents.err);
4760 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4761 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4762 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4765 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4766 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
4768 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4769 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4770 CHECK(val->result_ok);
4771 LDKClosingSigned res_var = (*val->contents.result);
4772 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4773 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4774 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4777 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
4778 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4779 CHECK(!val->result_ok);
4780 LDKDecodeError err_var = (*val->contents.err);
4781 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4782 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4783 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4786 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_result_ok(uint32_t arg) {
4787 return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
4789 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t arg) {
4790 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4791 CHECK(val->result_ok);
4792 LDKClosingSignedFeeRange res_var = (*val->contents.result);
4793 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4794 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4795 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4798 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t arg) {
4799 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4800 CHECK(!val->result_ok);
4801 LDKDecodeError err_var = (*val->contents.err);
4802 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4803 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4804 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4807 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
4808 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
4810 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
4811 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4812 CHECK(val->result_ok);
4813 LDKCommitmentSigned res_var = (*val->contents.result);
4814 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4815 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4816 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4819 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
4820 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4821 CHECK(!val->result_ok);
4822 LDKDecodeError err_var = (*val->contents.err);
4823 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4824 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4825 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4828 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
4829 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
4831 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
4832 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4833 CHECK(val->result_ok);
4834 LDKFundingCreated res_var = (*val->contents.result);
4835 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4836 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4837 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4840 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
4841 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4842 CHECK(!val->result_ok);
4843 LDKDecodeError err_var = (*val->contents.err);
4844 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4845 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4846 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4849 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4850 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
4852 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4853 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4854 CHECK(val->result_ok);
4855 LDKFundingSigned res_var = (*val->contents.result);
4856 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4857 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4858 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4861 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
4862 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4863 CHECK(!val->result_ok);
4864 LDKDecodeError err_var = (*val->contents.err);
4865 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4866 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4867 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4870 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
4871 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
4873 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
4874 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4875 CHECK(val->result_ok);
4876 LDKFundingLocked res_var = (*val->contents.result);
4877 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4878 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4879 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4882 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
4883 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4884 CHECK(!val->result_ok);
4885 LDKDecodeError err_var = (*val->contents.err);
4886 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4887 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4888 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4891 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_result_ok(uint32_t arg) {
4892 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
4894 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
4895 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4896 CHECK(val->result_ok);
4897 LDKInit res_var = (*val->contents.result);
4898 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4899 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4900 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4903 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
4904 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4905 CHECK(!val->result_ok);
4906 LDKDecodeError err_var = (*val->contents.err);
4907 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4908 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4909 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4912 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
4913 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
4915 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
4916 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4917 CHECK(val->result_ok);
4918 LDKOpenChannel res_var = (*val->contents.result);
4919 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4920 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4921 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4924 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
4925 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4926 CHECK(!val->result_ok);
4927 LDKDecodeError err_var = (*val->contents.err);
4928 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4929 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4930 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4933 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
4934 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
4936 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
4937 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4938 CHECK(val->result_ok);
4939 LDKRevokeAndACK res_var = (*val->contents.result);
4940 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4941 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4942 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4945 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
4946 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4947 CHECK(!val->result_ok);
4948 LDKDecodeError err_var = (*val->contents.err);
4949 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4950 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4951 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4954 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
4955 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
4957 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
4958 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4959 CHECK(val->result_ok);
4960 LDKShutdown res_var = (*val->contents.result);
4961 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4962 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4963 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4966 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
4967 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4968 CHECK(!val->result_ok);
4969 LDKDecodeError err_var = (*val->contents.err);
4970 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4971 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4972 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4975 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4976 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
4978 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4979 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4980 CHECK(val->result_ok);
4981 LDKUpdateFailHTLC res_var = (*val->contents.result);
4982 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4983 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4984 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4987 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
4988 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4989 CHECK(!val->result_ok);
4990 LDKDecodeError err_var = (*val->contents.err);
4991 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4992 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4993 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4996 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4997 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
4999 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
5000 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5001 CHECK(val->result_ok);
5002 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
5003 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5004 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5005 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5008 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
5009 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5010 CHECK(!val->result_ok);
5011 LDKDecodeError err_var = (*val->contents.err);
5012 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5013 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5014 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5017 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
5018 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
5020 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
5021 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5022 CHECK(val->result_ok);
5023 LDKUpdateFee res_var = (*val->contents.result);
5024 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5025 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5026 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5029 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
5030 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5031 CHECK(!val->result_ok);
5032 LDKDecodeError err_var = (*val->contents.err);
5033 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5034 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5035 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5038 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
5039 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
5041 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
5042 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5043 CHECK(val->result_ok);
5044 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
5045 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5046 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5047 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5050 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
5051 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5052 CHECK(!val->result_ok);
5053 LDKDecodeError err_var = (*val->contents.err);
5054 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5055 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5056 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5059 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
5060 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
5062 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
5063 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5064 CHECK(val->result_ok);
5065 LDKUpdateAddHTLC res_var = (*val->contents.result);
5066 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5067 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5068 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5071 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
5072 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5073 CHECK(!val->result_ok);
5074 LDKDecodeError err_var = (*val->contents.err);
5075 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5076 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5077 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5080 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_result_ok(uint32_t arg) {
5081 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
5083 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
5084 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5085 CHECK(val->result_ok);
5086 LDKPing res_var = (*val->contents.result);
5087 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5088 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5089 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5092 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
5093 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5094 CHECK(!val->result_ok);
5095 LDKDecodeError err_var = (*val->contents.err);
5096 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5097 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5098 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5101 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_result_ok(uint32_t arg) {
5102 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
5104 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
5105 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5106 CHECK(val->result_ok);
5107 LDKPong res_var = (*val->contents.result);
5108 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5109 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5110 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5113 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
5114 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5115 CHECK(!val->result_ok);
5116 LDKDecodeError err_var = (*val->contents.err);
5117 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5118 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5119 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5122 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5123 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5125 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5126 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5127 CHECK(val->result_ok);
5128 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
5129 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5130 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5131 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5134 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5135 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5136 CHECK(!val->result_ok);
5137 LDKDecodeError err_var = (*val->contents.err);
5138 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5139 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5140 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5143 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5144 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5146 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5147 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5148 CHECK(val->result_ok);
5149 LDKChannelAnnouncement res_var = (*val->contents.result);
5150 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5151 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5152 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5155 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5156 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5157 CHECK(!val->result_ok);
5158 LDKDecodeError err_var = (*val->contents.err);
5159 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5160 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5161 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5164 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
5165 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
5167 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
5168 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5169 CHECK(val->result_ok);
5170 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
5171 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5172 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5173 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5176 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
5177 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5178 CHECK(!val->result_ok);
5179 LDKDecodeError err_var = (*val->contents.err);
5180 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5181 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5182 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5185 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
5186 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
5188 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
5189 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5190 CHECK(val->result_ok);
5191 LDKChannelUpdate res_var = (*val->contents.result);
5192 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5193 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5194 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5197 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
5198 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5199 CHECK(!val->result_ok);
5200 LDKDecodeError err_var = (*val->contents.err);
5201 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5202 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5203 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5206 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
5207 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
5209 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
5210 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5211 CHECK(val->result_ok);
5212 LDKErrorMessage res_var = (*val->contents.result);
5213 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5214 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5215 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5218 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
5219 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5220 CHECK(!val->result_ok);
5221 LDKDecodeError err_var = (*val->contents.err);
5222 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5223 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5224 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5227 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5228 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5230 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5231 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5232 CHECK(val->result_ok);
5233 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
5234 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5235 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5236 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5239 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5240 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5241 CHECK(!val->result_ok);
5242 LDKDecodeError err_var = (*val->contents.err);
5243 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5244 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5245 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5248 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5249 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5251 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5252 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5253 CHECK(val->result_ok);
5254 LDKNodeAnnouncement res_var = (*val->contents.result);
5255 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5256 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5257 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5260 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5261 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5262 CHECK(!val->result_ok);
5263 LDKDecodeError err_var = (*val->contents.err);
5264 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5265 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5266 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5269 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
5270 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
5272 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
5273 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5274 CHECK(val->result_ok);
5275 LDKQueryShortChannelIds res_var = (*val->contents.result);
5276 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5277 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5278 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5281 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
5282 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5283 CHECK(!val->result_ok);
5284 LDKDecodeError err_var = (*val->contents.err);
5285 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5286 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5287 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5290 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
5291 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
5293 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
5294 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5295 CHECK(val->result_ok);
5296 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
5297 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5298 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5299 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5302 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
5303 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5304 CHECK(!val->result_ok);
5305 LDKDecodeError err_var = (*val->contents.err);
5306 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5307 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5308 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5311 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
5312 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
5314 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5315 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5316 CHECK(val->result_ok);
5317 LDKQueryChannelRange res_var = (*val->contents.result);
5318 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5319 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5320 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5323 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5324 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5325 CHECK(!val->result_ok);
5326 LDKDecodeError err_var = (*val->contents.err);
5327 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5328 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5329 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5332 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
5333 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
5335 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5336 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5337 CHECK(val->result_ok);
5338 LDKReplyChannelRange res_var = (*val->contents.result);
5339 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5340 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5341 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5344 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5345 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5346 CHECK(!val->result_ok);
5347 LDKDecodeError err_var = (*val->contents.err);
5348 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5349 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5350 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5353 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
5354 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
5356 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
5357 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5358 CHECK(val->result_ok);
5359 LDKGossipTimestampFilter res_var = (*val->contents.result);
5360 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5361 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5362 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5365 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
5366 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5367 CHECK(!val->result_ok);
5368 LDKDecodeError err_var = (*val->contents.err);
5369 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5370 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5371 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5374 uint32_t __attribute__((visibility("default"))) TS_LDKSignOrCreationError_ref_from_ptr(uint32_t ptr) {
5375 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
5377 case LDKSignOrCreationError_SignError: {
5378 return 0 /* LDKSignOrCreationError - SignError */;
5380 case LDKSignOrCreationError_CreationError: {
5381 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
5382 return 0 /* LDKSignOrCreationError - CreationError */; (void) creation_error_conv;
5387 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_result_ok(uint32_t arg) {
5388 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
5390 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t arg) {
5391 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5392 CHECK(val->result_ok);
5393 LDKInvoice res_var = (*val->contents.result);
5394 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5395 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5396 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5399 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t arg) {
5400 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5401 CHECK(!val->result_ok);
5402 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
5405 typedef struct LDKFilter_JCalls {
5406 atomic_size_t refcnt;
5407 uint32_t register_tx_meth;
5408 uint32_t register_output_meth;
5410 static void LDKFilter_JCalls_free(void* this_arg) {
5411 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5412 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5413 js_free(j_calls->register_tx_meth);
5414 js_free(j_calls->register_output_meth);
5418 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5419 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5420 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5421 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5422 LDKu8slice script_pubkey_var = script_pubkey;
5423 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5424 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
5425 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
5427 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5428 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5429 LDKWatchedOutput output_var = output;
5430 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5431 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5432 uint64_t output_ref = (uint64_t)output_var.inner;
5433 if (output_var.is_owned) {
5436 uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
5437 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5438 CHECK_ACCESS(ret_ptr);
5439 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
5440 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
5443 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5444 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5445 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5447 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
5448 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5449 atomic_init(&calls->refcnt, 1);
5450 //TODO: Assign calls->o from o
5453 .this_arg = (void*) calls,
5454 .register_tx = register_tx_LDKFilter_jcall,
5455 .register_output = register_output_LDKFilter_jcall,
5456 .free = LDKFilter_JCalls_free,
5460 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
5461 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5462 *res_ptr = LDKFilter_init(o);
5463 return (long)res_ptr;
5465 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5466 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5467 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5468 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5469 unsigned char txid_arr[32];
5470 CHECK(*((uint32_t*)txid) == 32);
5471 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5472 unsigned char (*txid_ref)[32] = &txid_arr;
5473 LDKu8slice script_pubkey_ref;
5474 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
5475 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
5476 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5479 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5480 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5481 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5482 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5483 LDKWatchedOutput output_conv;
5484 output_conv.inner = (void*)(output & (~1));
5485 output_conv.is_owned = (output & 1) || (output == 0);
5486 output_conv = WatchedOutput_clone(&output_conv);
5487 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5488 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5489 uint64_t ret_ref = (uint64_t)ret_copy;
5493 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_FilterZ_ref_from_ptr(uint32_t ptr) {
5494 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
5496 case LDKCOption_FilterZ_Some: {
5497 LDKFilter* some_ret =MALLOC(sizeof(LDKFilter), "LDKFilter");
5498 *some_ret = obj->some;
5499 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
5500 return 0 /* LDKCOption_FilterZ - Some */; (void) (uint64_t)some_ret;
5502 case LDKCOption_FilterZ_None: {
5503 return 0 /* LDKCOption_FilterZ - None */;
5508 jboolean __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_result_ok(uint32_t arg) {
5509 return ((LDKCResult_LockedChannelMonitorNoneZ*)arg)->result_ok;
5511 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_ok(uint32_t arg) {
5512 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
5513 CHECK(val->result_ok);
5514 LDKLockedChannelMonitor res_var = (*val->contents.result);
5515 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5516 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5517 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5520 void __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_err(uint32_t arg) {
5521 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
5522 CHECK(!val->result_ok);
5523 return *val->contents.err;
5525 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_OutPointZ_new(uint32_tArray elems) {
5526 LDKCVec_OutPointZ *ret = MALLOC(sizeof(LDKCVec_OutPointZ), "LDKCVec_OutPointZ");
5527 ret->datalen = *((uint32_t*)elems);
5528 if (ret->datalen == 0) {
5531 ret->data = MALLOC(sizeof(LDKOutPoint) * ret->datalen, "LDKCVec_OutPointZ Data");
5532 uint32_t *java_elems = (uint32_t*)(elems + 4);
5533 for (size_t i = 0; i < ret->datalen; i++) {
5534 uint32_t arr_elem = java_elems[i];
5535 LDKOutPoint arr_elem_conv;
5536 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5537 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5538 arr_elem_conv = OutPoint_clone(&arr_elem_conv);
5539 ret->data[i] = arr_elem_conv;
5542 return (uint64_t)ret;
5544 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
5545 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
5546 for (size_t i = 0; i < ret.datalen; i++) {
5547 ret.data[i] = OutPoint_clone(&orig->data[i]);
5551 typedef struct LDKMessageSendEventsProvider_JCalls {
5552 atomic_size_t refcnt;
5553 uint32_t get_and_clear_pending_msg_events_meth;
5554 } LDKMessageSendEventsProvider_JCalls;
5555 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
5556 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5557 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5558 js_free(j_calls->get_and_clear_pending_msg_events_meth);
5562 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
5563 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5564 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
5565 LDKCVec_MessageSendEventZ ret_constr;
5566 ret_constr.datalen = *((uint32_t*)ret);
5567 if (ret_constr.datalen > 0)
5568 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5570 ret_constr.data = NULL;
5571 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5572 for (size_t s = 0; s < ret_constr.datalen; s++) {
5573 uint32_t ret_conv_18 = ret_vals[s];
5574 void* ret_conv_18_ptr = (void*)(((uint64_t)ret_conv_18) & ~1);
5575 CHECK_ACCESS(ret_conv_18_ptr);
5576 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
5577 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
5578 ret_constr.data[s] = ret_conv_18_conv;
5582 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
5583 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
5584 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5586 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5587 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
5588 atomic_init(&calls->refcnt, 1);
5589 //TODO: Assign calls->o from o
5591 LDKMessageSendEventsProvider ret = {
5592 .this_arg = (void*) calls,
5593 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
5594 .free = LDKMessageSendEventsProvider_JCalls_free,
5598 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5599 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
5600 *res_ptr = LDKMessageSendEventsProvider_init(o);
5601 return (long)res_ptr;
5603 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
5604 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5605 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5606 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
5607 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
5608 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5609 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5610 for (size_t s = 0; s < ret_var.datalen; s++) {
5611 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5612 *ret_conv_18_copy = ret_var.data[s];
5613 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
5614 ret_arr_ptr[s] = ret_conv_18_ref;
5620 typedef struct LDKEventHandler_JCalls {
5621 atomic_size_t refcnt;
5622 uint32_t handle_event_meth;
5623 } LDKEventHandler_JCalls;
5624 static void LDKEventHandler_JCalls_free(void* this_arg) {
5625 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5626 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5627 js_free(j_calls->handle_event_meth);
5631 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
5632 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5633 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
5634 *ret_event = Event_clone(event);
5635 js_invoke_function_1(j_calls->handle_event_meth, (uint64_t)ret_event);
5637 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
5638 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
5639 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5641 static inline LDKEventHandler LDKEventHandler_init (/*TODO: JS Object Reference */void* o) {
5642 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
5643 atomic_init(&calls->refcnt, 1);
5644 //TODO: Assign calls->o from o
5646 LDKEventHandler ret = {
5647 .this_arg = (void*) calls,
5648 .handle_event = handle_event_LDKEventHandler_jcall,
5649 .free = LDKEventHandler_JCalls_free,
5653 long __attribute__((visibility("default"))) TS_LDKEventHandler_new(/*TODO: JS Object Reference */void* o) {
5654 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5655 *res_ptr = LDKEventHandler_init(o);
5656 return (long)res_ptr;
5658 void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
5659 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5660 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5661 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
5662 LDKEvent* event_conv = (LDKEvent*)event;
5663 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
5666 typedef struct LDKEventsProvider_JCalls {
5667 atomic_size_t refcnt;
5668 uint32_t process_pending_events_meth;
5669 } LDKEventsProvider_JCalls;
5670 static void LDKEventsProvider_JCalls_free(void* this_arg) {
5671 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5672 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5673 js_free(j_calls->process_pending_events_meth);
5677 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
5678 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5679 LDKEventHandler* handler_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5680 *handler_ret = handler;
5681 js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)handler_ret);
5683 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
5684 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
5685 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5687 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5688 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
5689 atomic_init(&calls->refcnt, 1);
5690 //TODO: Assign calls->o from o
5692 LDKEventsProvider ret = {
5693 .this_arg = (void*) calls,
5694 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
5695 .free = LDKEventsProvider_JCalls_free,
5699 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5700 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5701 *res_ptr = LDKEventsProvider_init(o);
5702 return (long)res_ptr;
5704 void __attribute__((visibility("default"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
5705 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5706 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5707 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
5708 void* handler_ptr = (void*)(((uint64_t)handler) & ~1);
5709 CHECK_ACCESS(handler_ptr);
5710 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
5711 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
5714 typedef struct LDKListen_JCalls {
5715 atomic_size_t refcnt;
5716 uint32_t block_connected_meth;
5717 uint32_t block_disconnected_meth;
5719 static void LDKListen_JCalls_free(void* this_arg) {
5720 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5721 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5722 js_free(j_calls->block_connected_meth);
5723 js_free(j_calls->block_disconnected_meth);
5727 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
5728 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5729 LDKu8slice block_var = block;
5730 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5731 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
5732 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
5734 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5735 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5736 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5737 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5738 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
5740 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
5741 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
5742 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5744 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
5745 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
5746 atomic_init(&calls->refcnt, 1);
5747 //TODO: Assign calls->o from o
5750 .this_arg = (void*) calls,
5751 .block_connected = block_connected_LDKListen_jcall,
5752 .block_disconnected = block_disconnected_LDKListen_jcall,
5753 .free = LDKListen_JCalls_free,
5757 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
5758 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
5759 *res_ptr = LDKListen_init(o);
5760 return (long)res_ptr;
5762 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
5763 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5764 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5765 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
5766 LDKu8slice block_ref;
5767 block_ref.datalen = *((uint32_t*)block);
5768 block_ref.data = (int8_t*)(block + 4);
5769 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
5772 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
5773 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5774 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5775 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
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->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
5783 typedef struct LDKConfirm_JCalls {
5784 atomic_size_t refcnt;
5785 uint32_t transactions_confirmed_meth;
5786 uint32_t transaction_unconfirmed_meth;
5787 uint32_t best_block_updated_meth;
5788 uint32_t get_relevant_txids_meth;
5789 } LDKConfirm_JCalls;
5790 static void LDKConfirm_JCalls_free(void* this_arg) {
5791 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5792 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5793 js_free(j_calls->transactions_confirmed_meth);
5794 js_free(j_calls->transaction_unconfirmed_meth);
5795 js_free(j_calls->best_block_updated_meth);
5796 js_free(j_calls->get_relevant_txids_meth);
5800 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
5801 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5802 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5803 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5804 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
5805 uint32_tArray txdata_arr = init_arr(txdata_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5806 uint32_t *txdata_arr_ptr = (uint32_t*)(txdata_arr + 4);
5807 for (size_t c = 0; c < txdata_var.datalen; c++) {
5808 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5809 *txdata_conv_28_conv = txdata_var.data[c];
5810 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
5812 FREE(txdata_var.data);
5813 js_invoke_function_3(j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
5815 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
5816 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5817 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5818 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5819 js_invoke_function_1(j_calls->transaction_unconfirmed_meth, txid_arr);
5821 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5822 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5823 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5824 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5825 js_invoke_function_2(j_calls->best_block_updated_meth, header_arr, height);
5827 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
5828 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5829 ptrArray ret = js_invoke_function_0(j_calls->get_relevant_txids_meth);
5830 LDKCVec_TxidZ ret_constr;
5831 ret_constr.datalen = *((uint32_t*)ret);
5832 if (ret_constr.datalen > 0)
5833 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
5835 ret_constr.data = NULL;
5836 int8_tArray* ret_vals = (int8_tArray*)(ret + 4);
5837 for (size_t m = 0; m < ret_constr.datalen; m++) {
5838 int8_tArray ret_conv_12 = ret_vals[m];
5839 LDKThirtyTwoBytes ret_conv_12_ref;
5840 CHECK(*((uint32_t*)ret_conv_12) == 32);
5841 memcpy(ret_conv_12_ref.data, (uint8_t*)(ret_conv_12 + 4), 32);
5842 ret_constr.data[m] = ret_conv_12_ref;
5846 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
5847 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
5848 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5850 static inline LDKConfirm LDKConfirm_init (/*TODO: JS Object Reference */void* o) {
5851 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
5852 atomic_init(&calls->refcnt, 1);
5853 //TODO: Assign calls->o from o
5856 .this_arg = (void*) calls,
5857 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
5858 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
5859 .best_block_updated = best_block_updated_LDKConfirm_jcall,
5860 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
5861 .free = LDKConfirm_JCalls_free,
5865 long __attribute__((visibility("default"))) TS_LDKConfirm_new(/*TODO: JS Object Reference */void* o) {
5866 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
5867 *res_ptr = LDKConfirm_init(o);
5868 return (long)res_ptr;
5870 void __attribute__((visibility("default"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
5871 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5872 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5873 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5874 unsigned char header_arr[80];
5875 CHECK(*((uint32_t*)header) == 80);
5876 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5877 unsigned char (*header_ref)[80] = &header_arr;
5878 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5879 txdata_constr.datalen = *((uint32_t*)txdata);
5880 if (txdata_constr.datalen > 0)
5881 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5883 txdata_constr.data = NULL;
5884 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
5885 for (size_t c = 0; c < txdata_constr.datalen; c++) {
5886 uint32_t txdata_conv_28 = txdata_vals[c];
5887 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
5888 CHECK_ACCESS(txdata_conv_28_ptr);
5889 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
5890 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
5891 txdata_constr.data[c] = txdata_conv_28_conv;
5893 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
5896 void __attribute__((visibility("default"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
5897 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5898 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5899 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5900 unsigned char txid_arr[32];
5901 CHECK(*((uint32_t*)txid) == 32);
5902 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5903 unsigned char (*txid_ref)[32] = &txid_arr;
5904 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
5907 void __attribute__((visibility("default"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
5908 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5909 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5910 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5911 unsigned char header_arr[80];
5912 CHECK(*((uint32_t*)header) == 80);
5913 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5914 unsigned char (*header_ref)[80] = &header_arr;
5915 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
5918 ptrArray __attribute__((visibility("default"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
5919 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5920 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5921 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5922 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
5923 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
5924 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
5925 for (size_t m = 0; m < ret_var.datalen; m++) {
5926 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5927 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
5928 ret_arr_ptr[m] = ret_conv_12_arr;
5934 typedef struct LDKPersist_JCalls {
5935 atomic_size_t refcnt;
5936 uint32_t persist_new_channel_meth;
5937 uint32_t update_persisted_channel_meth;
5938 } LDKPersist_JCalls;
5939 static void LDKPersist_JCalls_free(void* this_arg) {
5940 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5941 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5942 js_free(j_calls->persist_new_channel_meth);
5943 js_free(j_calls->update_persisted_channel_meth);
5947 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
5948 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5949 LDKOutPoint id_var = id;
5950 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5951 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5952 uint64_t id_ref = (uint64_t)id_var.inner;
5953 if (id_var.is_owned) {
5956 LDKChannelMonitor data_var = *data;
5957 data_var = ChannelMonitor_clone(data);
5958 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5959 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5960 uint64_t data_ref = (uint64_t)data_var.inner;
5961 if (data_var.is_owned) {
5964 uint32_t ret = js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
5965 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5966 CHECK_ACCESS(ret_ptr);
5967 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5968 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
5971 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
5972 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5973 LDKOutPoint id_var = id;
5974 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5975 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5976 uint64_t id_ref = (uint64_t)id_var.inner;
5977 if (id_var.is_owned) {
5980 LDKChannelMonitorUpdate update_var = *update;
5981 update_var = ChannelMonitorUpdate_clone(update);
5982 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5983 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5984 uint64_t update_ref = (uint64_t)update_var.inner;
5985 if (update_var.is_owned) {
5988 LDKChannelMonitor data_var = *data;
5989 data_var = ChannelMonitor_clone(data);
5990 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5991 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5992 uint64_t data_ref = (uint64_t)data_var.inner;
5993 if (data_var.is_owned) {
5996 uint32_t ret = js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
5997 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5998 CHECK_ACCESS(ret_ptr);
5999 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6000 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6003 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
6004 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
6005 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6007 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
6008 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
6009 atomic_init(&calls->refcnt, 1);
6010 //TODO: Assign calls->o from o
6013 .this_arg = (void*) calls,
6014 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
6015 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
6016 .free = LDKPersist_JCalls_free,
6020 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
6021 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
6022 *res_ptr = LDKPersist_init(o);
6023 return (long)res_ptr;
6025 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t id, uint32_t data) {
6026 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6027 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6028 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
6029 LDKOutPoint id_conv;
6030 id_conv.inner = (void*)(id & (~1));
6031 id_conv.is_owned = (id & 1) || (id == 0);
6032 id_conv = OutPoint_clone(&id_conv);
6033 LDKChannelMonitor data_conv;
6034 data_conv.inner = (void*)(data & (~1));
6035 data_conv.is_owned = false;
6036 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6037 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
6038 return (uint64_t)ret_conv;
6041 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
6042 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6043 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6044 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
6045 LDKOutPoint id_conv;
6046 id_conv.inner = (void*)(id & (~1));
6047 id_conv.is_owned = (id & 1) || (id == 0);
6048 id_conv = OutPoint_clone(&id_conv);
6049 LDKChannelMonitorUpdate update_conv;
6050 update_conv.inner = (void*)(update & (~1));
6051 update_conv.is_owned = false;
6052 LDKChannelMonitor data_conv;
6053 data_conv.inner = (void*)(data & (~1));
6054 data_conv.is_owned = false;
6055 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6056 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
6057 return (uint64_t)ret_conv;
6060 typedef struct LDKChannelMessageHandler_JCalls {
6061 atomic_size_t refcnt;
6062 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6063 uint32_t handle_open_channel_meth;
6064 uint32_t handle_accept_channel_meth;
6065 uint32_t handle_funding_created_meth;
6066 uint32_t handle_funding_signed_meth;
6067 uint32_t handle_funding_locked_meth;
6068 uint32_t handle_shutdown_meth;
6069 uint32_t handle_closing_signed_meth;
6070 uint32_t handle_update_add_htlc_meth;
6071 uint32_t handle_update_fulfill_htlc_meth;
6072 uint32_t handle_update_fail_htlc_meth;
6073 uint32_t handle_update_fail_malformed_htlc_meth;
6074 uint32_t handle_commitment_signed_meth;
6075 uint32_t handle_revoke_and_ack_meth;
6076 uint32_t handle_update_fee_meth;
6077 uint32_t handle_announcement_signatures_meth;
6078 uint32_t peer_disconnected_meth;
6079 uint32_t peer_connected_meth;
6080 uint32_t handle_channel_reestablish_meth;
6081 uint32_t handle_channel_update_meth;
6082 uint32_t handle_error_meth;
6083 } LDKChannelMessageHandler_JCalls;
6084 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
6085 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6086 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6087 js_free(j_calls->handle_open_channel_meth);
6088 js_free(j_calls->handle_accept_channel_meth);
6089 js_free(j_calls->handle_funding_created_meth);
6090 js_free(j_calls->handle_funding_signed_meth);
6091 js_free(j_calls->handle_funding_locked_meth);
6092 js_free(j_calls->handle_shutdown_meth);
6093 js_free(j_calls->handle_closing_signed_meth);
6094 js_free(j_calls->handle_update_add_htlc_meth);
6095 js_free(j_calls->handle_update_fulfill_htlc_meth);
6096 js_free(j_calls->handle_update_fail_htlc_meth);
6097 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
6098 js_free(j_calls->handle_commitment_signed_meth);
6099 js_free(j_calls->handle_revoke_and_ack_meth);
6100 js_free(j_calls->handle_update_fee_meth);
6101 js_free(j_calls->handle_announcement_signatures_meth);
6102 js_free(j_calls->peer_disconnected_meth);
6103 js_free(j_calls->peer_connected_meth);
6104 js_free(j_calls->handle_channel_reestablish_meth);
6105 js_free(j_calls->handle_channel_update_meth);
6106 js_free(j_calls->handle_error_meth);
6110 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
6111 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6112 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6113 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6114 LDKInitFeatures their_features_var = their_features;
6115 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6116 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6117 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6118 if (their_features_var.is_owned) {
6119 their_features_ref |= 1;
6121 LDKOpenChannel msg_var = *msg;
6122 msg_var = OpenChannel_clone(msg);
6123 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6124 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6125 uint64_t msg_ref = (uint64_t)msg_var.inner;
6126 if (msg_var.is_owned) {
6129 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6131 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
6132 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6133 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6134 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6135 LDKInitFeatures their_features_var = their_features;
6136 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6137 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6138 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6139 if (their_features_var.is_owned) {
6140 their_features_ref |= 1;
6142 LDKAcceptChannel msg_var = *msg;
6143 msg_var = AcceptChannel_clone(msg);
6144 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6145 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6146 uint64_t msg_ref = (uint64_t)msg_var.inner;
6147 if (msg_var.is_owned) {
6150 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6152 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
6153 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6154 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6155 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6156 LDKFundingCreated msg_var = *msg;
6157 msg_var = FundingCreated_clone(msg);
6158 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6159 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6160 uint64_t msg_ref = (uint64_t)msg_var.inner;
6161 if (msg_var.is_owned) {
6164 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
6166 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
6167 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6168 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6169 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6170 LDKFundingSigned msg_var = *msg;
6171 msg_var = FundingSigned_clone(msg);
6172 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6173 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6174 uint64_t msg_ref = (uint64_t)msg_var.inner;
6175 if (msg_var.is_owned) {
6178 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
6180 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
6181 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6182 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6183 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6184 LDKFundingLocked msg_var = *msg;
6185 msg_var = FundingLocked_clone(msg);
6186 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6187 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6188 uint64_t msg_ref = (uint64_t)msg_var.inner;
6189 if (msg_var.is_owned) {
6192 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
6194 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
6195 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6196 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6197 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6198 LDKInitFeatures their_features_var = *their_features;
6199 their_features_var = InitFeatures_clone(their_features);
6200 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6201 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6202 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6203 if (their_features_var.is_owned) {
6204 their_features_ref |= 1;
6206 LDKShutdown msg_var = *msg;
6207 msg_var = Shutdown_clone(msg);
6208 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6209 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6210 uint64_t msg_ref = (uint64_t)msg_var.inner;
6211 if (msg_var.is_owned) {
6214 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
6216 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
6217 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6218 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6219 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6220 LDKClosingSigned msg_var = *msg;
6221 msg_var = ClosingSigned_clone(msg);
6222 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6223 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6224 uint64_t msg_ref = (uint64_t)msg_var.inner;
6225 if (msg_var.is_owned) {
6228 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
6230 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
6231 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6232 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6233 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6234 LDKUpdateAddHTLC msg_var = *msg;
6235 msg_var = UpdateAddHTLC_clone(msg);
6236 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6237 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6238 uint64_t msg_ref = (uint64_t)msg_var.inner;
6239 if (msg_var.is_owned) {
6242 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
6244 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
6245 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6246 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6247 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6248 LDKUpdateFulfillHTLC msg_var = *msg;
6249 msg_var = UpdateFulfillHTLC_clone(msg);
6250 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6251 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6252 uint64_t msg_ref = (uint64_t)msg_var.inner;
6253 if (msg_var.is_owned) {
6256 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
6258 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
6259 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6260 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6261 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6262 LDKUpdateFailHTLC msg_var = *msg;
6263 msg_var = UpdateFailHTLC_clone(msg);
6264 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6265 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6266 uint64_t msg_ref = (uint64_t)msg_var.inner;
6267 if (msg_var.is_owned) {
6270 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
6272 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
6273 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6274 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6275 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6276 LDKUpdateFailMalformedHTLC msg_var = *msg;
6277 msg_var = UpdateFailMalformedHTLC_clone(msg);
6278 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6279 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6280 uint64_t msg_ref = (uint64_t)msg_var.inner;
6281 if (msg_var.is_owned) {
6284 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
6286 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
6287 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6288 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6289 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6290 LDKCommitmentSigned msg_var = *msg;
6291 msg_var = CommitmentSigned_clone(msg);
6292 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6293 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6294 uint64_t msg_ref = (uint64_t)msg_var.inner;
6295 if (msg_var.is_owned) {
6298 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
6300 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
6301 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6302 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6303 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6304 LDKRevokeAndACK msg_var = *msg;
6305 msg_var = RevokeAndACK_clone(msg);
6306 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6307 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6308 uint64_t msg_ref = (uint64_t)msg_var.inner;
6309 if (msg_var.is_owned) {
6312 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
6314 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
6315 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6316 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6317 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6318 LDKUpdateFee msg_var = *msg;
6319 msg_var = UpdateFee_clone(msg);
6320 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6321 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6322 uint64_t msg_ref = (uint64_t)msg_var.inner;
6323 if (msg_var.is_owned) {
6326 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
6328 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
6329 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6330 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6331 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6332 LDKAnnouncementSignatures msg_var = *msg;
6333 msg_var = AnnouncementSignatures_clone(msg);
6334 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6335 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6336 uint64_t msg_ref = (uint64_t)msg_var.inner;
6337 if (msg_var.is_owned) {
6340 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
6342 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
6343 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6344 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6345 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6346 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
6348 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
6349 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6350 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6351 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6352 LDKInit msg_var = *msg;
6353 msg_var = Init_clone(msg);
6354 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6355 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6356 uint64_t msg_ref = (uint64_t)msg_var.inner;
6357 if (msg_var.is_owned) {
6360 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
6362 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
6363 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6364 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6365 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6366 LDKChannelReestablish msg_var = *msg;
6367 msg_var = ChannelReestablish_clone(msg);
6368 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6369 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6370 uint64_t msg_ref = (uint64_t)msg_var.inner;
6371 if (msg_var.is_owned) {
6374 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
6376 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
6377 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6378 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6379 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6380 LDKChannelUpdate msg_var = *msg;
6381 msg_var = ChannelUpdate_clone(msg);
6382 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6383 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6384 uint64_t msg_ref = (uint64_t)msg_var.inner;
6385 if (msg_var.is_owned) {
6388 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
6390 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
6391 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6392 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6393 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6394 LDKErrorMessage msg_var = *msg;
6395 msg_var = ErrorMessage_clone(msg);
6396 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6397 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6398 uint64_t msg_ref = (uint64_t)msg_var.inner;
6399 if (msg_var.is_owned) {
6402 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
6404 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
6405 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
6406 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6407 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6409 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6410 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
6411 atomic_init(&calls->refcnt, 1);
6412 //TODO: Assign calls->o from o
6414 LDKChannelMessageHandler ret = {
6415 .this_arg = (void*) calls,
6416 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
6417 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
6418 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
6419 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
6420 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
6421 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
6422 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
6423 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
6424 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
6425 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
6426 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
6427 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
6428 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
6429 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
6430 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
6431 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
6432 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
6433 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
6434 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
6435 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
6436 .free = LDKChannelMessageHandler_JCalls_free,
6437 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6439 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6442 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6443 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6444 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
6445 return (long)res_ptr;
6447 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) {
6448 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6449 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6450 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6451 LDKPublicKey their_node_id_ref;
6452 CHECK(*((uint32_t*)their_node_id) == 33);
6453 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6454 LDKInitFeatures their_features_conv;
6455 their_features_conv.inner = (void*)(their_features & (~1));
6456 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6457 their_features_conv = InitFeatures_clone(&their_features_conv);
6458 LDKOpenChannel msg_conv;
6459 msg_conv.inner = (void*)(msg & (~1));
6460 msg_conv.is_owned = false;
6461 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6464 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) {
6465 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6466 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6467 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6468 LDKPublicKey their_node_id_ref;
6469 CHECK(*((uint32_t*)their_node_id) == 33);
6470 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6471 LDKInitFeatures their_features_conv;
6472 their_features_conv.inner = (void*)(their_features & (~1));
6473 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6474 their_features_conv = InitFeatures_clone(&their_features_conv);
6475 LDKAcceptChannel msg_conv;
6476 msg_conv.inner = (void*)(msg & (~1));
6477 msg_conv.is_owned = false;
6478 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6481 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6482 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6483 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6484 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6485 LDKPublicKey their_node_id_ref;
6486 CHECK(*((uint32_t*)their_node_id) == 33);
6487 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6488 LDKFundingCreated msg_conv;
6489 msg_conv.inner = (void*)(msg & (~1));
6490 msg_conv.is_owned = false;
6491 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6494 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6495 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6496 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6497 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6498 LDKPublicKey their_node_id_ref;
6499 CHECK(*((uint32_t*)their_node_id) == 33);
6500 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6501 LDKFundingSigned msg_conv;
6502 msg_conv.inner = (void*)(msg & (~1));
6503 msg_conv.is_owned = false;
6504 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6507 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6508 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6509 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6510 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6511 LDKPublicKey their_node_id_ref;
6512 CHECK(*((uint32_t*)their_node_id) == 33);
6513 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6514 LDKFundingLocked msg_conv;
6515 msg_conv.inner = (void*)(msg & (~1));
6516 msg_conv.is_owned = false;
6517 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6520 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
6521 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6522 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6523 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6524 LDKPublicKey their_node_id_ref;
6525 CHECK(*((uint32_t*)their_node_id) == 33);
6526 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6527 LDKInitFeatures their_features_conv;
6528 their_features_conv.inner = (void*)(their_features & (~1));
6529 their_features_conv.is_owned = false;
6530 LDKShutdown msg_conv;
6531 msg_conv.inner = (void*)(msg & (~1));
6532 msg_conv.is_owned = false;
6533 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
6536 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6537 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6538 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6539 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6540 LDKPublicKey their_node_id_ref;
6541 CHECK(*((uint32_t*)their_node_id) == 33);
6542 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6543 LDKClosingSigned msg_conv;
6544 msg_conv.inner = (void*)(msg & (~1));
6545 msg_conv.is_owned = false;
6546 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6549 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6550 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6551 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6552 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6553 LDKPublicKey their_node_id_ref;
6554 CHECK(*((uint32_t*)their_node_id) == 33);
6555 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6556 LDKUpdateAddHTLC msg_conv;
6557 msg_conv.inner = (void*)(msg & (~1));
6558 msg_conv.is_owned = false;
6559 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6562 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6563 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6564 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6565 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6566 LDKPublicKey their_node_id_ref;
6567 CHECK(*((uint32_t*)their_node_id) == 33);
6568 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6569 LDKUpdateFulfillHTLC msg_conv;
6570 msg_conv.inner = (void*)(msg & (~1));
6571 msg_conv.is_owned = false;
6572 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6575 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6576 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6577 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6578 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6579 LDKPublicKey their_node_id_ref;
6580 CHECK(*((uint32_t*)their_node_id) == 33);
6581 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6582 LDKUpdateFailHTLC msg_conv;
6583 msg_conv.inner = (void*)(msg & (~1));
6584 msg_conv.is_owned = false;
6585 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6588 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6589 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6590 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6591 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6592 LDKPublicKey their_node_id_ref;
6593 CHECK(*((uint32_t*)their_node_id) == 33);
6594 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6595 LDKUpdateFailMalformedHTLC msg_conv;
6596 msg_conv.inner = (void*)(msg & (~1));
6597 msg_conv.is_owned = false;
6598 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6601 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6602 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6603 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6604 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6605 LDKPublicKey their_node_id_ref;
6606 CHECK(*((uint32_t*)their_node_id) == 33);
6607 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6608 LDKCommitmentSigned msg_conv;
6609 msg_conv.inner = (void*)(msg & (~1));
6610 msg_conv.is_owned = false;
6611 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6614 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6615 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6616 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6617 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6618 LDKPublicKey their_node_id_ref;
6619 CHECK(*((uint32_t*)their_node_id) == 33);
6620 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6621 LDKRevokeAndACK msg_conv;
6622 msg_conv.inner = (void*)(msg & (~1));
6623 msg_conv.is_owned = false;
6624 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6627 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6628 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6629 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6630 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6631 LDKPublicKey their_node_id_ref;
6632 CHECK(*((uint32_t*)their_node_id) == 33);
6633 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6634 LDKUpdateFee msg_conv;
6635 msg_conv.inner = (void*)(msg & (~1));
6636 msg_conv.is_owned = false;
6637 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6640 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6641 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6642 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6643 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6644 LDKPublicKey their_node_id_ref;
6645 CHECK(*((uint32_t*)their_node_id) == 33);
6646 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6647 LDKAnnouncementSignatures msg_conv;
6648 msg_conv.inner = (void*)(msg & (~1));
6649 msg_conv.is_owned = false;
6650 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6653 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
6654 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6655 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6656 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6657 LDKPublicKey their_node_id_ref;
6658 CHECK(*((uint32_t*)their_node_id) == 33);
6659 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6660 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
6663 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6664 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6665 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6666 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6667 LDKPublicKey their_node_id_ref;
6668 CHECK(*((uint32_t*)their_node_id) == 33);
6669 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6671 msg_conv.inner = (void*)(msg & (~1));
6672 msg_conv.is_owned = false;
6673 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6676 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6677 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6678 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6679 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6680 LDKPublicKey their_node_id_ref;
6681 CHECK(*((uint32_t*)their_node_id) == 33);
6682 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6683 LDKChannelReestablish msg_conv;
6684 msg_conv.inner = (void*)(msg & (~1));
6685 msg_conv.is_owned = false;
6686 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6689 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6690 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6691 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6692 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6693 LDKPublicKey their_node_id_ref;
6694 CHECK(*((uint32_t*)their_node_id) == 33);
6695 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6696 LDKChannelUpdate msg_conv;
6697 msg_conv.inner = (void*)(msg & (~1));
6698 msg_conv.is_owned = false;
6699 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6702 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6703 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6704 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6705 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6706 LDKPublicKey their_node_id_ref;
6707 CHECK(*((uint32_t*)their_node_id) == 33);
6708 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6709 LDKErrorMessage msg_conv;
6710 msg_conv.inner = (void*)(msg & (~1));
6711 msg_conv.is_owned = false;
6712 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6715 typedef struct LDKRoutingMessageHandler_JCalls {
6716 atomic_size_t refcnt;
6717 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6718 uint32_t handle_node_announcement_meth;
6719 uint32_t handle_channel_announcement_meth;
6720 uint32_t handle_channel_update_meth;
6721 uint32_t get_next_channel_announcements_meth;
6722 uint32_t get_next_node_announcements_meth;
6723 uint32_t sync_routing_table_meth;
6724 uint32_t handle_reply_channel_range_meth;
6725 uint32_t handle_reply_short_channel_ids_end_meth;
6726 uint32_t handle_query_channel_range_meth;
6727 uint32_t handle_query_short_channel_ids_meth;
6728 } LDKRoutingMessageHandler_JCalls;
6729 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
6730 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6731 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6732 js_free(j_calls->handle_node_announcement_meth);
6733 js_free(j_calls->handle_channel_announcement_meth);
6734 js_free(j_calls->handle_channel_update_meth);
6735 js_free(j_calls->get_next_channel_announcements_meth);
6736 js_free(j_calls->get_next_node_announcements_meth);
6737 js_free(j_calls->sync_routing_table_meth);
6738 js_free(j_calls->handle_reply_channel_range_meth);
6739 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
6740 js_free(j_calls->handle_query_channel_range_meth);
6741 js_free(j_calls->handle_query_short_channel_ids_meth);
6745 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
6746 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6747 LDKNodeAnnouncement msg_var = *msg;
6748 msg_var = NodeAnnouncement_clone(msg);
6749 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6750 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6751 uint64_t msg_ref = (uint64_t)msg_var.inner;
6752 if (msg_var.is_owned) {
6755 uint32_t ret = js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
6756 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6757 CHECK_ACCESS(ret_ptr);
6758 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
6759 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6762 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
6763 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6764 LDKChannelAnnouncement msg_var = *msg;
6765 msg_var = ChannelAnnouncement_clone(msg);
6766 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6767 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6768 uint64_t msg_ref = (uint64_t)msg_var.inner;
6769 if (msg_var.is_owned) {
6772 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
6773 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6774 CHECK_ACCESS(ret_ptr);
6775 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
6776 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6779 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
6780 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6781 LDKChannelUpdate msg_var = *msg;
6782 msg_var = ChannelUpdate_clone(msg);
6783 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6784 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6785 uint64_t msg_ref = (uint64_t)msg_var.inner;
6786 if (msg_var.is_owned) {
6789 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
6790 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6791 CHECK_ACCESS(ret_ptr);
6792 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
6793 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6796 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
6797 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6798 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
6799 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
6800 ret_constr.datalen = *((uint32_t*)ret);
6801 if (ret_constr.datalen > 0)
6802 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6804 ret_constr.data = NULL;
6805 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6806 for (size_t h = 0; h < ret_constr.datalen; h++) {
6807 uint32_t ret_conv_59 = ret_vals[h];
6808 void* ret_conv_59_ptr = (void*)(((uint64_t)ret_conv_59) & ~1);
6809 CHECK_ACCESS(ret_conv_59_ptr);
6810 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
6811 ret_conv_59_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_59) & ~1));
6812 ret_constr.data[h] = ret_conv_59_conv;
6816 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
6817 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6818 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6819 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
6820 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
6821 LDKCVec_NodeAnnouncementZ ret_constr;
6822 ret_constr.datalen = *((uint32_t*)ret);
6823 if (ret_constr.datalen > 0)
6824 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6826 ret_constr.data = NULL;
6827 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6828 for (size_t s = 0; s < ret_constr.datalen; s++) {
6829 uint32_t ret_conv_18 = ret_vals[s];
6830 LDKNodeAnnouncement ret_conv_18_conv;
6831 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
6832 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
6833 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
6834 ret_constr.data[s] = ret_conv_18_conv;
6838 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
6839 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6840 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6841 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6842 LDKInit init_var = *init;
6843 init_var = Init_clone(init);
6844 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6845 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6846 uint64_t init_ref = (uint64_t)init_var.inner;
6847 if (init_var.is_owned) {
6850 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
6852 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
6853 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6854 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6855 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6856 LDKReplyChannelRange msg_var = msg;
6857 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6858 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6859 uint64_t msg_ref = (uint64_t)msg_var.inner;
6860 if (msg_var.is_owned) {
6863 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
6864 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6865 CHECK_ACCESS(ret_ptr);
6866 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6867 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6870 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
6871 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6872 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6873 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6874 LDKReplyShortChannelIdsEnd msg_var = msg;
6875 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6876 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6877 uint64_t msg_ref = (uint64_t)msg_var.inner;
6878 if (msg_var.is_owned) {
6881 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
6882 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6883 CHECK_ACCESS(ret_ptr);
6884 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6885 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6888 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
6889 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6890 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6891 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6892 LDKQueryChannelRange msg_var = msg;
6893 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6894 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6895 uint64_t msg_ref = (uint64_t)msg_var.inner;
6896 if (msg_var.is_owned) {
6899 uint32_t ret = js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
6900 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6901 CHECK_ACCESS(ret_ptr);
6902 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6903 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6906 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
6907 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6908 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6909 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6910 LDKQueryShortChannelIds msg_var = msg;
6911 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6912 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6913 uint64_t msg_ref = (uint64_t)msg_var.inner;
6914 if (msg_var.is_owned) {
6917 uint32_t ret = js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
6918 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6919 CHECK_ACCESS(ret_ptr);
6920 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6921 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6924 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
6925 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
6926 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6927 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6929 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6930 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
6931 atomic_init(&calls->refcnt, 1);
6932 //TODO: Assign calls->o from o
6934 LDKRoutingMessageHandler ret = {
6935 .this_arg = (void*) calls,
6936 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
6937 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
6938 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
6939 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
6940 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
6941 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
6942 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
6943 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
6944 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
6945 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
6946 .free = LDKRoutingMessageHandler_JCalls_free,
6947 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6949 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6952 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6953 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
6954 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
6955 return (long)res_ptr;
6957 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
6958 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6959 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6960 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6961 LDKNodeAnnouncement msg_conv;
6962 msg_conv.inner = (void*)(msg & (~1));
6963 msg_conv.is_owned = false;
6964 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6965 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
6966 return (uint64_t)ret_conv;
6969 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
6970 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6971 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6972 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6973 LDKChannelAnnouncement msg_conv;
6974 msg_conv.inner = (void*)(msg & (~1));
6975 msg_conv.is_owned = false;
6976 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6977 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
6978 return (uint64_t)ret_conv;
6981 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
6982 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6983 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6984 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6985 LDKChannelUpdate msg_conv;
6986 msg_conv.inner = (void*)(msg & (~1));
6987 msg_conv.is_owned = false;
6988 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6989 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
6990 return (uint64_t)ret_conv;
6993 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
6994 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6995 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6996 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6997 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
6998 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6999 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7000 for (size_t h = 0; h < ret_var.datalen; h++) {
7001 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
7002 *ret_conv_59_conv = ret_var.data[h];
7003 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
7009 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
7010 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7011 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7012 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7013 LDKPublicKey starting_point_ref;
7014 CHECK(*((uint32_t*)starting_point) == 33);
7015 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
7016 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
7017 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7018 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7019 for (size_t s = 0; s < ret_var.datalen; s++) {
7020 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
7021 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7022 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7023 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
7024 if (ret_conv_18_var.is_owned) {
7025 ret_conv_18_ref |= 1;
7027 ret_arr_ptr[s] = ret_conv_18_ref;
7033 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
7034 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7035 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7036 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7037 LDKPublicKey their_node_id_ref;
7038 CHECK(*((uint32_t*)their_node_id) == 33);
7039 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7041 init_conv.inner = (void*)(init & (~1));
7042 init_conv.is_owned = false;
7043 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
7046 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7047 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7048 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7049 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7050 LDKPublicKey their_node_id_ref;
7051 CHECK(*((uint32_t*)their_node_id) == 33);
7052 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7053 LDKReplyChannelRange msg_conv;
7054 msg_conv.inner = (void*)(msg & (~1));
7055 msg_conv.is_owned = (msg & 1) || (msg == 0);
7056 msg_conv = ReplyChannelRange_clone(&msg_conv);
7057 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7058 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7059 return (uint64_t)ret_conv;
7062 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) {
7063 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7064 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7065 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7066 LDKPublicKey their_node_id_ref;
7067 CHECK(*((uint32_t*)their_node_id) == 33);
7068 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7069 LDKReplyShortChannelIdsEnd msg_conv;
7070 msg_conv.inner = (void*)(msg & (~1));
7071 msg_conv.is_owned = (msg & 1) || (msg == 0);
7072 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
7073 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7074 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7075 return (uint64_t)ret_conv;
7078 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7079 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7080 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7081 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7082 LDKPublicKey their_node_id_ref;
7083 CHECK(*((uint32_t*)their_node_id) == 33);
7084 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7085 LDKQueryChannelRange msg_conv;
7086 msg_conv.inner = (void*)(msg & (~1));
7087 msg_conv.is_owned = (msg & 1) || (msg == 0);
7088 msg_conv = QueryChannelRange_clone(&msg_conv);
7089 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7090 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7091 return (uint64_t)ret_conv;
7094 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7095 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7096 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7097 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7098 LDKPublicKey their_node_id_ref;
7099 CHECK(*((uint32_t*)their_node_id) == 33);
7100 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7101 LDKQueryShortChannelIds msg_conv;
7102 msg_conv.inner = (void*)(msg & (~1));
7103 msg_conv.is_owned = (msg & 1) || (msg == 0);
7104 msg_conv = QueryShortChannelIds_clone(&msg_conv);
7105 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7106 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7107 return (uint64_t)ret_conv;
7110 typedef struct LDKCustomMessageReader_JCalls {
7111 atomic_size_t refcnt;
7113 } LDKCustomMessageReader_JCalls;
7114 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
7115 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
7116 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7117 js_free(j_calls->read_meth);
7121 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
7122 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
7123 LDKu8slice buffer_var = buffer;
7124 int8_tArray buffer_arr = init_arr(buffer_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7125 memcpy((uint8_t*)(buffer_arr + 4), buffer_var.data, buffer_var.datalen);
7126 uint32_t ret = js_invoke_function_2(j_calls->read_meth, message_type, buffer_arr);
7127 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7128 CHECK_ACCESS(ret_ptr);
7129 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
7130 ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
7133 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
7134 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
7135 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7137 static inline LDKCustomMessageReader LDKCustomMessageReader_init (/*TODO: JS Object Reference */void* o) {
7138 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
7139 atomic_init(&calls->refcnt, 1);
7140 //TODO: Assign calls->o from o
7142 LDKCustomMessageReader ret = {
7143 .this_arg = (void*) calls,
7144 .read = read_LDKCustomMessageReader_jcall,
7145 .free = LDKCustomMessageReader_JCalls_free,
7149 long __attribute__((visibility("default"))) TS_LDKCustomMessageReader_new(/*TODO: JS Object Reference */void* o) {
7150 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
7151 *res_ptr = LDKCustomMessageReader_init(o);
7152 return (long)res_ptr;
7154 uint32_t __attribute__((visibility("default"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
7155 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7156 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7157 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
7158 LDKu8slice buffer_ref;
7159 buffer_ref.datalen = *((uint32_t*)buffer);
7160 buffer_ref.data = (int8_t*)(buffer + 4);
7161 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
7162 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
7163 return (uint64_t)ret_conv;
7166 typedef struct LDKCustomMessageHandler_JCalls {
7167 atomic_size_t refcnt;
7168 LDKCustomMessageReader_JCalls* CustomMessageReader;
7169 uint32_t handle_custom_message_meth;
7170 uint32_t get_and_clear_pending_msg_meth;
7171 } LDKCustomMessageHandler_JCalls;
7172 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
7173 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7174 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7175 js_free(j_calls->handle_custom_message_meth);
7176 js_free(j_calls->get_and_clear_pending_msg_meth);
7180 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
7181 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7182 LDKType* msg_ret =MALLOC(sizeof(LDKType), "LDKType");
7184 int8_tArray sender_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7185 memcpy((uint8_t*)(sender_node_id_arr + 4), sender_node_id.compressed_form, 33);
7186 uint32_t ret = js_invoke_function_2(j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
7187 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7188 CHECK_ACCESS(ret_ptr);
7189 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7190 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
7193 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
7194 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7195 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_meth);
7196 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
7197 ret_constr.datalen = *((uint32_t*)ret);
7198 if (ret_constr.datalen > 0)
7199 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
7201 ret_constr.data = NULL;
7202 uint32_t* ret_vals = (uint32_t*)(ret + 4);
7203 for (size_t z = 0; z < ret_constr.datalen; z++) {
7204 uint32_t ret_conv_25 = ret_vals[z];
7205 void* ret_conv_25_ptr = (void*)(((uint64_t)ret_conv_25) & ~1);
7206 CHECK_ACCESS(ret_conv_25_ptr);
7207 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
7208 ret_conv_25_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_25) & ~1));
7209 ret_constr.data[z] = ret_conv_25_conv;
7213 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
7214 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
7215 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7216 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
7218 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* CustomMessageReader) {
7219 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
7220 atomic_init(&calls->refcnt, 1);
7221 //TODO: Assign calls->o from o
7223 LDKCustomMessageHandler ret = {
7224 .this_arg = (void*) calls,
7225 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
7226 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
7227 .free = LDKCustomMessageHandler_JCalls_free,
7228 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
7230 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
7233 long __attribute__((visibility("default"))) TS_LDKCustomMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* CustomMessageReader) {
7234 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
7235 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
7236 return (long)res_ptr;
7238 uint32_t __attribute__((visibility("default"))) TS_CustomMessageHandler_handle_custom_message(uint32_t this_arg, uint32_t msg, int8_tArray sender_node_id) {
7239 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7240 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7241 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
7242 void* msg_ptr = (void*)(((uint64_t)msg) & ~1);
7243 CHECK_ACCESS(msg_ptr);
7244 LDKType msg_conv = *(LDKType*)(msg_ptr);
7245 LDKPublicKey sender_node_id_ref;
7246 CHECK(*((uint32_t*)sender_node_id) == 33);
7247 memcpy(sender_node_id_ref.compressed_form, (uint8_t*)(sender_node_id + 4), 33);
7248 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7249 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
7250 return (uint64_t)ret_conv;
7253 uint32_tArray __attribute__((visibility("default"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
7254 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7255 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7256 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
7257 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
7258 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7259 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7260 for (size_t z = 0; z < ret_var.datalen; z++) {
7261 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
7262 *ret_conv_25_conv = ret_var.data[z];
7263 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
7269 typedef struct LDKSocketDescriptor_JCalls {
7270 atomic_size_t refcnt;
7271 uint32_t send_data_meth;
7272 uint32_t disconnect_socket_meth;
7275 } LDKSocketDescriptor_JCalls;
7276 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
7277 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7278 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7279 js_free(j_calls->send_data_meth);
7280 js_free(j_calls->disconnect_socket_meth);
7281 js_free(j_calls->eq_meth);
7282 js_free(j_calls->hash_meth);
7286 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
7287 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7288 LDKu8slice data_var = data;
7289 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7290 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
7291 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
7293 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
7294 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7295 js_invoke_function_0(j_calls->disconnect_socket_meth);
7297 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
7298 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7299 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
7300 *other_arg_clone = SocketDescriptor_clone(other_arg);
7301 return js_invoke_function_1(j_calls->eq_meth, (uint64_t)other_arg_clone);
7303 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
7304 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7305 return js_invoke_function_0(j_calls->hash_meth);
7307 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
7308 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
7309 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7311 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
7312 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
7313 atomic_init(&calls->refcnt, 1);
7314 //TODO: Assign calls->o from o
7316 LDKSocketDescriptor ret = {
7317 .this_arg = (void*) calls,
7318 .send_data = send_data_LDKSocketDescriptor_jcall,
7319 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
7320 .eq = eq_LDKSocketDescriptor_jcall,
7321 .hash = hash_LDKSocketDescriptor_jcall,
7322 .cloned = LDKSocketDescriptor_JCalls_cloned,
7323 .free = LDKSocketDescriptor_JCalls_free,
7327 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
7328 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
7329 *res_ptr = LDKSocketDescriptor_init(o);
7330 return (long)res_ptr;
7332 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
7333 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7334 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7335 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7336 LDKu8slice data_ref;
7337 data_ref.datalen = *((uint32_t*)data);
7338 data_ref.data = (int8_t*)(data + 4);
7339 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
7343 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
7344 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7345 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7346 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7347 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
7350 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
7351 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7352 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7353 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7354 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
7358 typedef struct LDKScore_JCalls {
7359 atomic_size_t refcnt;
7360 uint32_t channel_penalty_msat_meth;
7362 static void LDKScore_JCalls_free(void* this_arg) {
7363 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7364 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7365 js_free(j_calls->channel_penalty_msat_meth);
7369 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id) {
7370 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7371 return js_invoke_function_1(j_calls->channel_penalty_msat_meth, short_channel_id);
7373 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
7374 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
7375 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7377 static inline LDKScore LDKScore_init (/*TODO: JS Object Reference */void* o) {
7378 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
7379 atomic_init(&calls->refcnt, 1);
7380 //TODO: Assign calls->o from o
7383 .this_arg = (void*) calls,
7384 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
7385 .free = LDKScore_JCalls_free,
7389 long __attribute__((visibility("default"))) TS_LDKScore_new(/*TODO: JS Object Reference */void* o) {
7390 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
7391 *res_ptr = LDKScore_init(o);
7392 return (long)res_ptr;
7394 int64_t __attribute__((visibility("default"))) TS_Score_channel_penalty_msat(uint32_t this_arg, int64_t short_channel_id) {
7395 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7396 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7397 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7398 int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id);
7402 typedef struct LDKChannelManagerPersister_JCalls {
7403 atomic_size_t refcnt;
7404 uint32_t persist_manager_meth;
7405 } LDKChannelManagerPersister_JCalls;
7406 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
7407 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
7408 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7409 js_free(j_calls->persist_manager_meth);
7413 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
7414 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
7415 LDKChannelManager channel_manager_var = *channel_manager;
7416 // Warning: we may need a move here but no clone is available for LDKChannelManager
7417 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7418 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7419 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
7420 if (channel_manager_var.is_owned) {
7421 channel_manager_ref |= 1;
7423 uint32_t ret = js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
7424 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7425 CHECK_ACCESS(ret_ptr);
7426 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
7427 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
7430 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
7431 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
7432 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7434 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (/*TODO: JS Object Reference */void* o) {
7435 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
7436 atomic_init(&calls->refcnt, 1);
7437 //TODO: Assign calls->o from o
7439 LDKChannelManagerPersister ret = {
7440 .this_arg = (void*) calls,
7441 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
7442 .free = LDKChannelManagerPersister_JCalls_free,
7446 long __attribute__((visibility("default"))) TS_LDKChannelManagerPersister_new(/*TODO: JS Object Reference */void* o) {
7447 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
7448 *res_ptr = LDKChannelManagerPersister_init(o);
7449 return (long)res_ptr;
7451 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerPersister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
7452 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7453 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7454 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)this_arg_ptr;
7455 LDKChannelManager channel_manager_conv;
7456 channel_manager_conv.inner = (void*)(channel_manager & (~1));
7457 channel_manager_conv.is_owned = false;
7458 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7459 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
7460 return (uint64_t)ret_conv;
7463 uint32_t __attribute__((visibility("default"))) TS_LDKFallback_ref_from_ptr(uint32_t ptr) {
7464 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
7466 case LDKFallback_SegWitProgram: {
7467 uint8_t version_val = obj->seg_wit_program.version._0;
7468 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
7469 int8_tArray program_arr = init_arr(program_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7470 memcpy((uint8_t*)(program_arr + 4), program_var.data, program_var.datalen);
7471 return 0 /* LDKFallback - SegWitProgram */; (void) version_val; (void) program_arr;
7473 case LDKFallback_PubKeyHash: {
7474 int8_tArray pub_key_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7475 memcpy((uint8_t*)(pub_key_hash_arr + 4), obj->pub_key_hash.data, 20);
7476 return 0 /* LDKFallback - PubKeyHash */; (void) pub_key_hash_arr;
7478 case LDKFallback_ScriptHash: {
7479 int8_tArray script_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7480 memcpy((uint8_t*)(script_hash_arr + 4), obj->script_hash.data, 20);
7481 return 0 /* LDKFallback - ScriptHash */; (void) script_hash_arr;
7486 jstring __attribute__((visibility("default"))) TS__ldk_get_compiled_version() {
7487 LDKStr ret_str = _ldk_get_compiled_version();
7488 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7493 jstring __attribute__((visibility("default"))) TS__ldk_c_bindings_get_compiled_version() {
7494 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
7495 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7500 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
7501 LDKTransaction _res_ref;
7502 _res_ref.datalen = *((uint32_t*)_res);
7503 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
7504 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
7505 _res_ref.data_is_owned = true;
7506 Transaction_free(_res_ref);
7509 uint32_t __attribute__((visibility("default"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
7510 LDKCVec_u8Z script_pubkey_ref;
7511 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
7512 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
7513 memcpy(script_pubkey_ref.data, (uint8_t*)(script_pubkey + 4), script_pubkey_ref.datalen);
7514 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7515 *ret_ref = TxOut_new(script_pubkey_ref, value);
7516 return (uint64_t)ret_ref;
7519 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
7520 if ((_res & 1) != 0) return;
7521 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7522 CHECK_ACCESS(_res_ptr);
7523 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
7525 TxOut_free(_res_conv);
7528 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
7529 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
7530 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7531 *ret_ref = TxOut_clone(orig_conv);
7532 return (uint64_t)ret_ref;
7535 void __attribute__((visibility("default"))) TS_Str_free(jstring _res) {
7536 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
7540 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
7542 CHECK(*((uint32_t*)o) == 32);
7543 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
7544 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
7545 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
7546 return (uint64_t)ret_conv;
7549 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
7550 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7551 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
7552 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
7553 return (uint64_t)ret_conv;
7556 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
7557 if ((_res & 1) != 0) return;
7558 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7559 CHECK_ACCESS(_res_ptr);
7560 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
7562 CResult_SecretKeyErrorZ_free(_res_conv);
7565 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
7567 CHECK(*((uint32_t*)o) == 33);
7568 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
7569 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7570 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
7571 return (uint64_t)ret_conv;
7574 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
7575 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7576 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7577 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
7578 return (uint64_t)ret_conv;
7581 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
7582 if ((_res & 1) != 0) return;
7583 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7584 CHECK_ACCESS(_res_ptr);
7585 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
7587 CResult_PublicKeyErrorZ_free(_res_conv);
7590 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
7591 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
7592 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7593 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
7594 return (uint64_t)ret_conv;
7597 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
7598 LDKTxCreationKeys o_conv;
7599 o_conv.inner = (void*)(o & (~1));
7600 o_conv.is_owned = (o & 1) || (o == 0);
7601 o_conv = TxCreationKeys_clone(&o_conv);
7602 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7603 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
7604 return (uint64_t)ret_conv;
7607 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
7608 LDKDecodeError e_conv;
7609 e_conv.inner = (void*)(e & (~1));
7610 e_conv.is_owned = (e & 1) || (e == 0);
7611 e_conv = DecodeError_clone(&e_conv);
7612 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7613 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
7614 return (uint64_t)ret_conv;
7617 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
7618 if ((_res & 1) != 0) return;
7619 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7620 CHECK_ACCESS(_res_ptr);
7621 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
7623 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
7626 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
7627 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
7628 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7629 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
7630 return (uint64_t)ret_conv;
7633 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
7634 LDKChannelPublicKeys o_conv;
7635 o_conv.inner = (void*)(o & (~1));
7636 o_conv.is_owned = (o & 1) || (o == 0);
7637 o_conv = ChannelPublicKeys_clone(&o_conv);
7638 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7639 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
7640 return (uint64_t)ret_conv;
7643 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
7644 LDKDecodeError e_conv;
7645 e_conv.inner = (void*)(e & (~1));
7646 e_conv.is_owned = (e & 1) || (e == 0);
7647 e_conv = DecodeError_clone(&e_conv);
7648 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7649 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
7650 return (uint64_t)ret_conv;
7653 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
7654 if ((_res & 1) != 0) return;
7655 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7656 CHECK_ACCESS(_res_ptr);
7657 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
7659 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
7662 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
7663 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
7664 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7665 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
7666 return (uint64_t)ret_conv;
7669 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
7670 LDKTxCreationKeys o_conv;
7671 o_conv.inner = (void*)(o & (~1));
7672 o_conv.is_owned = (o & 1) || (o == 0);
7673 o_conv = TxCreationKeys_clone(&o_conv);
7674 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7675 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
7676 return (uint64_t)ret_conv;
7679 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
7680 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7681 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7682 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
7683 return (uint64_t)ret_conv;
7686 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
7687 if ((_res & 1) != 0) return;
7688 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7689 CHECK_ACCESS(_res_ptr);
7690 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
7692 CResult_TxCreationKeysErrorZ_free(_res_conv);
7695 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
7696 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
7697 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7698 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
7699 return (uint64_t)ret_conv;
7702 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
7703 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7704 *ret_copy = COption_u32Z_some(o);
7705 uint64_t ret_ref = (uint64_t)ret_copy;
7709 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
7710 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7711 *ret_copy = COption_u32Z_none();
7712 uint64_t ret_ref = (uint64_t)ret_copy;
7716 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
7717 if ((_res & 1) != 0) return;
7718 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7719 CHECK_ACCESS(_res_ptr);
7720 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
7722 COption_u32Z_free(_res_conv);
7725 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
7726 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
7727 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7728 *ret_copy = COption_u32Z_clone(orig_conv);
7729 uint64_t ret_ref = (uint64_t)ret_copy;
7733 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
7734 LDKHTLCOutputInCommitment o_conv;
7735 o_conv.inner = (void*)(o & (~1));
7736 o_conv.is_owned = (o & 1) || (o == 0);
7737 o_conv = HTLCOutputInCommitment_clone(&o_conv);
7738 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7739 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
7740 return (uint64_t)ret_conv;
7743 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
7744 LDKDecodeError e_conv;
7745 e_conv.inner = (void*)(e & (~1));
7746 e_conv.is_owned = (e & 1) || (e == 0);
7747 e_conv = DecodeError_clone(&e_conv);
7748 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7749 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
7750 return (uint64_t)ret_conv;
7753 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
7754 if ((_res & 1) != 0) return;
7755 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7756 CHECK_ACCESS(_res_ptr);
7757 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
7759 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
7762 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
7763 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
7764 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7765 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
7766 return (uint64_t)ret_conv;
7769 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
7770 LDKCounterpartyChannelTransactionParameters o_conv;
7771 o_conv.inner = (void*)(o & (~1));
7772 o_conv.is_owned = (o & 1) || (o == 0);
7773 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
7774 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7775 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
7776 return (uint64_t)ret_conv;
7779 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
7780 LDKDecodeError e_conv;
7781 e_conv.inner = (void*)(e & (~1));
7782 e_conv.is_owned = (e & 1) || (e == 0);
7783 e_conv = DecodeError_clone(&e_conv);
7784 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7785 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
7786 return (uint64_t)ret_conv;
7789 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
7790 if ((_res & 1) != 0) return;
7791 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7792 CHECK_ACCESS(_res_ptr);
7793 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
7795 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
7798 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
7799 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
7800 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7801 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
7802 return (uint64_t)ret_conv;
7805 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
7806 LDKChannelTransactionParameters o_conv;
7807 o_conv.inner = (void*)(o & (~1));
7808 o_conv.is_owned = (o & 1) || (o == 0);
7809 o_conv = ChannelTransactionParameters_clone(&o_conv);
7810 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7811 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
7812 return (uint64_t)ret_conv;
7815 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
7816 LDKDecodeError e_conv;
7817 e_conv.inner = (void*)(e & (~1));
7818 e_conv.is_owned = (e & 1) || (e == 0);
7819 e_conv = DecodeError_clone(&e_conv);
7820 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7821 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
7822 return (uint64_t)ret_conv;
7825 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
7826 if ((_res & 1) != 0) return;
7827 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7828 CHECK_ACCESS(_res_ptr);
7829 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
7831 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
7834 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
7835 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
7836 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7837 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
7838 return (uint64_t)ret_conv;
7841 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
7842 LDKCVec_SignatureZ _res_constr;
7843 _res_constr.datalen = *((uint32_t*)_res);
7844 if (_res_constr.datalen > 0)
7845 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7847 _res_constr.data = NULL;
7848 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7849 for (size_t m = 0; m < _res_constr.datalen; m++) {
7850 int8_tArray _res_conv_12 = _res_vals[m];
7851 LDKSignature _res_conv_12_ref;
7852 CHECK(*((uint32_t*)_res_conv_12) == 64);
7853 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
7854 _res_constr.data[m] = _res_conv_12_ref;
7856 CVec_SignatureZ_free(_res_constr);
7859 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7860 LDKHolderCommitmentTransaction o_conv;
7861 o_conv.inner = (void*)(o & (~1));
7862 o_conv.is_owned = (o & 1) || (o == 0);
7863 o_conv = HolderCommitmentTransaction_clone(&o_conv);
7864 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7865 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
7866 return (uint64_t)ret_conv;
7869 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7870 LDKDecodeError e_conv;
7871 e_conv.inner = (void*)(e & (~1));
7872 e_conv.is_owned = (e & 1) || (e == 0);
7873 e_conv = DecodeError_clone(&e_conv);
7874 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7875 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
7876 return (uint64_t)ret_conv;
7879 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7880 if ((_res & 1) != 0) return;
7881 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7882 CHECK_ACCESS(_res_ptr);
7883 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
7885 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
7888 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7889 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
7890 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7891 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
7892 return (uint64_t)ret_conv;
7895 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7896 LDKBuiltCommitmentTransaction o_conv;
7897 o_conv.inner = (void*)(o & (~1));
7898 o_conv.is_owned = (o & 1) || (o == 0);
7899 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
7900 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7901 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
7902 return (uint64_t)ret_conv;
7905 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7906 LDKDecodeError e_conv;
7907 e_conv.inner = (void*)(e & (~1));
7908 e_conv.is_owned = (e & 1) || (e == 0);
7909 e_conv = DecodeError_clone(&e_conv);
7910 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7911 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
7912 return (uint64_t)ret_conv;
7915 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7916 if ((_res & 1) != 0) return;
7917 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7918 CHECK_ACCESS(_res_ptr);
7919 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
7921 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
7924 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7925 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
7926 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7927 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
7928 return (uint64_t)ret_conv;
7931 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
7932 LDKTrustedClosingTransaction o_conv;
7933 o_conv.inner = (void*)(o & (~1));
7934 o_conv.is_owned = (o & 1) || (o == 0);
7935 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
7936 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
7937 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
7938 return (uint64_t)ret_conv;
7941 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
7942 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
7943 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
7944 return (uint64_t)ret_conv;
7947 void __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
7948 if ((_res & 1) != 0) return;
7949 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7950 CHECK_ACCESS(_res_ptr);
7951 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
7953 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
7956 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7957 LDKCommitmentTransaction o_conv;
7958 o_conv.inner = (void*)(o & (~1));
7959 o_conv.is_owned = (o & 1) || (o == 0);
7960 o_conv = CommitmentTransaction_clone(&o_conv);
7961 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7962 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
7963 return (uint64_t)ret_conv;
7966 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7967 LDKDecodeError e_conv;
7968 e_conv.inner = (void*)(e & (~1));
7969 e_conv.is_owned = (e & 1) || (e == 0);
7970 e_conv = DecodeError_clone(&e_conv);
7971 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7972 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
7973 return (uint64_t)ret_conv;
7976 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7977 if ((_res & 1) != 0) return;
7978 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7979 CHECK_ACCESS(_res_ptr);
7980 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
7982 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
7985 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7986 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
7987 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7988 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
7989 return (uint64_t)ret_conv;
7992 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
7993 LDKTrustedCommitmentTransaction o_conv;
7994 o_conv.inner = (void*)(o & (~1));
7995 o_conv.is_owned = (o & 1) || (o == 0);
7996 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
7997 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
7998 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
7999 return (uint64_t)ret_conv;
8002 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
8003 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
8004 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
8005 return (uint64_t)ret_conv;
8008 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
8009 if ((_res & 1) != 0) return;
8010 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8011 CHECK_ACCESS(_res_ptr);
8012 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
8014 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
8017 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
8018 LDKCVec_SignatureZ o_constr;
8019 o_constr.datalen = *((uint32_t*)o);
8020 if (o_constr.datalen > 0)
8021 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8023 o_constr.data = NULL;
8024 int8_tArray* o_vals = (int8_tArray*)(o + 4);
8025 for (size_t m = 0; m < o_constr.datalen; m++) {
8026 int8_tArray o_conv_12 = o_vals[m];
8027 LDKSignature o_conv_12_ref;
8028 CHECK(*((uint32_t*)o_conv_12) == 64);
8029 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
8030 o_constr.data[m] = o_conv_12_ref;
8032 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8033 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
8034 return (uint64_t)ret_conv;
8037 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
8038 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8039 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
8040 return (uint64_t)ret_conv;
8043 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
8044 if ((_res & 1) != 0) return;
8045 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8046 CHECK_ACCESS(_res_ptr);
8047 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
8049 CResult_CVec_SignatureZNoneZ_free(_res_conv);
8052 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
8053 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
8054 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8055 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
8056 return (uint64_t)ret_conv;
8059 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
8060 LDKShutdownScript o_conv;
8061 o_conv.inner = (void*)(o & (~1));
8062 o_conv.is_owned = (o & 1) || (o == 0);
8063 o_conv = ShutdownScript_clone(&o_conv);
8064 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8065 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
8066 return (uint64_t)ret_conv;
8069 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
8070 LDKDecodeError e_conv;
8071 e_conv.inner = (void*)(e & (~1));
8072 e_conv.is_owned = (e & 1) || (e == 0);
8073 e_conv = DecodeError_clone(&e_conv);
8074 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8075 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
8076 return (uint64_t)ret_conv;
8079 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
8080 if ((_res & 1) != 0) return;
8081 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8082 CHECK_ACCESS(_res_ptr);
8083 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
8085 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
8088 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
8089 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
8090 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8091 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
8092 return (uint64_t)ret_conv;
8095 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
8096 LDKShutdownScript o_conv;
8097 o_conv.inner = (void*)(o & (~1));
8098 o_conv.is_owned = (o & 1) || (o == 0);
8099 o_conv = ShutdownScript_clone(&o_conv);
8100 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8101 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
8102 return (uint64_t)ret_conv;
8105 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
8106 LDKInvalidShutdownScript e_conv;
8107 e_conv.inner = (void*)(e & (~1));
8108 e_conv.is_owned = (e & 1) || (e == 0);
8109 e_conv = InvalidShutdownScript_clone(&e_conv);
8110 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8111 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
8112 return (uint64_t)ret_conv;
8115 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
8116 if ((_res & 1) != 0) return;
8117 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8118 CHECK_ACCESS(_res_ptr);
8119 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
8121 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
8124 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint32_t orig) {
8125 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
8126 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8127 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
8128 return (uint64_t)ret_conv;
8131 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
8132 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8133 *ret_conv = CResult_NoneErrorZ_ok();
8134 return (uint64_t)ret_conv;
8137 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
8138 LDKIOError e_conv = LDKIOError_from_js(e);
8139 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8140 *ret_conv = CResult_NoneErrorZ_err(e_conv);
8141 return (uint64_t)ret_conv;
8144 void __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
8145 if ((_res & 1) != 0) return;
8146 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8147 CHECK_ACCESS(_res_ptr);
8148 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
8150 CResult_NoneErrorZ_free(_res_conv);
8153 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
8154 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
8155 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8156 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
8157 return (uint64_t)ret_conv;
8160 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
8162 o_conv.inner = (void*)(o & (~1));
8163 o_conv.is_owned = (o & 1) || (o == 0);
8164 o_conv = RouteHop_clone(&o_conv);
8165 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8166 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
8167 return (uint64_t)ret_conv;
8170 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
8171 LDKDecodeError e_conv;
8172 e_conv.inner = (void*)(e & (~1));
8173 e_conv.is_owned = (e & 1) || (e == 0);
8174 e_conv = DecodeError_clone(&e_conv);
8175 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8176 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
8177 return (uint64_t)ret_conv;
8180 void __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
8181 if ((_res & 1) != 0) return;
8182 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8183 CHECK_ACCESS(_res_ptr);
8184 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
8186 CResult_RouteHopDecodeErrorZ_free(_res_conv);
8189 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
8190 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
8191 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8192 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
8193 return (uint64_t)ret_conv;
8196 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
8197 LDKCVec_RouteHopZ _res_constr;
8198 _res_constr.datalen = *((uint32_t*)_res);
8199 if (_res_constr.datalen > 0)
8200 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8202 _res_constr.data = NULL;
8203 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8204 for (size_t k = 0; k < _res_constr.datalen; k++) {
8205 uint32_t _res_conv_10 = _res_vals[k];
8206 LDKRouteHop _res_conv_10_conv;
8207 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
8208 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
8209 _res_constr.data[k] = _res_conv_10_conv;
8211 CVec_RouteHopZ_free(_res_constr);
8214 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
8215 LDKCVec_CVec_RouteHopZZ _res_constr;
8216 _res_constr.datalen = *((uint32_t*)_res);
8217 if (_res_constr.datalen > 0)
8218 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
8220 _res_constr.data = NULL;
8221 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
8222 for (size_t m = 0; m < _res_constr.datalen; m++) {
8223 uint32_tArray _res_conv_12 = _res_vals[m];
8224 LDKCVec_RouteHopZ _res_conv_12_constr;
8225 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
8226 if (_res_conv_12_constr.datalen > 0)
8227 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8229 _res_conv_12_constr.data = NULL;
8230 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
8231 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
8232 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
8233 LDKRouteHop _res_conv_12_conv_10_conv;
8234 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
8235 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
8236 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
8238 _res_constr.data[m] = _res_conv_12_constr;
8240 CVec_CVec_RouteHopZZ_free(_res_constr);
8243 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
8245 o_conv.inner = (void*)(o & (~1));
8246 o_conv.is_owned = (o & 1) || (o == 0);
8247 o_conv = Route_clone(&o_conv);
8248 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8249 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
8250 return (uint64_t)ret_conv;
8253 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
8254 LDKDecodeError e_conv;
8255 e_conv.inner = (void*)(e & (~1));
8256 e_conv.is_owned = (e & 1) || (e == 0);
8257 e_conv = DecodeError_clone(&e_conv);
8258 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8259 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
8260 return (uint64_t)ret_conv;
8263 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
8264 if ((_res & 1) != 0) return;
8265 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8266 CHECK_ACCESS(_res_ptr);
8267 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
8269 CResult_RouteDecodeErrorZ_free(_res_conv);
8272 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
8273 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
8274 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8275 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
8276 return (uint64_t)ret_conv;
8279 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
8280 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
8281 *ret_copy = COption_u64Z_some(o);
8282 uint64_t ret_ref = (uint64_t)ret_copy;
8286 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
8287 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
8288 *ret_copy = COption_u64Z_none();
8289 uint64_t ret_ref = (uint64_t)ret_copy;
8293 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
8294 if ((_res & 1) != 0) return;
8295 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8296 CHECK_ACCESS(_res_ptr);
8297 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
8299 COption_u64Z_free(_res_conv);
8302 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
8303 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
8304 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
8305 *ret_copy = COption_u64Z_clone(orig_conv);
8306 uint64_t ret_ref = (uint64_t)ret_copy;
8310 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
8311 LDKCVec_ChannelDetailsZ _res_constr;
8312 _res_constr.datalen = *((uint32_t*)_res);
8313 if (_res_constr.datalen > 0)
8314 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8316 _res_constr.data = NULL;
8317 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8318 for (size_t q = 0; q < _res_constr.datalen; q++) {
8319 uint32_t _res_conv_16 = _res_vals[q];
8320 LDKChannelDetails _res_conv_16_conv;
8321 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8322 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8323 _res_constr.data[q] = _res_conv_16_conv;
8325 CVec_ChannelDetailsZ_free(_res_constr);
8328 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
8329 LDKCVec_RouteHintZ _res_constr;
8330 _res_constr.datalen = *((uint32_t*)_res);
8331 if (_res_constr.datalen > 0)
8332 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
8334 _res_constr.data = NULL;
8335 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8336 for (size_t l = 0; l < _res_constr.datalen; l++) {
8337 uint32_t _res_conv_11 = _res_vals[l];
8338 LDKRouteHint _res_conv_11_conv;
8339 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
8340 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
8341 _res_constr.data[l] = _res_conv_11_conv;
8343 CVec_RouteHintZ_free(_res_constr);
8346 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
8348 o_conv.inner = (void*)(o & (~1));
8349 o_conv.is_owned = (o & 1) || (o == 0);
8350 o_conv = Route_clone(&o_conv);
8351 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8352 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
8353 return (uint64_t)ret_conv;
8356 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
8357 LDKLightningError e_conv;
8358 e_conv.inner = (void*)(e & (~1));
8359 e_conv.is_owned = (e & 1) || (e == 0);
8360 e_conv = LightningError_clone(&e_conv);
8361 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8362 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
8363 return (uint64_t)ret_conv;
8366 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
8367 if ((_res & 1) != 0) return;
8368 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8369 CHECK_ACCESS(_res_ptr);
8370 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
8372 CResult_RouteLightningErrorZ_free(_res_conv);
8375 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
8376 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
8377 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8378 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
8379 return (uint64_t)ret_conv;
8382 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
8383 void* o_ptr = (void*)(((uint64_t)o) & ~1);
8384 CHECK_ACCESS(o_ptr);
8385 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
8386 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
8387 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8388 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
8389 return (uint64_t)ret_conv;
8392 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
8393 LDKAccessError e_conv = LDKAccessError_from_js(e);
8394 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8395 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
8396 return (uint64_t)ret_conv;
8399 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
8400 if ((_res & 1) != 0) return;
8401 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8402 CHECK_ACCESS(_res_ptr);
8403 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
8405 CResult_TxOutAccessErrorZ_free(_res_conv);
8408 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
8409 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
8410 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8411 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
8412 return (uint64_t)ret_conv;
8415 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
8416 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
8417 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8418 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
8419 return ((uint64_t)ret_conv);
8422 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
8423 LDKTransaction b_ref;
8424 b_ref.datalen = *((uint32_t*)b);
8425 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
8426 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
8427 b_ref.data_is_owned = true;
8428 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8429 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
8430 return ((uint64_t)ret_conv);
8433 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
8434 if ((_res & 1) != 0) return;
8435 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8436 CHECK_ACCESS(_res_ptr);
8437 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
8439 C2Tuple_usizeTransactionZ_free(_res_conv);
8442 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
8443 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
8444 _res_constr.datalen = *((uint32_t*)_res);
8445 if (_res_constr.datalen > 0)
8446 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8448 _res_constr.data = NULL;
8449 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8450 for (size_t c = 0; c < _res_constr.datalen; c++) {
8451 uint32_t _res_conv_28 = _res_vals[c];
8452 void* _res_conv_28_ptr = (void*)(((uint64_t)_res_conv_28) & ~1);
8453 CHECK_ACCESS(_res_conv_28_ptr);
8454 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
8455 FREE((void*)_res_conv_28);
8456 _res_constr.data[c] = _res_conv_28_conv;
8458 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
8461 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
8462 LDKCVec_TxidZ _res_constr;
8463 _res_constr.datalen = *((uint32_t*)_res);
8464 if (_res_constr.datalen > 0)
8465 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8467 _res_constr.data = NULL;
8468 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
8469 for (size_t m = 0; m < _res_constr.datalen; m++) {
8470 int8_tArray _res_conv_12 = _res_vals[m];
8471 LDKThirtyTwoBytes _res_conv_12_ref;
8472 CHECK(*((uint32_t*)_res_conv_12) == 32);
8473 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), 32);
8474 _res_constr.data[m] = _res_conv_12_ref;
8476 CVec_TxidZ_free(_res_constr);
8479 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
8480 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8481 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
8482 return (uint64_t)ret_conv;
8485 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
8486 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
8487 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8488 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
8489 return (uint64_t)ret_conv;
8492 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
8493 if ((_res & 1) != 0) return;
8494 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8495 CHECK_ACCESS(_res_ptr);
8496 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
8498 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
8501 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
8502 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
8503 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8504 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
8505 return (uint64_t)ret_conv;
8508 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
8509 LDKCVec_MonitorEventZ _res_constr;
8510 _res_constr.datalen = *((uint32_t*)_res);
8511 if (_res_constr.datalen > 0)
8512 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
8514 _res_constr.data = NULL;
8515 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8516 for (size_t o = 0; o < _res_constr.datalen; o++) {
8517 uint32_t _res_conv_14 = _res_vals[o];
8518 void* _res_conv_14_ptr = (void*)(((uint64_t)_res_conv_14) & ~1);
8519 CHECK_ACCESS(_res_conv_14_ptr);
8520 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
8521 FREE((void*)_res_conv_14);
8522 _res_constr.data[o] = _res_conv_14_conv;
8524 CVec_MonitorEventZ_free(_res_constr);
8527 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
8528 void* o_ptr = (void*)(((uint64_t)o) & ~1);
8529 CHECK_ACCESS(o_ptr);
8530 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
8531 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
8532 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8533 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
8534 uint64_t ret_ref = (uint64_t)ret_copy;
8538 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
8539 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8540 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
8541 uint64_t ret_ref = (uint64_t)ret_copy;
8545 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
8546 if ((_res & 1) != 0) return;
8547 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8548 CHECK_ACCESS(_res_ptr);
8549 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
8551 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
8554 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
8555 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
8556 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8557 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
8558 uint64_t ret_ref = (uint64_t)ret_copy;
8562 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
8563 void* o_ptr = (void*)(((uint64_t)o) & ~1);
8564 CHECK_ACCESS(o_ptr);
8565 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
8566 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
8567 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8568 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
8569 uint64_t ret_ref = (uint64_t)ret_copy;
8573 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_none() {
8574 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8575 *ret_copy = COption_NetworkUpdateZ_none();
8576 uint64_t ret_ref = (uint64_t)ret_copy;
8580 void __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
8581 if ((_res & 1) != 0) return;
8582 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8583 CHECK_ACCESS(_res_ptr);
8584 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
8586 COption_NetworkUpdateZ_free(_res_conv);
8589 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
8590 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
8591 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8592 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
8593 uint64_t ret_ref = (uint64_t)ret_copy;
8597 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
8598 LDKCVec_SpendableOutputDescriptorZ _res_constr;
8599 _res_constr.datalen = *((uint32_t*)_res);
8600 if (_res_constr.datalen > 0)
8601 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
8603 _res_constr.data = NULL;
8604 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8605 for (size_t b = 0; b < _res_constr.datalen; b++) {
8606 uint32_t _res_conv_27 = _res_vals[b];
8607 void* _res_conv_27_ptr = (void*)(((uint64_t)_res_conv_27) & ~1);
8608 CHECK_ACCESS(_res_conv_27_ptr);
8609 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
8610 FREE((void*)_res_conv_27);
8611 _res_constr.data[b] = _res_conv_27_conv;
8613 CVec_SpendableOutputDescriptorZ_free(_res_constr);
8616 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
8617 LDKCVec_MessageSendEventZ _res_constr;
8618 _res_constr.datalen = *((uint32_t*)_res);
8619 if (_res_constr.datalen > 0)
8620 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
8622 _res_constr.data = NULL;
8623 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8624 for (size_t s = 0; s < _res_constr.datalen; s++) {
8625 uint32_t _res_conv_18 = _res_vals[s];
8626 void* _res_conv_18_ptr = (void*)(((uint64_t)_res_conv_18) & ~1);
8627 CHECK_ACCESS(_res_conv_18_ptr);
8628 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
8629 FREE((void*)_res_conv_18);
8630 _res_constr.data[s] = _res_conv_18_conv;
8632 CVec_MessageSendEventZ_free(_res_constr);
8635 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
8636 LDKInitFeatures o_conv;
8637 o_conv.inner = (void*)(o & (~1));
8638 o_conv.is_owned = (o & 1) || (o == 0);
8639 o_conv = InitFeatures_clone(&o_conv);
8640 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
8641 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
8642 return (uint64_t)ret_conv;
8645 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
8646 LDKDecodeError e_conv;
8647 e_conv.inner = (void*)(e & (~1));
8648 e_conv.is_owned = (e & 1) || (e == 0);
8649 e_conv = DecodeError_clone(&e_conv);
8650 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
8651 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
8652 return (uint64_t)ret_conv;
8655 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
8656 if ((_res & 1) != 0) return;
8657 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8658 CHECK_ACCESS(_res_ptr);
8659 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
8661 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
8664 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
8665 LDKNodeFeatures o_conv;
8666 o_conv.inner = (void*)(o & (~1));
8667 o_conv.is_owned = (o & 1) || (o == 0);
8668 o_conv = NodeFeatures_clone(&o_conv);
8669 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
8670 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
8671 return (uint64_t)ret_conv;
8674 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
8675 LDKDecodeError e_conv;
8676 e_conv.inner = (void*)(e & (~1));
8677 e_conv.is_owned = (e & 1) || (e == 0);
8678 e_conv = DecodeError_clone(&e_conv);
8679 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
8680 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
8681 return (uint64_t)ret_conv;
8684 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
8685 if ((_res & 1) != 0) return;
8686 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8687 CHECK_ACCESS(_res_ptr);
8688 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
8690 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
8693 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
8694 LDKChannelFeatures o_conv;
8695 o_conv.inner = (void*)(o & (~1));
8696 o_conv.is_owned = (o & 1) || (o == 0);
8697 o_conv = ChannelFeatures_clone(&o_conv);
8698 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
8699 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
8700 return (uint64_t)ret_conv;
8703 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
8704 LDKDecodeError e_conv;
8705 e_conv.inner = (void*)(e & (~1));
8706 e_conv.is_owned = (e & 1) || (e == 0);
8707 e_conv = DecodeError_clone(&e_conv);
8708 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
8709 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
8710 return (uint64_t)ret_conv;
8713 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
8714 if ((_res & 1) != 0) return;
8715 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8716 CHECK_ACCESS(_res_ptr);
8717 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
8719 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
8722 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
8723 LDKInvoiceFeatures o_conv;
8724 o_conv.inner = (void*)(o & (~1));
8725 o_conv.is_owned = (o & 1) || (o == 0);
8726 o_conv = InvoiceFeatures_clone(&o_conv);
8727 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
8728 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
8729 return (uint64_t)ret_conv;
8732 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
8733 LDKDecodeError e_conv;
8734 e_conv.inner = (void*)(e & (~1));
8735 e_conv.is_owned = (e & 1) || (e == 0);
8736 e_conv = DecodeError_clone(&e_conv);
8737 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
8738 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
8739 return (uint64_t)ret_conv;
8742 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
8743 if ((_res & 1) != 0) return;
8744 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8745 CHECK_ACCESS(_res_ptr);
8746 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
8748 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
8751 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8752 LDKDelayedPaymentOutputDescriptor o_conv;
8753 o_conv.inner = (void*)(o & (~1));
8754 o_conv.is_owned = (o & 1) || (o == 0);
8755 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
8756 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8757 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
8758 return (uint64_t)ret_conv;
8761 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8762 LDKDecodeError e_conv;
8763 e_conv.inner = (void*)(e & (~1));
8764 e_conv.is_owned = (e & 1) || (e == 0);
8765 e_conv = DecodeError_clone(&e_conv);
8766 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8767 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
8768 return (uint64_t)ret_conv;
8771 void __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8772 if ((_res & 1) != 0) return;
8773 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8774 CHECK_ACCESS(_res_ptr);
8775 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
8777 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
8780 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8781 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
8782 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8783 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
8784 return (uint64_t)ret_conv;
8787 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8788 LDKStaticPaymentOutputDescriptor o_conv;
8789 o_conv.inner = (void*)(o & (~1));
8790 o_conv.is_owned = (o & 1) || (o == 0);
8791 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
8792 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8793 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
8794 return (uint64_t)ret_conv;
8797 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8798 LDKDecodeError e_conv;
8799 e_conv.inner = (void*)(e & (~1));
8800 e_conv.is_owned = (e & 1) || (e == 0);
8801 e_conv = DecodeError_clone(&e_conv);
8802 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8803 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
8804 return (uint64_t)ret_conv;
8807 void __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8808 if ((_res & 1) != 0) return;
8809 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8810 CHECK_ACCESS(_res_ptr);
8811 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
8813 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
8816 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8817 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
8818 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8819 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
8820 return (uint64_t)ret_conv;
8823 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8824 void* o_ptr = (void*)(((uint64_t)o) & ~1);
8825 CHECK_ACCESS(o_ptr);
8826 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
8827 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
8828 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8829 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
8830 return (uint64_t)ret_conv;
8833 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8834 LDKDecodeError e_conv;
8835 e_conv.inner = (void*)(e & (~1));
8836 e_conv.is_owned = (e & 1) || (e == 0);
8837 e_conv = DecodeError_clone(&e_conv);
8838 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8839 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
8840 return (uint64_t)ret_conv;
8843 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8844 if ((_res & 1) != 0) return;
8845 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8846 CHECK_ACCESS(_res_ptr);
8847 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
8849 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
8852 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8853 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
8854 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8855 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
8856 return (uint64_t)ret_conv;
8859 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_ok() {
8860 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8861 *ret_conv = CResult_NoneNoneZ_ok();
8862 return (uint64_t)ret_conv;
8865 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_err() {
8866 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8867 *ret_conv = CResult_NoneNoneZ_err();
8868 return (uint64_t)ret_conv;
8871 void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
8872 if ((_res & 1) != 0) return;
8873 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8874 CHECK_ACCESS(_res_ptr);
8875 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
8877 CResult_NoneNoneZ_free(_res_conv);
8880 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
8881 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
8882 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8883 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
8884 return (uint64_t)ret_conv;
8887 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
8888 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
8889 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8890 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
8891 return ((uint64_t)ret_conv);
8894 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
8896 CHECK(*((uint32_t*)a) == 64);
8897 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
8898 LDKCVec_SignatureZ b_constr;
8899 b_constr.datalen = *((uint32_t*)b);
8900 if (b_constr.datalen > 0)
8901 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8903 b_constr.data = NULL;
8904 int8_tArray* b_vals = (int8_tArray*)(b + 4);
8905 for (size_t m = 0; m < b_constr.datalen; m++) {
8906 int8_tArray b_conv_12 = b_vals[m];
8907 LDKSignature b_conv_12_ref;
8908 CHECK(*((uint32_t*)b_conv_12) == 64);
8909 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
8910 b_constr.data[m] = b_conv_12_ref;
8912 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8913 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
8914 return ((uint64_t)ret_conv);
8917 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
8918 if ((_res & 1) != 0) return;
8919 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8920 CHECK_ACCESS(_res_ptr);
8921 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
8923 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
8926 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
8927 void* o_ptr = (void*)(((uint64_t)o) & ~1);
8928 CHECK_ACCESS(o_ptr);
8929 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
8930 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
8931 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8932 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
8933 return (uint64_t)ret_conv;
8936 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
8937 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8938 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
8939 return (uint64_t)ret_conv;
8942 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
8943 if ((_res & 1) != 0) return;
8944 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8945 CHECK_ACCESS(_res_ptr);
8946 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
8948 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
8951 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
8952 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
8953 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8954 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
8955 return (uint64_t)ret_conv;
8958 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
8960 CHECK(*((uint32_t*)o) == 64);
8961 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
8962 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8963 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
8964 return (uint64_t)ret_conv;
8967 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
8968 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8969 *ret_conv = CResult_SignatureNoneZ_err();
8970 return (uint64_t)ret_conv;
8973 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
8974 if ((_res & 1) != 0) return;
8975 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8976 CHECK_ACCESS(_res_ptr);
8977 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
8979 CResult_SignatureNoneZ_free(_res_conv);
8982 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
8983 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
8984 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8985 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
8986 return (uint64_t)ret_conv;
8989 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
8990 void* o_ptr = (void*)(((uint64_t)o) & ~1);
8991 CHECK_ACCESS(o_ptr);
8992 LDKSign o_conv = *(LDKSign*)(o_ptr);
8993 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8994 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
8995 return (uint64_t)ret_conv;
8998 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
8999 LDKDecodeError e_conv;
9000 e_conv.inner = (void*)(e & (~1));
9001 e_conv.is_owned = (e & 1) || (e == 0);
9002 e_conv = DecodeError_clone(&e_conv);
9003 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
9004 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
9005 return (uint64_t)ret_conv;
9008 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
9009 if ((_res & 1) != 0) return;
9010 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9011 CHECK_ACCESS(_res_ptr);
9012 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
9014 CResult_SignDecodeErrorZ_free(_res_conv);
9017 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
9018 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
9019 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
9020 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
9021 return (uint64_t)ret_conv;
9024 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
9025 LDKCVec_u8Z _res_ref;
9026 _res_ref.datalen = *((uint32_t*)_res);
9027 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
9028 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
9029 CVec_u8Z_free(_res_ref);
9032 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray arg) {
9033 LDKRecoverableSignature arg_ref;
9034 CHECK(*((uint32_t*)arg) == 68);
9035 memcpy(arg_ref.serialized_form, (uint8_t*)(arg + 4), 68);
9036 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9037 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
9038 return (uint64_t)ret_conv;
9041 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_err() {
9042 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9043 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
9044 return (uint64_t)ret_conv;
9047 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
9048 if ((_res & 1) != 0) return;
9049 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9050 CHECK_ACCESS(_res_ptr);
9051 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
9053 CResult_RecoverableSignatureNoneZ_free(_res_conv);
9056 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
9057 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
9058 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9059 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
9060 return (uint64_t)ret_conv;
9063 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
9064 LDKCVec_CVec_u8ZZ _res_constr;
9065 _res_constr.datalen = *((uint32_t*)_res);
9066 if (_res_constr.datalen > 0)
9067 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
9069 _res_constr.data = NULL;
9070 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
9071 for (size_t m = 0; m < _res_constr.datalen; m++) {
9072 int8_tArray _res_conv_12 = _res_vals[m];
9073 LDKCVec_u8Z _res_conv_12_ref;
9074 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
9075 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
9076 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
9077 _res_constr.data[m] = _res_conv_12_ref;
9079 CVec_CVec_u8ZZ_free(_res_constr);
9082 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
9083 LDKCVec_CVec_u8ZZ o_constr;
9084 o_constr.datalen = *((uint32_t*)o);
9085 if (o_constr.datalen > 0)
9086 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
9088 o_constr.data = NULL;
9089 int8_tArray* o_vals = (int8_tArray*)(o + 4);
9090 for (size_t m = 0; m < o_constr.datalen; m++) {
9091 int8_tArray o_conv_12 = o_vals[m];
9092 LDKCVec_u8Z o_conv_12_ref;
9093 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
9094 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
9095 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
9096 o_constr.data[m] = o_conv_12_ref;
9098 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9099 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
9100 return (uint64_t)ret_conv;
9103 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
9104 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9105 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
9106 return (uint64_t)ret_conv;
9109 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
9110 if ((_res & 1) != 0) return;
9111 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9112 CHECK_ACCESS(_res_ptr);
9113 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
9115 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
9118 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
9119 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
9120 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9121 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
9122 return (uint64_t)ret_conv;
9125 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
9126 LDKInMemorySigner o_conv;
9127 o_conv.inner = (void*)(o & (~1));
9128 o_conv.is_owned = (o & 1) || (o == 0);
9129 o_conv = InMemorySigner_clone(&o_conv);
9130 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9131 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
9132 return (uint64_t)ret_conv;
9135 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
9136 LDKDecodeError e_conv;
9137 e_conv.inner = (void*)(e & (~1));
9138 e_conv.is_owned = (e & 1) || (e == 0);
9139 e_conv = DecodeError_clone(&e_conv);
9140 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9141 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
9142 return (uint64_t)ret_conv;
9145 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
9146 if ((_res & 1) != 0) return;
9147 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9148 CHECK_ACCESS(_res_ptr);
9149 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
9151 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
9154 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
9155 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
9156 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9157 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
9158 return (uint64_t)ret_conv;
9161 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
9162 LDKCVec_TxOutZ _res_constr;
9163 _res_constr.datalen = *((uint32_t*)_res);
9164 if (_res_constr.datalen > 0)
9165 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
9167 _res_constr.data = NULL;
9168 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9169 for (size_t h = 0; h < _res_constr.datalen; h++) {
9170 uint32_t _res_conv_7 = _res_vals[h];
9171 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
9172 CHECK_ACCESS(_res_conv_7_ptr);
9173 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
9174 FREE((void*)_res_conv_7);
9175 _res_constr.data[h] = _res_conv_7_conv;
9177 CVec_TxOutZ_free(_res_constr);
9180 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
9181 LDKTransaction o_ref;
9182 o_ref.datalen = *((uint32_t*)o);
9183 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
9184 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
9185 o_ref.data_is_owned = true;
9186 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
9187 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
9188 return (uint64_t)ret_conv;
9191 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
9192 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
9193 *ret_conv = CResult_TransactionNoneZ_err();
9194 return (uint64_t)ret_conv;
9197 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
9198 if ((_res & 1) != 0) return;
9199 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9200 CHECK_ACCESS(_res_ptr);
9201 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
9203 CResult_TransactionNoneZ_free(_res_conv);
9206 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
9207 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
9208 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
9209 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
9210 return (uint64_t)ret_conv;
9213 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
9214 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
9215 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
9216 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
9217 return ((uint64_t)ret_conv);
9220 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
9221 LDKThirtyTwoBytes a_ref;
9222 CHECK(*((uint32_t*)a) == 32);
9223 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9224 LDKChannelMonitor b_conv;
9225 b_conv.inner = (void*)(b & (~1));
9226 b_conv.is_owned = (b & 1) || (b == 0);
9227 b_conv = ChannelMonitor_clone(&b_conv);
9228 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
9229 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
9230 return ((uint64_t)ret_conv);
9233 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
9234 if ((_res & 1) != 0) return;
9235 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9236 CHECK_ACCESS(_res_ptr);
9237 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
9239 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
9242 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_BlockHashChannelMonitorZZ_free(uint32_tArray _res) {
9243 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
9244 _res_constr.datalen = *((uint32_t*)_res);
9245 if (_res_constr.datalen > 0)
9246 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
9248 _res_constr.data = NULL;
9249 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9250 for (size_t j = 0; j < _res_constr.datalen; j++) {
9251 uint32_t _res_conv_35 = _res_vals[j];
9252 void* _res_conv_35_ptr = (void*)(((uint64_t)_res_conv_35) & ~1);
9253 CHECK_ACCESS(_res_conv_35_ptr);
9254 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
9255 FREE((void*)_res_conv_35);
9256 _res_constr.data[j] = _res_conv_35_conv;
9258 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
9261 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(uint32_tArray o) {
9262 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
9263 o_constr.datalen = *((uint32_t*)o);
9264 if (o_constr.datalen > 0)
9265 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
9267 o_constr.data = NULL;
9268 uint32_t* o_vals = (uint32_t*)(o + 4);
9269 for (size_t j = 0; j < o_constr.datalen; j++) {
9270 uint32_t o_conv_35 = o_vals[j];
9271 void* o_conv_35_ptr = (void*)(((uint64_t)o_conv_35) & ~1);
9272 CHECK_ACCESS(o_conv_35_ptr);
9273 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
9274 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1));
9275 o_constr.data[j] = o_conv_35_conv;
9277 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
9278 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
9279 return (uint64_t)ret_conv;
9282 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(uint32_t e) {
9283 LDKIOError e_conv = LDKIOError_from_js(e);
9284 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
9285 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
9286 return (uint64_t)ret_conv;
9289 void __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(uint32_t _res) {
9290 if ((_res & 1) != 0) return;
9291 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9292 CHECK_ACCESS(_res_ptr);
9293 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
9295 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
9298 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(uint32_t orig) {
9299 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
9300 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
9301 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
9302 return (uint64_t)ret_conv;
9305 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_ok(uint32_t o) {
9306 LDKPaymentId o_conv;
9307 o_conv.inner = (void*)(o & (~1));
9308 o_conv.is_owned = (o & 1) || (o == 0);
9309 o_conv = PaymentId_clone(&o_conv);
9310 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
9311 *ret_conv = CResult_PaymentIdDecodeErrorZ_ok(o_conv);
9312 return (uint64_t)ret_conv;
9315 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_err(uint32_t e) {
9316 LDKDecodeError e_conv;
9317 e_conv.inner = (void*)(e & (~1));
9318 e_conv.is_owned = (e & 1) || (e == 0);
9319 e_conv = DecodeError_clone(&e_conv);
9320 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
9321 *ret_conv = CResult_PaymentIdDecodeErrorZ_err(e_conv);
9322 return (uint64_t)ret_conv;
9325 void __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_free(uint32_t _res) {
9326 if ((_res & 1) != 0) return;
9327 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9328 CHECK_ACCESS(_res_ptr);
9329 LDKCResult_PaymentIdDecodeErrorZ _res_conv = *(LDKCResult_PaymentIdDecodeErrorZ*)(_res_ptr);
9331 CResult_PaymentIdDecodeErrorZ_free(_res_conv);
9334 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_clone(uint32_t orig) {
9335 LDKCResult_PaymentIdDecodeErrorZ* orig_conv = (LDKCResult_PaymentIdDecodeErrorZ*)(orig & ~1);
9336 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
9337 *ret_conv = CResult_PaymentIdDecodeErrorZ_clone(orig_conv);
9338 return (uint64_t)ret_conv;
9341 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) {
9342 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
9343 *ret_copy = COption_u16Z_some(o);
9344 uint64_t ret_ref = (uint64_t)ret_copy;
9348 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_none() {
9349 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
9350 *ret_copy = COption_u16Z_none();
9351 uint64_t ret_ref = (uint64_t)ret_copy;
9355 void __attribute__((visibility("default"))) TS_COption_u16Z_free(uint32_t _res) {
9356 if ((_res & 1) != 0) return;
9357 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9358 CHECK_ACCESS(_res_ptr);
9359 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
9361 COption_u16Z_free(_res_conv);
9364 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_clone(uint32_t orig) {
9365 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
9366 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
9367 *ret_copy = COption_u16Z_clone(orig_conv);
9368 uint64_t ret_ref = (uint64_t)ret_copy;
9372 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
9373 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9374 *ret_conv = CResult_NoneAPIErrorZ_ok();
9375 return (uint64_t)ret_conv;
9378 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
9379 void* e_ptr = (void*)(((uint64_t)e) & ~1);
9380 CHECK_ACCESS(e_ptr);
9381 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
9382 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
9383 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9384 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
9385 return (uint64_t)ret_conv;
9388 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
9389 if ((_res & 1) != 0) return;
9390 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9391 CHECK_ACCESS(_res_ptr);
9392 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
9394 CResult_NoneAPIErrorZ_free(_res_conv);
9397 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
9398 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
9399 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9400 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
9401 return (uint64_t)ret_conv;
9404 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
9405 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
9406 _res_constr.datalen = *((uint32_t*)_res);
9407 if (_res_constr.datalen > 0)
9408 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
9410 _res_constr.data = NULL;
9411 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9412 for (size_t w = 0; w < _res_constr.datalen; w++) {
9413 uint32_t _res_conv_22 = _res_vals[w];
9414 void* _res_conv_22_ptr = (void*)(((uint64_t)_res_conv_22) & ~1);
9415 CHECK_ACCESS(_res_conv_22_ptr);
9416 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
9417 FREE((void*)_res_conv_22);
9418 _res_constr.data[w] = _res_conv_22_conv;
9420 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
9423 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
9424 LDKCVec_APIErrorZ _res_constr;
9425 _res_constr.datalen = *((uint32_t*)_res);
9426 if (_res_constr.datalen > 0)
9427 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
9429 _res_constr.data = NULL;
9430 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9431 for (size_t k = 0; k < _res_constr.datalen; k++) {
9432 uint32_t _res_conv_10 = _res_vals[k];
9433 void* _res_conv_10_ptr = (void*)(((uint64_t)_res_conv_10) & ~1);
9434 CHECK_ACCESS(_res_conv_10_ptr);
9435 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
9436 FREE((void*)_res_conv_10);
9437 _res_constr.data[k] = _res_conv_10_conv;
9439 CVec_APIErrorZ_free(_res_constr);
9442 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
9443 LDKThirtyTwoBytes o_ref;
9444 CHECK(*((uint32_t*)o) == 32);
9445 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
9446 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
9447 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
9448 return (uint64_t)ret_conv;
9451 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
9452 void* e_ptr = (void*)(((uint64_t)e) & ~1);
9453 CHECK_ACCESS(e_ptr);
9454 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
9455 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
9456 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
9457 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
9458 return (uint64_t)ret_conv;
9461 void __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) {
9462 if ((_res & 1) != 0) return;
9463 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9464 CHECK_ACCESS(_res_ptr);
9465 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
9467 CResult__u832APIErrorZ_free(_res_conv);
9470 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
9471 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
9472 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
9473 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
9474 return (uint64_t)ret_conv;
9477 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(uint32_t o) {
9478 LDKPaymentId o_conv;
9479 o_conv.inner = (void*)(o & (~1));
9480 o_conv.is_owned = (o & 1) || (o == 0);
9481 o_conv = PaymentId_clone(&o_conv);
9482 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
9483 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_conv);
9484 return (uint64_t)ret_conv;
9487 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
9488 void* e_ptr = (void*)(((uint64_t)e) & ~1);
9489 CHECK_ACCESS(e_ptr);
9490 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
9491 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
9492 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
9493 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
9494 return (uint64_t)ret_conv;
9497 void __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
9498 if ((_res & 1) != 0) return;
9499 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9500 CHECK_ACCESS(_res_ptr);
9501 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
9503 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
9506 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
9507 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
9508 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
9509 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
9510 return (uint64_t)ret_conv;
9513 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
9514 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9515 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
9516 return (uint64_t)ret_conv;
9519 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
9520 void* e_ptr = (void*)(((uint64_t)e) & ~1);
9521 CHECK_ACCESS(e_ptr);
9522 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
9523 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
9524 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9525 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
9526 return (uint64_t)ret_conv;
9529 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
9530 if ((_res & 1) != 0) return;
9531 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9532 CHECK_ACCESS(_res_ptr);
9533 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
9535 CResult_NonePaymentSendFailureZ_free(_res_conv);
9538 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
9539 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
9540 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9541 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
9542 return (uint64_t)ret_conv;
9545 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
9546 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
9547 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
9548 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
9549 return ((uint64_t)ret_conv);
9552 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, uint32_t b) {
9553 LDKThirtyTwoBytes a_ref;
9554 CHECK(*((uint32_t*)a) == 32);
9555 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9556 LDKPaymentId b_conv;
9557 b_conv.inner = (void*)(b & (~1));
9558 b_conv.is_owned = (b & 1) || (b == 0);
9559 b_conv = PaymentId_clone(&b_conv);
9560 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
9561 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_conv);
9562 return ((uint64_t)ret_conv);
9565 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
9566 if ((_res & 1) != 0) return;
9567 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9568 CHECK_ACCESS(_res_ptr);
9569 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
9571 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
9574 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
9575 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9576 CHECK_ACCESS(o_ptr);
9577 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
9578 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1));
9579 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
9580 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
9581 return (uint64_t)ret_conv;
9584 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
9585 void* e_ptr = (void*)(((uint64_t)e) & ~1);
9586 CHECK_ACCESS(e_ptr);
9587 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
9588 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
9589 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
9590 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
9591 return (uint64_t)ret_conv;
9594 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
9595 if ((_res & 1) != 0) return;
9596 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9597 CHECK_ACCESS(_res_ptr);
9598 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
9600 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
9603 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
9604 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
9605 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
9606 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
9607 return (uint64_t)ret_conv;
9610 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
9611 LDKCVec_NetAddressZ _res_constr;
9612 _res_constr.datalen = *((uint32_t*)_res);
9613 if (_res_constr.datalen > 0)
9614 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9616 _res_constr.data = NULL;
9617 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9618 for (size_t m = 0; m < _res_constr.datalen; m++) {
9619 uint32_t _res_conv_12 = _res_vals[m];
9620 void* _res_conv_12_ptr = (void*)(((uint64_t)_res_conv_12) & ~1);
9621 CHECK_ACCESS(_res_conv_12_ptr);
9622 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
9623 FREE((void*)_res_conv_12);
9624 _res_constr.data[m] = _res_conv_12_conv;
9626 CVec_NetAddressZ_free(_res_constr);
9629 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
9630 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
9631 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
9632 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
9633 return ((uint64_t)ret_conv);
9636 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
9637 LDKThirtyTwoBytes a_ref;
9638 CHECK(*((uint32_t*)a) == 32);
9639 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9640 LDKThirtyTwoBytes b_ref;
9641 CHECK(*((uint32_t*)b) == 32);
9642 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
9643 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
9644 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
9645 return ((uint64_t)ret_conv);
9648 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
9649 if ((_res & 1) != 0) return;
9650 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9651 CHECK_ACCESS(_res_ptr);
9652 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
9654 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
9657 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
9658 LDKThirtyTwoBytes o_ref;
9659 CHECK(*((uint32_t*)o) == 32);
9660 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
9661 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
9662 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
9663 return (uint64_t)ret_conv;
9666 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
9667 void* e_ptr = (void*)(((uint64_t)e) & ~1);
9668 CHECK_ACCESS(e_ptr);
9669 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
9670 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
9671 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
9672 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
9673 return (uint64_t)ret_conv;
9676 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
9677 if ((_res & 1) != 0) return;
9678 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9679 CHECK_ACCESS(_res_ptr);
9680 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
9682 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
9685 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
9686 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
9687 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
9688 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
9689 return (uint64_t)ret_conv;
9692 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
9693 LDKCVec_ChannelMonitorZ _res_constr;
9694 _res_constr.datalen = *((uint32_t*)_res);
9695 if (_res_constr.datalen > 0)
9696 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
9698 _res_constr.data = NULL;
9699 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9700 for (size_t q = 0; q < _res_constr.datalen; q++) {
9701 uint32_t _res_conv_16 = _res_vals[q];
9702 LDKChannelMonitor _res_conv_16_conv;
9703 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9704 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9705 _res_constr.data[q] = _res_conv_16_conv;
9707 CVec_ChannelMonitorZ_free(_res_constr);
9710 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
9711 LDKThirtyTwoBytes a_ref;
9712 CHECK(*((uint32_t*)a) == 32);
9713 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9714 LDKChannelManager b_conv;
9715 b_conv.inner = (void*)(b & (~1));
9716 b_conv.is_owned = (b & 1) || (b == 0);
9717 // Warning: we need a move here but no clone is available for LDKChannelManager
9718 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
9719 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
9720 return ((uint64_t)ret_conv);
9723 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
9724 if ((_res & 1) != 0) return;
9725 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9726 CHECK_ACCESS(_res_ptr);
9727 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
9729 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
9732 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
9733 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9734 CHECK_ACCESS(o_ptr);
9735 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
9736 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
9737 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9738 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
9739 return (uint64_t)ret_conv;
9742 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
9743 LDKDecodeError e_conv;
9744 e_conv.inner = (void*)(e & (~1));
9745 e_conv.is_owned = (e & 1) || (e == 0);
9746 e_conv = DecodeError_clone(&e_conv);
9747 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9748 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
9749 return (uint64_t)ret_conv;
9752 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
9753 if ((_res & 1) != 0) return;
9754 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9755 CHECK_ACCESS(_res_ptr);
9756 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
9758 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
9761 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
9762 LDKChannelConfig o_conv;
9763 o_conv.inner = (void*)(o & (~1));
9764 o_conv.is_owned = (o & 1) || (o == 0);
9765 o_conv = ChannelConfig_clone(&o_conv);
9766 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9767 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
9768 return (uint64_t)ret_conv;
9771 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
9772 LDKDecodeError e_conv;
9773 e_conv.inner = (void*)(e & (~1));
9774 e_conv.is_owned = (e & 1) || (e == 0);
9775 e_conv = DecodeError_clone(&e_conv);
9776 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9777 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
9778 return (uint64_t)ret_conv;
9781 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
9782 if ((_res & 1) != 0) return;
9783 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9784 CHECK_ACCESS(_res_ptr);
9785 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
9787 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
9790 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
9791 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
9792 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9793 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
9794 return (uint64_t)ret_conv;
9797 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
9799 o_conv.inner = (void*)(o & (~1));
9800 o_conv.is_owned = (o & 1) || (o == 0);
9801 o_conv = OutPoint_clone(&o_conv);
9802 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9803 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
9804 return (uint64_t)ret_conv;
9807 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
9808 LDKDecodeError e_conv;
9809 e_conv.inner = (void*)(e & (~1));
9810 e_conv.is_owned = (e & 1) || (e == 0);
9811 e_conv = DecodeError_clone(&e_conv);
9812 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9813 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
9814 return (uint64_t)ret_conv;
9817 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
9818 if ((_res & 1) != 0) return;
9819 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9820 CHECK_ACCESS(_res_ptr);
9821 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
9823 CResult_OutPointDecodeErrorZ_free(_res_conv);
9826 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
9827 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
9828 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9829 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
9830 return (uint64_t)ret_conv;
9833 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_some(uint32_t o) {
9834 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9835 CHECK_ACCESS(o_ptr);
9836 LDKType o_conv = *(LDKType*)(o_ptr);
9837 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9838 *ret_copy = COption_TypeZ_some(o_conv);
9839 uint64_t ret_ref = (uint64_t)ret_copy;
9843 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_none() {
9844 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9845 *ret_copy = COption_TypeZ_none();
9846 uint64_t ret_ref = (uint64_t)ret_copy;
9850 void __attribute__((visibility("default"))) TS_COption_TypeZ_free(uint32_t _res) {
9851 if ((_res & 1) != 0) return;
9852 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9853 CHECK_ACCESS(_res_ptr);
9854 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
9856 COption_TypeZ_free(_res_conv);
9859 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone(uint32_t orig) {
9860 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
9861 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9862 *ret_copy = COption_TypeZ_clone(orig_conv);
9863 uint64_t ret_ref = (uint64_t)ret_copy;
9867 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
9868 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9869 CHECK_ACCESS(o_ptr);
9870 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
9871 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
9872 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9873 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
9874 return (uint64_t)ret_conv;
9877 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
9878 LDKDecodeError e_conv;
9879 e_conv.inner = (void*)(e & (~1));
9880 e_conv.is_owned = (e & 1) || (e == 0);
9881 e_conv = DecodeError_clone(&e_conv);
9882 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9883 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
9884 return (uint64_t)ret_conv;
9887 void __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
9888 if ((_res & 1) != 0) return;
9889 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9890 CHECK_ACCESS(_res_ptr);
9891 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
9893 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
9896 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
9897 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
9898 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9899 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
9900 return (uint64_t)ret_conv;
9903 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
9904 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
9905 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9906 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
9907 return (uint64_t)ret_conv;
9910 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_err() {
9911 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9912 *ret_conv = CResult_SiPrefixNoneZ_err();
9913 return (uint64_t)ret_conv;
9916 void __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_free(uint32_t _res) {
9917 if ((_res & 1) != 0) return;
9918 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9919 CHECK_ACCESS(_res_ptr);
9920 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(_res_ptr);
9922 CResult_SiPrefixNoneZ_free(_res_conv);
9925 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_clone(uint32_t orig) {
9926 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
9927 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9928 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
9929 return (uint64_t)ret_conv;
9932 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_ok(uint32_t o) {
9934 o_conv.inner = (void*)(o & (~1));
9935 o_conv.is_owned = (o & 1) || (o == 0);
9936 o_conv = Invoice_clone(&o_conv);
9937 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9938 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
9939 return (uint64_t)ret_conv;
9942 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_err() {
9943 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9944 *ret_conv = CResult_InvoiceNoneZ_err();
9945 return (uint64_t)ret_conv;
9948 void __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_free(uint32_t _res) {
9949 if ((_res & 1) != 0) return;
9950 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9951 CHECK_ACCESS(_res_ptr);
9952 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(_res_ptr);
9954 CResult_InvoiceNoneZ_free(_res_conv);
9957 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_clone(uint32_t orig) {
9958 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
9959 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9960 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
9961 return (uint64_t)ret_conv;
9964 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_ok(uint32_t o) {
9965 LDKSignedRawInvoice o_conv;
9966 o_conv.inner = (void*)(o & (~1));
9967 o_conv.is_owned = (o & 1) || (o == 0);
9968 o_conv = SignedRawInvoice_clone(&o_conv);
9969 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9970 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
9971 return (uint64_t)ret_conv;
9974 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_err() {
9975 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9976 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
9977 return (uint64_t)ret_conv;
9980 void __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_free(uint32_t _res) {
9981 if ((_res & 1) != 0) return;
9982 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9983 CHECK_ACCESS(_res_ptr);
9984 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(_res_ptr);
9986 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
9989 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_clone(uint32_t orig) {
9990 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
9991 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9992 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
9993 return (uint64_t)ret_conv;
9996 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
9997 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
9998 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
9999 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
10000 return ((uint64_t)ret_conv);
10003 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
10004 LDKRawInvoice a_conv;
10005 a_conv.inner = (void*)(a & (~1));
10006 a_conv.is_owned = (a & 1) || (a == 0);
10007 a_conv = RawInvoice_clone(&a_conv);
10008 LDKThirtyTwoBytes b_ref;
10009 CHECK(*((uint32_t*)b) == 32);
10010 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
10011 LDKInvoiceSignature c_conv;
10012 c_conv.inner = (void*)(c & (~1));
10013 c_conv.is_owned = (c & 1) || (c == 0);
10014 c_conv = InvoiceSignature_clone(&c_conv);
10015 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
10016 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
10017 return ((uint64_t)ret_conv);
10020 void __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
10021 if ((_res & 1) != 0) return;
10022 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10023 CHECK_ACCESS(_res_ptr);
10024 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
10026 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
10029 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
10030 LDKPayeePubKey o_conv;
10031 o_conv.inner = (void*)(o & (~1));
10032 o_conv.is_owned = (o & 1) || (o == 0);
10033 o_conv = PayeePubKey_clone(&o_conv);
10034 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10035 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
10036 return (uint64_t)ret_conv;
10039 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
10040 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10041 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10042 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
10043 return (uint64_t)ret_conv;
10046 void __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
10047 if ((_res & 1) != 0) return;
10048 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10049 CHECK_ACCESS(_res_ptr);
10050 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
10052 CResult_PayeePubKeyErrorZ_free(_res_conv);
10055 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
10056 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
10057 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10058 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
10059 return (uint64_t)ret_conv;
10062 void __attribute__((visibility("default"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
10063 LDKCVec_PrivateRouteZ _res_constr;
10064 _res_constr.datalen = *((uint32_t*)_res);
10065 if (_res_constr.datalen > 0)
10066 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
10068 _res_constr.data = NULL;
10069 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10070 for (size_t o = 0; o < _res_constr.datalen; o++) {
10071 uint32_t _res_conv_14 = _res_vals[o];
10072 LDKPrivateRoute _res_conv_14_conv;
10073 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
10074 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
10075 _res_constr.data[o] = _res_conv_14_conv;
10077 CVec_PrivateRouteZ_free(_res_constr);
10080 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
10081 LDKPositiveTimestamp o_conv;
10082 o_conv.inner = (void*)(o & (~1));
10083 o_conv.is_owned = (o & 1) || (o == 0);
10084 o_conv = PositiveTimestamp_clone(&o_conv);
10085 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10086 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
10087 return (uint64_t)ret_conv;
10090 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
10091 LDKCreationError e_conv = LDKCreationError_from_js(e);
10092 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10093 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
10094 return (uint64_t)ret_conv;
10097 void __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
10098 if ((_res & 1) != 0) return;
10099 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10100 CHECK_ACCESS(_res_ptr);
10101 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
10103 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
10106 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
10107 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
10108 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10109 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
10110 return (uint64_t)ret_conv;
10113 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_ok() {
10114 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10115 *ret_conv = CResult_NoneSemanticErrorZ_ok();
10116 return (uint64_t)ret_conv;
10119 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
10120 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
10121 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10122 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
10123 return (uint64_t)ret_conv;
10126 void __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
10127 if ((_res & 1) != 0) return;
10128 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10129 CHECK_ACCESS(_res_ptr);
10130 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
10132 CResult_NoneSemanticErrorZ_free(_res_conv);
10135 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
10136 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
10137 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10138 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
10139 return (uint64_t)ret_conv;
10142 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
10144 o_conv.inner = (void*)(o & (~1));
10145 o_conv.is_owned = (o & 1) || (o == 0);
10146 o_conv = Invoice_clone(&o_conv);
10147 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10148 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
10149 return (uint64_t)ret_conv;
10152 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
10153 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
10154 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10155 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
10156 return (uint64_t)ret_conv;
10159 void __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
10160 if ((_res & 1) != 0) return;
10161 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10162 CHECK_ACCESS(_res_ptr);
10163 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
10165 CResult_InvoiceSemanticErrorZ_free(_res_conv);
10168 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
10169 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
10170 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10171 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
10172 return (uint64_t)ret_conv;
10175 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
10176 LDKDescription o_conv;
10177 o_conv.inner = (void*)(o & (~1));
10178 o_conv.is_owned = (o & 1) || (o == 0);
10179 o_conv = Description_clone(&o_conv);
10180 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10181 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
10182 return (uint64_t)ret_conv;
10185 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
10186 LDKCreationError e_conv = LDKCreationError_from_js(e);
10187 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10188 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
10189 return (uint64_t)ret_conv;
10192 void __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
10193 if ((_res & 1) != 0) return;
10194 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10195 CHECK_ACCESS(_res_ptr);
10196 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
10198 CResult_DescriptionCreationErrorZ_free(_res_conv);
10201 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
10202 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
10203 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10204 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
10205 return (uint64_t)ret_conv;
10208 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_ok(uint32_t o) {
10209 LDKExpiryTime o_conv;
10210 o_conv.inner = (void*)(o & (~1));
10211 o_conv.is_owned = (o & 1) || (o == 0);
10212 o_conv = ExpiryTime_clone(&o_conv);
10213 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10214 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
10215 return (uint64_t)ret_conv;
10218 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_err(uint32_t e) {
10219 LDKCreationError e_conv = LDKCreationError_from_js(e);
10220 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10221 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
10222 return (uint64_t)ret_conv;
10225 void __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_free(uint32_t _res) {
10226 if ((_res & 1) != 0) return;
10227 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10228 CHECK_ACCESS(_res_ptr);
10229 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(_res_ptr);
10231 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
10234 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_clone(uint32_t orig) {
10235 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
10236 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10237 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
10238 return (uint64_t)ret_conv;
10241 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
10242 LDKPrivateRoute o_conv;
10243 o_conv.inner = (void*)(o & (~1));
10244 o_conv.is_owned = (o & 1) || (o == 0);
10245 o_conv = PrivateRoute_clone(&o_conv);
10246 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
10247 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
10248 return (uint64_t)ret_conv;
10251 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
10252 LDKCreationError e_conv = LDKCreationError_from_js(e);
10253 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
10254 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
10255 return (uint64_t)ret_conv;
10258 void __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
10259 if ((_res & 1) != 0) return;
10260 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10261 CHECK_ACCESS(_res_ptr);
10262 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
10264 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
10267 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
10268 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
10269 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
10270 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
10271 return (uint64_t)ret_conv;
10274 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_ok(jstring o) {
10275 LDKStr o_conv = str_ref_to_owned_c(o);
10276 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10277 *ret_conv = CResult_StringErrorZ_ok(o_conv);
10278 return (uint64_t)ret_conv;
10281 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_err(uint32_t e) {
10282 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10283 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10284 *ret_conv = CResult_StringErrorZ_err(e_conv);
10285 return (uint64_t)ret_conv;
10288 void __attribute__((visibility("default"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
10289 if ((_res & 1) != 0) return;
10290 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10291 CHECK_ACCESS(_res_ptr);
10292 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
10294 CResult_StringErrorZ_free(_res_conv);
10297 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
10298 LDKChannelMonitorUpdate o_conv;
10299 o_conv.inner = (void*)(o & (~1));
10300 o_conv.is_owned = (o & 1) || (o == 0);
10301 o_conv = ChannelMonitorUpdate_clone(&o_conv);
10302 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10303 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
10304 return (uint64_t)ret_conv;
10307 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
10308 LDKDecodeError e_conv;
10309 e_conv.inner = (void*)(e & (~1));
10310 e_conv.is_owned = (e & 1) || (e == 0);
10311 e_conv = DecodeError_clone(&e_conv);
10312 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10313 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
10314 return (uint64_t)ret_conv;
10317 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
10318 if ((_res & 1) != 0) return;
10319 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10320 CHECK_ACCESS(_res_ptr);
10321 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
10323 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
10326 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
10327 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
10328 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10329 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
10330 return (uint64_t)ret_conv;
10333 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
10334 LDKHTLCUpdate o_conv;
10335 o_conv.inner = (void*)(o & (~1));
10336 o_conv.is_owned = (o & 1) || (o == 0);
10337 o_conv = HTLCUpdate_clone(&o_conv);
10338 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10339 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
10340 return (uint64_t)ret_conv;
10343 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
10344 LDKDecodeError e_conv;
10345 e_conv.inner = (void*)(e & (~1));
10346 e_conv.is_owned = (e & 1) || (e == 0);
10347 e_conv = DecodeError_clone(&e_conv);
10348 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10349 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
10350 return (uint64_t)ret_conv;
10353 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
10354 if ((_res & 1) != 0) return;
10355 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10356 CHECK_ACCESS(_res_ptr);
10357 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
10359 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
10362 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
10363 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
10364 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10365 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
10366 return (uint64_t)ret_conv;
10369 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
10370 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10371 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
10372 return (uint64_t)ret_conv;
10375 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
10376 LDKMonitorUpdateError e_conv;
10377 e_conv.inner = (void*)(e & (~1));
10378 e_conv.is_owned = (e & 1) || (e == 0);
10379 e_conv = MonitorUpdateError_clone(&e_conv);
10380 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10381 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
10382 return (uint64_t)ret_conv;
10385 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
10386 if ((_res & 1) != 0) return;
10387 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10388 CHECK_ACCESS(_res_ptr);
10389 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(_res_ptr);
10391 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
10394 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
10395 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
10396 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10397 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
10398 return (uint64_t)ret_conv;
10401 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
10402 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
10403 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10404 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
10405 return ((uint64_t)ret_conv);
10408 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
10409 LDKOutPoint a_conv;
10410 a_conv.inner = (void*)(a & (~1));
10411 a_conv.is_owned = (a & 1) || (a == 0);
10412 a_conv = OutPoint_clone(&a_conv);
10414 b_ref.datalen = *((uint32_t*)b);
10415 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10416 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
10417 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10418 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
10419 return ((uint64_t)ret_conv);
10422 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
10423 if ((_res & 1) != 0) return;
10424 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10425 CHECK_ACCESS(_res_ptr);
10426 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
10428 C2Tuple_OutPointScriptZ_free(_res_conv);
10431 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
10432 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
10433 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10434 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
10435 return ((uint64_t)ret_conv);
10438 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
10440 b_ref.datalen = *((uint32_t*)b);
10441 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10442 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
10443 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10444 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
10445 return ((uint64_t)ret_conv);
10448 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
10449 if ((_res & 1) != 0) return;
10450 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10451 CHECK_ACCESS(_res_ptr);
10452 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
10454 C2Tuple_u32ScriptZ_free(_res_conv);
10457 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
10458 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
10459 _res_constr.datalen = *((uint32_t*)_res);
10460 if (_res_constr.datalen > 0)
10461 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10463 _res_constr.data = NULL;
10464 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10465 for (size_t v = 0; v < _res_constr.datalen; v++) {
10466 uint32_t _res_conv_21 = _res_vals[v];
10467 void* _res_conv_21_ptr = (void*)(((uint64_t)_res_conv_21) & ~1);
10468 CHECK_ACCESS(_res_conv_21_ptr);
10469 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
10470 FREE((void*)_res_conv_21);
10471 _res_constr.data[v] = _res_conv_21_conv;
10473 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
10476 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
10477 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
10478 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10479 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
10480 return ((uint64_t)ret_conv);
10483 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
10484 LDKThirtyTwoBytes a_ref;
10485 CHECK(*((uint32_t*)a) == 32);
10486 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
10487 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
10488 b_constr.datalen = *((uint32_t*)b);
10489 if (b_constr.datalen > 0)
10490 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10492 b_constr.data = NULL;
10493 uint32_t* b_vals = (uint32_t*)(b + 4);
10494 for (size_t v = 0; v < b_constr.datalen; v++) {
10495 uint32_t b_conv_21 = b_vals[v];
10496 void* b_conv_21_ptr = (void*)(((uint64_t)b_conv_21) & ~1);
10497 CHECK_ACCESS(b_conv_21_ptr);
10498 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
10499 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
10500 b_constr.data[v] = b_conv_21_conv;
10502 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10503 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
10504 return ((uint64_t)ret_conv);
10507 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
10508 if ((_res & 1) != 0) return;
10509 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10510 CHECK_ACCESS(_res_ptr);
10511 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
10513 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
10516 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
10517 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
10518 _res_constr.datalen = *((uint32_t*)_res);
10519 if (_res_constr.datalen > 0)
10520 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
10522 _res_constr.data = NULL;
10523 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10524 for (size_t o = 0; o < _res_constr.datalen; o++) {
10525 uint32_t _res_conv_40 = _res_vals[o];
10526 void* _res_conv_40_ptr = (void*)(((uint64_t)_res_conv_40) & ~1);
10527 CHECK_ACCESS(_res_conv_40_ptr);
10528 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
10529 FREE((void*)_res_conv_40);
10530 _res_constr.data[o] = _res_conv_40_conv;
10532 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
10535 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
10536 LDKCVec_EventZ _res_constr;
10537 _res_constr.datalen = *((uint32_t*)_res);
10538 if (_res_constr.datalen > 0)
10539 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
10541 _res_constr.data = NULL;
10542 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10543 for (size_t h = 0; h < _res_constr.datalen; h++) {
10544 uint32_t _res_conv_7 = _res_vals[h];
10545 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
10546 CHECK_ACCESS(_res_conv_7_ptr);
10547 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
10548 FREE((void*)_res_conv_7);
10549 _res_constr.data[h] = _res_conv_7_conv;
10551 CVec_EventZ_free(_res_constr);
10554 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
10555 LDKCVec_TransactionZ _res_constr;
10556 _res_constr.datalen = *((uint32_t*)_res);
10557 if (_res_constr.datalen > 0)
10558 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
10560 _res_constr.data = NULL;
10561 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
10562 for (size_t m = 0; m < _res_constr.datalen; m++) {
10563 int8_tArray _res_conv_12 = _res_vals[m];
10564 LDKTransaction _res_conv_12_ref;
10565 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
10566 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
10567 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
10568 _res_conv_12_ref.data_is_owned = true;
10569 _res_constr.data[m] = _res_conv_12_ref;
10571 CVec_TransactionZ_free(_res_constr);
10574 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
10575 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
10576 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10577 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
10578 return ((uint64_t)ret_conv);
10581 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
10582 void* b_ptr = (void*)(((uint64_t)b) & ~1);
10583 CHECK_ACCESS(b_ptr);
10584 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
10585 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
10586 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10587 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
10588 return ((uint64_t)ret_conv);
10591 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
10592 if ((_res & 1) != 0) return;
10593 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10594 CHECK_ACCESS(_res_ptr);
10595 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
10597 C2Tuple_u32TxOutZ_free(_res_conv);
10600 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
10601 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
10602 _res_constr.datalen = *((uint32_t*)_res);
10603 if (_res_constr.datalen > 0)
10604 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
10606 _res_constr.data = NULL;
10607 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10608 for (size_t u = 0; u < _res_constr.datalen; u++) {
10609 uint32_t _res_conv_20 = _res_vals[u];
10610 void* _res_conv_20_ptr = (void*)(((uint64_t)_res_conv_20) & ~1);
10611 CHECK_ACCESS(_res_conv_20_ptr);
10612 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
10613 FREE((void*)_res_conv_20);
10614 _res_constr.data[u] = _res_conv_20_conv;
10616 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
10619 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
10620 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
10621 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10622 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
10623 return ((uint64_t)ret_conv);
10626 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
10627 LDKThirtyTwoBytes a_ref;
10628 CHECK(*((uint32_t*)a) == 32);
10629 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
10630 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
10631 b_constr.datalen = *((uint32_t*)b);
10632 if (b_constr.datalen > 0)
10633 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
10635 b_constr.data = NULL;
10636 uint32_t* b_vals = (uint32_t*)(b + 4);
10637 for (size_t u = 0; u < b_constr.datalen; u++) {
10638 uint32_t b_conv_20 = b_vals[u];
10639 void* b_conv_20_ptr = (void*)(((uint64_t)b_conv_20) & ~1);
10640 CHECK_ACCESS(b_conv_20_ptr);
10641 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
10642 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
10643 b_constr.data[u] = b_conv_20_conv;
10645 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10646 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
10647 return ((uint64_t)ret_conv);
10650 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
10651 if ((_res & 1) != 0) return;
10652 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10653 CHECK_ACCESS(_res_ptr);
10654 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
10656 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
10659 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
10660 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
10661 _res_constr.datalen = *((uint32_t*)_res);
10662 if (_res_constr.datalen > 0)
10663 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
10665 _res_constr.data = NULL;
10666 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10667 for (size_t n = 0; n < _res_constr.datalen; n++) {
10668 uint32_t _res_conv_39 = _res_vals[n];
10669 void* _res_conv_39_ptr = (void*)(((uint64_t)_res_conv_39) & ~1);
10670 CHECK_ACCESS(_res_conv_39_ptr);
10671 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
10672 FREE((void*)_res_conv_39);
10673 _res_constr.data[n] = _res_conv_39_conv;
10675 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
10678 void __attribute__((visibility("default"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
10679 LDKCVec_BalanceZ _res_constr;
10680 _res_constr.datalen = *((uint32_t*)_res);
10681 if (_res_constr.datalen > 0)
10682 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
10684 _res_constr.data = NULL;
10685 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10686 for (size_t j = 0; j < _res_constr.datalen; j++) {
10687 uint32_t _res_conv_9 = _res_vals[j];
10688 void* _res_conv_9_ptr = (void*)(((uint64_t)_res_conv_9) & ~1);
10689 CHECK_ACCESS(_res_conv_9_ptr);
10690 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
10691 FREE((void*)_res_conv_9);
10692 _res_constr.data[j] = _res_conv_9_conv;
10694 CVec_BalanceZ_free(_res_constr);
10697 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
10698 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10699 CHECK_ACCESS(o_ptr);
10700 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
10701 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
10702 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10703 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
10704 return (uint64_t)ret_conv;
10707 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
10708 LDKDecodeError e_conv;
10709 e_conv.inner = (void*)(e & (~1));
10710 e_conv.is_owned = (e & 1) || (e == 0);
10711 e_conv = DecodeError_clone(&e_conv);
10712 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10713 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
10714 return (uint64_t)ret_conv;
10717 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
10718 if ((_res & 1) != 0) return;
10719 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10720 CHECK_ACCESS(_res_ptr);
10721 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
10723 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
10726 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
10727 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
10728 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10729 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
10730 return (uint64_t)ret_conv;
10733 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
10734 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10735 *ret_conv = CResult_NoneLightningErrorZ_ok();
10736 return (uint64_t)ret_conv;
10739 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
10740 LDKLightningError e_conv;
10741 e_conv.inner = (void*)(e & (~1));
10742 e_conv.is_owned = (e & 1) || (e == 0);
10743 e_conv = LightningError_clone(&e_conv);
10744 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10745 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
10746 return (uint64_t)ret_conv;
10749 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
10750 if ((_res & 1) != 0) return;
10751 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10752 CHECK_ACCESS(_res_ptr);
10753 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
10755 CResult_NoneLightningErrorZ_free(_res_conv);
10758 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
10759 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
10760 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10761 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
10762 return (uint64_t)ret_conv;
10765 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
10766 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
10767 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10768 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
10769 return ((uint64_t)ret_conv);
10772 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
10773 LDKPublicKey a_ref;
10774 CHECK(*((uint32_t*)a) == 33);
10775 memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
10776 void* b_ptr = (void*)(((uint64_t)b) & ~1);
10777 CHECK_ACCESS(b_ptr);
10778 LDKType b_conv = *(LDKType*)(b_ptr);
10779 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10780 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
10781 return ((uint64_t)ret_conv);
10784 void __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
10785 if ((_res & 1) != 0) return;
10786 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10787 CHECK_ACCESS(_res_ptr);
10788 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
10790 C2Tuple_PublicKeyTypeZ_free(_res_conv);
10793 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
10794 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
10795 _res_constr.datalen = *((uint32_t*)_res);
10796 if (_res_constr.datalen > 0)
10797 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
10799 _res_constr.data = NULL;
10800 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10801 for (size_t z = 0; z < _res_constr.datalen; z++) {
10802 uint32_t _res_conv_25 = _res_vals[z];
10803 void* _res_conv_25_ptr = (void*)(((uint64_t)_res_conv_25) & ~1);
10804 CHECK_ACCESS(_res_conv_25_ptr);
10805 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
10806 FREE((void*)_res_conv_25);
10807 _res_constr.data[z] = _res_conv_25_conv;
10809 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
10812 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
10813 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10814 *ret_conv = CResult_boolLightningErrorZ_ok(o);
10815 return (uint64_t)ret_conv;
10818 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
10819 LDKLightningError e_conv;
10820 e_conv.inner = (void*)(e & (~1));
10821 e_conv.is_owned = (e & 1) || (e == 0);
10822 e_conv = LightningError_clone(&e_conv);
10823 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10824 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
10825 return (uint64_t)ret_conv;
10828 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
10829 if ((_res & 1) != 0) return;
10830 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10831 CHECK_ACCESS(_res_ptr);
10832 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
10834 CResult_boolLightningErrorZ_free(_res_conv);
10837 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
10838 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
10839 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10840 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
10841 return (uint64_t)ret_conv;
10844 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
10845 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
10846 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
10847 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
10848 return ((uint64_t)ret_conv);
10851 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
10852 LDKChannelAnnouncement a_conv;
10853 a_conv.inner = (void*)(a & (~1));
10854 a_conv.is_owned = (a & 1) || (a == 0);
10855 a_conv = ChannelAnnouncement_clone(&a_conv);
10856 LDKChannelUpdate b_conv;
10857 b_conv.inner = (void*)(b & (~1));
10858 b_conv.is_owned = (b & 1) || (b == 0);
10859 b_conv = ChannelUpdate_clone(&b_conv);
10860 LDKChannelUpdate c_conv;
10861 c_conv.inner = (void*)(c & (~1));
10862 c_conv.is_owned = (c & 1) || (c == 0);
10863 c_conv = ChannelUpdate_clone(&c_conv);
10864 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
10865 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
10866 return ((uint64_t)ret_conv);
10869 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
10870 if ((_res & 1) != 0) return;
10871 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10872 CHECK_ACCESS(_res_ptr);
10873 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
10875 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
10878 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
10879 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
10880 _res_constr.datalen = *((uint32_t*)_res);
10881 if (_res_constr.datalen > 0)
10882 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
10884 _res_constr.data = NULL;
10885 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10886 for (size_t h = 0; h < _res_constr.datalen; h++) {
10887 uint32_t _res_conv_59 = _res_vals[h];
10888 void* _res_conv_59_ptr = (void*)(((uint64_t)_res_conv_59) & ~1);
10889 CHECK_ACCESS(_res_conv_59_ptr);
10890 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
10891 FREE((void*)_res_conv_59);
10892 _res_constr.data[h] = _res_conv_59_conv;
10894 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
10897 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
10898 LDKCVec_NodeAnnouncementZ _res_constr;
10899 _res_constr.datalen = *((uint32_t*)_res);
10900 if (_res_constr.datalen > 0)
10901 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
10903 _res_constr.data = NULL;
10904 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10905 for (size_t s = 0; s < _res_constr.datalen; s++) {
10906 uint32_t _res_conv_18 = _res_vals[s];
10907 LDKNodeAnnouncement _res_conv_18_conv;
10908 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
10909 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
10910 _res_constr.data[s] = _res_conv_18_conv;
10912 CVec_NodeAnnouncementZ_free(_res_constr);
10915 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
10916 LDKCVec_PublicKeyZ _res_constr;
10917 _res_constr.datalen = *((uint32_t*)_res);
10918 if (_res_constr.datalen > 0)
10919 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
10921 _res_constr.data = NULL;
10922 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
10923 for (size_t m = 0; m < _res_constr.datalen; m++) {
10924 int8_tArray _res_conv_12 = _res_vals[m];
10925 LDKPublicKey _res_conv_12_ref;
10926 CHECK(*((uint32_t*)_res_conv_12) == 33);
10927 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
10928 _res_constr.data[m] = _res_conv_12_ref;
10930 CVec_PublicKeyZ_free(_res_constr);
10933 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
10935 o_ref.datalen = *((uint32_t*)o);
10936 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
10937 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
10938 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10939 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
10940 return (uint64_t)ret_conv;
10943 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
10944 LDKPeerHandleError e_conv;
10945 e_conv.inner = (void*)(e & (~1));
10946 e_conv.is_owned = (e & 1) || (e == 0);
10947 e_conv = PeerHandleError_clone(&e_conv);
10948 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10949 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
10950 return (uint64_t)ret_conv;
10953 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
10954 if ((_res & 1) != 0) return;
10955 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10956 CHECK_ACCESS(_res_ptr);
10957 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
10959 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
10962 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
10963 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
10964 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10965 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
10966 return (uint64_t)ret_conv;
10969 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
10970 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10971 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
10972 return (uint64_t)ret_conv;
10975 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
10976 LDKPeerHandleError e_conv;
10977 e_conv.inner = (void*)(e & (~1));
10978 e_conv.is_owned = (e & 1) || (e == 0);
10979 e_conv = PeerHandleError_clone(&e_conv);
10980 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10981 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
10982 return (uint64_t)ret_conv;
10985 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
10986 if ((_res & 1) != 0) return;
10987 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10988 CHECK_ACCESS(_res_ptr);
10989 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
10991 CResult_NonePeerHandleErrorZ_free(_res_conv);
10994 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
10995 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
10996 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10997 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
10998 return (uint64_t)ret_conv;
11001 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
11002 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11003 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
11004 return (uint64_t)ret_conv;
11007 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
11008 LDKPeerHandleError e_conv;
11009 e_conv.inner = (void*)(e & (~1));
11010 e_conv.is_owned = (e & 1) || (e == 0);
11011 e_conv = PeerHandleError_clone(&e_conv);
11012 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11013 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
11014 return (uint64_t)ret_conv;
11017 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
11018 if ((_res & 1) != 0) return;
11019 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11020 CHECK_ACCESS(_res_ptr);
11021 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
11023 CResult_boolPeerHandleErrorZ_free(_res_conv);
11026 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
11027 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
11028 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11029 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
11030 return (uint64_t)ret_conv;
11033 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
11035 o_conv.inner = (void*)(o & (~1));
11036 o_conv.is_owned = (o & 1) || (o == 0);
11037 o_conv = NodeId_clone(&o_conv);
11038 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
11039 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
11040 return (uint64_t)ret_conv;
11043 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_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_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
11049 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
11050 return (uint64_t)ret_conv;
11053 void __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
11054 if ((_res & 1) != 0) return;
11055 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11056 CHECK_ACCESS(_res_ptr);
11057 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
11059 CResult_NodeIdDecodeErrorZ_free(_res_conv);
11062 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
11063 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
11064 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
11065 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
11066 return (uint64_t)ret_conv;
11069 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_some(uint32_t o) {
11070 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11071 CHECK_ACCESS(o_ptr);
11072 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
11073 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
11074 *ret_copy = COption_AccessZ_some(o_conv);
11075 uint64_t ret_ref = (uint64_t)ret_copy;
11079 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_none() {
11080 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
11081 *ret_copy = COption_AccessZ_none();
11082 uint64_t ret_ref = (uint64_t)ret_copy;
11086 void __attribute__((visibility("default"))) TS_COption_AccessZ_free(uint32_t _res) {
11087 if ((_res & 1) != 0) return;
11088 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11089 CHECK_ACCESS(_res_ptr);
11090 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
11092 COption_AccessZ_free(_res_conv);
11095 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
11096 LDKDirectionalChannelInfo o_conv;
11097 o_conv.inner = (void*)(o & (~1));
11098 o_conv.is_owned = (o & 1) || (o == 0);
11099 o_conv = DirectionalChannelInfo_clone(&o_conv);
11100 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11101 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
11102 return (uint64_t)ret_conv;
11105 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
11106 LDKDecodeError e_conv;
11107 e_conv.inner = (void*)(e & (~1));
11108 e_conv.is_owned = (e & 1) || (e == 0);
11109 e_conv = DecodeError_clone(&e_conv);
11110 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11111 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
11112 return (uint64_t)ret_conv;
11115 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
11116 if ((_res & 1) != 0) return;
11117 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11118 CHECK_ACCESS(_res_ptr);
11119 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(_res_ptr);
11121 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
11124 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
11125 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
11126 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11127 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
11128 return (uint64_t)ret_conv;
11131 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
11132 LDKChannelInfo o_conv;
11133 o_conv.inner = (void*)(o & (~1));
11134 o_conv.is_owned = (o & 1) || (o == 0);
11135 o_conv = ChannelInfo_clone(&o_conv);
11136 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11137 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
11138 return (uint64_t)ret_conv;
11141 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
11142 LDKDecodeError e_conv;
11143 e_conv.inner = (void*)(e & (~1));
11144 e_conv.is_owned = (e & 1) || (e == 0);
11145 e_conv = DecodeError_clone(&e_conv);
11146 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11147 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
11148 return (uint64_t)ret_conv;
11151 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
11152 if ((_res & 1) != 0) return;
11153 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11154 CHECK_ACCESS(_res_ptr);
11155 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
11157 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
11160 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
11161 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
11162 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11163 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
11164 return (uint64_t)ret_conv;
11167 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
11168 LDKRoutingFees o_conv;
11169 o_conv.inner = (void*)(o & (~1));
11170 o_conv.is_owned = (o & 1) || (o == 0);
11171 o_conv = RoutingFees_clone(&o_conv);
11172 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11173 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
11174 return (uint64_t)ret_conv;
11177 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
11178 LDKDecodeError e_conv;
11179 e_conv.inner = (void*)(e & (~1));
11180 e_conv.is_owned = (e & 1) || (e == 0);
11181 e_conv = DecodeError_clone(&e_conv);
11182 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11183 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
11184 return (uint64_t)ret_conv;
11187 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
11188 if ((_res & 1) != 0) return;
11189 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11190 CHECK_ACCESS(_res_ptr);
11191 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
11193 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
11196 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
11197 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
11198 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11199 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
11200 return (uint64_t)ret_conv;
11203 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
11204 LDKNodeAnnouncementInfo o_conv;
11205 o_conv.inner = (void*)(o & (~1));
11206 o_conv.is_owned = (o & 1) || (o == 0);
11207 o_conv = NodeAnnouncementInfo_clone(&o_conv);
11208 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11209 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
11210 return (uint64_t)ret_conv;
11213 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_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_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11219 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
11220 return (uint64_t)ret_conv;
11223 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
11224 if ((_res & 1) != 0) return;
11225 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11226 CHECK_ACCESS(_res_ptr);
11227 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
11229 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
11232 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
11233 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
11234 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11235 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
11236 return (uint64_t)ret_conv;
11239 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
11240 LDKCVec_u64Z _res_constr;
11241 _res_constr.datalen = *((uint32_t*)_res);
11242 if (_res_constr.datalen > 0)
11243 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11245 _res_constr.data = NULL;
11246 int64_t* _res_vals = (int64_t*)(_res + 4);
11247 for (size_t i = 0; i < _res_constr.datalen; i++) {
11248 int64_t _res_conv_8 = _res_vals[i];
11249 _res_constr.data[i] = _res_conv_8;
11251 CVec_u64Z_free(_res_constr);
11254 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
11255 LDKNodeInfo o_conv;
11256 o_conv.inner = (void*)(o & (~1));
11257 o_conv.is_owned = (o & 1) || (o == 0);
11258 o_conv = NodeInfo_clone(&o_conv);
11259 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11260 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
11261 return (uint64_t)ret_conv;
11264 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
11265 LDKDecodeError e_conv;
11266 e_conv.inner = (void*)(e & (~1));
11267 e_conv.is_owned = (e & 1) || (e == 0);
11268 e_conv = DecodeError_clone(&e_conv);
11269 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11270 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
11271 return (uint64_t)ret_conv;
11274 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
11275 if ((_res & 1) != 0) return;
11276 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11277 CHECK_ACCESS(_res_ptr);
11278 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
11280 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
11283 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
11284 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
11285 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11286 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
11287 return (uint64_t)ret_conv;
11290 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
11291 LDKNetworkGraph o_conv;
11292 o_conv.inner = (void*)(o & (~1));
11293 o_conv.is_owned = (o & 1) || (o == 0);
11294 o_conv = NetworkGraph_clone(&o_conv);
11295 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11296 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
11297 return (uint64_t)ret_conv;
11300 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
11301 LDKDecodeError e_conv;
11302 e_conv.inner = (void*)(e & (~1));
11303 e_conv.is_owned = (e & 1) || (e == 0);
11304 e_conv = DecodeError_clone(&e_conv);
11305 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11306 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
11307 return (uint64_t)ret_conv;
11310 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
11311 if ((_res & 1) != 0) return;
11312 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11313 CHECK_ACCESS(_res_ptr);
11314 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
11316 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
11319 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
11320 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
11321 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11322 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
11323 return (uint64_t)ret_conv;
11326 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
11327 LDKCVec_NetAddressZ o_constr;
11328 o_constr.datalen = *((uint32_t*)o);
11329 if (o_constr.datalen > 0)
11330 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11332 o_constr.data = NULL;
11333 uint32_t* o_vals = (uint32_t*)(o + 4);
11334 for (size_t m = 0; m < o_constr.datalen; m++) {
11335 uint32_t o_conv_12 = o_vals[m];
11336 void* o_conv_12_ptr = (void*)(((uint64_t)o_conv_12) & ~1);
11337 CHECK_ACCESS(o_conv_12_ptr);
11338 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
11339 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1));
11340 o_constr.data[m] = o_conv_12_conv;
11342 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
11343 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
11344 uint64_t ret_ref = (uint64_t)ret_copy;
11348 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_none() {
11349 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
11350 *ret_copy = COption_CVec_NetAddressZZ_none();
11351 uint64_t ret_ref = (uint64_t)ret_copy;
11355 void __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
11356 if ((_res & 1) != 0) return;
11357 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11358 CHECK_ACCESS(_res_ptr);
11359 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
11361 COption_CVec_NetAddressZZ_free(_res_conv);
11364 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
11365 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
11366 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
11367 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
11368 uint64_t ret_ref = (uint64_t)ret_copy;
11372 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
11373 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11374 CHECK_ACCESS(o_ptr);
11375 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
11376 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
11377 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11378 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
11379 return (uint64_t)ret_conv;
11382 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_err(int8_t e) {
11383 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11384 *ret_conv = CResult_NetAddressu8Z_err(e);
11385 return (uint64_t)ret_conv;
11388 void __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_free(uint32_t _res) {
11389 if ((_res & 1) != 0) return;
11390 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11391 CHECK_ACCESS(_res_ptr);
11392 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(_res_ptr);
11394 CResult_NetAddressu8Z_free(_res_conv);
11397 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_clone(uint32_t orig) {
11398 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
11399 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11400 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
11401 return (uint64_t)ret_conv;
11404 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
11405 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11406 CHECK_ACCESS(o_ptr);
11407 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(o_ptr);
11408 o_conv = CResult_NetAddressu8Z_clone((LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1));
11409 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11410 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
11411 return (uint64_t)ret_conv;
11414 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_err(uint32_t e) {
11415 LDKDecodeError e_conv;
11416 e_conv.inner = (void*)(e & (~1));
11417 e_conv.is_owned = (e & 1) || (e == 0);
11418 e_conv = DecodeError_clone(&e_conv);
11419 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11420 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
11421 return (uint64_t)ret_conv;
11424 void __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_free(uint32_t _res) {
11425 if ((_res & 1) != 0) return;
11426 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11427 CHECK_ACCESS(_res_ptr);
11428 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(_res_ptr);
11430 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
11433 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(uint32_t orig) {
11434 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
11435 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11436 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
11437 return (uint64_t)ret_conv;
11440 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
11441 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11442 CHECK_ACCESS(o_ptr);
11443 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
11444 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
11445 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11446 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
11447 return (uint64_t)ret_conv;
11450 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
11451 LDKDecodeError e_conv;
11452 e_conv.inner = (void*)(e & (~1));
11453 e_conv.is_owned = (e & 1) || (e == 0);
11454 e_conv = DecodeError_clone(&e_conv);
11455 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11456 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
11457 return (uint64_t)ret_conv;
11460 void __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
11461 if ((_res & 1) != 0) return;
11462 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11463 CHECK_ACCESS(_res_ptr);
11464 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
11466 CResult_NetAddressDecodeErrorZ_free(_res_conv);
11469 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
11470 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
11471 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11472 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
11473 return (uint64_t)ret_conv;
11476 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
11477 LDKCVec_UpdateAddHTLCZ _res_constr;
11478 _res_constr.datalen = *((uint32_t*)_res);
11479 if (_res_constr.datalen > 0)
11480 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11482 _res_constr.data = NULL;
11483 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11484 for (size_t p = 0; p < _res_constr.datalen; p++) {
11485 uint32_t _res_conv_15 = _res_vals[p];
11486 LDKUpdateAddHTLC _res_conv_15_conv;
11487 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
11488 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
11489 _res_constr.data[p] = _res_conv_15_conv;
11491 CVec_UpdateAddHTLCZ_free(_res_constr);
11494 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
11495 LDKCVec_UpdateFulfillHTLCZ _res_constr;
11496 _res_constr.datalen = *((uint32_t*)_res);
11497 if (_res_constr.datalen > 0)
11498 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11500 _res_constr.data = NULL;
11501 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11502 for (size_t t = 0; t < _res_constr.datalen; t++) {
11503 uint32_t _res_conv_19 = _res_vals[t];
11504 LDKUpdateFulfillHTLC _res_conv_19_conv;
11505 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
11506 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
11507 _res_constr.data[t] = _res_conv_19_conv;
11509 CVec_UpdateFulfillHTLCZ_free(_res_constr);
11512 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
11513 LDKCVec_UpdateFailHTLCZ _res_constr;
11514 _res_constr.datalen = *((uint32_t*)_res);
11515 if (_res_constr.datalen > 0)
11516 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11518 _res_constr.data = NULL;
11519 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11520 for (size_t q = 0; q < _res_constr.datalen; q++) {
11521 uint32_t _res_conv_16 = _res_vals[q];
11522 LDKUpdateFailHTLC _res_conv_16_conv;
11523 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11524 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11525 _res_constr.data[q] = _res_conv_16_conv;
11527 CVec_UpdateFailHTLCZ_free(_res_constr);
11530 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
11531 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
11532 _res_constr.datalen = *((uint32_t*)_res);
11533 if (_res_constr.datalen > 0)
11534 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11536 _res_constr.data = NULL;
11537 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11538 for (size_t z = 0; z < _res_constr.datalen; z++) {
11539 uint32_t _res_conv_25 = _res_vals[z];
11540 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
11541 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
11542 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
11543 _res_constr.data[z] = _res_conv_25_conv;
11545 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
11548 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
11549 LDKAcceptChannel o_conv;
11550 o_conv.inner = (void*)(o & (~1));
11551 o_conv.is_owned = (o & 1) || (o == 0);
11552 o_conv = AcceptChannel_clone(&o_conv);
11553 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11554 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
11555 return (uint64_t)ret_conv;
11558 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
11559 LDKDecodeError e_conv;
11560 e_conv.inner = (void*)(e & (~1));
11561 e_conv.is_owned = (e & 1) || (e == 0);
11562 e_conv = DecodeError_clone(&e_conv);
11563 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11564 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
11565 return (uint64_t)ret_conv;
11568 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
11569 if ((_res & 1) != 0) return;
11570 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11571 CHECK_ACCESS(_res_ptr);
11572 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
11574 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
11577 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
11578 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
11579 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11580 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
11581 return (uint64_t)ret_conv;
11584 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
11585 LDKAnnouncementSignatures o_conv;
11586 o_conv.inner = (void*)(o & (~1));
11587 o_conv.is_owned = (o & 1) || (o == 0);
11588 o_conv = AnnouncementSignatures_clone(&o_conv);
11589 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11590 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
11591 return (uint64_t)ret_conv;
11594 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
11595 LDKDecodeError e_conv;
11596 e_conv.inner = (void*)(e & (~1));
11597 e_conv.is_owned = (e & 1) || (e == 0);
11598 e_conv = DecodeError_clone(&e_conv);
11599 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11600 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
11601 return (uint64_t)ret_conv;
11604 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
11605 if ((_res & 1) != 0) return;
11606 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11607 CHECK_ACCESS(_res_ptr);
11608 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
11610 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
11613 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
11614 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
11615 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11616 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
11617 return (uint64_t)ret_conv;
11620 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
11621 LDKChannelReestablish o_conv;
11622 o_conv.inner = (void*)(o & (~1));
11623 o_conv.is_owned = (o & 1) || (o == 0);
11624 o_conv = ChannelReestablish_clone(&o_conv);
11625 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11626 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
11627 return (uint64_t)ret_conv;
11630 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
11631 LDKDecodeError e_conv;
11632 e_conv.inner = (void*)(e & (~1));
11633 e_conv.is_owned = (e & 1) || (e == 0);
11634 e_conv = DecodeError_clone(&e_conv);
11635 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11636 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
11637 return (uint64_t)ret_conv;
11640 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
11641 if ((_res & 1) != 0) return;
11642 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11643 CHECK_ACCESS(_res_ptr);
11644 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
11646 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
11649 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
11650 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
11651 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11652 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
11653 return (uint64_t)ret_conv;
11656 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
11657 LDKClosingSigned o_conv;
11658 o_conv.inner = (void*)(o & (~1));
11659 o_conv.is_owned = (o & 1) || (o == 0);
11660 o_conv = ClosingSigned_clone(&o_conv);
11661 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11662 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
11663 return (uint64_t)ret_conv;
11666 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
11667 LDKDecodeError e_conv;
11668 e_conv.inner = (void*)(e & (~1));
11669 e_conv.is_owned = (e & 1) || (e == 0);
11670 e_conv = DecodeError_clone(&e_conv);
11671 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11672 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
11673 return (uint64_t)ret_conv;
11676 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
11677 if ((_res & 1) != 0) return;
11678 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11679 CHECK_ACCESS(_res_ptr);
11680 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
11682 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
11685 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
11686 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
11687 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11688 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
11689 return (uint64_t)ret_conv;
11692 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
11693 LDKClosingSignedFeeRange o_conv;
11694 o_conv.inner = (void*)(o & (~1));
11695 o_conv.is_owned = (o & 1) || (o == 0);
11696 o_conv = ClosingSignedFeeRange_clone(&o_conv);
11697 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
11698 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
11699 return (uint64_t)ret_conv;
11702 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
11703 LDKDecodeError e_conv;
11704 e_conv.inner = (void*)(e & (~1));
11705 e_conv.is_owned = (e & 1) || (e == 0);
11706 e_conv = DecodeError_clone(&e_conv);
11707 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
11708 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
11709 return (uint64_t)ret_conv;
11712 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
11713 if ((_res & 1) != 0) return;
11714 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11715 CHECK_ACCESS(_res_ptr);
11716 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
11718 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
11721 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
11722 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
11723 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
11724 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
11725 return (uint64_t)ret_conv;
11728 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
11729 LDKCommitmentSigned o_conv;
11730 o_conv.inner = (void*)(o & (~1));
11731 o_conv.is_owned = (o & 1) || (o == 0);
11732 o_conv = CommitmentSigned_clone(&o_conv);
11733 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11734 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
11735 return (uint64_t)ret_conv;
11738 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
11739 LDKDecodeError e_conv;
11740 e_conv.inner = (void*)(e & (~1));
11741 e_conv.is_owned = (e & 1) || (e == 0);
11742 e_conv = DecodeError_clone(&e_conv);
11743 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11744 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
11745 return (uint64_t)ret_conv;
11748 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
11749 if ((_res & 1) != 0) return;
11750 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11751 CHECK_ACCESS(_res_ptr);
11752 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
11754 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
11757 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
11758 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
11759 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11760 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
11761 return (uint64_t)ret_conv;
11764 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
11765 LDKFundingCreated o_conv;
11766 o_conv.inner = (void*)(o & (~1));
11767 o_conv.is_owned = (o & 1) || (o == 0);
11768 o_conv = FundingCreated_clone(&o_conv);
11769 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11770 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
11771 return (uint64_t)ret_conv;
11774 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
11775 LDKDecodeError e_conv;
11776 e_conv.inner = (void*)(e & (~1));
11777 e_conv.is_owned = (e & 1) || (e == 0);
11778 e_conv = DecodeError_clone(&e_conv);
11779 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11780 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
11781 return (uint64_t)ret_conv;
11784 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
11785 if ((_res & 1) != 0) return;
11786 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11787 CHECK_ACCESS(_res_ptr);
11788 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
11790 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
11793 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
11794 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
11795 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11796 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
11797 return (uint64_t)ret_conv;
11800 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
11801 LDKFundingSigned o_conv;
11802 o_conv.inner = (void*)(o & (~1));
11803 o_conv.is_owned = (o & 1) || (o == 0);
11804 o_conv = FundingSigned_clone(&o_conv);
11805 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
11806 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
11807 return (uint64_t)ret_conv;
11810 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
11811 LDKDecodeError e_conv;
11812 e_conv.inner = (void*)(e & (~1));
11813 e_conv.is_owned = (e & 1) || (e == 0);
11814 e_conv = DecodeError_clone(&e_conv);
11815 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
11816 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
11817 return (uint64_t)ret_conv;
11820 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
11821 if ((_res & 1) != 0) return;
11822 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11823 CHECK_ACCESS(_res_ptr);
11824 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
11826 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
11829 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
11830 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
11831 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
11832 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
11833 return (uint64_t)ret_conv;
11836 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
11837 LDKFundingLocked o_conv;
11838 o_conv.inner = (void*)(o & (~1));
11839 o_conv.is_owned = (o & 1) || (o == 0);
11840 o_conv = FundingLocked_clone(&o_conv);
11841 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
11842 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
11843 return (uint64_t)ret_conv;
11846 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
11847 LDKDecodeError e_conv;
11848 e_conv.inner = (void*)(e & (~1));
11849 e_conv.is_owned = (e & 1) || (e == 0);
11850 e_conv = DecodeError_clone(&e_conv);
11851 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
11852 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
11853 return (uint64_t)ret_conv;
11856 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
11857 if ((_res & 1) != 0) return;
11858 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11859 CHECK_ACCESS(_res_ptr);
11860 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
11862 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
11865 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
11866 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
11867 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
11868 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
11869 return (uint64_t)ret_conv;
11872 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
11874 o_conv.inner = (void*)(o & (~1));
11875 o_conv.is_owned = (o & 1) || (o == 0);
11876 o_conv = Init_clone(&o_conv);
11877 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
11878 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
11879 return (uint64_t)ret_conv;
11882 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
11883 LDKDecodeError e_conv;
11884 e_conv.inner = (void*)(e & (~1));
11885 e_conv.is_owned = (e & 1) || (e == 0);
11886 e_conv = DecodeError_clone(&e_conv);
11887 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
11888 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
11889 return (uint64_t)ret_conv;
11892 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
11893 if ((_res & 1) != 0) return;
11894 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11895 CHECK_ACCESS(_res_ptr);
11896 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
11898 CResult_InitDecodeErrorZ_free(_res_conv);
11901 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
11902 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
11903 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
11904 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
11905 return (uint64_t)ret_conv;
11908 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
11909 LDKOpenChannel o_conv;
11910 o_conv.inner = (void*)(o & (~1));
11911 o_conv.is_owned = (o & 1) || (o == 0);
11912 o_conv = OpenChannel_clone(&o_conv);
11913 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
11914 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
11915 return (uint64_t)ret_conv;
11918 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
11919 LDKDecodeError e_conv;
11920 e_conv.inner = (void*)(e & (~1));
11921 e_conv.is_owned = (e & 1) || (e == 0);
11922 e_conv = DecodeError_clone(&e_conv);
11923 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
11924 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
11925 return (uint64_t)ret_conv;
11928 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
11929 if ((_res & 1) != 0) return;
11930 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11931 CHECK_ACCESS(_res_ptr);
11932 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
11934 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
11937 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
11938 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
11939 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
11940 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
11941 return (uint64_t)ret_conv;
11944 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
11945 LDKRevokeAndACK o_conv;
11946 o_conv.inner = (void*)(o & (~1));
11947 o_conv.is_owned = (o & 1) || (o == 0);
11948 o_conv = RevokeAndACK_clone(&o_conv);
11949 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
11950 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
11951 return (uint64_t)ret_conv;
11954 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
11955 LDKDecodeError e_conv;
11956 e_conv.inner = (void*)(e & (~1));
11957 e_conv.is_owned = (e & 1) || (e == 0);
11958 e_conv = DecodeError_clone(&e_conv);
11959 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
11960 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
11961 return (uint64_t)ret_conv;
11964 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
11965 if ((_res & 1) != 0) return;
11966 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11967 CHECK_ACCESS(_res_ptr);
11968 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
11970 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
11973 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
11974 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
11975 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
11976 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
11977 return (uint64_t)ret_conv;
11980 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
11981 LDKShutdown o_conv;
11982 o_conv.inner = (void*)(o & (~1));
11983 o_conv.is_owned = (o & 1) || (o == 0);
11984 o_conv = Shutdown_clone(&o_conv);
11985 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
11986 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
11987 return (uint64_t)ret_conv;
11990 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
11991 LDKDecodeError e_conv;
11992 e_conv.inner = (void*)(e & (~1));
11993 e_conv.is_owned = (e & 1) || (e == 0);
11994 e_conv = DecodeError_clone(&e_conv);
11995 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
11996 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
11997 return (uint64_t)ret_conv;
12000 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
12001 if ((_res & 1) != 0) return;
12002 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12003 CHECK_ACCESS(_res_ptr);
12004 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
12006 CResult_ShutdownDecodeErrorZ_free(_res_conv);
12009 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
12010 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
12011 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12012 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
12013 return (uint64_t)ret_conv;
12016 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
12017 LDKUpdateFailHTLC o_conv;
12018 o_conv.inner = (void*)(o & (~1));
12019 o_conv.is_owned = (o & 1) || (o == 0);
12020 o_conv = UpdateFailHTLC_clone(&o_conv);
12021 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12022 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
12023 return (uint64_t)ret_conv;
12026 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
12027 LDKDecodeError e_conv;
12028 e_conv.inner = (void*)(e & (~1));
12029 e_conv.is_owned = (e & 1) || (e == 0);
12030 e_conv = DecodeError_clone(&e_conv);
12031 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12032 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
12033 return (uint64_t)ret_conv;
12036 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
12037 if ((_res & 1) != 0) return;
12038 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12039 CHECK_ACCESS(_res_ptr);
12040 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
12042 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
12045 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
12046 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
12047 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12048 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
12049 return (uint64_t)ret_conv;
12052 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
12053 LDKUpdateFailMalformedHTLC o_conv;
12054 o_conv.inner = (void*)(o & (~1));
12055 o_conv.is_owned = (o & 1) || (o == 0);
12056 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
12057 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12058 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
12059 return (uint64_t)ret_conv;
12062 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
12063 LDKDecodeError e_conv;
12064 e_conv.inner = (void*)(e & (~1));
12065 e_conv.is_owned = (e & 1) || (e == 0);
12066 e_conv = DecodeError_clone(&e_conv);
12067 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12068 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
12069 return (uint64_t)ret_conv;
12072 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
12073 if ((_res & 1) != 0) return;
12074 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12075 CHECK_ACCESS(_res_ptr);
12076 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
12078 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
12081 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
12082 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
12083 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12084 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
12085 return (uint64_t)ret_conv;
12088 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
12089 LDKUpdateFee o_conv;
12090 o_conv.inner = (void*)(o & (~1));
12091 o_conv.is_owned = (o & 1) || (o == 0);
12092 o_conv = UpdateFee_clone(&o_conv);
12093 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12094 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
12095 return (uint64_t)ret_conv;
12098 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
12099 LDKDecodeError e_conv;
12100 e_conv.inner = (void*)(e & (~1));
12101 e_conv.is_owned = (e & 1) || (e == 0);
12102 e_conv = DecodeError_clone(&e_conv);
12103 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12104 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
12105 return (uint64_t)ret_conv;
12108 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
12109 if ((_res & 1) != 0) return;
12110 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12111 CHECK_ACCESS(_res_ptr);
12112 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
12114 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
12117 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
12118 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
12119 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12120 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
12121 return (uint64_t)ret_conv;
12124 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
12125 LDKUpdateFulfillHTLC o_conv;
12126 o_conv.inner = (void*)(o & (~1));
12127 o_conv.is_owned = (o & 1) || (o == 0);
12128 o_conv = UpdateFulfillHTLC_clone(&o_conv);
12129 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12130 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
12131 return (uint64_t)ret_conv;
12134 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
12135 LDKDecodeError e_conv;
12136 e_conv.inner = (void*)(e & (~1));
12137 e_conv.is_owned = (e & 1) || (e == 0);
12138 e_conv = DecodeError_clone(&e_conv);
12139 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12140 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
12141 return (uint64_t)ret_conv;
12144 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
12145 if ((_res & 1) != 0) return;
12146 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12147 CHECK_ACCESS(_res_ptr);
12148 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
12150 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
12153 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
12154 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
12155 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12156 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
12157 return (uint64_t)ret_conv;
12160 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
12161 LDKUpdateAddHTLC o_conv;
12162 o_conv.inner = (void*)(o & (~1));
12163 o_conv.is_owned = (o & 1) || (o == 0);
12164 o_conv = UpdateAddHTLC_clone(&o_conv);
12165 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12166 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
12167 return (uint64_t)ret_conv;
12170 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
12171 LDKDecodeError e_conv;
12172 e_conv.inner = (void*)(e & (~1));
12173 e_conv.is_owned = (e & 1) || (e == 0);
12174 e_conv = DecodeError_clone(&e_conv);
12175 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12176 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
12177 return (uint64_t)ret_conv;
12180 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
12181 if ((_res & 1) != 0) return;
12182 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12183 CHECK_ACCESS(_res_ptr);
12184 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
12186 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
12189 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
12190 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
12191 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12192 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
12193 return (uint64_t)ret_conv;
12196 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
12198 o_conv.inner = (void*)(o & (~1));
12199 o_conv.is_owned = (o & 1) || (o == 0);
12200 o_conv = Ping_clone(&o_conv);
12201 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12202 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
12203 return (uint64_t)ret_conv;
12206 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
12207 LDKDecodeError e_conv;
12208 e_conv.inner = (void*)(e & (~1));
12209 e_conv.is_owned = (e & 1) || (e == 0);
12210 e_conv = DecodeError_clone(&e_conv);
12211 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12212 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
12213 return (uint64_t)ret_conv;
12216 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
12217 if ((_res & 1) != 0) return;
12218 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12219 CHECK_ACCESS(_res_ptr);
12220 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
12222 CResult_PingDecodeErrorZ_free(_res_conv);
12225 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
12226 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
12227 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12228 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
12229 return (uint64_t)ret_conv;
12232 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
12234 o_conv.inner = (void*)(o & (~1));
12235 o_conv.is_owned = (o & 1) || (o == 0);
12236 o_conv = Pong_clone(&o_conv);
12237 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12238 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
12239 return (uint64_t)ret_conv;
12242 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
12243 LDKDecodeError e_conv;
12244 e_conv.inner = (void*)(e & (~1));
12245 e_conv.is_owned = (e & 1) || (e == 0);
12246 e_conv = DecodeError_clone(&e_conv);
12247 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12248 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
12249 return (uint64_t)ret_conv;
12252 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
12253 if ((_res & 1) != 0) return;
12254 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12255 CHECK_ACCESS(_res_ptr);
12256 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
12258 CResult_PongDecodeErrorZ_free(_res_conv);
12261 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
12262 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
12263 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12264 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
12265 return (uint64_t)ret_conv;
12268 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
12269 LDKUnsignedChannelAnnouncement o_conv;
12270 o_conv.inner = (void*)(o & (~1));
12271 o_conv.is_owned = (o & 1) || (o == 0);
12272 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
12273 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12274 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
12275 return (uint64_t)ret_conv;
12278 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
12279 LDKDecodeError e_conv;
12280 e_conv.inner = (void*)(e & (~1));
12281 e_conv.is_owned = (e & 1) || (e == 0);
12282 e_conv = DecodeError_clone(&e_conv);
12283 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12284 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
12285 return (uint64_t)ret_conv;
12288 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
12289 if ((_res & 1) != 0) return;
12290 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12291 CHECK_ACCESS(_res_ptr);
12292 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
12294 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
12297 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
12298 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
12299 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12300 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
12301 return (uint64_t)ret_conv;
12304 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
12305 LDKChannelAnnouncement o_conv;
12306 o_conv.inner = (void*)(o & (~1));
12307 o_conv.is_owned = (o & 1) || (o == 0);
12308 o_conv = ChannelAnnouncement_clone(&o_conv);
12309 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12310 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
12311 return (uint64_t)ret_conv;
12314 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
12315 LDKDecodeError e_conv;
12316 e_conv.inner = (void*)(e & (~1));
12317 e_conv.is_owned = (e & 1) || (e == 0);
12318 e_conv = DecodeError_clone(&e_conv);
12319 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12320 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
12321 return (uint64_t)ret_conv;
12324 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
12325 if ((_res & 1) != 0) return;
12326 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12327 CHECK_ACCESS(_res_ptr);
12328 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
12330 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
12333 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
12334 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
12335 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12336 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
12337 return (uint64_t)ret_conv;
12340 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
12341 LDKUnsignedChannelUpdate o_conv;
12342 o_conv.inner = (void*)(o & (~1));
12343 o_conv.is_owned = (o & 1) || (o == 0);
12344 o_conv = UnsignedChannelUpdate_clone(&o_conv);
12345 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12346 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
12347 return (uint64_t)ret_conv;
12350 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
12351 LDKDecodeError e_conv;
12352 e_conv.inner = (void*)(e & (~1));
12353 e_conv.is_owned = (e & 1) || (e == 0);
12354 e_conv = DecodeError_clone(&e_conv);
12355 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12356 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
12357 return (uint64_t)ret_conv;
12360 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
12361 if ((_res & 1) != 0) return;
12362 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12363 CHECK_ACCESS(_res_ptr);
12364 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
12366 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
12369 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
12370 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
12371 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12372 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
12373 return (uint64_t)ret_conv;
12376 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
12377 LDKChannelUpdate o_conv;
12378 o_conv.inner = (void*)(o & (~1));
12379 o_conv.is_owned = (o & 1) || (o == 0);
12380 o_conv = ChannelUpdate_clone(&o_conv);
12381 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12382 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
12383 return (uint64_t)ret_conv;
12386 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
12387 LDKDecodeError e_conv;
12388 e_conv.inner = (void*)(e & (~1));
12389 e_conv.is_owned = (e & 1) || (e == 0);
12390 e_conv = DecodeError_clone(&e_conv);
12391 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12392 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
12393 return (uint64_t)ret_conv;
12396 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
12397 if ((_res & 1) != 0) return;
12398 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12399 CHECK_ACCESS(_res_ptr);
12400 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
12402 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
12405 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
12406 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
12407 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12408 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
12409 return (uint64_t)ret_conv;
12412 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
12413 LDKErrorMessage o_conv;
12414 o_conv.inner = (void*)(o & (~1));
12415 o_conv.is_owned = (o & 1) || (o == 0);
12416 o_conv = ErrorMessage_clone(&o_conv);
12417 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12418 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
12419 return (uint64_t)ret_conv;
12422 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
12423 LDKDecodeError e_conv;
12424 e_conv.inner = (void*)(e & (~1));
12425 e_conv.is_owned = (e & 1) || (e == 0);
12426 e_conv = DecodeError_clone(&e_conv);
12427 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12428 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
12429 return (uint64_t)ret_conv;
12432 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
12433 if ((_res & 1) != 0) return;
12434 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12435 CHECK_ACCESS(_res_ptr);
12436 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
12438 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
12441 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
12442 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
12443 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12444 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
12445 return (uint64_t)ret_conv;
12448 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
12449 LDKUnsignedNodeAnnouncement o_conv;
12450 o_conv.inner = (void*)(o & (~1));
12451 o_conv.is_owned = (o & 1) || (o == 0);
12452 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
12453 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12454 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
12455 return (uint64_t)ret_conv;
12458 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
12459 LDKDecodeError e_conv;
12460 e_conv.inner = (void*)(e & (~1));
12461 e_conv.is_owned = (e & 1) || (e == 0);
12462 e_conv = DecodeError_clone(&e_conv);
12463 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12464 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
12465 return (uint64_t)ret_conv;
12468 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
12469 if ((_res & 1) != 0) return;
12470 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12471 CHECK_ACCESS(_res_ptr);
12472 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
12474 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
12477 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
12478 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
12479 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12480 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
12481 return (uint64_t)ret_conv;
12484 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
12485 LDKNodeAnnouncement o_conv;
12486 o_conv.inner = (void*)(o & (~1));
12487 o_conv.is_owned = (o & 1) || (o == 0);
12488 o_conv = NodeAnnouncement_clone(&o_conv);
12489 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12490 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
12491 return (uint64_t)ret_conv;
12494 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
12495 LDKDecodeError e_conv;
12496 e_conv.inner = (void*)(e & (~1));
12497 e_conv.is_owned = (e & 1) || (e == 0);
12498 e_conv = DecodeError_clone(&e_conv);
12499 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12500 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
12501 return (uint64_t)ret_conv;
12504 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
12505 if ((_res & 1) != 0) return;
12506 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12507 CHECK_ACCESS(_res_ptr);
12508 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
12510 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
12513 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
12514 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
12515 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12516 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
12517 return (uint64_t)ret_conv;
12520 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
12521 LDKQueryShortChannelIds o_conv;
12522 o_conv.inner = (void*)(o & (~1));
12523 o_conv.is_owned = (o & 1) || (o == 0);
12524 o_conv = QueryShortChannelIds_clone(&o_conv);
12525 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12526 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
12527 return (uint64_t)ret_conv;
12530 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
12531 LDKDecodeError e_conv;
12532 e_conv.inner = (void*)(e & (~1));
12533 e_conv.is_owned = (e & 1) || (e == 0);
12534 e_conv = DecodeError_clone(&e_conv);
12535 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12536 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
12537 return (uint64_t)ret_conv;
12540 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
12541 if ((_res & 1) != 0) return;
12542 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12543 CHECK_ACCESS(_res_ptr);
12544 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
12546 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
12549 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
12550 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
12551 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12552 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
12553 return (uint64_t)ret_conv;
12556 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
12557 LDKReplyShortChannelIdsEnd o_conv;
12558 o_conv.inner = (void*)(o & (~1));
12559 o_conv.is_owned = (o & 1) || (o == 0);
12560 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
12561 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12562 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
12563 return (uint64_t)ret_conv;
12566 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
12567 LDKDecodeError e_conv;
12568 e_conv.inner = (void*)(e & (~1));
12569 e_conv.is_owned = (e & 1) || (e == 0);
12570 e_conv = DecodeError_clone(&e_conv);
12571 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12572 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
12573 return (uint64_t)ret_conv;
12576 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
12577 if ((_res & 1) != 0) return;
12578 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12579 CHECK_ACCESS(_res_ptr);
12580 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
12582 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
12585 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
12586 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
12587 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12588 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
12589 return (uint64_t)ret_conv;
12592 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
12593 LDKQueryChannelRange o_conv;
12594 o_conv.inner = (void*)(o & (~1));
12595 o_conv.is_owned = (o & 1) || (o == 0);
12596 o_conv = QueryChannelRange_clone(&o_conv);
12597 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12598 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
12599 return (uint64_t)ret_conv;
12602 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
12603 LDKDecodeError e_conv;
12604 e_conv.inner = (void*)(e & (~1));
12605 e_conv.is_owned = (e & 1) || (e == 0);
12606 e_conv = DecodeError_clone(&e_conv);
12607 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12608 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
12609 return (uint64_t)ret_conv;
12612 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
12613 if ((_res & 1) != 0) return;
12614 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12615 CHECK_ACCESS(_res_ptr);
12616 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
12618 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
12621 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
12622 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
12623 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12624 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
12625 return (uint64_t)ret_conv;
12628 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
12629 LDKReplyChannelRange o_conv;
12630 o_conv.inner = (void*)(o & (~1));
12631 o_conv.is_owned = (o & 1) || (o == 0);
12632 o_conv = ReplyChannelRange_clone(&o_conv);
12633 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12634 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
12635 return (uint64_t)ret_conv;
12638 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
12639 LDKDecodeError e_conv;
12640 e_conv.inner = (void*)(e & (~1));
12641 e_conv.is_owned = (e & 1) || (e == 0);
12642 e_conv = DecodeError_clone(&e_conv);
12643 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12644 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
12645 return (uint64_t)ret_conv;
12648 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
12649 if ((_res & 1) != 0) return;
12650 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12651 CHECK_ACCESS(_res_ptr);
12652 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
12654 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
12657 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
12658 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
12659 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12660 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
12661 return (uint64_t)ret_conv;
12664 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
12665 LDKGossipTimestampFilter o_conv;
12666 o_conv.inner = (void*)(o & (~1));
12667 o_conv.is_owned = (o & 1) || (o == 0);
12668 o_conv = GossipTimestampFilter_clone(&o_conv);
12669 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12670 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
12671 return (uint64_t)ret_conv;
12674 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
12675 LDKDecodeError e_conv;
12676 e_conv.inner = (void*)(e & (~1));
12677 e_conv.is_owned = (e & 1) || (e == 0);
12678 e_conv = DecodeError_clone(&e_conv);
12679 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12680 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
12681 return (uint64_t)ret_conv;
12684 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
12685 if ((_res & 1) != 0) return;
12686 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12687 CHECK_ACCESS(_res_ptr);
12688 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
12690 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
12693 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
12694 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
12695 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12696 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
12697 return (uint64_t)ret_conv;
12700 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
12702 o_conv.inner = (void*)(o & (~1));
12703 o_conv.is_owned = (o & 1) || (o == 0);
12704 o_conv = Invoice_clone(&o_conv);
12705 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12706 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
12707 return (uint64_t)ret_conv;
12710 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
12711 void* e_ptr = (void*)(((uint64_t)e) & ~1);
12712 CHECK_ACCESS(e_ptr);
12713 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
12714 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
12715 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12716 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
12717 return (uint64_t)ret_conv;
12720 void __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
12721 if ((_res & 1) != 0) return;
12722 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12723 CHECK_ACCESS(_res_ptr);
12724 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
12726 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
12729 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
12730 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
12731 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12732 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
12733 return (uint64_t)ret_conv;
12736 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_some(uint32_t o) {
12737 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12738 CHECK_ACCESS(o_ptr);
12739 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
12740 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
12741 *ret_copy = COption_FilterZ_some(o_conv);
12742 uint64_t ret_ref = (uint64_t)ret_copy;
12746 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_none() {
12747 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
12748 *ret_copy = COption_FilterZ_none();
12749 uint64_t ret_ref = (uint64_t)ret_copy;
12753 void __attribute__((visibility("default"))) TS_COption_FilterZ_free(uint32_t _res) {
12754 if ((_res & 1) != 0) return;
12755 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12756 CHECK_ACCESS(_res_ptr);
12757 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
12759 COption_FilterZ_free(_res_conv);
12762 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
12763 LDKLockedChannelMonitor o_conv;
12764 o_conv.inner = (void*)(o & (~1));
12765 o_conv.is_owned = (o & 1) || (o == 0);
12766 // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor
12767 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
12768 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
12769 return (uint64_t)ret_conv;
12772 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
12773 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
12774 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
12775 return (uint64_t)ret_conv;
12778 void __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
12779 if ((_res & 1) != 0) return;
12780 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12781 CHECK_ACCESS(_res_ptr);
12782 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
12784 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
12787 void __attribute__((visibility("default"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
12788 LDKCVec_OutPointZ _res_constr;
12789 _res_constr.datalen = *((uint32_t*)_res);
12790 if (_res_constr.datalen > 0)
12791 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
12793 _res_constr.data = NULL;
12794 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12795 for (size_t k = 0; k < _res_constr.datalen; k++) {
12796 uint32_t _res_conv_10 = _res_vals[k];
12797 LDKOutPoint _res_conv_10_conv;
12798 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
12799 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
12800 _res_constr.data[k] = _res_conv_10_conv;
12802 CVec_OutPointZ_free(_res_constr);
12805 void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
12806 if ((this_ptr & 1) != 0) return;
12807 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
12808 CHECK_ACCESS(this_ptr_ptr);
12809 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
12810 FREE((void*)this_ptr);
12811 PaymentPurpose_free(this_ptr_conv);
12814 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) {
12815 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
12816 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
12817 *ret_copy = PaymentPurpose_clone(orig_conv);
12818 uint64_t ret_ref = (uint64_t)ret_copy;
12822 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
12823 LDKThirtyTwoBytes payment_preimage_ref;
12824 CHECK(*((uint32_t*)payment_preimage) == 32);
12825 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
12826 LDKThirtyTwoBytes payment_secret_ref;
12827 CHECK(*((uint32_t*)payment_secret) == 32);
12828 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
12829 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
12830 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
12831 uint64_t ret_ref = (uint64_t)ret_copy;
12835 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
12836 LDKThirtyTwoBytes a_ref;
12837 CHECK(*((uint32_t*)a) == 32);
12838 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
12839 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
12840 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
12841 uint64_t ret_ref = (uint64_t)ret_copy;
12845 void __attribute__((visibility("default"))) TS_ClosureReason_free(uint32_t this_ptr) {
12846 if ((this_ptr & 1) != 0) return;
12847 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
12848 CHECK_ACCESS(this_ptr_ptr);
12849 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
12850 FREE((void*)this_ptr);
12851 ClosureReason_free(this_ptr_conv);
12854 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_clone(uint32_t orig) {
12855 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
12856 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12857 *ret_copy = ClosureReason_clone(orig_conv);
12858 uint64_t ret_ref = (uint64_t)ret_copy;
12862 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
12863 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
12864 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12865 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
12866 uint64_t ret_ref = (uint64_t)ret_copy;
12870 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_holder_force_closed() {
12871 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12872 *ret_copy = ClosureReason_holder_force_closed();
12873 uint64_t ret_ref = (uint64_t)ret_copy;
12877 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_cooperative_closure() {
12878 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12879 *ret_copy = ClosureReason_cooperative_closure();
12880 uint64_t ret_ref = (uint64_t)ret_copy;
12884 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_commitment_tx_confirmed() {
12885 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12886 *ret_copy = ClosureReason_commitment_tx_confirmed();
12887 uint64_t ret_ref = (uint64_t)ret_copy;
12891 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_processing_error(jstring err) {
12892 LDKStr err_conv = str_ref_to_owned_c(err);
12893 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12894 *ret_copy = ClosureReason_processing_error(err_conv);
12895 uint64_t ret_ref = (uint64_t)ret_copy;
12899 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_disconnected_peer() {
12900 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12901 *ret_copy = ClosureReason_disconnected_peer();
12902 uint64_t ret_ref = (uint64_t)ret_copy;
12906 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_outdated_channel_manager() {
12907 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12908 *ret_copy = ClosureReason_outdated_channel_manager();
12909 uint64_t ret_ref = (uint64_t)ret_copy;
12913 int8_tArray __attribute__((visibility("default"))) TS_ClosureReason_write(uint32_t obj) {
12914 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
12915 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
12916 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12917 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12918 CVec_u8Z_free(ret_var);
12922 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
12923 if ((this_ptr & 1) != 0) return;
12924 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
12925 CHECK_ACCESS(this_ptr_ptr);
12926 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
12927 FREE((void*)this_ptr);
12928 Event_free(this_ptr_conv);
12931 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
12932 LDKEvent* orig_conv = (LDKEvent*)orig;
12933 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12934 *ret_copy = Event_clone(orig_conv);
12935 uint64_t ret_ref = (uint64_t)ret_copy;
12939 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) {
12940 LDKThirtyTwoBytes temporary_channel_id_ref;
12941 CHECK(*((uint32_t*)temporary_channel_id) == 32);
12942 memcpy(temporary_channel_id_ref.data, (uint8_t*)(temporary_channel_id + 4), 32);
12943 LDKCVec_u8Z output_script_ref;
12944 output_script_ref.datalen = *((uint32_t*)output_script);
12945 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
12946 memcpy(output_script_ref.data, (uint8_t*)(output_script + 4), output_script_ref.datalen);
12947 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12948 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
12949 uint64_t ret_ref = (uint64_t)ret_copy;
12953 uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
12954 LDKThirtyTwoBytes payment_hash_ref;
12955 CHECK(*((uint32_t*)payment_hash) == 32);
12956 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
12957 void* purpose_ptr = (void*)(((uint64_t)purpose) & ~1);
12958 CHECK_ACCESS(purpose_ptr);
12959 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
12960 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
12961 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12962 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
12963 uint64_t ret_ref = (uint64_t)ret_copy;
12967 uint32_t __attribute__((visibility("default"))) TS_Event_payment_sent(int8_tArray payment_preimage, int8_tArray payment_hash) {
12968 LDKThirtyTwoBytes payment_preimage_ref;
12969 CHECK(*((uint32_t*)payment_preimage) == 32);
12970 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
12971 LDKThirtyTwoBytes payment_hash_ref;
12972 CHECK(*((uint32_t*)payment_hash) == 32);
12973 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
12974 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12975 *ret_copy = Event_payment_sent(payment_preimage_ref, payment_hash_ref);
12976 uint64_t ret_ref = (uint64_t)ret_copy;
12980 uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_failed(int8_tArray payment_hash, jboolean rejected_by_dest, uint32_t network_update, jboolean all_paths_failed, uint32_tArray path, uint32_t short_channel_id) {
12981 LDKThirtyTwoBytes payment_hash_ref;
12982 CHECK(*((uint32_t*)payment_hash) == 32);
12983 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
12984 void* network_update_ptr = (void*)(((uint64_t)network_update) & ~1);
12985 CHECK_ACCESS(network_update_ptr);
12986 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
12987 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
12988 LDKCVec_RouteHopZ path_constr;
12989 path_constr.datalen = *((uint32_t*)path);
12990 if (path_constr.datalen > 0)
12991 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12993 path_constr.data = NULL;
12994 uint32_t* path_vals = (uint32_t*)(path + 4);
12995 for (size_t k = 0; k < path_constr.datalen; k++) {
12996 uint32_t path_conv_10 = path_vals[k];
12997 LDKRouteHop path_conv_10_conv;
12998 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
12999 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
13000 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
13001 path_constr.data[k] = path_conv_10_conv;
13003 void* short_channel_id_ptr = (void*)(((uint64_t)short_channel_id) & ~1);
13004 CHECK_ACCESS(short_channel_id_ptr);
13005 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
13006 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1));
13007 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13008 *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv);
13009 uint64_t ret_ref = (uint64_t)ret_copy;
13013 uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
13014 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13015 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
13016 uint64_t ret_ref = (uint64_t)ret_copy;
13020 uint32_t __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
13021 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
13022 outputs_constr.datalen = *((uint32_t*)outputs);
13023 if (outputs_constr.datalen > 0)
13024 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13026 outputs_constr.data = NULL;
13027 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
13028 for (size_t b = 0; b < outputs_constr.datalen; b++) {
13029 uint32_t outputs_conv_27 = outputs_vals[b];
13030 void* outputs_conv_27_ptr = (void*)(((uint64_t)outputs_conv_27) & ~1);
13031 CHECK_ACCESS(outputs_conv_27_ptr);
13032 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
13033 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
13034 outputs_constr.data[b] = outputs_conv_27_conv;
13036 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13037 *ret_copy = Event_spendable_outputs(outputs_constr);
13038 uint64_t ret_ref = (uint64_t)ret_copy;
13042 uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
13043 void* fee_earned_msat_ptr = (void*)(((uint64_t)fee_earned_msat) & ~1);
13044 CHECK_ACCESS(fee_earned_msat_ptr);
13045 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
13046 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
13047 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13048 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
13049 uint64_t ret_ref = (uint64_t)ret_copy;
13053 uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, int64_t user_channel_id, uint32_t reason) {
13054 LDKThirtyTwoBytes channel_id_ref;
13055 CHECK(*((uint32_t*)channel_id) == 32);
13056 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
13057 void* reason_ptr = (void*)(((uint64_t)reason) & ~1);
13058 CHECK_ACCESS(reason_ptr);
13059 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
13060 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
13061 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13062 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
13063 uint64_t ret_ref = (uint64_t)ret_copy;
13067 uint32_t __attribute__((visibility("default"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
13068 LDKThirtyTwoBytes channel_id_ref;
13069 CHECK(*((uint32_t*)channel_id) == 32);
13070 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
13071 LDKTransaction transaction_ref;
13072 transaction_ref.datalen = *((uint32_t*)transaction);
13073 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
13074 memcpy(transaction_ref.data, (uint8_t*)(transaction + 4), transaction_ref.datalen);
13075 transaction_ref.data_is_owned = true;
13076 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13077 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
13078 uint64_t ret_ref = (uint64_t)ret_copy;
13082 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
13083 LDKEvent* obj_conv = (LDKEvent*)obj;
13084 LDKCVec_u8Z ret_var = Event_write(obj_conv);
13085 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13086 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13087 CVec_u8Z_free(ret_var);
13091 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
13092 if ((this_ptr & 1) != 0) return;
13093 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
13094 CHECK_ACCESS(this_ptr_ptr);
13095 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
13096 FREE((void*)this_ptr);
13097 MessageSendEvent_free(this_ptr_conv);
13100 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
13101 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
13102 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13103 *ret_copy = MessageSendEvent_clone(orig_conv);
13104 uint64_t ret_ref = (uint64_t)ret_copy;
13108 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
13109 LDKPublicKey node_id_ref;
13110 CHECK(*((uint32_t*)node_id) == 33);
13111 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13112 LDKAcceptChannel msg_conv;
13113 msg_conv.inner = (void*)(msg & (~1));
13114 msg_conv.is_owned = (msg & 1) || (msg == 0);
13115 msg_conv = AcceptChannel_clone(&msg_conv);
13116 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13117 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
13118 uint64_t ret_ref = (uint64_t)ret_copy;
13122 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
13123 LDKPublicKey node_id_ref;
13124 CHECK(*((uint32_t*)node_id) == 33);
13125 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13126 LDKOpenChannel msg_conv;
13127 msg_conv.inner = (void*)(msg & (~1));
13128 msg_conv.is_owned = (msg & 1) || (msg == 0);
13129 msg_conv = OpenChannel_clone(&msg_conv);
13130 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13131 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
13132 uint64_t ret_ref = (uint64_t)ret_copy;
13136 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
13137 LDKPublicKey node_id_ref;
13138 CHECK(*((uint32_t*)node_id) == 33);
13139 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13140 LDKFundingCreated msg_conv;
13141 msg_conv.inner = (void*)(msg & (~1));
13142 msg_conv.is_owned = (msg & 1) || (msg == 0);
13143 msg_conv = FundingCreated_clone(&msg_conv);
13144 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13145 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
13146 uint64_t ret_ref = (uint64_t)ret_copy;
13150 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
13151 LDKPublicKey node_id_ref;
13152 CHECK(*((uint32_t*)node_id) == 33);
13153 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13154 LDKFundingSigned msg_conv;
13155 msg_conv.inner = (void*)(msg & (~1));
13156 msg_conv.is_owned = (msg & 1) || (msg == 0);
13157 msg_conv = FundingSigned_clone(&msg_conv);
13158 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13159 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
13160 uint64_t ret_ref = (uint64_t)ret_copy;
13164 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
13165 LDKPublicKey node_id_ref;
13166 CHECK(*((uint32_t*)node_id) == 33);
13167 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13168 LDKFundingLocked msg_conv;
13169 msg_conv.inner = (void*)(msg & (~1));
13170 msg_conv.is_owned = (msg & 1) || (msg == 0);
13171 msg_conv = FundingLocked_clone(&msg_conv);
13172 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13173 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
13174 uint64_t ret_ref = (uint64_t)ret_copy;
13178 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
13179 LDKPublicKey node_id_ref;
13180 CHECK(*((uint32_t*)node_id) == 33);
13181 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13182 LDKAnnouncementSignatures msg_conv;
13183 msg_conv.inner = (void*)(msg & (~1));
13184 msg_conv.is_owned = (msg & 1) || (msg == 0);
13185 msg_conv = AnnouncementSignatures_clone(&msg_conv);
13186 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13187 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
13188 uint64_t ret_ref = (uint64_t)ret_copy;
13192 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
13193 LDKPublicKey node_id_ref;
13194 CHECK(*((uint32_t*)node_id) == 33);
13195 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13196 LDKCommitmentUpdate updates_conv;
13197 updates_conv.inner = (void*)(updates & (~1));
13198 updates_conv.is_owned = (updates & 1) || (updates == 0);
13199 updates_conv = CommitmentUpdate_clone(&updates_conv);
13200 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13201 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
13202 uint64_t ret_ref = (uint64_t)ret_copy;
13206 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
13207 LDKPublicKey node_id_ref;
13208 CHECK(*((uint32_t*)node_id) == 33);
13209 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13210 LDKRevokeAndACK msg_conv;
13211 msg_conv.inner = (void*)(msg & (~1));
13212 msg_conv.is_owned = (msg & 1) || (msg == 0);
13213 msg_conv = RevokeAndACK_clone(&msg_conv);
13214 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13215 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
13216 uint64_t ret_ref = (uint64_t)ret_copy;
13220 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
13221 LDKPublicKey node_id_ref;
13222 CHECK(*((uint32_t*)node_id) == 33);
13223 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13224 LDKClosingSigned msg_conv;
13225 msg_conv.inner = (void*)(msg & (~1));
13226 msg_conv.is_owned = (msg & 1) || (msg == 0);
13227 msg_conv = ClosingSigned_clone(&msg_conv);
13228 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13229 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
13230 uint64_t ret_ref = (uint64_t)ret_copy;
13234 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
13235 LDKPublicKey node_id_ref;
13236 CHECK(*((uint32_t*)node_id) == 33);
13237 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13238 LDKShutdown msg_conv;
13239 msg_conv.inner = (void*)(msg & (~1));
13240 msg_conv.is_owned = (msg & 1) || (msg == 0);
13241 msg_conv = Shutdown_clone(&msg_conv);
13242 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13243 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
13244 uint64_t ret_ref = (uint64_t)ret_copy;
13248 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
13249 LDKPublicKey node_id_ref;
13250 CHECK(*((uint32_t*)node_id) == 33);
13251 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13252 LDKChannelReestablish msg_conv;
13253 msg_conv.inner = (void*)(msg & (~1));
13254 msg_conv.is_owned = (msg & 1) || (msg == 0);
13255 msg_conv = ChannelReestablish_clone(&msg_conv);
13256 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13257 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
13258 uint64_t ret_ref = (uint64_t)ret_copy;
13262 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
13263 LDKChannelAnnouncement msg_conv;
13264 msg_conv.inner = (void*)(msg & (~1));
13265 msg_conv.is_owned = (msg & 1) || (msg == 0);
13266 msg_conv = ChannelAnnouncement_clone(&msg_conv);
13267 LDKChannelUpdate update_msg_conv;
13268 update_msg_conv.inner = (void*)(update_msg & (~1));
13269 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
13270 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
13271 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13272 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
13273 uint64_t ret_ref = (uint64_t)ret_copy;
13277 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
13278 LDKNodeAnnouncement msg_conv;
13279 msg_conv.inner = (void*)(msg & (~1));
13280 msg_conv.is_owned = (msg & 1) || (msg == 0);
13281 msg_conv = NodeAnnouncement_clone(&msg_conv);
13282 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13283 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
13284 uint64_t ret_ref = (uint64_t)ret_copy;
13288 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
13289 LDKChannelUpdate msg_conv;
13290 msg_conv.inner = (void*)(msg & (~1));
13291 msg_conv.is_owned = (msg & 1) || (msg == 0);
13292 msg_conv = ChannelUpdate_clone(&msg_conv);
13293 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13294 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
13295 uint64_t ret_ref = (uint64_t)ret_copy;
13299 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
13300 LDKPublicKey node_id_ref;
13301 CHECK(*((uint32_t*)node_id) == 33);
13302 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13303 LDKChannelUpdate msg_conv;
13304 msg_conv.inner = (void*)(msg & (~1));
13305 msg_conv.is_owned = (msg & 1) || (msg == 0);
13306 msg_conv = ChannelUpdate_clone(&msg_conv);
13307 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13308 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
13309 uint64_t ret_ref = (uint64_t)ret_copy;
13313 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
13314 LDKPublicKey node_id_ref;
13315 CHECK(*((uint32_t*)node_id) == 33);
13316 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13317 void* action_ptr = (void*)(((uint64_t)action) & ~1);
13318 CHECK_ACCESS(action_ptr);
13319 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
13320 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
13321 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13322 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
13323 uint64_t ret_ref = (uint64_t)ret_copy;
13327 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
13328 LDKPublicKey node_id_ref;
13329 CHECK(*((uint32_t*)node_id) == 33);
13330 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13331 LDKQueryChannelRange msg_conv;
13332 msg_conv.inner = (void*)(msg & (~1));
13333 msg_conv.is_owned = (msg & 1) || (msg == 0);
13334 msg_conv = QueryChannelRange_clone(&msg_conv);
13335 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13336 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
13337 uint64_t ret_ref = (uint64_t)ret_copy;
13341 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
13342 LDKPublicKey node_id_ref;
13343 CHECK(*((uint32_t*)node_id) == 33);
13344 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13345 LDKQueryShortChannelIds msg_conv;
13346 msg_conv.inner = (void*)(msg & (~1));
13347 msg_conv.is_owned = (msg & 1) || (msg == 0);
13348 msg_conv = QueryShortChannelIds_clone(&msg_conv);
13349 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13350 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
13351 uint64_t ret_ref = (uint64_t)ret_copy;
13355 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
13356 LDKPublicKey node_id_ref;
13357 CHECK(*((uint32_t*)node_id) == 33);
13358 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13359 LDKReplyChannelRange msg_conv;
13360 msg_conv.inner = (void*)(msg & (~1));
13361 msg_conv.is_owned = (msg & 1) || (msg == 0);
13362 msg_conv = ReplyChannelRange_clone(&msg_conv);
13363 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13364 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
13365 uint64_t ret_ref = (uint64_t)ret_copy;
13369 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
13370 if ((this_ptr & 1) != 0) return;
13371 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
13372 CHECK_ACCESS(this_ptr_ptr);
13373 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
13374 FREE((void*)this_ptr);
13375 MessageSendEventsProvider_free(this_ptr_conv);
13378 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
13379 if ((this_ptr & 1) != 0) return;
13380 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
13381 CHECK_ACCESS(this_ptr_ptr);
13382 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
13383 FREE((void*)this_ptr);
13384 EventsProvider_free(this_ptr_conv);
13387 void __attribute__((visibility("default"))) TS_EventHandler_free(uint32_t this_ptr) {
13388 if ((this_ptr & 1) != 0) return;
13389 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
13390 CHECK_ACCESS(this_ptr_ptr);
13391 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
13392 FREE((void*)this_ptr);
13393 EventHandler_free(this_ptr_conv);
13396 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
13397 if ((this_ptr & 1) != 0) return;
13398 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
13399 CHECK_ACCESS(this_ptr_ptr);
13400 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
13401 FREE((void*)this_ptr);
13402 APIError_free(this_ptr_conv);
13405 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
13406 LDKAPIError* orig_conv = (LDKAPIError*)orig;
13407 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13408 *ret_copy = APIError_clone(orig_conv);
13409 uint64_t ret_ref = (uint64_t)ret_copy;
13413 uint32_t __attribute__((visibility("default"))) TS_APIError_apimisuse_error(jstring err) {
13414 LDKStr err_conv = str_ref_to_owned_c(err);
13415 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13416 *ret_copy = APIError_apimisuse_error(err_conv);
13417 uint64_t ret_ref = (uint64_t)ret_copy;
13421 uint32_t __attribute__((visibility("default"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
13422 LDKStr err_conv = str_ref_to_owned_c(err);
13423 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13424 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
13425 uint64_t ret_ref = (uint64_t)ret_copy;
13429 uint32_t __attribute__((visibility("default"))) TS_APIError_route_error(jstring err) {
13430 LDKStr err_conv = str_ref_to_owned_c(err);
13431 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13432 *ret_copy = APIError_route_error(err_conv);
13433 uint64_t ret_ref = (uint64_t)ret_copy;
13437 uint32_t __attribute__((visibility("default"))) TS_APIError_channel_unavailable(jstring err) {
13438 LDKStr err_conv = str_ref_to_owned_c(err);
13439 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13440 *ret_copy = APIError_channel_unavailable(err_conv);
13441 uint64_t ret_ref = (uint64_t)ret_copy;
13445 uint32_t __attribute__((visibility("default"))) TS_APIError_monitor_update_failed() {
13446 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13447 *ret_copy = APIError_monitor_update_failed();
13448 uint64_t ret_ref = (uint64_t)ret_copy;
13452 uint32_t __attribute__((visibility("default"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
13453 LDKShutdownScript script_conv;
13454 script_conv.inner = (void*)(script & (~1));
13455 script_conv.is_owned = (script & 1) || (script == 0);
13456 script_conv = ShutdownScript_clone(&script_conv);
13457 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13458 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
13459 uint64_t ret_ref = (uint64_t)ret_copy;
13463 uint32_t __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
13464 LDKu8slice msg_ref;
13465 msg_ref.datalen = *((uint32_t*)msg);
13466 msg_ref.data = (int8_t*)(msg + 4);
13467 unsigned char sk_arr[32];
13468 CHECK(*((uint32_t*)sk) == 32);
13469 memcpy(sk_arr, (uint8_t*)(sk + 4), 32);
13470 unsigned char (*sk_ref)[32] = &sk_arr;
13471 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
13472 *ret_conv = sign(msg_ref, sk_ref);
13473 return (uint64_t)ret_conv;
13476 uint32_t __attribute__((visibility("default"))) TS_recover_pk(int8_tArray msg, jstring sig) {
13477 LDKu8slice msg_ref;
13478 msg_ref.datalen = *((uint32_t*)msg);
13479 msg_ref.data = (int8_t*)(msg + 4);
13480 LDKStr sig_conv = str_ref_to_owned_c(sig);
13481 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13482 *ret_conv = recover_pk(msg_ref, sig_conv);
13483 return (uint64_t)ret_conv;
13486 jboolean __attribute__((visibility("default"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
13487 LDKu8slice msg_ref;
13488 msg_ref.datalen = *((uint32_t*)msg);
13489 msg_ref.data = (int8_t*)(msg + 4);
13490 LDKStr sig_conv = str_ref_to_owned_c(sig);
13491 LDKPublicKey pk_ref;
13492 CHECK(*((uint32_t*)pk) == 33);
13493 memcpy(pk_ref.compressed_form, (uint8_t*)(pk + 4), 33);
13494 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
13498 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
13499 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
13500 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
13504 uint32_t __attribute__((visibility("default"))) TS_Level_trace() {
13505 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
13509 uint32_t __attribute__((visibility("default"))) TS_Level_debug() {
13510 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
13514 uint32_t __attribute__((visibility("default"))) TS_Level_info() {
13515 uint32_t ret_conv = LDKLevel_to_js(Level_info());
13519 uint32_t __attribute__((visibility("default"))) TS_Level_warn() {
13520 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
13524 uint32_t __attribute__((visibility("default"))) TS_Level_error() {
13525 uint32_t ret_conv = LDKLevel_to_js(Level_error());
13529 jboolean __attribute__((visibility("default"))) TS_Level_eq(uint32_t a, uint32_t b) {
13530 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
13531 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
13532 jboolean ret_val = Level_eq(a_conv, b_conv);
13536 int64_t __attribute__((visibility("default"))) TS_Level_hash(uint32_t o) {
13537 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
13538 int64_t ret_val = Level_hash(o_conv);
13542 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
13543 uint32_t ret_conv = LDKLevel_to_js(Level_max());
13547 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
13548 if ((this_ptr & 1) != 0) return;
13549 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
13550 CHECK_ACCESS(this_ptr_ptr);
13551 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
13552 FREE((void*)this_ptr);
13553 Logger_free(this_ptr_conv);
13556 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
13557 LDKChannelHandshakeConfig this_obj_conv;
13558 this_obj_conv.inner = (void*)(this_obj & (~1));
13559 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13560 ChannelHandshakeConfig_free(this_obj_conv);
13563 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
13564 LDKChannelHandshakeConfig this_ptr_conv;
13565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13566 this_ptr_conv.is_owned = false;
13567 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
13571 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
13572 LDKChannelHandshakeConfig this_ptr_conv;
13573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13574 this_ptr_conv.is_owned = false;
13575 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
13578 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
13579 LDKChannelHandshakeConfig this_ptr_conv;
13580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13581 this_ptr_conv.is_owned = false;
13582 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
13586 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
13587 LDKChannelHandshakeConfig this_ptr_conv;
13588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13589 this_ptr_conv.is_owned = false;
13590 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
13593 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
13594 LDKChannelHandshakeConfig this_ptr_conv;
13595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13596 this_ptr_conv.is_owned = false;
13597 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
13601 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
13602 LDKChannelHandshakeConfig this_ptr_conv;
13603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13604 this_ptr_conv.is_owned = false;
13605 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
13608 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) {
13609 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
13610 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13611 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13612 uint64_t ret_ref = (uint64_t)ret_var.inner;
13613 if (ret_var.is_owned) {
13619 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
13620 LDKChannelHandshakeConfig orig_conv;
13621 orig_conv.inner = (void*)(orig & (~1));
13622 orig_conv.is_owned = false;
13623 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
13624 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13625 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13626 uint64_t ret_ref = (uint64_t)ret_var.inner;
13627 if (ret_var.is_owned) {
13633 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
13634 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
13635 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13636 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13637 uint64_t ret_ref = (uint64_t)ret_var.inner;
13638 if (ret_var.is_owned) {
13644 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
13645 LDKChannelHandshakeLimits this_obj_conv;
13646 this_obj_conv.inner = (void*)(this_obj & (~1));
13647 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13648 ChannelHandshakeLimits_free(this_obj_conv);
13651 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
13652 LDKChannelHandshakeLimits this_ptr_conv;
13653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13654 this_ptr_conv.is_owned = false;
13655 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
13659 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
13660 LDKChannelHandshakeLimits this_ptr_conv;
13661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13662 this_ptr_conv.is_owned = false;
13663 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
13666 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
13667 LDKChannelHandshakeLimits this_ptr_conv;
13668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13669 this_ptr_conv.is_owned = false;
13670 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
13674 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
13675 LDKChannelHandshakeLimits this_ptr_conv;
13676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13677 this_ptr_conv.is_owned = false;
13678 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
13681 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
13682 LDKChannelHandshakeLimits this_ptr_conv;
13683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13684 this_ptr_conv.is_owned = false;
13685 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
13689 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
13690 LDKChannelHandshakeLimits this_ptr_conv;
13691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13692 this_ptr_conv.is_owned = false;
13693 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
13696 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
13697 LDKChannelHandshakeLimits this_ptr_conv;
13698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13699 this_ptr_conv.is_owned = false;
13700 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
13704 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
13705 LDKChannelHandshakeLimits this_ptr_conv;
13706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13707 this_ptr_conv.is_owned = false;
13708 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
13711 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
13712 LDKChannelHandshakeLimits this_ptr_conv;
13713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13714 this_ptr_conv.is_owned = false;
13715 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
13719 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
13720 LDKChannelHandshakeLimits this_ptr_conv;
13721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13722 this_ptr_conv.is_owned = false;
13723 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
13726 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
13727 LDKChannelHandshakeLimits this_ptr_conv;
13728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13729 this_ptr_conv.is_owned = false;
13730 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
13734 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
13735 LDKChannelHandshakeLimits this_ptr_conv;
13736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13737 this_ptr_conv.is_owned = false;
13738 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
13741 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
13742 LDKChannelHandshakeLimits this_ptr_conv;
13743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13744 this_ptr_conv.is_owned = false;
13745 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
13749 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
13750 LDKChannelHandshakeLimits this_ptr_conv;
13751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13752 this_ptr_conv.is_owned = false;
13753 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
13756 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
13757 LDKChannelHandshakeLimits this_ptr_conv;
13758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13759 this_ptr_conv.is_owned = false;
13760 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
13764 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
13765 LDKChannelHandshakeLimits this_ptr_conv;
13766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13767 this_ptr_conv.is_owned = false;
13768 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
13771 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) {
13772 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);
13773 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13774 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13775 uint64_t ret_ref = (uint64_t)ret_var.inner;
13776 if (ret_var.is_owned) {
13782 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
13783 LDKChannelHandshakeLimits orig_conv;
13784 orig_conv.inner = (void*)(orig & (~1));
13785 orig_conv.is_owned = false;
13786 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
13787 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13788 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13789 uint64_t ret_ref = (uint64_t)ret_var.inner;
13790 if (ret_var.is_owned) {
13796 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
13797 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
13798 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13799 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13800 uint64_t ret_ref = (uint64_t)ret_var.inner;
13801 if (ret_var.is_owned) {
13807 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
13808 LDKChannelConfig this_obj_conv;
13809 this_obj_conv.inner = (void*)(this_obj & (~1));
13810 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13811 ChannelConfig_free(this_obj_conv);
13814 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
13815 LDKChannelConfig this_ptr_conv;
13816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13817 this_ptr_conv.is_owned = false;
13818 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
13822 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
13823 LDKChannelConfig this_ptr_conv;
13824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13825 this_ptr_conv.is_owned = false;
13826 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
13829 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
13830 LDKChannelConfig this_ptr_conv;
13831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13832 this_ptr_conv.is_owned = false;
13833 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
13837 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
13838 LDKChannelConfig this_ptr_conv;
13839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13840 this_ptr_conv.is_owned = false;
13841 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
13844 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
13845 LDKChannelConfig this_ptr_conv;
13846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13847 this_ptr_conv.is_owned = false;
13848 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
13852 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
13853 LDKChannelConfig this_ptr_conv;
13854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13855 this_ptr_conv.is_owned = false;
13856 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
13859 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
13860 LDKChannelConfig this_ptr_conv;
13861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13862 this_ptr_conv.is_owned = false;
13863 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
13867 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
13868 LDKChannelConfig this_ptr_conv;
13869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13870 this_ptr_conv.is_owned = false;
13871 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
13874 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
13875 LDKChannelConfig this_ptr_conv;
13876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13877 this_ptr_conv.is_owned = false;
13878 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
13882 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
13883 LDKChannelConfig this_ptr_conv;
13884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13885 this_ptr_conv.is_owned = false;
13886 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
13889 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
13890 LDKChannelConfig this_ptr_conv;
13891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13892 this_ptr_conv.is_owned = false;
13893 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
13897 void __attribute__((visibility("default"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
13898 LDKChannelConfig this_ptr_conv;
13899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13900 this_ptr_conv.is_owned = false;
13901 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
13904 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
13905 LDKChannelConfig this_ptr_conv;
13906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13907 this_ptr_conv.is_owned = false;
13908 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
13912 void __attribute__((visibility("default"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
13913 LDKChannelConfig this_ptr_conv;
13914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13915 this_ptr_conv.is_owned = false;
13916 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
13919 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) {
13920 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);
13921 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13922 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13923 uint64_t ret_ref = (uint64_t)ret_var.inner;
13924 if (ret_var.is_owned) {
13930 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
13931 LDKChannelConfig orig_conv;
13932 orig_conv.inner = (void*)(orig & (~1));
13933 orig_conv.is_owned = false;
13934 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
13935 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13936 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13937 uint64_t ret_ref = (uint64_t)ret_var.inner;
13938 if (ret_var.is_owned) {
13944 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
13945 LDKChannelConfig ret_var = ChannelConfig_default();
13946 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13947 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13948 uint64_t ret_ref = (uint64_t)ret_var.inner;
13949 if (ret_var.is_owned) {
13955 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
13956 LDKChannelConfig obj_conv;
13957 obj_conv.inner = (void*)(obj & (~1));
13958 obj_conv.is_owned = false;
13959 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
13960 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13961 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13962 CVec_u8Z_free(ret_var);
13966 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
13967 LDKu8slice ser_ref;
13968 ser_ref.datalen = *((uint32_t*)ser);
13969 ser_ref.data = (int8_t*)(ser + 4);
13970 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
13971 *ret_conv = ChannelConfig_read(ser_ref);
13972 return (uint64_t)ret_conv;
13975 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
13976 LDKUserConfig this_obj_conv;
13977 this_obj_conv.inner = (void*)(this_obj & (~1));
13978 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13979 UserConfig_free(this_obj_conv);
13982 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
13983 LDKUserConfig this_ptr_conv;
13984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13985 this_ptr_conv.is_owned = false;
13986 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
13987 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13988 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13989 uint64_t ret_ref = (uint64_t)ret_var.inner;
13990 if (ret_var.is_owned) {
13996 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
13997 LDKUserConfig this_ptr_conv;
13998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13999 this_ptr_conv.is_owned = false;
14000 LDKChannelHandshakeConfig val_conv;
14001 val_conv.inner = (void*)(val & (~1));
14002 val_conv.is_owned = (val & 1) || (val == 0);
14003 val_conv = ChannelHandshakeConfig_clone(&val_conv);
14004 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
14007 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
14008 LDKUserConfig this_ptr_conv;
14009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14010 this_ptr_conv.is_owned = false;
14011 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
14012 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14013 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14014 uint64_t ret_ref = (uint64_t)ret_var.inner;
14015 if (ret_var.is_owned) {
14021 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
14022 LDKUserConfig this_ptr_conv;
14023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14024 this_ptr_conv.is_owned = false;
14025 LDKChannelHandshakeLimits val_conv;
14026 val_conv.inner = (void*)(val & (~1));
14027 val_conv.is_owned = (val & 1) || (val == 0);
14028 val_conv = ChannelHandshakeLimits_clone(&val_conv);
14029 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
14032 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
14033 LDKUserConfig this_ptr_conv;
14034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14035 this_ptr_conv.is_owned = false;
14036 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
14037 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14038 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14039 uint64_t ret_ref = (uint64_t)ret_var.inner;
14040 if (ret_var.is_owned) {
14046 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
14047 LDKUserConfig this_ptr_conv;
14048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14049 this_ptr_conv.is_owned = false;
14050 LDKChannelConfig val_conv;
14051 val_conv.inner = (void*)(val & (~1));
14052 val_conv.is_owned = (val & 1) || (val == 0);
14053 val_conv = ChannelConfig_clone(&val_conv);
14054 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
14057 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
14058 LDKUserConfig this_ptr_conv;
14059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14060 this_ptr_conv.is_owned = false;
14061 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
14065 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
14066 LDKUserConfig this_ptr_conv;
14067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14068 this_ptr_conv.is_owned = false;
14069 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
14072 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) {
14073 LDKChannelHandshakeConfig own_channel_config_arg_conv;
14074 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
14075 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
14076 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
14077 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
14078 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
14079 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
14080 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
14081 LDKChannelConfig channel_options_arg_conv;
14082 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
14083 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
14084 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
14085 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);
14086 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14087 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14088 uint64_t ret_ref = (uint64_t)ret_var.inner;
14089 if (ret_var.is_owned) {
14095 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
14096 LDKUserConfig orig_conv;
14097 orig_conv.inner = (void*)(orig & (~1));
14098 orig_conv.is_owned = false;
14099 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
14100 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14101 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14102 uint64_t ret_ref = (uint64_t)ret_var.inner;
14103 if (ret_var.is_owned) {
14109 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
14110 LDKUserConfig ret_var = UserConfig_default();
14111 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14112 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14113 uint64_t ret_ref = (uint64_t)ret_var.inner;
14114 if (ret_var.is_owned) {
14120 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
14121 LDKBestBlock this_obj_conv;
14122 this_obj_conv.inner = (void*)(this_obj & (~1));
14123 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14124 BestBlock_free(this_obj_conv);
14127 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
14128 LDKBestBlock orig_conv;
14129 orig_conv.inner = (void*)(orig & (~1));
14130 orig_conv.is_owned = false;
14131 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
14132 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14133 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14134 uint64_t ret_ref = (uint64_t)ret_var.inner;
14135 if (ret_var.is_owned) {
14141 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
14142 LDKNetwork network_conv = LDKNetwork_from_js(network);
14143 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
14144 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14145 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14146 uint64_t ret_ref = (uint64_t)ret_var.inner;
14147 if (ret_var.is_owned) {
14153 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
14154 LDKThirtyTwoBytes block_hash_ref;
14155 CHECK(*((uint32_t*)block_hash) == 32);
14156 memcpy(block_hash_ref.data, (uint8_t*)(block_hash + 4), 32);
14157 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
14158 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14159 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14160 uint64_t ret_ref = (uint64_t)ret_var.inner;
14161 if (ret_var.is_owned) {
14167 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
14168 LDKBestBlock this_arg_conv;
14169 this_arg_conv.inner = (void*)(this_arg & (~1));
14170 this_arg_conv.is_owned = false;
14171 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14172 memcpy((uint8_t*)(ret_arr + 4), BestBlock_block_hash(&this_arg_conv).data, 32);
14176 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
14177 LDKBestBlock this_arg_conv;
14178 this_arg_conv.inner = (void*)(this_arg & (~1));
14179 this_arg_conv.is_owned = false;
14180 int32_t ret_val = BestBlock_height(&this_arg_conv);
14184 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
14185 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
14186 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
14190 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_chain() {
14191 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
14195 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_tx() {
14196 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
14200 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
14201 if ((this_ptr & 1) != 0) return;
14202 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14203 CHECK_ACCESS(this_ptr_ptr);
14204 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
14205 FREE((void*)this_ptr);
14206 Access_free(this_ptr_conv);
14209 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
14210 if ((this_ptr & 1) != 0) return;
14211 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14212 CHECK_ACCESS(this_ptr_ptr);
14213 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
14214 FREE((void*)this_ptr);
14215 Listen_free(this_ptr_conv);
14218 void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) {
14219 if ((this_ptr & 1) != 0) return;
14220 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14221 CHECK_ACCESS(this_ptr_ptr);
14222 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
14223 FREE((void*)this_ptr);
14224 Confirm_free(this_ptr_conv);
14227 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
14228 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
14229 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
14233 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
14234 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
14238 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
14239 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
14243 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
14244 if ((this_ptr & 1) != 0) return;
14245 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14246 CHECK_ACCESS(this_ptr_ptr);
14247 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
14248 FREE((void*)this_ptr);
14249 Watch_free(this_ptr_conv);
14252 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
14253 if ((this_ptr & 1) != 0) return;
14254 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14255 CHECK_ACCESS(this_ptr_ptr);
14256 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
14257 FREE((void*)this_ptr);
14258 Filter_free(this_ptr_conv);
14261 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
14262 LDKWatchedOutput this_obj_conv;
14263 this_obj_conv.inner = (void*)(this_obj & (~1));
14264 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14265 WatchedOutput_free(this_obj_conv);
14268 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
14269 LDKWatchedOutput this_ptr_conv;
14270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14271 this_ptr_conv.is_owned = false;
14272 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14273 memcpy((uint8_t*)(ret_arr + 4), WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
14277 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
14278 LDKWatchedOutput this_ptr_conv;
14279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14280 this_ptr_conv.is_owned = false;
14281 LDKThirtyTwoBytes val_ref;
14282 CHECK(*((uint32_t*)val) == 32);
14283 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14284 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
14287 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
14288 LDKWatchedOutput this_ptr_conv;
14289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14290 this_ptr_conv.is_owned = false;
14291 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
14292 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14293 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14294 uint64_t ret_ref = (uint64_t)ret_var.inner;
14295 if (ret_var.is_owned) {
14301 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
14302 LDKWatchedOutput this_ptr_conv;
14303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14304 this_ptr_conv.is_owned = false;
14305 LDKOutPoint val_conv;
14306 val_conv.inner = (void*)(val & (~1));
14307 val_conv.is_owned = (val & 1) || (val == 0);
14308 val_conv = OutPoint_clone(&val_conv);
14309 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
14312 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
14313 LDKWatchedOutput this_ptr_conv;
14314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14315 this_ptr_conv.is_owned = false;
14316 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
14317 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14318 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14322 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
14323 LDKWatchedOutput this_ptr_conv;
14324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14325 this_ptr_conv.is_owned = false;
14326 LDKCVec_u8Z val_ref;
14327 val_ref.datalen = *((uint32_t*)val);
14328 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
14329 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
14330 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
14333 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
14334 LDKThirtyTwoBytes block_hash_arg_ref;
14335 CHECK(*((uint32_t*)block_hash_arg) == 32);
14336 memcpy(block_hash_arg_ref.data, (uint8_t*)(block_hash_arg + 4), 32);
14337 LDKOutPoint outpoint_arg_conv;
14338 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14339 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14340 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14341 LDKCVec_u8Z script_pubkey_arg_ref;
14342 script_pubkey_arg_ref.datalen = *((uint32_t*)script_pubkey_arg);
14343 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
14344 memcpy(script_pubkey_arg_ref.data, (uint8_t*)(script_pubkey_arg + 4), script_pubkey_arg_ref.datalen);
14345 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
14346 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14347 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14348 uint64_t ret_ref = (uint64_t)ret_var.inner;
14349 if (ret_var.is_owned) {
14355 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_clone(uint32_t orig) {
14356 LDKWatchedOutput orig_conv;
14357 orig_conv.inner = (void*)(orig & (~1));
14358 orig_conv.is_owned = false;
14359 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
14360 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14361 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14362 uint64_t ret_ref = (uint64_t)ret_var.inner;
14363 if (ret_var.is_owned) {
14369 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_hash(uint32_t o) {
14370 LDKWatchedOutput o_conv;
14371 o_conv.inner = (void*)(o & (~1));
14372 o_conv.is_owned = false;
14373 int64_t ret_val = WatchedOutput_hash(&o_conv);
14377 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
14378 if ((this_ptr & 1) != 0) return;
14379 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14380 CHECK_ACCESS(this_ptr_ptr);
14381 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
14382 FREE((void*)this_ptr);
14383 BroadcasterInterface_free(this_ptr_conv);
14386 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
14387 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
14388 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
14392 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_background() {
14393 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
14397 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_normal() {
14398 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
14402 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_high_priority() {
14403 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
14407 jboolean __attribute__((visibility("default"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
14408 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
14409 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
14410 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
14414 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
14415 if ((this_ptr & 1) != 0) return;
14416 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14417 CHECK_ACCESS(this_ptr_ptr);
14418 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
14419 FREE((void*)this_ptr);
14420 FeeEstimator_free(this_ptr_conv);
14423 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
14424 if ((this_ptr & 1) != 0) return;
14425 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14426 CHECK_ACCESS(this_ptr_ptr);
14427 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
14428 FREE((void*)this_ptr);
14429 Persist_free(this_ptr_conv);
14432 void __attribute__((visibility("default"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
14433 LDKLockedChannelMonitor this_obj_conv;
14434 this_obj_conv.inner = (void*)(this_obj & (~1));
14435 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14436 LockedChannelMonitor_free(this_obj_conv);
14439 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
14440 LDKChainMonitor this_obj_conv;
14441 this_obj_conv.inner = (void*)(this_obj & (~1));
14442 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14443 ChainMonitor_free(this_obj_conv);
14446 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
14447 void* chain_source_ptr = (void*)(((uint64_t)chain_source) & ~1);
14448 CHECK_ACCESS(chain_source_ptr);
14449 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
14450 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
14451 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
14452 // Manually implement clone for Java trait instances
14454 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
14455 CHECK_ACCESS(broadcaster_ptr);
14456 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
14457 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
14458 CHECK_ACCESS(logger_ptr);
14459 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
14460 void* feeest_ptr = (void*)(((uint64_t)feeest) & ~1);
14461 CHECK_ACCESS(feeest_ptr);
14462 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
14463 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
14464 CHECK_ACCESS(persister_ptr);
14465 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
14466 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
14467 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14468 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14469 uint64_t ret_ref = (uint64_t)ret_var.inner;
14470 if (ret_var.is_owned) {
14476 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
14477 LDKChainMonitor this_arg_conv;
14478 this_arg_conv.inner = (void*)(this_arg & (~1));
14479 this_arg_conv.is_owned = false;
14480 LDKCVec_ChannelDetailsZ ignored_channels_constr;
14481 ignored_channels_constr.datalen = *((uint32_t*)ignored_channels);
14482 if (ignored_channels_constr.datalen > 0)
14483 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
14485 ignored_channels_constr.data = NULL;
14486 uint32_t* ignored_channels_vals = (uint32_t*)(ignored_channels + 4);
14487 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
14488 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
14489 LDKChannelDetails ignored_channels_conv_16_conv;
14490 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
14491 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
14492 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
14493 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
14495 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
14496 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14497 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14498 for (size_t j = 0; j < ret_var.datalen; j++) {
14499 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14500 *ret_conv_9_copy = ret_var.data[j];
14501 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
14502 ret_arr_ptr[j] = ret_conv_9_ref;
14504 FREE(ret_var.data);
14508 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
14509 LDKChainMonitor this_arg_conv;
14510 this_arg_conv.inner = (void*)(this_arg & (~1));
14511 this_arg_conv.is_owned = false;
14512 LDKOutPoint funding_txo_conv;
14513 funding_txo_conv.inner = (void*)(funding_txo & (~1));
14514 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
14515 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
14516 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
14517 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
14518 return (uint64_t)ret_conv;
14521 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
14522 LDKChainMonitor this_arg_conv;
14523 this_arg_conv.inner = (void*)(this_arg & (~1));
14524 this_arg_conv.is_owned = false;
14525 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
14526 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14527 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14528 for (size_t k = 0; k < ret_var.datalen; k++) {
14529 LDKOutPoint ret_conv_10_var = ret_var.data[k];
14530 CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14531 CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14532 uint64_t ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner;
14533 if (ret_conv_10_var.is_owned) {
14534 ret_conv_10_ref |= 1;
14536 ret_arr_ptr[k] = ret_conv_10_ref;
14538 FREE(ret_var.data);
14542 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
14543 LDKChainMonitor this_arg_conv;
14544 this_arg_conv.inner = (void*)(this_arg & (~1));
14545 this_arg_conv.is_owned = false;
14546 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
14547 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
14548 return (uint64_t)ret_ret;
14551 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
14552 LDKChainMonitor this_arg_conv;
14553 this_arg_conv.inner = (void*)(this_arg & (~1));
14554 this_arg_conv.is_owned = false;
14555 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
14556 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
14557 return (uint64_t)ret_ret;
14560 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
14561 LDKChainMonitor this_arg_conv;
14562 this_arg_conv.inner = (void*)(this_arg & (~1));
14563 this_arg_conv.is_owned = false;
14564 LDKWatch* ret_ret =MALLOC(sizeof(LDKWatch), "LDKWatch");
14565 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
14566 return (uint64_t)ret_ret;
14569 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
14570 LDKChainMonitor this_arg_conv;
14571 this_arg_conv.inner = (void*)(this_arg & (~1));
14572 this_arg_conv.is_owned = false;
14573 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
14574 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
14575 return (uint64_t)ret_ret;
14578 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
14579 LDKChannelMonitorUpdate this_obj_conv;
14580 this_obj_conv.inner = (void*)(this_obj & (~1));
14581 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14582 ChannelMonitorUpdate_free(this_obj_conv);
14585 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
14586 LDKChannelMonitorUpdate this_ptr_conv;
14587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14588 this_ptr_conv.is_owned = false;
14589 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
14593 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
14594 LDKChannelMonitorUpdate this_ptr_conv;
14595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14596 this_ptr_conv.is_owned = false;
14597 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
14600 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
14601 LDKChannelMonitorUpdate orig_conv;
14602 orig_conv.inner = (void*)(orig & (~1));
14603 orig_conv.is_owned = false;
14604 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
14605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14607 uint64_t ret_ref = (uint64_t)ret_var.inner;
14608 if (ret_var.is_owned) {
14614 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
14615 LDKChannelMonitorUpdate obj_conv;
14616 obj_conv.inner = (void*)(obj & (~1));
14617 obj_conv.is_owned = false;
14618 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
14619 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14620 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14621 CVec_u8Z_free(ret_var);
14625 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
14626 LDKu8slice ser_ref;
14627 ser_ref.datalen = *((uint32_t*)ser);
14628 ser_ref.data = (int8_t*)(ser + 4);
14629 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
14630 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
14631 return (uint64_t)ret_conv;
14634 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) {
14635 LDKMonitorUpdateError this_obj_conv;
14636 this_obj_conv.inner = (void*)(this_obj & (~1));
14637 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14638 MonitorUpdateError_free(this_obj_conv);
14641 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
14642 LDKMonitorUpdateError orig_conv;
14643 orig_conv.inner = (void*)(orig & (~1));
14644 orig_conv.is_owned = false;
14645 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
14646 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14647 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14648 uint64_t ret_ref = (uint64_t)ret_var.inner;
14649 if (ret_var.is_owned) {
14655 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
14656 if ((this_ptr & 1) != 0) return;
14657 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14658 CHECK_ACCESS(this_ptr_ptr);
14659 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
14660 FREE((void*)this_ptr);
14661 MonitorEvent_free(this_ptr_conv);
14664 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
14665 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
14666 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14667 *ret_copy = MonitorEvent_clone(orig_conv);
14668 uint64_t ret_ref = (uint64_t)ret_copy;
14672 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_htlcevent(uint32_t a) {
14673 LDKHTLCUpdate a_conv;
14674 a_conv.inner = (void*)(a & (~1));
14675 a_conv.is_owned = (a & 1) || (a == 0);
14676 a_conv = HTLCUpdate_clone(&a_conv);
14677 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14678 *ret_copy = MonitorEvent_htlcevent(a_conv);
14679 uint64_t ret_ref = (uint64_t)ret_copy;
14683 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
14684 LDKOutPoint a_conv;
14685 a_conv.inner = (void*)(a & (~1));
14686 a_conv.is_owned = (a & 1) || (a == 0);
14687 a_conv = OutPoint_clone(&a_conv);
14688 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14689 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
14690 uint64_t ret_ref = (uint64_t)ret_copy;
14694 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
14695 LDKHTLCUpdate this_obj_conv;
14696 this_obj_conv.inner = (void*)(this_obj & (~1));
14697 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14698 HTLCUpdate_free(this_obj_conv);
14701 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
14702 LDKHTLCUpdate orig_conv;
14703 orig_conv.inner = (void*)(orig & (~1));
14704 orig_conv.is_owned = false;
14705 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
14706 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14707 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14708 uint64_t ret_ref = (uint64_t)ret_var.inner;
14709 if (ret_var.is_owned) {
14715 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
14716 LDKHTLCUpdate obj_conv;
14717 obj_conv.inner = (void*)(obj & (~1));
14718 obj_conv.is_owned = false;
14719 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
14720 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14721 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14722 CVec_u8Z_free(ret_var);
14726 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
14727 LDKu8slice ser_ref;
14728 ser_ref.datalen = *((uint32_t*)ser);
14729 ser_ref.data = (int8_t*)(ser + 4);
14730 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
14731 *ret_conv = HTLCUpdate_read(ser_ref);
14732 return (uint64_t)ret_conv;
14735 void __attribute__((visibility("default"))) TS_Balance_free(uint32_t this_ptr) {
14736 if ((this_ptr & 1) != 0) return;
14737 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14738 CHECK_ACCESS(this_ptr_ptr);
14739 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
14740 FREE((void*)this_ptr);
14741 Balance_free(this_ptr_conv);
14744 uint32_t __attribute__((visibility("default"))) TS_Balance_clone(uint32_t orig) {
14745 LDKBalance* orig_conv = (LDKBalance*)orig;
14746 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14747 *ret_copy = Balance_clone(orig_conv);
14748 uint64_t ret_ref = (uint64_t)ret_copy;
14752 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
14753 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14754 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
14755 uint64_t ret_ref = (uint64_t)ret_copy;
14759 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
14760 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14761 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
14762 uint64_t ret_ref = (uint64_t)ret_copy;
14766 uint32_t __attribute__((visibility("default"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
14767 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14768 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
14769 uint64_t ret_ref = (uint64_t)ret_copy;
14773 uint32_t __attribute__((visibility("default"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
14774 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14775 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
14776 uint64_t ret_ref = (uint64_t)ret_copy;
14780 jboolean __attribute__((visibility("default"))) TS_Balance_eq(uint32_t a, uint32_t b) {
14781 LDKBalance* a_conv = (LDKBalance*)a;
14782 LDKBalance* b_conv = (LDKBalance*)b;
14783 jboolean ret_val = Balance_eq(a_conv, b_conv);
14787 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
14788 LDKChannelMonitor this_obj_conv;
14789 this_obj_conv.inner = (void*)(this_obj & (~1));
14790 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14791 ChannelMonitor_free(this_obj_conv);
14794 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
14795 LDKChannelMonitor orig_conv;
14796 orig_conv.inner = (void*)(orig & (~1));
14797 orig_conv.is_owned = false;
14798 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
14799 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14800 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14801 uint64_t ret_ref = (uint64_t)ret_var.inner;
14802 if (ret_var.is_owned) {
14808 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
14809 LDKChannelMonitor obj_conv;
14810 obj_conv.inner = (void*)(obj & (~1));
14811 obj_conv.is_owned = false;
14812 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
14813 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14814 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14815 CVec_u8Z_free(ret_var);
14819 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) {
14820 LDKChannelMonitor this_arg_conv;
14821 this_arg_conv.inner = (void*)(this_arg & (~1));
14822 this_arg_conv.is_owned = false;
14823 LDKChannelMonitorUpdate updates_conv;
14824 updates_conv.inner = (void*)(updates & (~1));
14825 updates_conv.is_owned = false;
14826 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
14827 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
14828 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
14829 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
14830 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
14831 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
14832 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
14833 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
14834 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
14835 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
14836 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
14837 return (uint64_t)ret_conv;
14840 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
14841 LDKChannelMonitor this_arg_conv;
14842 this_arg_conv.inner = (void*)(this_arg & (~1));
14843 this_arg_conv.is_owned = false;
14844 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
14848 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
14849 LDKChannelMonitor this_arg_conv;
14850 this_arg_conv.inner = (void*)(this_arg & (~1));
14851 this_arg_conv.is_owned = false;
14852 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
14853 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
14854 return ((uint64_t)ret_conv);
14857 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
14858 LDKChannelMonitor this_arg_conv;
14859 this_arg_conv.inner = (void*)(this_arg & (~1));
14860 this_arg_conv.is_owned = false;
14861 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
14862 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14863 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14864 for (size_t o = 0; o < ret_var.datalen; o++) {
14865 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
14866 *ret_conv_40_conv = ret_var.data[o];
14867 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
14869 FREE(ret_var.data);
14873 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
14874 LDKChannelMonitor this_arg_conv;
14875 this_arg_conv.inner = (void*)(this_arg & (~1));
14876 this_arg_conv.is_owned = false;
14877 void* filter_ptr = (void*)(((uint64_t)filter) & ~1);
14878 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
14879 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
14880 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
14883 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
14884 LDKChannelMonitor this_arg_conv;
14885 this_arg_conv.inner = (void*)(this_arg & (~1));
14886 this_arg_conv.is_owned = false;
14887 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
14888 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14889 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14890 for (size_t o = 0; o < ret_var.datalen; o++) {
14891 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14892 *ret_conv_14_copy = ret_var.data[o];
14893 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
14894 ret_arr_ptr[o] = ret_conv_14_ref;
14896 FREE(ret_var.data);
14900 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
14901 LDKChannelMonitor this_arg_conv;
14902 this_arg_conv.inner = (void*)(this_arg & (~1));
14903 this_arg_conv.is_owned = false;
14904 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
14905 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14906 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14907 for (size_t h = 0; h < ret_var.datalen; h++) {
14908 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14909 *ret_conv_7_copy = ret_var.data[h];
14910 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
14911 ret_arr_ptr[h] = ret_conv_7_ref;
14913 FREE(ret_var.data);
14917 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
14918 LDKChannelMonitor this_arg_conv;
14919 this_arg_conv.inner = (void*)(this_arg & (~1));
14920 this_arg_conv.is_owned = false;
14921 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
14922 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
14923 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
14924 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
14925 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
14926 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
14927 for (size_t m = 0; m < ret_var.datalen; m++) {
14928 LDKTransaction ret_conv_12_var = ret_var.data[m];
14929 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14930 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
14931 Transaction_free(ret_conv_12_var);
14932 ret_arr_ptr[m] = ret_conv_12_arr;
14934 FREE(ret_var.data);
14938 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) {
14939 LDKChannelMonitor this_arg_conv;
14940 this_arg_conv.inner = (void*)(this_arg & (~1));
14941 this_arg_conv.is_owned = false;
14942 unsigned char header_arr[80];
14943 CHECK(*((uint32_t*)header) == 80);
14944 memcpy(header_arr, (uint8_t*)(header + 4), 80);
14945 unsigned char (*header_ref)[80] = &header_arr;
14946 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14947 txdata_constr.datalen = *((uint32_t*)txdata);
14948 if (txdata_constr.datalen > 0)
14949 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14951 txdata_constr.data = NULL;
14952 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
14953 for (size_t c = 0; c < txdata_constr.datalen; c++) {
14954 uint32_t txdata_conv_28 = txdata_vals[c];
14955 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
14956 CHECK_ACCESS(txdata_conv_28_ptr);
14957 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
14958 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
14959 txdata_constr.data[c] = txdata_conv_28_conv;
14961 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
14962 CHECK_ACCESS(broadcaster_ptr);
14963 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
14964 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
14965 CHECK_ACCESS(fee_estimator_ptr);
14966 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
14967 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
14968 CHECK_ACCESS(logger_ptr);
14969 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
14970 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);
14971 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14972 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14973 for (size_t n = 0; n < ret_var.datalen; n++) {
14974 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14975 *ret_conv_39_conv = ret_var.data[n];
14976 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
14978 FREE(ret_var.data);
14982 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) {
14983 LDKChannelMonitor this_arg_conv;
14984 this_arg_conv.inner = (void*)(this_arg & (~1));
14985 this_arg_conv.is_owned = false;
14986 unsigned char header_arr[80];
14987 CHECK(*((uint32_t*)header) == 80);
14988 memcpy(header_arr, (uint8_t*)(header + 4), 80);
14989 unsigned char (*header_ref)[80] = &header_arr;
14990 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
14991 CHECK_ACCESS(broadcaster_ptr);
14992 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
14993 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
14994 CHECK_ACCESS(fee_estimator_ptr);
14995 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
14996 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
14997 CHECK_ACCESS(logger_ptr);
14998 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
14999 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
15002 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) {
15003 LDKChannelMonitor this_arg_conv;
15004 this_arg_conv.inner = (void*)(this_arg & (~1));
15005 this_arg_conv.is_owned = false;
15006 unsigned char header_arr[80];
15007 CHECK(*((uint32_t*)header) == 80);
15008 memcpy(header_arr, (uint8_t*)(header + 4), 80);
15009 unsigned char (*header_ref)[80] = &header_arr;
15010 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
15011 txdata_constr.datalen = *((uint32_t*)txdata);
15012 if (txdata_constr.datalen > 0)
15013 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15015 txdata_constr.data = NULL;
15016 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
15017 for (size_t c = 0; c < txdata_constr.datalen; c++) {
15018 uint32_t txdata_conv_28 = txdata_vals[c];
15019 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
15020 CHECK_ACCESS(txdata_conv_28_ptr);
15021 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
15022 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
15023 txdata_constr.data[c] = txdata_conv_28_conv;
15025 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
15026 CHECK_ACCESS(broadcaster_ptr);
15027 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
15028 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
15029 CHECK_ACCESS(fee_estimator_ptr);
15030 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
15031 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
15032 CHECK_ACCESS(logger_ptr);
15033 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
15034 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);
15035 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
15036 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
15037 for (size_t n = 0; n < ret_var.datalen; n++) {
15038 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
15039 *ret_conv_39_conv = ret_var.data[n];
15040 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
15042 FREE(ret_var.data);
15046 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) {
15047 LDKChannelMonitor this_arg_conv;
15048 this_arg_conv.inner = (void*)(this_arg & (~1));
15049 this_arg_conv.is_owned = false;
15050 unsigned char txid_arr[32];
15051 CHECK(*((uint32_t*)txid) == 32);
15052 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
15053 unsigned char (*txid_ref)[32] = &txid_arr;
15054 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
15055 CHECK_ACCESS(broadcaster_ptr);
15056 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
15057 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
15058 CHECK_ACCESS(fee_estimator_ptr);
15059 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
15060 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
15061 CHECK_ACCESS(logger_ptr);
15062 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
15063 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
15066 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) {
15067 LDKChannelMonitor this_arg_conv;
15068 this_arg_conv.inner = (void*)(this_arg & (~1));
15069 this_arg_conv.is_owned = false;
15070 unsigned char header_arr[80];
15071 CHECK(*((uint32_t*)header) == 80);
15072 memcpy(header_arr, (uint8_t*)(header + 4), 80);
15073 unsigned char (*header_ref)[80] = &header_arr;
15074 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
15075 CHECK_ACCESS(broadcaster_ptr);
15076 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
15077 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
15078 CHECK_ACCESS(fee_estimator_ptr);
15079 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
15080 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
15081 CHECK_ACCESS(logger_ptr);
15082 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
15083 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
15084 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
15085 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
15086 for (size_t n = 0; n < ret_var.datalen; n++) {
15087 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
15088 *ret_conv_39_conv = ret_var.data[n];
15089 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
15091 FREE(ret_var.data);
15095 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
15096 LDKChannelMonitor this_arg_conv;
15097 this_arg_conv.inner = (void*)(this_arg & (~1));
15098 this_arg_conv.is_owned = false;
15099 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
15100 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
15101 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
15102 for (size_t m = 0; m < ret_var.datalen; m++) {
15103 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15104 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
15105 ret_arr_ptr[m] = ret_conv_12_arr;
15107 FREE(ret_var.data);
15111 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
15112 LDKChannelMonitor this_arg_conv;
15113 this_arg_conv.inner = (void*)(this_arg & (~1));
15114 this_arg_conv.is_owned = false;
15115 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
15116 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15117 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15118 uint64_t ret_ref = (uint64_t)ret_var.inner;
15119 if (ret_var.is_owned) {
15125 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
15126 LDKChannelMonitor this_arg_conv;
15127 this_arg_conv.inner = (void*)(this_arg & (~1));
15128 this_arg_conv.is_owned = false;
15129 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
15130 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
15131 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
15132 for (size_t j = 0; j < ret_var.datalen; j++) {
15133 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
15134 *ret_conv_9_copy = ret_var.data[j];
15135 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
15136 ret_arr_ptr[j] = ret_conv_9_ref;
15138 FREE(ret_var.data);
15142 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
15143 LDKu8slice ser_ref;
15144 ser_ref.datalen = *((uint32_t*)ser);
15145 ser_ref.data = (int8_t*)(ser + 4);
15146 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
15147 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
15148 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
15149 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
15150 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
15151 return (uint64_t)ret_conv;
15154 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
15155 LDKOutPoint this_obj_conv;
15156 this_obj_conv.inner = (void*)(this_obj & (~1));
15157 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15158 OutPoint_free(this_obj_conv);
15161 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
15162 LDKOutPoint this_ptr_conv;
15163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15164 this_ptr_conv.is_owned = false;
15165 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15166 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
15170 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
15171 LDKOutPoint this_ptr_conv;
15172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15173 this_ptr_conv.is_owned = false;
15174 LDKThirtyTwoBytes val_ref;
15175 CHECK(*((uint32_t*)val) == 32);
15176 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15177 OutPoint_set_txid(&this_ptr_conv, val_ref);
15180 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
15181 LDKOutPoint this_ptr_conv;
15182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15183 this_ptr_conv.is_owned = false;
15184 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
15188 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
15189 LDKOutPoint this_ptr_conv;
15190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15191 this_ptr_conv.is_owned = false;
15192 OutPoint_set_index(&this_ptr_conv, val);
15195 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
15196 LDKThirtyTwoBytes txid_arg_ref;
15197 CHECK(*((uint32_t*)txid_arg) == 32);
15198 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
15199 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
15200 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15201 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15202 uint64_t ret_ref = (uint64_t)ret_var.inner;
15203 if (ret_var.is_owned) {
15209 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
15210 LDKOutPoint orig_conv;
15211 orig_conv.inner = (void*)(orig & (~1));
15212 orig_conv.is_owned = false;
15213 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
15214 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15215 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15216 uint64_t ret_ref = (uint64_t)ret_var.inner;
15217 if (ret_var.is_owned) {
15223 jboolean __attribute__((visibility("default"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
15224 LDKOutPoint a_conv;
15225 a_conv.inner = (void*)(a & (~1));
15226 a_conv.is_owned = false;
15227 LDKOutPoint b_conv;
15228 b_conv.inner = (void*)(b & (~1));
15229 b_conv.is_owned = false;
15230 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
15234 int64_t __attribute__((visibility("default"))) TS_OutPoint_hash(uint32_t o) {
15235 LDKOutPoint o_conv;
15236 o_conv.inner = (void*)(o & (~1));
15237 o_conv.is_owned = false;
15238 int64_t ret_val = OutPoint_hash(&o_conv);
15242 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
15243 LDKOutPoint this_arg_conv;
15244 this_arg_conv.inner = (void*)(this_arg & (~1));
15245 this_arg_conv.is_owned = false;
15246 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15247 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
15251 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
15252 LDKOutPoint obj_conv;
15253 obj_conv.inner = (void*)(obj & (~1));
15254 obj_conv.is_owned = false;
15255 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
15256 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15257 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15258 CVec_u8Z_free(ret_var);
15262 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
15263 LDKu8slice ser_ref;
15264 ser_ref.datalen = *((uint32_t*)ser);
15265 ser_ref.data = (int8_t*)(ser + 4);
15266 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15267 *ret_conv = OutPoint_read(ser_ref);
15268 return (uint64_t)ret_conv;
15271 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
15272 LDKDelayedPaymentOutputDescriptor this_obj_conv;
15273 this_obj_conv.inner = (void*)(this_obj & (~1));
15274 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15275 DelayedPaymentOutputDescriptor_free(this_obj_conv);
15278 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
15279 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15281 this_ptr_conv.is_owned = false;
15282 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
15283 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15284 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15285 uint64_t ret_ref = (uint64_t)ret_var.inner;
15286 if (ret_var.is_owned) {
15292 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
15293 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15295 this_ptr_conv.is_owned = false;
15296 LDKOutPoint val_conv;
15297 val_conv.inner = (void*)(val & (~1));
15298 val_conv.is_owned = (val & 1) || (val == 0);
15299 val_conv = OutPoint_clone(&val_conv);
15300 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
15303 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
15304 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15306 this_ptr_conv.is_owned = false;
15307 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15308 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
15312 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
15313 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15315 this_ptr_conv.is_owned = false;
15316 LDKPublicKey val_ref;
15317 CHECK(*((uint32_t*)val) == 33);
15318 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15319 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
15322 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
15323 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15325 this_ptr_conv.is_owned = false;
15326 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
15330 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
15331 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15333 this_ptr_conv.is_owned = false;
15334 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
15337 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
15338 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15340 this_ptr_conv.is_owned = false;
15341 void* val_ptr = (void*)(((uint64_t)val) & ~1);
15342 CHECK_ACCESS(val_ptr);
15343 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
15344 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
15345 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
15348 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
15349 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15351 this_ptr_conv.is_owned = false;
15352 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15353 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
15357 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
15358 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15360 this_ptr_conv.is_owned = false;
15361 LDKPublicKey val_ref;
15362 CHECK(*((uint32_t*)val) == 33);
15363 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15364 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
15367 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
15368 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15370 this_ptr_conv.is_owned = false;
15371 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15372 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
15376 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
15377 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15379 this_ptr_conv.is_owned = false;
15380 LDKThirtyTwoBytes val_ref;
15381 CHECK(*((uint32_t*)val) == 32);
15382 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15383 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
15386 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
15387 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15389 this_ptr_conv.is_owned = false;
15390 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
15394 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
15395 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15397 this_ptr_conv.is_owned = false;
15398 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
15401 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) {
15402 LDKOutPoint outpoint_arg_conv;
15403 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
15404 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
15405 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
15406 LDKPublicKey per_commitment_point_arg_ref;
15407 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
15408 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
15409 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
15410 CHECK_ACCESS(output_arg_ptr);
15411 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
15412 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
15413 LDKPublicKey revocation_pubkey_arg_ref;
15414 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
15415 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
15416 LDKThirtyTwoBytes channel_keys_id_arg_ref;
15417 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
15418 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
15419 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);
15420 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15421 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15422 uint64_t ret_ref = (uint64_t)ret_var.inner;
15423 if (ret_var.is_owned) {
15429 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
15430 LDKDelayedPaymentOutputDescriptor orig_conv;
15431 orig_conv.inner = (void*)(orig & (~1));
15432 orig_conv.is_owned = false;
15433 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
15434 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15435 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15436 uint64_t ret_ref = (uint64_t)ret_var.inner;
15437 if (ret_var.is_owned) {
15443 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
15444 LDKDelayedPaymentOutputDescriptor obj_conv;
15445 obj_conv.inner = (void*)(obj & (~1));
15446 obj_conv.is_owned = false;
15447 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
15448 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15449 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15450 CVec_u8Z_free(ret_var);
15454 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
15455 LDKu8slice ser_ref;
15456 ser_ref.datalen = *((uint32_t*)ser);
15457 ser_ref.data = (int8_t*)(ser + 4);
15458 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15459 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
15460 return (uint64_t)ret_conv;
15463 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
15464 LDKStaticPaymentOutputDescriptor this_obj_conv;
15465 this_obj_conv.inner = (void*)(this_obj & (~1));
15466 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15467 StaticPaymentOutputDescriptor_free(this_obj_conv);
15470 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
15471 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15473 this_ptr_conv.is_owned = false;
15474 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
15475 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15476 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15477 uint64_t ret_ref = (uint64_t)ret_var.inner;
15478 if (ret_var.is_owned) {
15484 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
15485 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15487 this_ptr_conv.is_owned = false;
15488 LDKOutPoint val_conv;
15489 val_conv.inner = (void*)(val & (~1));
15490 val_conv.is_owned = (val & 1) || (val == 0);
15491 val_conv = OutPoint_clone(&val_conv);
15492 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
15495 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
15496 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15498 this_ptr_conv.is_owned = false;
15499 void* val_ptr = (void*)(((uint64_t)val) & ~1);
15500 CHECK_ACCESS(val_ptr);
15501 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
15502 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
15503 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
15506 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
15507 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15509 this_ptr_conv.is_owned = false;
15510 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15511 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
15515 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
15516 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15518 this_ptr_conv.is_owned = false;
15519 LDKThirtyTwoBytes val_ref;
15520 CHECK(*((uint32_t*)val) == 32);
15521 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15522 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
15525 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
15526 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15528 this_ptr_conv.is_owned = false;
15529 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
15533 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
15534 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15536 this_ptr_conv.is_owned = false;
15537 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
15540 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) {
15541 LDKOutPoint outpoint_arg_conv;
15542 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
15543 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
15544 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
15545 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
15546 CHECK_ACCESS(output_arg_ptr);
15547 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
15548 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
15549 LDKThirtyTwoBytes channel_keys_id_arg_ref;
15550 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
15551 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
15552 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
15553 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15554 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15555 uint64_t ret_ref = (uint64_t)ret_var.inner;
15556 if (ret_var.is_owned) {
15562 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
15563 LDKStaticPaymentOutputDescriptor orig_conv;
15564 orig_conv.inner = (void*)(orig & (~1));
15565 orig_conv.is_owned = false;
15566 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
15567 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15568 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15569 uint64_t ret_ref = (uint64_t)ret_var.inner;
15570 if (ret_var.is_owned) {
15576 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
15577 LDKStaticPaymentOutputDescriptor obj_conv;
15578 obj_conv.inner = (void*)(obj & (~1));
15579 obj_conv.is_owned = false;
15580 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
15581 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15582 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15583 CVec_u8Z_free(ret_var);
15587 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
15588 LDKu8slice ser_ref;
15589 ser_ref.datalen = *((uint32_t*)ser);
15590 ser_ref.data = (int8_t*)(ser + 4);
15591 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15592 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
15593 return (uint64_t)ret_conv;
15596 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
15597 if ((this_ptr & 1) != 0) return;
15598 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15599 CHECK_ACCESS(this_ptr_ptr);
15600 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
15601 FREE((void*)this_ptr);
15602 SpendableOutputDescriptor_free(this_ptr_conv);
15605 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
15606 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
15607 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
15608 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
15609 uint64_t ret_ref = (uint64_t)ret_copy;
15613 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
15614 LDKOutPoint outpoint_conv;
15615 outpoint_conv.inner = (void*)(outpoint & (~1));
15616 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
15617 outpoint_conv = OutPoint_clone(&outpoint_conv);
15618 void* output_ptr = (void*)(((uint64_t)output) & ~1);
15619 CHECK_ACCESS(output_ptr);
15620 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
15621 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
15622 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
15623 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
15624 uint64_t ret_ref = (uint64_t)ret_copy;
15628 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
15629 LDKDelayedPaymentOutputDescriptor a_conv;
15630 a_conv.inner = (void*)(a & (~1));
15631 a_conv.is_owned = (a & 1) || (a == 0);
15632 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
15633 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
15634 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
15635 uint64_t ret_ref = (uint64_t)ret_copy;
15639 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
15640 LDKStaticPaymentOutputDescriptor a_conv;
15641 a_conv.inner = (void*)(a & (~1));
15642 a_conv.is_owned = (a & 1) || (a == 0);
15643 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
15644 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
15645 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
15646 uint64_t ret_ref = (uint64_t)ret_copy;
15650 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
15651 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
15652 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
15653 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15654 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15655 CVec_u8Z_free(ret_var);
15659 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
15660 LDKu8slice ser_ref;
15661 ser_ref.datalen = *((uint32_t*)ser);
15662 ser_ref.data = (int8_t*)(ser + 4);
15663 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15664 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
15665 return (uint64_t)ret_conv;
15668 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
15669 if ((this_ptr & 1) != 0) return;
15670 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15671 CHECK_ACCESS(this_ptr_ptr);
15672 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
15673 FREE((void*)this_ptr);
15674 BaseSign_free(this_ptr_conv);
15677 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
15678 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
15679 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
15680 LDKSign* orig_conv = (LDKSign*)orig_ptr;
15681 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
15682 *ret_ret = Sign_clone(orig_conv);
15683 return (uint64_t)ret_ret;
15686 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
15687 if ((this_ptr & 1) != 0) return;
15688 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15689 CHECK_ACCESS(this_ptr_ptr);
15690 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
15691 FREE((void*)this_ptr);
15692 Sign_free(this_ptr_conv);
15695 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
15696 if ((this_ptr & 1) != 0) return;
15697 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15698 CHECK_ACCESS(this_ptr_ptr);
15699 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
15700 FREE((void*)this_ptr);
15701 KeysInterface_free(this_ptr_conv);
15704 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
15705 LDKInMemorySigner this_obj_conv;
15706 this_obj_conv.inner = (void*)(this_obj & (~1));
15707 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15708 InMemorySigner_free(this_obj_conv);
15711 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
15712 LDKInMemorySigner this_ptr_conv;
15713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15714 this_ptr_conv.is_owned = false;
15715 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15716 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
15720 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
15721 LDKInMemorySigner this_ptr_conv;
15722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15723 this_ptr_conv.is_owned = false;
15724 LDKSecretKey val_ref;
15725 CHECK(*((uint32_t*)val) == 32);
15726 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
15727 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
15730 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
15731 LDKInMemorySigner this_ptr_conv;
15732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15733 this_ptr_conv.is_owned = false;
15734 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15735 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
15739 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
15740 LDKInMemorySigner this_ptr_conv;
15741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15742 this_ptr_conv.is_owned = false;
15743 LDKSecretKey val_ref;
15744 CHECK(*((uint32_t*)val) == 32);
15745 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
15746 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
15749 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
15750 LDKInMemorySigner this_ptr_conv;
15751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15752 this_ptr_conv.is_owned = false;
15753 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15754 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
15758 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
15759 LDKInMemorySigner this_ptr_conv;
15760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15761 this_ptr_conv.is_owned = false;
15762 LDKSecretKey val_ref;
15763 CHECK(*((uint32_t*)val) == 32);
15764 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
15765 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
15768 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
15769 LDKInMemorySigner this_ptr_conv;
15770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15771 this_ptr_conv.is_owned = false;
15772 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15773 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
15777 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
15778 LDKInMemorySigner this_ptr_conv;
15779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15780 this_ptr_conv.is_owned = false;
15781 LDKSecretKey val_ref;
15782 CHECK(*((uint32_t*)val) == 32);
15783 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
15784 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
15787 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
15788 LDKInMemorySigner this_ptr_conv;
15789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15790 this_ptr_conv.is_owned = false;
15791 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15792 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
15796 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
15797 LDKInMemorySigner this_ptr_conv;
15798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15799 this_ptr_conv.is_owned = false;
15800 LDKSecretKey val_ref;
15801 CHECK(*((uint32_t*)val) == 32);
15802 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
15803 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
15806 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
15807 LDKInMemorySigner this_ptr_conv;
15808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15809 this_ptr_conv.is_owned = false;
15810 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15811 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
15815 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
15816 LDKInMemorySigner this_ptr_conv;
15817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15818 this_ptr_conv.is_owned = false;
15819 LDKThirtyTwoBytes val_ref;
15820 CHECK(*((uint32_t*)val) == 32);
15821 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15822 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
15825 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
15826 LDKInMemorySigner orig_conv;
15827 orig_conv.inner = (void*)(orig & (~1));
15828 orig_conv.is_owned = false;
15829 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
15830 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15831 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15832 uint64_t ret_ref = (uint64_t)ret_var.inner;
15833 if (ret_var.is_owned) {
15839 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) {
15840 LDKSecretKey funding_key_ref;
15841 CHECK(*((uint32_t*)funding_key) == 32);
15842 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
15843 LDKSecretKey revocation_base_key_ref;
15844 CHECK(*((uint32_t*)revocation_base_key) == 32);
15845 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
15846 LDKSecretKey payment_key_ref;
15847 CHECK(*((uint32_t*)payment_key) == 32);
15848 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
15849 LDKSecretKey delayed_payment_base_key_ref;
15850 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
15851 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
15852 LDKSecretKey htlc_base_key_ref;
15853 CHECK(*((uint32_t*)htlc_base_key) == 32);
15854 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
15855 LDKThirtyTwoBytes commitment_seed_ref;
15856 CHECK(*((uint32_t*)commitment_seed) == 32);
15857 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
15858 LDKThirtyTwoBytes channel_keys_id_ref;
15859 CHECK(*((uint32_t*)channel_keys_id) == 32);
15860 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
15861 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);
15862 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15863 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15864 uint64_t ret_ref = (uint64_t)ret_var.inner;
15865 if (ret_var.is_owned) {
15871 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
15872 LDKInMemorySigner this_arg_conv;
15873 this_arg_conv.inner = (void*)(this_arg & (~1));
15874 this_arg_conv.is_owned = false;
15875 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
15876 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15877 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15878 uint64_t ret_ref = (uint64_t)ret_var.inner;
15879 if (ret_var.is_owned) {
15885 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
15886 LDKInMemorySigner this_arg_conv;
15887 this_arg_conv.inner = (void*)(this_arg & (~1));
15888 this_arg_conv.is_owned = false;
15889 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
15893 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
15894 LDKInMemorySigner this_arg_conv;
15895 this_arg_conv.inner = (void*)(this_arg & (~1));
15896 this_arg_conv.is_owned = false;
15897 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
15901 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
15902 LDKInMemorySigner this_arg_conv;
15903 this_arg_conv.inner = (void*)(this_arg & (~1));
15904 this_arg_conv.is_owned = false;
15905 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
15909 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
15910 LDKInMemorySigner this_arg_conv;
15911 this_arg_conv.inner = (void*)(this_arg & (~1));
15912 this_arg_conv.is_owned = false;
15913 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
15914 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15915 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15916 uint64_t ret_ref = (uint64_t)ret_var.inner;
15917 if (ret_var.is_owned) {
15923 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
15924 LDKInMemorySigner this_arg_conv;
15925 this_arg_conv.inner = (void*)(this_arg & (~1));
15926 this_arg_conv.is_owned = false;
15927 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
15928 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15929 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15930 uint64_t ret_ref = (uint64_t)ret_var.inner;
15931 if (ret_var.is_owned) {
15937 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) {
15938 LDKInMemorySigner this_arg_conv;
15939 this_arg_conv.inner = (void*)(this_arg & (~1));
15940 this_arg_conv.is_owned = false;
15941 LDKTransaction spend_tx_ref;
15942 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
15943 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15944 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
15945 spend_tx_ref.data_is_owned = true;
15946 LDKStaticPaymentOutputDescriptor descriptor_conv;
15947 descriptor_conv.inner = (void*)(descriptor & (~1));
15948 descriptor_conv.is_owned = false;
15949 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15950 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15951 return (uint64_t)ret_conv;
15954 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) {
15955 LDKInMemorySigner this_arg_conv;
15956 this_arg_conv.inner = (void*)(this_arg & (~1));
15957 this_arg_conv.is_owned = false;
15958 LDKTransaction spend_tx_ref;
15959 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
15960 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15961 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
15962 spend_tx_ref.data_is_owned = true;
15963 LDKDelayedPaymentOutputDescriptor descriptor_conv;
15964 descriptor_conv.inner = (void*)(descriptor & (~1));
15965 descriptor_conv.is_owned = false;
15966 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15967 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15968 return (uint64_t)ret_conv;
15971 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
15972 LDKInMemorySigner this_arg_conv;
15973 this_arg_conv.inner = (void*)(this_arg & (~1));
15974 this_arg_conv.is_owned = false;
15975 LDKBaseSign* ret_ret =MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
15976 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
15977 return (uint64_t)ret_ret;
15980 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
15981 LDKInMemorySigner this_arg_conv;
15982 this_arg_conv.inner = (void*)(this_arg & (~1));
15983 this_arg_conv.is_owned = false;
15984 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
15985 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
15986 return (uint64_t)ret_ret;
15989 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
15990 LDKInMemorySigner obj_conv;
15991 obj_conv.inner = (void*)(obj & (~1));
15992 obj_conv.is_owned = false;
15993 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
15994 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15995 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15996 CVec_u8Z_free(ret_var);
16000 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
16001 LDKu8slice ser_ref;
16002 ser_ref.datalen = *((uint32_t*)ser);
16003 ser_ref.data = (int8_t*)(ser + 4);
16004 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16005 *ret_conv = InMemorySigner_read(ser_ref);
16006 return (uint64_t)ret_conv;
16009 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
16010 LDKKeysManager this_obj_conv;
16011 this_obj_conv.inner = (void*)(this_obj & (~1));
16012 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16013 KeysManager_free(this_obj_conv);
16016 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
16017 unsigned char seed_arr[32];
16018 CHECK(*((uint32_t*)seed) == 32);
16019 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
16020 unsigned char (*seed_ref)[32] = &seed_arr;
16021 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
16022 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16023 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16024 uint64_t ret_ref = (uint64_t)ret_var.inner;
16025 if (ret_var.is_owned) {
16031 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
16032 LDKKeysManager this_arg_conv;
16033 this_arg_conv.inner = (void*)(this_arg & (~1));
16034 this_arg_conv.is_owned = false;
16035 unsigned char params_arr[32];
16036 CHECK(*((uint32_t*)params) == 32);
16037 memcpy(params_arr, (uint8_t*)(params + 4), 32);
16038 unsigned char (*params_ref)[32] = ¶ms_arr;
16039 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
16040 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16041 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16042 uint64_t ret_ref = (uint64_t)ret_var.inner;
16043 if (ret_var.is_owned) {
16049 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) {
16050 LDKKeysManager this_arg_conv;
16051 this_arg_conv.inner = (void*)(this_arg & (~1));
16052 this_arg_conv.is_owned = false;
16053 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
16054 descriptors_constr.datalen = *((uint32_t*)descriptors);
16055 if (descriptors_constr.datalen > 0)
16056 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16058 descriptors_constr.data = NULL;
16059 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
16060 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
16061 uint32_t descriptors_conv_27 = descriptors_vals[b];
16062 void* descriptors_conv_27_ptr = (void*)(((uint64_t)descriptors_conv_27) & ~1);
16063 CHECK_ACCESS(descriptors_conv_27_ptr);
16064 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
16065 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
16066 descriptors_constr.data[b] = descriptors_conv_27_conv;
16068 LDKCVec_TxOutZ outputs_constr;
16069 outputs_constr.datalen = *((uint32_t*)outputs);
16070 if (outputs_constr.datalen > 0)
16071 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16073 outputs_constr.data = NULL;
16074 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
16075 for (size_t h = 0; h < outputs_constr.datalen; h++) {
16076 uint32_t outputs_conv_7 = outputs_vals[h];
16077 void* outputs_conv_7_ptr = (void*)(((uint64_t)outputs_conv_7) & ~1);
16078 CHECK_ACCESS(outputs_conv_7_ptr);
16079 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
16080 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
16081 outputs_constr.data[h] = outputs_conv_7_conv;
16083 LDKCVec_u8Z change_destination_script_ref;
16084 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
16085 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
16086 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
16087 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16088 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
16089 return (uint64_t)ret_conv;
16092 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
16093 LDKKeysManager this_arg_conv;
16094 this_arg_conv.inner = (void*)(this_arg & (~1));
16095 this_arg_conv.is_owned = false;
16096 LDKKeysInterface* ret_ret =MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
16097 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
16098 return (uint64_t)ret_ret;
16101 void __attribute__((visibility("default"))) TS_PaymentId_free(uint32_t this_obj) {
16102 LDKPaymentId this_obj_conv;
16103 this_obj_conv.inner = (void*)(this_obj & (~1));
16104 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16105 PaymentId_free(this_obj_conv);
16108 int64_t __attribute__((visibility("default"))) TS_PaymentId_hash(uint32_t o) {
16109 LDKPaymentId o_conv;
16110 o_conv.inner = (void*)(o & (~1));
16111 o_conv.is_owned = false;
16112 int64_t ret_val = PaymentId_hash(&o_conv);
16116 uint32_t __attribute__((visibility("default"))) TS_PaymentId_clone(uint32_t orig) {
16117 LDKPaymentId orig_conv;
16118 orig_conv.inner = (void*)(orig & (~1));
16119 orig_conv.is_owned = false;
16120 LDKPaymentId ret_var = PaymentId_clone(&orig_conv);
16121 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16122 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16123 uint64_t ret_ref = (uint64_t)ret_var.inner;
16124 if (ret_var.is_owned) {
16130 jboolean __attribute__((visibility("default"))) TS_PaymentId_eq(uint32_t a, uint32_t b) {
16131 LDKPaymentId a_conv;
16132 a_conv.inner = (void*)(a & (~1));
16133 a_conv.is_owned = false;
16134 LDKPaymentId b_conv;
16135 b_conv.inner = (void*)(b & (~1));
16136 b_conv.is_owned = false;
16137 jboolean ret_val = PaymentId_eq(&a_conv, &b_conv);
16141 int8_tArray __attribute__((visibility("default"))) TS_PaymentId_write(uint32_t obj) {
16142 LDKPaymentId obj_conv;
16143 obj_conv.inner = (void*)(obj & (~1));
16144 obj_conv.is_owned = false;
16145 LDKCVec_u8Z ret_var = PaymentId_write(&obj_conv);
16146 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16147 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16148 CVec_u8Z_free(ret_var);
16152 uint32_t __attribute__((visibility("default"))) TS_PaymentId_read(int8_tArray ser) {
16153 LDKu8slice ser_ref;
16154 ser_ref.datalen = *((uint32_t*)ser);
16155 ser_ref.data = (int8_t*)(ser + 4);
16156 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
16157 *ret_conv = PaymentId_read(ser_ref);
16158 return (uint64_t)ret_conv;
16161 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
16162 LDKChannelManager this_obj_conv;
16163 this_obj_conv.inner = (void*)(this_obj & (~1));
16164 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16165 ChannelManager_free(this_obj_conv);
16168 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
16169 LDKChainParameters this_obj_conv;
16170 this_obj_conv.inner = (void*)(this_obj & (~1));
16171 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16172 ChainParameters_free(this_obj_conv);
16175 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
16176 LDKChainParameters this_ptr_conv;
16177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16178 this_ptr_conv.is_owned = false;
16179 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
16183 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
16184 LDKChainParameters this_ptr_conv;
16185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16186 this_ptr_conv.is_owned = false;
16187 LDKNetwork val_conv = LDKNetwork_from_js(val);
16188 ChainParameters_set_network(&this_ptr_conv, val_conv);
16191 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
16192 LDKChainParameters this_ptr_conv;
16193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16194 this_ptr_conv.is_owned = false;
16195 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
16196 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16197 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16198 uint64_t ret_ref = (uint64_t)ret_var.inner;
16199 if (ret_var.is_owned) {
16205 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
16206 LDKChainParameters this_ptr_conv;
16207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16208 this_ptr_conv.is_owned = false;
16209 LDKBestBlock val_conv;
16210 val_conv.inner = (void*)(val & (~1));
16211 val_conv.is_owned = (val & 1) || (val == 0);
16212 val_conv = BestBlock_clone(&val_conv);
16213 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
16216 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
16217 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
16218 LDKBestBlock best_block_arg_conv;
16219 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
16220 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
16221 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
16222 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
16223 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16224 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16225 uint64_t ret_ref = (uint64_t)ret_var.inner;
16226 if (ret_var.is_owned) {
16232 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_clone(uint32_t orig) {
16233 LDKChainParameters orig_conv;
16234 orig_conv.inner = (void*)(orig & (~1));
16235 orig_conv.is_owned = false;
16236 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
16237 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16238 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16239 uint64_t ret_ref = (uint64_t)ret_var.inner;
16240 if (ret_var.is_owned) {
16246 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
16247 LDKCounterpartyForwardingInfo this_obj_conv;
16248 this_obj_conv.inner = (void*)(this_obj & (~1));
16249 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16250 CounterpartyForwardingInfo_free(this_obj_conv);
16253 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
16254 LDKCounterpartyForwardingInfo this_ptr_conv;
16255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16256 this_ptr_conv.is_owned = false;
16257 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
16261 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
16262 LDKCounterpartyForwardingInfo this_ptr_conv;
16263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16264 this_ptr_conv.is_owned = false;
16265 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
16268 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
16269 LDKCounterpartyForwardingInfo this_ptr_conv;
16270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16271 this_ptr_conv.is_owned = false;
16272 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
16276 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
16277 LDKCounterpartyForwardingInfo this_ptr_conv;
16278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16279 this_ptr_conv.is_owned = false;
16280 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
16283 int16_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
16284 LDKCounterpartyForwardingInfo this_ptr_conv;
16285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16286 this_ptr_conv.is_owned = false;
16287 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
16291 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
16292 LDKCounterpartyForwardingInfo this_ptr_conv;
16293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16294 this_ptr_conv.is_owned = false;
16295 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
16298 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) {
16299 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
16300 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16301 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16302 uint64_t ret_ref = (uint64_t)ret_var.inner;
16303 if (ret_var.is_owned) {
16309 uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
16310 LDKCounterpartyForwardingInfo orig_conv;
16311 orig_conv.inner = (void*)(orig & (~1));
16312 orig_conv.is_owned = false;
16313 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
16314 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16315 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16316 uint64_t ret_ref = (uint64_t)ret_var.inner;
16317 if (ret_var.is_owned) {
16323 void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
16324 LDKChannelCounterparty this_obj_conv;
16325 this_obj_conv.inner = (void*)(this_obj & (~1));
16326 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16327 ChannelCounterparty_free(this_obj_conv);
16330 int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
16331 LDKChannelCounterparty this_ptr_conv;
16332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16333 this_ptr_conv.is_owned = false;
16334 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16335 memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
16339 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
16340 LDKChannelCounterparty this_ptr_conv;
16341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16342 this_ptr_conv.is_owned = false;
16343 LDKPublicKey val_ref;
16344 CHECK(*((uint32_t*)val) == 33);
16345 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16346 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
16349 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
16350 LDKChannelCounterparty this_ptr_conv;
16351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16352 this_ptr_conv.is_owned = false;
16353 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
16354 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16355 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16356 uint64_t ret_ref = (uint64_t)ret_var.inner;
16357 if (ret_var.is_owned) {
16363 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
16364 LDKChannelCounterparty this_ptr_conv;
16365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16366 this_ptr_conv.is_owned = false;
16367 LDKInitFeatures val_conv;
16368 val_conv.inner = (void*)(val & (~1));
16369 val_conv.is_owned = (val & 1) || (val == 0);
16370 val_conv = InitFeatures_clone(&val_conv);
16371 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
16374 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
16375 LDKChannelCounterparty this_ptr_conv;
16376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16377 this_ptr_conv.is_owned = false;
16378 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
16382 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
16383 LDKChannelCounterparty this_ptr_conv;
16384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16385 this_ptr_conv.is_owned = false;
16386 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
16389 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
16390 LDKChannelCounterparty this_ptr_conv;
16391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16392 this_ptr_conv.is_owned = false;
16393 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
16394 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16395 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16396 uint64_t ret_ref = (uint64_t)ret_var.inner;
16397 if (ret_var.is_owned) {
16403 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
16404 LDKChannelCounterparty this_ptr_conv;
16405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16406 this_ptr_conv.is_owned = false;
16407 LDKCounterpartyForwardingInfo val_conv;
16408 val_conv.inner = (void*)(val & (~1));
16409 val_conv.is_owned = (val & 1) || (val == 0);
16410 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
16411 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
16414 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) {
16415 LDKPublicKey node_id_arg_ref;
16416 CHECK(*((uint32_t*)node_id_arg) == 33);
16417 memcpy(node_id_arg_ref.compressed_form, (uint8_t*)(node_id_arg + 4), 33);
16418 LDKInitFeatures features_arg_conv;
16419 features_arg_conv.inner = (void*)(features_arg & (~1));
16420 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16421 features_arg_conv = InitFeatures_clone(&features_arg_conv);
16422 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
16423 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
16424 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
16425 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
16426 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
16427 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16428 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16429 uint64_t ret_ref = (uint64_t)ret_var.inner;
16430 if (ret_var.is_owned) {
16436 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
16437 LDKChannelCounterparty orig_conv;
16438 orig_conv.inner = (void*)(orig & (~1));
16439 orig_conv.is_owned = false;
16440 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
16441 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16442 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16443 uint64_t ret_ref = (uint64_t)ret_var.inner;
16444 if (ret_var.is_owned) {
16450 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
16451 LDKChannelDetails this_obj_conv;
16452 this_obj_conv.inner = (void*)(this_obj & (~1));
16453 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16454 ChannelDetails_free(this_obj_conv);
16457 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
16458 LDKChannelDetails this_ptr_conv;
16459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16460 this_ptr_conv.is_owned = false;
16461 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16462 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
16466 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16467 LDKChannelDetails this_ptr_conv;
16468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16469 this_ptr_conv.is_owned = false;
16470 LDKThirtyTwoBytes val_ref;
16471 CHECK(*((uint32_t*)val) == 32);
16472 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16473 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
16476 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
16477 LDKChannelDetails this_ptr_conv;
16478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16479 this_ptr_conv.is_owned = false;
16480 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
16481 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16482 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16483 uint64_t ret_ref = (uint64_t)ret_var.inner;
16484 if (ret_var.is_owned) {
16490 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
16491 LDKChannelDetails this_ptr_conv;
16492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16493 this_ptr_conv.is_owned = false;
16494 LDKChannelCounterparty val_conv;
16495 val_conv.inner = (void*)(val & (~1));
16496 val_conv.is_owned = (val & 1) || (val == 0);
16497 val_conv = ChannelCounterparty_clone(&val_conv);
16498 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
16501 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
16502 LDKChannelDetails this_ptr_conv;
16503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16504 this_ptr_conv.is_owned = false;
16505 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
16506 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16507 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16508 uint64_t ret_ref = (uint64_t)ret_var.inner;
16509 if (ret_var.is_owned) {
16515 void __attribute__((visibility("default"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
16516 LDKChannelDetails this_ptr_conv;
16517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16518 this_ptr_conv.is_owned = false;
16519 LDKOutPoint val_conv;
16520 val_conv.inner = (void*)(val & (~1));
16521 val_conv.is_owned = (val & 1) || (val == 0);
16522 val_conv = OutPoint_clone(&val_conv);
16523 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
16526 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
16527 LDKChannelDetails this_ptr_conv;
16528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16529 this_ptr_conv.is_owned = false;
16530 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16531 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
16532 uint64_t ret_ref = (uint64_t)ret_copy;
16536 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
16537 LDKChannelDetails this_ptr_conv;
16538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16539 this_ptr_conv.is_owned = false;
16540 void* val_ptr = (void*)(((uint64_t)val) & ~1);
16541 CHECK_ACCESS(val_ptr);
16542 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
16543 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
16544 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
16547 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
16548 LDKChannelDetails this_ptr_conv;
16549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16550 this_ptr_conv.is_owned = false;
16551 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
16555 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
16556 LDKChannelDetails this_ptr_conv;
16557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16558 this_ptr_conv.is_owned = false;
16559 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
16562 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
16563 LDKChannelDetails this_ptr_conv;
16564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16565 this_ptr_conv.is_owned = false;
16566 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16567 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
16568 uint64_t ret_ref = (uint64_t)ret_copy;
16572 void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
16573 LDKChannelDetails this_ptr_conv;
16574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16575 this_ptr_conv.is_owned = false;
16576 void* val_ptr = (void*)(((uint64_t)val) & ~1);
16577 CHECK_ACCESS(val_ptr);
16578 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
16579 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
16580 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
16583 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) {
16584 LDKChannelDetails this_ptr_conv;
16585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16586 this_ptr_conv.is_owned = false;
16587 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
16591 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
16592 LDKChannelDetails this_ptr_conv;
16593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16594 this_ptr_conv.is_owned = false;
16595 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
16598 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
16599 LDKChannelDetails this_ptr_conv;
16600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16601 this_ptr_conv.is_owned = false;
16602 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
16606 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
16607 LDKChannelDetails this_ptr_conv;
16608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16609 this_ptr_conv.is_owned = false;
16610 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
16613 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
16614 LDKChannelDetails this_ptr_conv;
16615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16616 this_ptr_conv.is_owned = false;
16617 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
16621 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
16622 LDKChannelDetails this_ptr_conv;
16623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16624 this_ptr_conv.is_owned = false;
16625 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
16628 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
16629 LDKChannelDetails this_ptr_conv;
16630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16631 this_ptr_conv.is_owned = false;
16632 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16633 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
16634 uint64_t ret_ref = (uint64_t)ret_copy;
16638 void __attribute__((visibility("default"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
16639 LDKChannelDetails this_ptr_conv;
16640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16641 this_ptr_conv.is_owned = false;
16642 void* val_ptr = (void*)(((uint64_t)val) & ~1);
16643 CHECK_ACCESS(val_ptr);
16644 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
16645 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
16646 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
16649 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
16650 LDKChannelDetails this_ptr_conv;
16651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16652 this_ptr_conv.is_owned = false;
16653 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16654 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
16655 uint64_t ret_ref = (uint64_t)ret_copy;
16659 void __attribute__((visibility("default"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
16660 LDKChannelDetails this_ptr_conv;
16661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16662 this_ptr_conv.is_owned = false;
16663 void* val_ptr = (void*)(((uint64_t)val) & ~1);
16664 CHECK_ACCESS(val_ptr);
16665 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
16666 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
16667 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
16670 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
16671 LDKChannelDetails this_ptr_conv;
16672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16673 this_ptr_conv.is_owned = false;
16674 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
16678 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
16679 LDKChannelDetails this_ptr_conv;
16680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16681 this_ptr_conv.is_owned = false;
16682 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
16685 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
16686 LDKChannelDetails this_ptr_conv;
16687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16688 this_ptr_conv.is_owned = false;
16689 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
16693 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
16694 LDKChannelDetails this_ptr_conv;
16695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16696 this_ptr_conv.is_owned = false;
16697 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
16700 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
16701 LDKChannelDetails this_ptr_conv;
16702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16703 this_ptr_conv.is_owned = false;
16704 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
16708 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
16709 LDKChannelDetails this_ptr_conv;
16710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16711 this_ptr_conv.is_owned = false;
16712 ChannelDetails_set_is_usable(&this_ptr_conv, val);
16715 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
16716 LDKChannelDetails this_ptr_conv;
16717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16718 this_ptr_conv.is_owned = false;
16719 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
16723 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
16724 LDKChannelDetails this_ptr_conv;
16725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16726 this_ptr_conv.is_owned = false;
16727 ChannelDetails_set_is_public(&this_ptr_conv, val);
16730 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint32_t counterparty_arg, uint32_t funding_txo_arg, uint32_t short_channel_id_arg, int64_t channel_value_satoshis_arg, uint32_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, uint32_t confirmations_required_arg, uint32_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
16731 LDKThirtyTwoBytes channel_id_arg_ref;
16732 CHECK(*((uint32_t*)channel_id_arg) == 32);
16733 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16734 LDKChannelCounterparty counterparty_arg_conv;
16735 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
16736 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
16737 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
16738 LDKOutPoint funding_txo_arg_conv;
16739 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
16740 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
16741 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
16742 void* short_channel_id_arg_ptr = (void*)(((uint64_t)short_channel_id_arg) & ~1);
16743 CHECK_ACCESS(short_channel_id_arg_ptr);
16744 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
16745 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
16746 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
16747 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
16748 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
16749 void* confirmations_required_arg_ptr = (void*)(((uint64_t)confirmations_required_arg) & ~1);
16750 CHECK_ACCESS(confirmations_required_arg_ptr);
16751 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
16752 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
16753 void* force_close_spend_delay_arg_ptr = (void*)(((uint64_t)force_close_spend_delay_arg) & ~1);
16754 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
16755 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
16756 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
16757 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
16758 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16759 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16760 uint64_t ret_ref = (uint64_t)ret_var.inner;
16761 if (ret_var.is_owned) {
16767 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
16768 LDKChannelDetails orig_conv;
16769 orig_conv.inner = (void*)(orig & (~1));
16770 orig_conv.is_owned = false;
16771 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
16772 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16773 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16774 uint64_t ret_ref = (uint64_t)ret_var.inner;
16775 if (ret_var.is_owned) {
16781 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
16782 if ((this_ptr & 1) != 0) return;
16783 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16784 CHECK_ACCESS(this_ptr_ptr);
16785 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
16786 FREE((void*)this_ptr);
16787 PaymentSendFailure_free(this_ptr_conv);
16790 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
16791 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
16792 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
16793 *ret_copy = PaymentSendFailure_clone(orig_conv);
16794 uint64_t ret_ref = (uint64_t)ret_copy;
16798 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
16799 void* a_ptr = (void*)(((uint64_t)a) & ~1);
16800 CHECK_ACCESS(a_ptr);
16801 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
16802 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
16803 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
16804 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
16805 uint64_t ret_ref = (uint64_t)ret_copy;
16809 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
16810 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
16811 a_constr.datalen = *((uint32_t*)a);
16812 if (a_constr.datalen > 0)
16813 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
16815 a_constr.data = NULL;
16816 uint32_t* a_vals = (uint32_t*)(a + 4);
16817 for (size_t w = 0; w < a_constr.datalen; w++) {
16818 uint32_t a_conv_22 = a_vals[w];
16819 void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1);
16820 CHECK_ACCESS(a_conv_22_ptr);
16821 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
16822 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
16823 a_constr.data[w] = a_conv_22_conv;
16825 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
16826 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
16827 uint64_t ret_ref = (uint64_t)ret_copy;
16831 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
16832 LDKCVec_APIErrorZ a_constr;
16833 a_constr.datalen = *((uint32_t*)a);
16834 if (a_constr.datalen > 0)
16835 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
16837 a_constr.data = NULL;
16838 uint32_t* a_vals = (uint32_t*)(a + 4);
16839 for (size_t k = 0; k < a_constr.datalen; k++) {
16840 uint32_t a_conv_10 = a_vals[k];
16841 void* a_conv_10_ptr = (void*)(((uint64_t)a_conv_10) & ~1);
16842 CHECK_ACCESS(a_conv_10_ptr);
16843 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
16844 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
16845 a_constr.data[k] = a_conv_10_conv;
16847 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
16848 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
16849 uint64_t ret_ref = (uint64_t)ret_copy;
16853 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_partial_failure(uint32_tArray a) {
16854 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
16855 a_constr.datalen = *((uint32_t*)a);
16856 if (a_constr.datalen > 0)
16857 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
16859 a_constr.data = NULL;
16860 uint32_t* a_vals = (uint32_t*)(a + 4);
16861 for (size_t w = 0; w < a_constr.datalen; w++) {
16862 uint32_t a_conv_22 = a_vals[w];
16863 void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1);
16864 CHECK_ACCESS(a_conv_22_ptr);
16865 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
16866 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
16867 a_constr.data[w] = a_conv_22_conv;
16869 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
16870 *ret_copy = PaymentSendFailure_partial_failure(a_constr);
16871 uint64_t ret_ref = (uint64_t)ret_copy;
16875 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) {
16876 void* fee_est_ptr = (void*)(((uint64_t)fee_est) & ~1);
16877 CHECK_ACCESS(fee_est_ptr);
16878 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
16879 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
16880 CHECK_ACCESS(chain_monitor_ptr);
16881 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
16882 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
16883 CHECK_ACCESS(tx_broadcaster_ptr);
16884 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
16885 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
16886 CHECK_ACCESS(logger_ptr);
16887 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
16888 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
16889 CHECK_ACCESS(keys_manager_ptr);
16890 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
16891 LDKUserConfig config_conv;
16892 config_conv.inner = (void*)(config & (~1));
16893 config_conv.is_owned = (config & 1) || (config == 0);
16894 config_conv = UserConfig_clone(&config_conv);
16895 LDKChainParameters params_conv;
16896 params_conv.inner = (void*)(params & (~1));
16897 params_conv.is_owned = (params & 1) || (params == 0);
16898 params_conv = ChainParameters_clone(¶ms_conv);
16899 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
16900 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16901 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16902 uint64_t ret_ref = (uint64_t)ret_var.inner;
16903 if (ret_var.is_owned) {
16909 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
16910 LDKChannelManager this_arg_conv;
16911 this_arg_conv.inner = (void*)(this_arg & (~1));
16912 this_arg_conv.is_owned = false;
16913 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
16914 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16915 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16916 uint64_t ret_ref = (uint64_t)ret_var.inner;
16917 if (ret_var.is_owned) {
16923 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_channel(uint32_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_channel_id, uint32_t override_config) {
16924 LDKChannelManager this_arg_conv;
16925 this_arg_conv.inner = (void*)(this_arg & (~1));
16926 this_arg_conv.is_owned = false;
16927 LDKPublicKey their_network_key_ref;
16928 CHECK(*((uint32_t*)their_network_key) == 33);
16929 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
16930 LDKUserConfig override_config_conv;
16931 override_config_conv.inner = (void*)(override_config & (~1));
16932 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
16933 override_config_conv = UserConfig_clone(&override_config_conv);
16934 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16935 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
16936 return (uint64_t)ret_conv;
16939 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
16940 LDKChannelManager this_arg_conv;
16941 this_arg_conv.inner = (void*)(this_arg & (~1));
16942 this_arg_conv.is_owned = false;
16943 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
16944 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
16945 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
16946 for (size_t q = 0; q < ret_var.datalen; q++) {
16947 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
16948 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16949 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16950 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
16951 if (ret_conv_16_var.is_owned) {
16952 ret_conv_16_ref |= 1;
16954 ret_arr_ptr[q] = ret_conv_16_ref;
16956 FREE(ret_var.data);
16960 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
16961 LDKChannelManager this_arg_conv;
16962 this_arg_conv.inner = (void*)(this_arg & (~1));
16963 this_arg_conv.is_owned = false;
16964 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
16965 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
16966 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
16967 for (size_t q = 0; q < ret_var.datalen; q++) {
16968 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
16969 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16970 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16971 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
16972 if (ret_conv_16_var.is_owned) {
16973 ret_conv_16_ref |= 1;
16975 ret_arr_ptr[q] = ret_conv_16_ref;
16977 FREE(ret_var.data);
16981 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
16982 LDKChannelManager this_arg_conv;
16983 this_arg_conv.inner = (void*)(this_arg & (~1));
16984 this_arg_conv.is_owned = false;
16985 unsigned char channel_id_arr[32];
16986 CHECK(*((uint32_t*)channel_id) == 32);
16987 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
16988 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
16989 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16990 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
16991 return (uint64_t)ret_conv;
16994 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) {
16995 LDKChannelManager this_arg_conv;
16996 this_arg_conv.inner = (void*)(this_arg & (~1));
16997 this_arg_conv.is_owned = false;
16998 unsigned char channel_id_arr[32];
16999 CHECK(*((uint32_t*)channel_id) == 32);
17000 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
17001 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
17002 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17003 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
17004 return (uint64_t)ret_conv;
17007 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
17008 LDKChannelManager this_arg_conv;
17009 this_arg_conv.inner = (void*)(this_arg & (~1));
17010 this_arg_conv.is_owned = false;
17011 unsigned char channel_id_arr[32];
17012 CHECK(*((uint32_t*)channel_id) == 32);
17013 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
17014 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
17015 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17016 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
17017 return (uint64_t)ret_conv;
17020 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
17021 LDKChannelManager this_arg_conv;
17022 this_arg_conv.inner = (void*)(this_arg & (~1));
17023 this_arg_conv.is_owned = false;
17024 ChannelManager_force_close_all_channels(&this_arg_conv);
17027 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
17028 LDKChannelManager this_arg_conv;
17029 this_arg_conv.inner = (void*)(this_arg & (~1));
17030 this_arg_conv.is_owned = false;
17031 LDKRoute route_conv;
17032 route_conv.inner = (void*)(route & (~1));
17033 route_conv.is_owned = false;
17034 LDKThirtyTwoBytes payment_hash_ref;
17035 CHECK(*((uint32_t*)payment_hash) == 32);
17036 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
17037 LDKThirtyTwoBytes payment_secret_ref;
17038 CHECK(*((uint32_t*)payment_secret) == 32);
17039 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
17040 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17041 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
17042 return (uint64_t)ret_conv;
17045 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, uint32_t payment_id) {
17046 LDKChannelManager this_arg_conv;
17047 this_arg_conv.inner = (void*)(this_arg & (~1));
17048 this_arg_conv.is_owned = false;
17049 LDKRoute route_conv;
17050 route_conv.inner = (void*)(route & (~1));
17051 route_conv.is_owned = false;
17052 LDKPaymentId payment_id_conv;
17053 payment_id_conv.inner = (void*)(payment_id & (~1));
17054 payment_id_conv.is_owned = (payment_id & 1) || (payment_id == 0);
17055 payment_id_conv = PaymentId_clone(&payment_id_conv);
17056 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17057 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_conv);
17058 return (uint64_t)ret_conv;
17061 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
17062 LDKChannelManager this_arg_conv;
17063 this_arg_conv.inner = (void*)(this_arg & (~1));
17064 this_arg_conv.is_owned = false;
17065 LDKRoute route_conv;
17066 route_conv.inner = (void*)(route & (~1));
17067 route_conv.is_owned = false;
17068 LDKThirtyTwoBytes payment_preimage_ref;
17069 CHECK(*((uint32_t*)payment_preimage) == 32);
17070 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
17071 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17072 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
17073 return (uint64_t)ret_conv;
17076 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
17077 LDKChannelManager this_arg_conv;
17078 this_arg_conv.inner = (void*)(this_arg & (~1));
17079 this_arg_conv.is_owned = false;
17080 unsigned char temporary_channel_id_arr[32];
17081 CHECK(*((uint32_t*)temporary_channel_id) == 32);
17082 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
17083 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
17084 LDKTransaction funding_transaction_ref;
17085 funding_transaction_ref.datalen = *((uint32_t*)funding_transaction);
17086 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
17087 memcpy(funding_transaction_ref.data, (uint8_t*)(funding_transaction + 4), funding_transaction_ref.datalen);
17088 funding_transaction_ref.data_is_owned = true;
17089 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17090 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
17091 return (uint64_t)ret_conv;
17094 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
17095 LDKChannelManager this_arg_conv;
17096 this_arg_conv.inner = (void*)(this_arg & (~1));
17097 this_arg_conv.is_owned = false;
17098 LDKThreeBytes rgb_ref;
17099 CHECK(*((uint32_t*)rgb) == 3);
17100 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
17101 LDKThirtyTwoBytes alias_ref;
17102 CHECK(*((uint32_t*)alias) == 32);
17103 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
17104 LDKCVec_NetAddressZ addresses_constr;
17105 addresses_constr.datalen = *((uint32_t*)addresses);
17106 if (addresses_constr.datalen > 0)
17107 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17109 addresses_constr.data = NULL;
17110 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
17111 for (size_t m = 0; m < addresses_constr.datalen; m++) {
17112 uint32_t addresses_conv_12 = addresses_vals[m];
17113 void* addresses_conv_12_ptr = (void*)(((uint64_t)addresses_conv_12) & ~1);
17114 CHECK_ACCESS(addresses_conv_12_ptr);
17115 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
17116 addresses_constr.data[m] = addresses_conv_12_conv;
17118 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
17121 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
17122 LDKChannelManager this_arg_conv;
17123 this_arg_conv.inner = (void*)(this_arg & (~1));
17124 this_arg_conv.is_owned = false;
17125 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
17128 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
17129 LDKChannelManager this_arg_conv;
17130 this_arg_conv.inner = (void*)(this_arg & (~1));
17131 this_arg_conv.is_owned = false;
17132 ChannelManager_timer_tick_occurred(&this_arg_conv);
17135 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
17136 LDKChannelManager this_arg_conv;
17137 this_arg_conv.inner = (void*)(this_arg & (~1));
17138 this_arg_conv.is_owned = false;
17139 unsigned char payment_hash_arr[32];
17140 CHECK(*((uint32_t*)payment_hash) == 32);
17141 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
17142 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
17143 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
17147 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
17148 LDKChannelManager this_arg_conv;
17149 this_arg_conv.inner = (void*)(this_arg & (~1));
17150 this_arg_conv.is_owned = false;
17151 LDKThirtyTwoBytes payment_preimage_ref;
17152 CHECK(*((uint32_t*)payment_preimage) == 32);
17153 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
17154 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
17158 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
17159 LDKChannelManager this_arg_conv;
17160 this_arg_conv.inner = (void*)(this_arg & (~1));
17161 this_arg_conv.is_owned = false;
17162 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17163 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
17167 void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
17168 LDKChannelManager this_arg_conv;
17169 this_arg_conv.inner = (void*)(this_arg & (~1));
17170 this_arg_conv.is_owned = false;
17171 LDKOutPoint funding_txo_conv;
17172 funding_txo_conv.inner = (void*)(funding_txo & (~1));
17173 funding_txo_conv.is_owned = false;
17174 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
17177 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) {
17178 LDKChannelManager this_arg_conv;
17179 this_arg_conv.inner = (void*)(this_arg & (~1));
17180 this_arg_conv.is_owned = false;
17181 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
17182 CHECK_ACCESS(min_value_msat_ptr);
17183 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
17184 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
17185 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17186 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
17187 return ((uint64_t)ret_conv);
17190 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) {
17191 LDKChannelManager this_arg_conv;
17192 this_arg_conv.inner = (void*)(this_arg & (~1));
17193 this_arg_conv.is_owned = false;
17194 LDKThirtyTwoBytes payment_hash_ref;
17195 CHECK(*((uint32_t*)payment_hash) == 32);
17196 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
17197 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
17198 CHECK_ACCESS(min_value_msat_ptr);
17199 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
17200 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
17201 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17202 *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);
17203 return (uint64_t)ret_conv;
17206 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
17207 LDKChannelManager this_arg_conv;
17208 this_arg_conv.inner = (void*)(this_arg & (~1));
17209 this_arg_conv.is_owned = false;
17210 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
17211 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
17212 return (uint64_t)ret_ret;
17215 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
17216 LDKChannelManager this_arg_conv;
17217 this_arg_conv.inner = (void*)(this_arg & (~1));
17218 this_arg_conv.is_owned = false;
17219 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
17220 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
17221 return (uint64_t)ret_ret;
17224 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
17225 LDKChannelManager this_arg_conv;
17226 this_arg_conv.inner = (void*)(this_arg & (~1));
17227 this_arg_conv.is_owned = false;
17228 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
17229 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
17230 return (uint64_t)ret_ret;
17233 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
17234 LDKChannelManager this_arg_conv;
17235 this_arg_conv.inner = (void*)(this_arg & (~1));
17236 this_arg_conv.is_owned = false;
17237 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
17238 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
17239 return (uint64_t)ret_ret;
17242 jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
17243 LDKChannelManager this_arg_conv;
17244 this_arg_conv.inner = (void*)(this_arg & (~1));
17245 this_arg_conv.is_owned = false;
17246 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
17250 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
17251 LDKChannelManager this_arg_conv;
17252 this_arg_conv.inner = (void*)(this_arg & (~1));
17253 this_arg_conv.is_owned = false;
17254 ChannelManager_await_persistable_update(&this_arg_conv);
17257 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
17258 LDKChannelManager this_arg_conv;
17259 this_arg_conv.inner = (void*)(this_arg & (~1));
17260 this_arg_conv.is_owned = false;
17261 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
17262 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17263 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17264 uint64_t ret_ref = (uint64_t)ret_var.inner;
17265 if (ret_var.is_owned) {
17271 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
17272 LDKChannelManager this_arg_conv;
17273 this_arg_conv.inner = (void*)(this_arg & (~1));
17274 this_arg_conv.is_owned = false;
17275 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
17276 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
17277 return (uint64_t)ret_ret;
17280 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
17281 LDKChannelManager obj_conv;
17282 obj_conv.inner = (void*)(obj & (~1));
17283 obj_conv.is_owned = false;
17284 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
17285 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17286 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17287 CVec_u8Z_free(ret_var);
17291 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
17292 LDKChannelManagerReadArgs this_obj_conv;
17293 this_obj_conv.inner = (void*)(this_obj & (~1));
17294 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17295 ChannelManagerReadArgs_free(this_obj_conv);
17298 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
17299 LDKChannelManagerReadArgs this_ptr_conv;
17300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17301 this_ptr_conv.is_owned = false;
17302 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
17306 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
17307 LDKChannelManagerReadArgs this_ptr_conv;
17308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17309 this_ptr_conv.is_owned = false;
17310 void* val_ptr = (void*)(((uint64_t)val) & ~1);
17311 CHECK_ACCESS(val_ptr);
17312 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
17313 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
17316 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
17317 LDKChannelManagerReadArgs this_ptr_conv;
17318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17319 this_ptr_conv.is_owned = false;
17320 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
17324 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
17325 LDKChannelManagerReadArgs this_ptr_conv;
17326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17327 this_ptr_conv.is_owned = false;
17328 void* val_ptr = (void*)(((uint64_t)val) & ~1);
17329 CHECK_ACCESS(val_ptr);
17330 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
17331 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
17334 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
17335 LDKChannelManagerReadArgs this_ptr_conv;
17336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17337 this_ptr_conv.is_owned = false;
17338 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
17342 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
17343 LDKChannelManagerReadArgs this_ptr_conv;
17344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17345 this_ptr_conv.is_owned = false;
17346 void* val_ptr = (void*)(((uint64_t)val) & ~1);
17347 CHECK_ACCESS(val_ptr);
17348 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
17349 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
17352 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
17353 LDKChannelManagerReadArgs this_ptr_conv;
17354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17355 this_ptr_conv.is_owned = false;
17356 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
17360 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
17361 LDKChannelManagerReadArgs this_ptr_conv;
17362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17363 this_ptr_conv.is_owned = false;
17364 void* val_ptr = (void*)(((uint64_t)val) & ~1);
17365 CHECK_ACCESS(val_ptr);
17366 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
17367 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
17370 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
17371 LDKChannelManagerReadArgs this_ptr_conv;
17372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17373 this_ptr_conv.is_owned = false;
17374 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
17378 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
17379 LDKChannelManagerReadArgs this_ptr_conv;
17380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17381 this_ptr_conv.is_owned = false;
17382 void* val_ptr = (void*)(((uint64_t)val) & ~1);
17383 CHECK_ACCESS(val_ptr);
17384 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
17385 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
17388 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
17389 LDKChannelManagerReadArgs this_ptr_conv;
17390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17391 this_ptr_conv.is_owned = false;
17392 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
17393 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17394 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17395 uint64_t ret_ref = (uint64_t)ret_var.inner;
17396 if (ret_var.is_owned) {
17402 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
17403 LDKChannelManagerReadArgs this_ptr_conv;
17404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17405 this_ptr_conv.is_owned = false;
17406 LDKUserConfig val_conv;
17407 val_conv.inner = (void*)(val & (~1));
17408 val_conv.is_owned = (val & 1) || (val == 0);
17409 val_conv = UserConfig_clone(&val_conv);
17410 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
17413 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) {
17414 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
17415 CHECK_ACCESS(keys_manager_ptr);
17416 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
17417 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
17418 CHECK_ACCESS(fee_estimator_ptr);
17419 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
17420 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
17421 CHECK_ACCESS(chain_monitor_ptr);
17422 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
17423 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
17424 CHECK_ACCESS(tx_broadcaster_ptr);
17425 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
17426 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
17427 CHECK_ACCESS(logger_ptr);
17428 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
17429 LDKUserConfig default_config_conv;
17430 default_config_conv.inner = (void*)(default_config & (~1));
17431 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
17432 default_config_conv = UserConfig_clone(&default_config_conv);
17433 LDKCVec_ChannelMonitorZ channel_monitors_constr;
17434 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
17435 if (channel_monitors_constr.datalen > 0)
17436 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
17438 channel_monitors_constr.data = NULL;
17439 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
17440 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
17441 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
17442 LDKChannelMonitor channel_monitors_conv_16_conv;
17443 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
17444 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
17445 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
17447 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);
17448 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17449 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17450 uint64_t ret_ref = (uint64_t)ret_var.inner;
17451 if (ret_var.is_owned) {
17457 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
17458 LDKu8slice ser_ref;
17459 ser_ref.datalen = *((uint32_t*)ser);
17460 ser_ref.data = (int8_t*)(ser + 4);
17461 LDKChannelManagerReadArgs arg_conv;
17462 arg_conv.inner = (void*)(arg & (~1));
17463 arg_conv.is_owned = (arg & 1) || (arg == 0);
17464 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
17465 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17466 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
17467 return (uint64_t)ret_conv;
17470 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
17471 LDKDecodeError this_obj_conv;
17472 this_obj_conv.inner = (void*)(this_obj & (~1));
17473 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17474 DecodeError_free(this_obj_conv);
17477 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
17478 LDKDecodeError orig_conv;
17479 orig_conv.inner = (void*)(orig & (~1));
17480 orig_conv.is_owned = false;
17481 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
17482 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17483 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17484 uint64_t ret_ref = (uint64_t)ret_var.inner;
17485 if (ret_var.is_owned) {
17491 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
17492 LDKInit this_obj_conv;
17493 this_obj_conv.inner = (void*)(this_obj & (~1));
17494 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17495 Init_free(this_obj_conv);
17498 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
17499 LDKInit this_ptr_conv;
17500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17501 this_ptr_conv.is_owned = false;
17502 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
17503 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17504 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17505 uint64_t ret_ref = (uint64_t)ret_var.inner;
17506 if (ret_var.is_owned) {
17512 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
17513 LDKInit this_ptr_conv;
17514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17515 this_ptr_conv.is_owned = false;
17516 LDKInitFeatures val_conv;
17517 val_conv.inner = (void*)(val & (~1));
17518 val_conv.is_owned = (val & 1) || (val == 0);
17519 val_conv = InitFeatures_clone(&val_conv);
17520 Init_set_features(&this_ptr_conv, val_conv);
17523 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
17524 LDKInitFeatures features_arg_conv;
17525 features_arg_conv.inner = (void*)(features_arg & (~1));
17526 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
17527 features_arg_conv = InitFeatures_clone(&features_arg_conv);
17528 LDKInit ret_var = Init_new(features_arg_conv);
17529 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17530 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17531 uint64_t ret_ref = (uint64_t)ret_var.inner;
17532 if (ret_var.is_owned) {
17538 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
17540 orig_conv.inner = (void*)(orig & (~1));
17541 orig_conv.is_owned = false;
17542 LDKInit ret_var = Init_clone(&orig_conv);
17543 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17544 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17545 uint64_t ret_ref = (uint64_t)ret_var.inner;
17546 if (ret_var.is_owned) {
17552 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
17553 LDKErrorMessage this_obj_conv;
17554 this_obj_conv.inner = (void*)(this_obj & (~1));
17555 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17556 ErrorMessage_free(this_obj_conv);
17559 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
17560 LDKErrorMessage this_ptr_conv;
17561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17562 this_ptr_conv.is_owned = false;
17563 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17564 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
17568 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17569 LDKErrorMessage this_ptr_conv;
17570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17571 this_ptr_conv.is_owned = false;
17572 LDKThirtyTwoBytes val_ref;
17573 CHECK(*((uint32_t*)val) == 32);
17574 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17575 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
17578 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
17579 LDKErrorMessage this_ptr_conv;
17580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17581 this_ptr_conv.is_owned = false;
17582 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
17583 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17588 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
17589 LDKErrorMessage this_ptr_conv;
17590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17591 this_ptr_conv.is_owned = false;
17592 LDKStr val_conv = str_ref_to_owned_c(val);
17593 ErrorMessage_set_data(&this_ptr_conv, val_conv);
17596 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
17597 LDKThirtyTwoBytes channel_id_arg_ref;
17598 CHECK(*((uint32_t*)channel_id_arg) == 32);
17599 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17600 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
17601 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
17602 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17603 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17604 uint64_t ret_ref = (uint64_t)ret_var.inner;
17605 if (ret_var.is_owned) {
17611 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
17612 LDKErrorMessage orig_conv;
17613 orig_conv.inner = (void*)(orig & (~1));
17614 orig_conv.is_owned = false;
17615 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
17616 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17617 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17618 uint64_t ret_ref = (uint64_t)ret_var.inner;
17619 if (ret_var.is_owned) {
17625 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
17626 LDKPing this_obj_conv;
17627 this_obj_conv.inner = (void*)(this_obj & (~1));
17628 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17629 Ping_free(this_obj_conv);
17632 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
17633 LDKPing this_ptr_conv;
17634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17635 this_ptr_conv.is_owned = false;
17636 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
17640 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
17641 LDKPing this_ptr_conv;
17642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17643 this_ptr_conv.is_owned = false;
17644 Ping_set_ponglen(&this_ptr_conv, val);
17647 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
17648 LDKPing this_ptr_conv;
17649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17650 this_ptr_conv.is_owned = false;
17651 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
17655 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
17656 LDKPing this_ptr_conv;
17657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17658 this_ptr_conv.is_owned = false;
17659 Ping_set_byteslen(&this_ptr_conv, val);
17662 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
17663 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
17664 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17665 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17666 uint64_t ret_ref = (uint64_t)ret_var.inner;
17667 if (ret_var.is_owned) {
17673 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
17675 orig_conv.inner = (void*)(orig & (~1));
17676 orig_conv.is_owned = false;
17677 LDKPing ret_var = Ping_clone(&orig_conv);
17678 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17679 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17680 uint64_t ret_ref = (uint64_t)ret_var.inner;
17681 if (ret_var.is_owned) {
17687 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
17688 LDKPong this_obj_conv;
17689 this_obj_conv.inner = (void*)(this_obj & (~1));
17690 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17691 Pong_free(this_obj_conv);
17694 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
17695 LDKPong this_ptr_conv;
17696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17697 this_ptr_conv.is_owned = false;
17698 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
17702 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
17703 LDKPong this_ptr_conv;
17704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17705 this_ptr_conv.is_owned = false;
17706 Pong_set_byteslen(&this_ptr_conv, val);
17709 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
17710 LDKPong ret_var = Pong_new(byteslen_arg);
17711 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17712 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17713 uint64_t ret_ref = (uint64_t)ret_var.inner;
17714 if (ret_var.is_owned) {
17720 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
17722 orig_conv.inner = (void*)(orig & (~1));
17723 orig_conv.is_owned = false;
17724 LDKPong ret_var = Pong_clone(&orig_conv);
17725 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17726 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17727 uint64_t ret_ref = (uint64_t)ret_var.inner;
17728 if (ret_var.is_owned) {
17734 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
17735 LDKOpenChannel this_obj_conv;
17736 this_obj_conv.inner = (void*)(this_obj & (~1));
17737 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17738 OpenChannel_free(this_obj_conv);
17741 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
17742 LDKOpenChannel this_ptr_conv;
17743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17744 this_ptr_conv.is_owned = false;
17745 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17746 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
17750 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17751 LDKOpenChannel this_ptr_conv;
17752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17753 this_ptr_conv.is_owned = false;
17754 LDKThirtyTwoBytes val_ref;
17755 CHECK(*((uint32_t*)val) == 32);
17756 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17757 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
17760 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
17761 LDKOpenChannel this_ptr_conv;
17762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17763 this_ptr_conv.is_owned = false;
17764 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17765 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
17769 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
17770 LDKOpenChannel this_ptr_conv;
17771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17772 this_ptr_conv.is_owned = false;
17773 LDKThirtyTwoBytes val_ref;
17774 CHECK(*((uint32_t*)val) == 32);
17775 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17776 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
17779 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
17780 LDKOpenChannel this_ptr_conv;
17781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17782 this_ptr_conv.is_owned = false;
17783 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
17787 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
17788 LDKOpenChannel this_ptr_conv;
17789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17790 this_ptr_conv.is_owned = false;
17791 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
17794 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
17795 LDKOpenChannel this_ptr_conv;
17796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17797 this_ptr_conv.is_owned = false;
17798 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
17802 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
17803 LDKOpenChannel this_ptr_conv;
17804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17805 this_ptr_conv.is_owned = false;
17806 OpenChannel_set_push_msat(&this_ptr_conv, val);
17809 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
17810 LDKOpenChannel this_ptr_conv;
17811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17812 this_ptr_conv.is_owned = false;
17813 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
17817 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
17818 LDKOpenChannel this_ptr_conv;
17819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17820 this_ptr_conv.is_owned = false;
17821 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
17824 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
17825 LDKOpenChannel this_ptr_conv;
17826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17827 this_ptr_conv.is_owned = false;
17828 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
17832 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
17833 LDKOpenChannel this_ptr_conv;
17834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17835 this_ptr_conv.is_owned = false;
17836 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
17839 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
17840 LDKOpenChannel this_ptr_conv;
17841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17842 this_ptr_conv.is_owned = false;
17843 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
17847 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
17848 LDKOpenChannel this_ptr_conv;
17849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17850 this_ptr_conv.is_owned = false;
17851 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
17854 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
17855 LDKOpenChannel this_ptr_conv;
17856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17857 this_ptr_conv.is_owned = false;
17858 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
17862 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17863 LDKOpenChannel this_ptr_conv;
17864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17865 this_ptr_conv.is_owned = false;
17866 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
17869 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
17870 LDKOpenChannel this_ptr_conv;
17871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17872 this_ptr_conv.is_owned = false;
17873 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
17877 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
17878 LDKOpenChannel this_ptr_conv;
17879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17880 this_ptr_conv.is_owned = false;
17881 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
17884 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
17885 LDKOpenChannel this_ptr_conv;
17886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17887 this_ptr_conv.is_owned = false;
17888 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
17892 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
17893 LDKOpenChannel this_ptr_conv;
17894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17895 this_ptr_conv.is_owned = false;
17896 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
17899 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
17900 LDKOpenChannel this_ptr_conv;
17901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17902 this_ptr_conv.is_owned = false;
17903 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
17907 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
17908 LDKOpenChannel this_ptr_conv;
17909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17910 this_ptr_conv.is_owned = false;
17911 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
17914 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
17915 LDKOpenChannel this_ptr_conv;
17916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17917 this_ptr_conv.is_owned = false;
17918 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17919 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
17923 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
17924 LDKOpenChannel this_ptr_conv;
17925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17926 this_ptr_conv.is_owned = false;
17927 LDKPublicKey val_ref;
17928 CHECK(*((uint32_t*)val) == 33);
17929 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17930 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
17933 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
17934 LDKOpenChannel this_ptr_conv;
17935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17936 this_ptr_conv.is_owned = false;
17937 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17938 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
17942 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
17943 LDKOpenChannel this_ptr_conv;
17944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17945 this_ptr_conv.is_owned = false;
17946 LDKPublicKey val_ref;
17947 CHECK(*((uint32_t*)val) == 33);
17948 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17949 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
17952 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
17953 LDKOpenChannel this_ptr_conv;
17954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17955 this_ptr_conv.is_owned = false;
17956 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17957 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
17961 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
17962 LDKOpenChannel this_ptr_conv;
17963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17964 this_ptr_conv.is_owned = false;
17965 LDKPublicKey val_ref;
17966 CHECK(*((uint32_t*)val) == 33);
17967 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17968 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
17971 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
17972 LDKOpenChannel this_ptr_conv;
17973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17974 this_ptr_conv.is_owned = false;
17975 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17976 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
17980 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
17981 LDKOpenChannel this_ptr_conv;
17982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17983 this_ptr_conv.is_owned = false;
17984 LDKPublicKey val_ref;
17985 CHECK(*((uint32_t*)val) == 33);
17986 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17987 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
17990 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
17991 LDKOpenChannel this_ptr_conv;
17992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17993 this_ptr_conv.is_owned = false;
17994 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17995 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
17999 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
18000 LDKOpenChannel this_ptr_conv;
18001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18002 this_ptr_conv.is_owned = false;
18003 LDKPublicKey val_ref;
18004 CHECK(*((uint32_t*)val) == 33);
18005 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18006 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
18009 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
18010 LDKOpenChannel this_ptr_conv;
18011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18012 this_ptr_conv.is_owned = false;
18013 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18014 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
18018 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
18019 LDKOpenChannel this_ptr_conv;
18020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18021 this_ptr_conv.is_owned = false;
18022 LDKPublicKey val_ref;
18023 CHECK(*((uint32_t*)val) == 33);
18024 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18025 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
18028 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
18029 LDKOpenChannel this_ptr_conv;
18030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18031 this_ptr_conv.is_owned = false;
18032 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
18036 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
18037 LDKOpenChannel this_ptr_conv;
18038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18039 this_ptr_conv.is_owned = false;
18040 OpenChannel_set_channel_flags(&this_ptr_conv, val);
18043 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
18044 LDKOpenChannel orig_conv;
18045 orig_conv.inner = (void*)(orig & (~1));
18046 orig_conv.is_owned = false;
18047 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
18048 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18049 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18050 uint64_t ret_ref = (uint64_t)ret_var.inner;
18051 if (ret_var.is_owned) {
18057 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
18058 LDKAcceptChannel this_obj_conv;
18059 this_obj_conv.inner = (void*)(this_obj & (~1));
18060 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18061 AcceptChannel_free(this_obj_conv);
18064 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
18065 LDKAcceptChannel this_ptr_conv;
18066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18067 this_ptr_conv.is_owned = false;
18068 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18069 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
18073 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
18074 LDKAcceptChannel this_ptr_conv;
18075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18076 this_ptr_conv.is_owned = false;
18077 LDKThirtyTwoBytes val_ref;
18078 CHECK(*((uint32_t*)val) == 32);
18079 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18080 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
18083 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
18084 LDKAcceptChannel this_ptr_conv;
18085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18086 this_ptr_conv.is_owned = false;
18087 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
18091 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
18092 LDKAcceptChannel this_ptr_conv;
18093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18094 this_ptr_conv.is_owned = false;
18095 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
18098 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
18099 LDKAcceptChannel this_ptr_conv;
18100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18101 this_ptr_conv.is_owned = false;
18102 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
18106 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
18107 LDKAcceptChannel this_ptr_conv;
18108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18109 this_ptr_conv.is_owned = false;
18110 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
18113 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
18114 LDKAcceptChannel this_ptr_conv;
18115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18116 this_ptr_conv.is_owned = false;
18117 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
18121 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
18122 LDKAcceptChannel this_ptr_conv;
18123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18124 this_ptr_conv.is_owned = false;
18125 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
18128 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
18129 LDKAcceptChannel this_ptr_conv;
18130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18131 this_ptr_conv.is_owned = false;
18132 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
18136 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
18137 LDKAcceptChannel this_ptr_conv;
18138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18139 this_ptr_conv.is_owned = false;
18140 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
18143 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
18144 LDKAcceptChannel this_ptr_conv;
18145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18146 this_ptr_conv.is_owned = false;
18147 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
18151 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
18152 LDKAcceptChannel this_ptr_conv;
18153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18154 this_ptr_conv.is_owned = false;
18155 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
18158 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
18159 LDKAcceptChannel this_ptr_conv;
18160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18161 this_ptr_conv.is_owned = false;
18162 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
18166 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
18167 LDKAcceptChannel this_ptr_conv;
18168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18169 this_ptr_conv.is_owned = false;
18170 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
18173 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
18174 LDKAcceptChannel this_ptr_conv;
18175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18176 this_ptr_conv.is_owned = false;
18177 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
18181 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
18182 LDKAcceptChannel this_ptr_conv;
18183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18184 this_ptr_conv.is_owned = false;
18185 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
18188 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
18189 LDKAcceptChannel this_ptr_conv;
18190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18191 this_ptr_conv.is_owned = false;
18192 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18193 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
18197 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
18198 LDKAcceptChannel this_ptr_conv;
18199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18200 this_ptr_conv.is_owned = false;
18201 LDKPublicKey val_ref;
18202 CHECK(*((uint32_t*)val) == 33);
18203 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18204 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
18207 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
18208 LDKAcceptChannel this_ptr_conv;
18209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18210 this_ptr_conv.is_owned = false;
18211 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18212 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
18216 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
18217 LDKAcceptChannel this_ptr_conv;
18218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18219 this_ptr_conv.is_owned = false;
18220 LDKPublicKey val_ref;
18221 CHECK(*((uint32_t*)val) == 33);
18222 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18223 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
18226 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
18227 LDKAcceptChannel this_ptr_conv;
18228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18229 this_ptr_conv.is_owned = false;
18230 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18231 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
18235 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
18236 LDKAcceptChannel this_ptr_conv;
18237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18238 this_ptr_conv.is_owned = false;
18239 LDKPublicKey val_ref;
18240 CHECK(*((uint32_t*)val) == 33);
18241 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18242 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
18245 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
18246 LDKAcceptChannel this_ptr_conv;
18247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18248 this_ptr_conv.is_owned = false;
18249 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18250 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
18254 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
18255 LDKAcceptChannel this_ptr_conv;
18256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18257 this_ptr_conv.is_owned = false;
18258 LDKPublicKey val_ref;
18259 CHECK(*((uint32_t*)val) == 33);
18260 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18261 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
18264 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
18265 LDKAcceptChannel this_ptr_conv;
18266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18267 this_ptr_conv.is_owned = false;
18268 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18269 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
18273 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
18274 LDKAcceptChannel this_ptr_conv;
18275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18276 this_ptr_conv.is_owned = false;
18277 LDKPublicKey val_ref;
18278 CHECK(*((uint32_t*)val) == 33);
18279 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18280 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
18283 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
18284 LDKAcceptChannel this_ptr_conv;
18285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18286 this_ptr_conv.is_owned = false;
18287 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18288 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
18292 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
18293 LDKAcceptChannel this_ptr_conv;
18294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18295 this_ptr_conv.is_owned = false;
18296 LDKPublicKey val_ref;
18297 CHECK(*((uint32_t*)val) == 33);
18298 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18299 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
18302 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
18303 LDKAcceptChannel orig_conv;
18304 orig_conv.inner = (void*)(orig & (~1));
18305 orig_conv.is_owned = false;
18306 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
18307 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18308 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18309 uint64_t ret_ref = (uint64_t)ret_var.inner;
18310 if (ret_var.is_owned) {
18316 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
18317 LDKFundingCreated this_obj_conv;
18318 this_obj_conv.inner = (void*)(this_obj & (~1));
18319 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18320 FundingCreated_free(this_obj_conv);
18323 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
18324 LDKFundingCreated this_ptr_conv;
18325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18326 this_ptr_conv.is_owned = false;
18327 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18328 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
18332 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
18333 LDKFundingCreated this_ptr_conv;
18334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18335 this_ptr_conv.is_owned = false;
18336 LDKThirtyTwoBytes val_ref;
18337 CHECK(*((uint32_t*)val) == 32);
18338 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18339 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
18342 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
18343 LDKFundingCreated this_ptr_conv;
18344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18345 this_ptr_conv.is_owned = false;
18346 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18347 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
18351 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
18352 LDKFundingCreated this_ptr_conv;
18353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18354 this_ptr_conv.is_owned = false;
18355 LDKThirtyTwoBytes val_ref;
18356 CHECK(*((uint32_t*)val) == 32);
18357 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18358 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
18361 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
18362 LDKFundingCreated this_ptr_conv;
18363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18364 this_ptr_conv.is_owned = false;
18365 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
18369 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
18370 LDKFundingCreated this_ptr_conv;
18371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18372 this_ptr_conv.is_owned = false;
18373 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
18376 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
18377 LDKFundingCreated this_ptr_conv;
18378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18379 this_ptr_conv.is_owned = false;
18380 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18381 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
18385 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
18386 LDKFundingCreated this_ptr_conv;
18387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18388 this_ptr_conv.is_owned = false;
18389 LDKSignature val_ref;
18390 CHECK(*((uint32_t*)val) == 64);
18391 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18392 FundingCreated_set_signature(&this_ptr_conv, val_ref);
18395 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) {
18396 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
18397 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
18398 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
18399 LDKThirtyTwoBytes funding_txid_arg_ref;
18400 CHECK(*((uint32_t*)funding_txid_arg) == 32);
18401 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
18402 LDKSignature signature_arg_ref;
18403 CHECK(*((uint32_t*)signature_arg) == 64);
18404 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
18405 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
18406 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18407 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18408 uint64_t ret_ref = (uint64_t)ret_var.inner;
18409 if (ret_var.is_owned) {
18415 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
18416 LDKFundingCreated orig_conv;
18417 orig_conv.inner = (void*)(orig & (~1));
18418 orig_conv.is_owned = false;
18419 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
18420 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18421 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18422 uint64_t ret_ref = (uint64_t)ret_var.inner;
18423 if (ret_var.is_owned) {
18429 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
18430 LDKFundingSigned this_obj_conv;
18431 this_obj_conv.inner = (void*)(this_obj & (~1));
18432 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18433 FundingSigned_free(this_obj_conv);
18436 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
18437 LDKFundingSigned this_ptr_conv;
18438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18439 this_ptr_conv.is_owned = false;
18440 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18441 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
18445 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18446 LDKFundingSigned this_ptr_conv;
18447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18448 this_ptr_conv.is_owned = false;
18449 LDKThirtyTwoBytes val_ref;
18450 CHECK(*((uint32_t*)val) == 32);
18451 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18452 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
18455 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
18456 LDKFundingSigned this_ptr_conv;
18457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18458 this_ptr_conv.is_owned = false;
18459 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18460 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
18464 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
18465 LDKFundingSigned this_ptr_conv;
18466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18467 this_ptr_conv.is_owned = false;
18468 LDKSignature val_ref;
18469 CHECK(*((uint32_t*)val) == 64);
18470 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18471 FundingSigned_set_signature(&this_ptr_conv, val_ref);
18474 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
18475 LDKThirtyTwoBytes channel_id_arg_ref;
18476 CHECK(*((uint32_t*)channel_id_arg) == 32);
18477 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18478 LDKSignature signature_arg_ref;
18479 CHECK(*((uint32_t*)signature_arg) == 64);
18480 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
18481 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
18482 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18483 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18484 uint64_t ret_ref = (uint64_t)ret_var.inner;
18485 if (ret_var.is_owned) {
18491 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
18492 LDKFundingSigned orig_conv;
18493 orig_conv.inner = (void*)(orig & (~1));
18494 orig_conv.is_owned = false;
18495 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
18496 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18497 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18498 uint64_t ret_ref = (uint64_t)ret_var.inner;
18499 if (ret_var.is_owned) {
18505 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
18506 LDKFundingLocked this_obj_conv;
18507 this_obj_conv.inner = (void*)(this_obj & (~1));
18508 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18509 FundingLocked_free(this_obj_conv);
18512 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
18513 LDKFundingLocked this_ptr_conv;
18514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18515 this_ptr_conv.is_owned = false;
18516 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18517 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
18521 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18522 LDKFundingLocked this_ptr_conv;
18523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18524 this_ptr_conv.is_owned = false;
18525 LDKThirtyTwoBytes val_ref;
18526 CHECK(*((uint32_t*)val) == 32);
18527 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18528 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
18531 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
18532 LDKFundingLocked this_ptr_conv;
18533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18534 this_ptr_conv.is_owned = false;
18535 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18536 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
18540 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
18541 LDKFundingLocked this_ptr_conv;
18542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18543 this_ptr_conv.is_owned = false;
18544 LDKPublicKey val_ref;
18545 CHECK(*((uint32_t*)val) == 33);
18546 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18547 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
18550 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
18551 LDKThirtyTwoBytes channel_id_arg_ref;
18552 CHECK(*((uint32_t*)channel_id_arg) == 32);
18553 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18554 LDKPublicKey next_per_commitment_point_arg_ref;
18555 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
18556 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
18557 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
18558 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18559 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18560 uint64_t ret_ref = (uint64_t)ret_var.inner;
18561 if (ret_var.is_owned) {
18567 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
18568 LDKFundingLocked orig_conv;
18569 orig_conv.inner = (void*)(orig & (~1));
18570 orig_conv.is_owned = false;
18571 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
18572 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18573 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18574 uint64_t ret_ref = (uint64_t)ret_var.inner;
18575 if (ret_var.is_owned) {
18581 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
18582 LDKShutdown this_obj_conv;
18583 this_obj_conv.inner = (void*)(this_obj & (~1));
18584 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18585 Shutdown_free(this_obj_conv);
18588 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
18589 LDKShutdown this_ptr_conv;
18590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18591 this_ptr_conv.is_owned = false;
18592 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18593 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
18597 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18598 LDKShutdown this_ptr_conv;
18599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18600 this_ptr_conv.is_owned = false;
18601 LDKThirtyTwoBytes val_ref;
18602 CHECK(*((uint32_t*)val) == 32);
18603 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18604 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
18607 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
18608 LDKShutdown this_ptr_conv;
18609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18610 this_ptr_conv.is_owned = false;
18611 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
18612 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18613 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18617 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
18618 LDKShutdown this_ptr_conv;
18619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18620 this_ptr_conv.is_owned = false;
18621 LDKCVec_u8Z val_ref;
18622 val_ref.datalen = *((uint32_t*)val);
18623 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
18624 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
18625 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
18628 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
18629 LDKThirtyTwoBytes channel_id_arg_ref;
18630 CHECK(*((uint32_t*)channel_id_arg) == 32);
18631 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18632 LDKCVec_u8Z scriptpubkey_arg_ref;
18633 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
18634 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
18635 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
18636 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
18637 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18638 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18639 uint64_t ret_ref = (uint64_t)ret_var.inner;
18640 if (ret_var.is_owned) {
18646 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
18647 LDKShutdown orig_conv;
18648 orig_conv.inner = (void*)(orig & (~1));
18649 orig_conv.is_owned = false;
18650 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
18651 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18652 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18653 uint64_t ret_ref = (uint64_t)ret_var.inner;
18654 if (ret_var.is_owned) {
18660 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
18661 LDKClosingSignedFeeRange this_obj_conv;
18662 this_obj_conv.inner = (void*)(this_obj & (~1));
18663 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18664 ClosingSignedFeeRange_free(this_obj_conv);
18667 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
18668 LDKClosingSignedFeeRange this_ptr_conv;
18669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18670 this_ptr_conv.is_owned = false;
18671 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
18675 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
18676 LDKClosingSignedFeeRange this_ptr_conv;
18677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18678 this_ptr_conv.is_owned = false;
18679 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
18682 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
18683 LDKClosingSignedFeeRange this_ptr_conv;
18684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18685 this_ptr_conv.is_owned = false;
18686 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
18690 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
18691 LDKClosingSignedFeeRange this_ptr_conv;
18692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18693 this_ptr_conv.is_owned = false;
18694 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
18697 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
18698 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
18699 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18700 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18701 uint64_t ret_ref = (uint64_t)ret_var.inner;
18702 if (ret_var.is_owned) {
18708 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
18709 LDKClosingSignedFeeRange orig_conv;
18710 orig_conv.inner = (void*)(orig & (~1));
18711 orig_conv.is_owned = false;
18712 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
18713 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18714 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18715 uint64_t ret_ref = (uint64_t)ret_var.inner;
18716 if (ret_var.is_owned) {
18722 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
18723 LDKClosingSigned this_obj_conv;
18724 this_obj_conv.inner = (void*)(this_obj & (~1));
18725 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18726 ClosingSigned_free(this_obj_conv);
18729 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
18730 LDKClosingSigned this_ptr_conv;
18731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18732 this_ptr_conv.is_owned = false;
18733 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18734 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
18738 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18739 LDKClosingSigned this_ptr_conv;
18740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18741 this_ptr_conv.is_owned = false;
18742 LDKThirtyTwoBytes val_ref;
18743 CHECK(*((uint32_t*)val) == 32);
18744 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18745 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
18748 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
18749 LDKClosingSigned this_ptr_conv;
18750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18751 this_ptr_conv.is_owned = false;
18752 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
18756 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
18757 LDKClosingSigned this_ptr_conv;
18758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18759 this_ptr_conv.is_owned = false;
18760 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
18763 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
18764 LDKClosingSigned this_ptr_conv;
18765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18766 this_ptr_conv.is_owned = false;
18767 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18768 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
18772 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
18773 LDKClosingSigned this_ptr_conv;
18774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18775 this_ptr_conv.is_owned = false;
18776 LDKSignature val_ref;
18777 CHECK(*((uint32_t*)val) == 64);
18778 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18779 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
18782 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
18783 LDKClosingSigned this_ptr_conv;
18784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18785 this_ptr_conv.is_owned = false;
18786 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
18787 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18788 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18789 uint64_t ret_ref = (uint64_t)ret_var.inner;
18790 if (ret_var.is_owned) {
18796 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
18797 LDKClosingSigned this_ptr_conv;
18798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18799 this_ptr_conv.is_owned = false;
18800 LDKClosingSignedFeeRange val_conv;
18801 val_conv.inner = (void*)(val & (~1));
18802 val_conv.is_owned = (val & 1) || (val == 0);
18803 val_conv = ClosingSignedFeeRange_clone(&val_conv);
18804 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
18807 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) {
18808 LDKThirtyTwoBytes channel_id_arg_ref;
18809 CHECK(*((uint32_t*)channel_id_arg) == 32);
18810 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18811 LDKSignature signature_arg_ref;
18812 CHECK(*((uint32_t*)signature_arg) == 64);
18813 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
18814 LDKClosingSignedFeeRange fee_range_arg_conv;
18815 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
18816 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
18817 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
18818 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
18819 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18820 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18821 uint64_t ret_ref = (uint64_t)ret_var.inner;
18822 if (ret_var.is_owned) {
18828 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
18829 LDKClosingSigned orig_conv;
18830 orig_conv.inner = (void*)(orig & (~1));
18831 orig_conv.is_owned = false;
18832 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
18833 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18834 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18835 uint64_t ret_ref = (uint64_t)ret_var.inner;
18836 if (ret_var.is_owned) {
18842 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
18843 LDKUpdateAddHTLC this_obj_conv;
18844 this_obj_conv.inner = (void*)(this_obj & (~1));
18845 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18846 UpdateAddHTLC_free(this_obj_conv);
18849 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
18850 LDKUpdateAddHTLC this_ptr_conv;
18851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18852 this_ptr_conv.is_owned = false;
18853 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18854 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
18858 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18859 LDKUpdateAddHTLC this_ptr_conv;
18860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18861 this_ptr_conv.is_owned = false;
18862 LDKThirtyTwoBytes val_ref;
18863 CHECK(*((uint32_t*)val) == 32);
18864 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18865 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
18868 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
18869 LDKUpdateAddHTLC this_ptr_conv;
18870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18871 this_ptr_conv.is_owned = false;
18872 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
18876 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
18877 LDKUpdateAddHTLC this_ptr_conv;
18878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18879 this_ptr_conv.is_owned = false;
18880 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
18883 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
18884 LDKUpdateAddHTLC this_ptr_conv;
18885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18886 this_ptr_conv.is_owned = false;
18887 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
18891 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
18892 LDKUpdateAddHTLC this_ptr_conv;
18893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18894 this_ptr_conv.is_owned = false;
18895 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
18898 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
18899 LDKUpdateAddHTLC this_ptr_conv;
18900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18901 this_ptr_conv.is_owned = false;
18902 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18903 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
18907 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
18908 LDKUpdateAddHTLC this_ptr_conv;
18909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18910 this_ptr_conv.is_owned = false;
18911 LDKThirtyTwoBytes val_ref;
18912 CHECK(*((uint32_t*)val) == 32);
18913 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18914 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
18917 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
18918 LDKUpdateAddHTLC this_ptr_conv;
18919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18920 this_ptr_conv.is_owned = false;
18921 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
18925 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
18926 LDKUpdateAddHTLC this_ptr_conv;
18927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18928 this_ptr_conv.is_owned = false;
18929 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
18932 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
18933 LDKUpdateAddHTLC orig_conv;
18934 orig_conv.inner = (void*)(orig & (~1));
18935 orig_conv.is_owned = false;
18936 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
18937 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18938 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18939 uint64_t ret_ref = (uint64_t)ret_var.inner;
18940 if (ret_var.is_owned) {
18946 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
18947 LDKUpdateFulfillHTLC this_obj_conv;
18948 this_obj_conv.inner = (void*)(this_obj & (~1));
18949 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18950 UpdateFulfillHTLC_free(this_obj_conv);
18953 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
18954 LDKUpdateFulfillHTLC this_ptr_conv;
18955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18956 this_ptr_conv.is_owned = false;
18957 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18958 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
18962 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18963 LDKUpdateFulfillHTLC this_ptr_conv;
18964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18965 this_ptr_conv.is_owned = false;
18966 LDKThirtyTwoBytes val_ref;
18967 CHECK(*((uint32_t*)val) == 32);
18968 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18969 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
18972 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
18973 LDKUpdateFulfillHTLC this_ptr_conv;
18974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18975 this_ptr_conv.is_owned = false;
18976 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
18980 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
18981 LDKUpdateFulfillHTLC this_ptr_conv;
18982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18983 this_ptr_conv.is_owned = false;
18984 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
18987 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
18988 LDKUpdateFulfillHTLC this_ptr_conv;
18989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18990 this_ptr_conv.is_owned = false;
18991 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18992 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
18996 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
18997 LDKUpdateFulfillHTLC this_ptr_conv;
18998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18999 this_ptr_conv.is_owned = false;
19000 LDKThirtyTwoBytes val_ref;
19001 CHECK(*((uint32_t*)val) == 32);
19002 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19003 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
19006 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
19007 LDKThirtyTwoBytes channel_id_arg_ref;
19008 CHECK(*((uint32_t*)channel_id_arg) == 32);
19009 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
19010 LDKThirtyTwoBytes payment_preimage_arg_ref;
19011 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
19012 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
19013 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
19014 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19015 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19016 uint64_t ret_ref = (uint64_t)ret_var.inner;
19017 if (ret_var.is_owned) {
19023 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
19024 LDKUpdateFulfillHTLC orig_conv;
19025 orig_conv.inner = (void*)(orig & (~1));
19026 orig_conv.is_owned = false;
19027 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
19028 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19029 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19030 uint64_t ret_ref = (uint64_t)ret_var.inner;
19031 if (ret_var.is_owned) {
19037 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
19038 LDKUpdateFailHTLC this_obj_conv;
19039 this_obj_conv.inner = (void*)(this_obj & (~1));
19040 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19041 UpdateFailHTLC_free(this_obj_conv);
19044 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
19045 LDKUpdateFailHTLC this_ptr_conv;
19046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19047 this_ptr_conv.is_owned = false;
19048 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19049 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
19053 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19054 LDKUpdateFailHTLC this_ptr_conv;
19055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19056 this_ptr_conv.is_owned = false;
19057 LDKThirtyTwoBytes val_ref;
19058 CHECK(*((uint32_t*)val) == 32);
19059 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19060 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
19063 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
19064 LDKUpdateFailHTLC this_ptr_conv;
19065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19066 this_ptr_conv.is_owned = false;
19067 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
19071 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
19072 LDKUpdateFailHTLC this_ptr_conv;
19073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19074 this_ptr_conv.is_owned = false;
19075 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
19078 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
19079 LDKUpdateFailHTLC orig_conv;
19080 orig_conv.inner = (void*)(orig & (~1));
19081 orig_conv.is_owned = false;
19082 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
19083 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19084 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19085 uint64_t ret_ref = (uint64_t)ret_var.inner;
19086 if (ret_var.is_owned) {
19092 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
19093 LDKUpdateFailMalformedHTLC this_obj_conv;
19094 this_obj_conv.inner = (void*)(this_obj & (~1));
19095 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19096 UpdateFailMalformedHTLC_free(this_obj_conv);
19099 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
19100 LDKUpdateFailMalformedHTLC this_ptr_conv;
19101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19102 this_ptr_conv.is_owned = false;
19103 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19104 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
19108 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19109 LDKUpdateFailMalformedHTLC this_ptr_conv;
19110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19111 this_ptr_conv.is_owned = false;
19112 LDKThirtyTwoBytes val_ref;
19113 CHECK(*((uint32_t*)val) == 32);
19114 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19115 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
19118 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
19119 LDKUpdateFailMalformedHTLC this_ptr_conv;
19120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19121 this_ptr_conv.is_owned = false;
19122 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
19126 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
19127 LDKUpdateFailMalformedHTLC this_ptr_conv;
19128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19129 this_ptr_conv.is_owned = false;
19130 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
19133 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
19134 LDKUpdateFailMalformedHTLC this_ptr_conv;
19135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19136 this_ptr_conv.is_owned = false;
19137 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
19141 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
19142 LDKUpdateFailMalformedHTLC this_ptr_conv;
19143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19144 this_ptr_conv.is_owned = false;
19145 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
19148 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
19149 LDKUpdateFailMalformedHTLC orig_conv;
19150 orig_conv.inner = (void*)(orig & (~1));
19151 orig_conv.is_owned = false;
19152 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
19153 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19154 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19155 uint64_t ret_ref = (uint64_t)ret_var.inner;
19156 if (ret_var.is_owned) {
19162 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_obj) {
19163 LDKCommitmentSigned this_obj_conv;
19164 this_obj_conv.inner = (void*)(this_obj & (~1));
19165 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19166 CommitmentSigned_free(this_obj_conv);
19169 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
19170 LDKCommitmentSigned this_ptr_conv;
19171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19172 this_ptr_conv.is_owned = false;
19173 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19174 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
19178 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19179 LDKCommitmentSigned this_ptr_conv;
19180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19181 this_ptr_conv.is_owned = false;
19182 LDKThirtyTwoBytes val_ref;
19183 CHECK(*((uint32_t*)val) == 32);
19184 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19185 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
19188 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
19189 LDKCommitmentSigned this_ptr_conv;
19190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19191 this_ptr_conv.is_owned = false;
19192 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19193 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
19197 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
19198 LDKCommitmentSigned this_ptr_conv;
19199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19200 this_ptr_conv.is_owned = false;
19201 LDKSignature val_ref;
19202 CHECK(*((uint32_t*)val) == 64);
19203 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19204 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
19207 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
19208 LDKCommitmentSigned this_ptr_conv;
19209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19210 this_ptr_conv.is_owned = false;
19211 LDKCVec_SignatureZ val_constr;
19212 val_constr.datalen = *((uint32_t*)val);
19213 if (val_constr.datalen > 0)
19214 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
19216 val_constr.data = NULL;
19217 int8_tArray* val_vals = (int8_tArray*)(val + 4);
19218 for (size_t m = 0; m < val_constr.datalen; m++) {
19219 int8_tArray val_conv_12 = val_vals[m];
19220 LDKSignature val_conv_12_ref;
19221 CHECK(*((uint32_t*)val_conv_12) == 64);
19222 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
19223 val_constr.data[m] = val_conv_12_ref;
19225 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
19228 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
19229 LDKThirtyTwoBytes channel_id_arg_ref;
19230 CHECK(*((uint32_t*)channel_id_arg) == 32);
19231 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
19232 LDKSignature signature_arg_ref;
19233 CHECK(*((uint32_t*)signature_arg) == 64);
19234 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
19235 LDKCVec_SignatureZ htlc_signatures_arg_constr;
19236 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
19237 if (htlc_signatures_arg_constr.datalen > 0)
19238 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
19240 htlc_signatures_arg_constr.data = NULL;
19241 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
19242 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
19243 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
19244 LDKSignature htlc_signatures_arg_conv_12_ref;
19245 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
19246 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
19247 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
19249 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
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 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
19260 LDKCommitmentSigned orig_conv;
19261 orig_conv.inner = (void*)(orig & (~1));
19262 orig_conv.is_owned = false;
19263 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
19264 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19265 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19266 uint64_t ret_ref = (uint64_t)ret_var.inner;
19267 if (ret_var.is_owned) {
19273 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
19274 LDKRevokeAndACK this_obj_conv;
19275 this_obj_conv.inner = (void*)(this_obj & (~1));
19276 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19277 RevokeAndACK_free(this_obj_conv);
19280 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
19281 LDKRevokeAndACK this_ptr_conv;
19282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19283 this_ptr_conv.is_owned = false;
19284 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19285 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
19289 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19290 LDKRevokeAndACK this_ptr_conv;
19291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19292 this_ptr_conv.is_owned = false;
19293 LDKThirtyTwoBytes val_ref;
19294 CHECK(*((uint32_t*)val) == 32);
19295 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19296 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
19299 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
19300 LDKRevokeAndACK this_ptr_conv;
19301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19302 this_ptr_conv.is_owned = false;
19303 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19304 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
19308 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
19309 LDKRevokeAndACK this_ptr_conv;
19310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19311 this_ptr_conv.is_owned = false;
19312 LDKThirtyTwoBytes val_ref;
19313 CHECK(*((uint32_t*)val) == 32);
19314 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19315 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
19318 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
19319 LDKRevokeAndACK this_ptr_conv;
19320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19321 this_ptr_conv.is_owned = false;
19322 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19323 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19327 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19328 LDKRevokeAndACK this_ptr_conv;
19329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19330 this_ptr_conv.is_owned = false;
19331 LDKPublicKey val_ref;
19332 CHECK(*((uint32_t*)val) == 33);
19333 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19334 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
19337 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) {
19338 LDKThirtyTwoBytes channel_id_arg_ref;
19339 CHECK(*((uint32_t*)channel_id_arg) == 32);
19340 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
19341 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
19342 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
19343 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
19344 LDKPublicKey next_per_commitment_point_arg_ref;
19345 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
19346 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
19347 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
19348 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19349 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19350 uint64_t ret_ref = (uint64_t)ret_var.inner;
19351 if (ret_var.is_owned) {
19357 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
19358 LDKRevokeAndACK orig_conv;
19359 orig_conv.inner = (void*)(orig & (~1));
19360 orig_conv.is_owned = false;
19361 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
19362 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19363 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19364 uint64_t ret_ref = (uint64_t)ret_var.inner;
19365 if (ret_var.is_owned) {
19371 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
19372 LDKUpdateFee this_obj_conv;
19373 this_obj_conv.inner = (void*)(this_obj & (~1));
19374 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19375 UpdateFee_free(this_obj_conv);
19378 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
19379 LDKUpdateFee this_ptr_conv;
19380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19381 this_ptr_conv.is_owned = false;
19382 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19383 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
19387 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19388 LDKUpdateFee this_ptr_conv;
19389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19390 this_ptr_conv.is_owned = false;
19391 LDKThirtyTwoBytes val_ref;
19392 CHECK(*((uint32_t*)val) == 32);
19393 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19394 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
19397 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
19398 LDKUpdateFee this_ptr_conv;
19399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19400 this_ptr_conv.is_owned = false;
19401 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
19405 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
19406 LDKUpdateFee this_ptr_conv;
19407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19408 this_ptr_conv.is_owned = false;
19409 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
19412 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
19413 LDKThirtyTwoBytes channel_id_arg_ref;
19414 CHECK(*((uint32_t*)channel_id_arg) == 32);
19415 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
19416 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
19417 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19418 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19419 uint64_t ret_ref = (uint64_t)ret_var.inner;
19420 if (ret_var.is_owned) {
19426 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
19427 LDKUpdateFee orig_conv;
19428 orig_conv.inner = (void*)(orig & (~1));
19429 orig_conv.is_owned = false;
19430 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
19431 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19432 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19433 uint64_t ret_ref = (uint64_t)ret_var.inner;
19434 if (ret_var.is_owned) {
19440 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
19441 LDKDataLossProtect this_obj_conv;
19442 this_obj_conv.inner = (void*)(this_obj & (~1));
19443 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19444 DataLossProtect_free(this_obj_conv);
19447 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
19448 LDKDataLossProtect this_ptr_conv;
19449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19450 this_ptr_conv.is_owned = false;
19451 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19452 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
19456 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
19457 LDKDataLossProtect this_ptr_conv;
19458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19459 this_ptr_conv.is_owned = false;
19460 LDKThirtyTwoBytes val_ref;
19461 CHECK(*((uint32_t*)val) == 32);
19462 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19463 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
19466 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
19467 LDKDataLossProtect this_ptr_conv;
19468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19469 this_ptr_conv.is_owned = false;
19470 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19471 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19475 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19476 LDKDataLossProtect this_ptr_conv;
19477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19478 this_ptr_conv.is_owned = false;
19479 LDKPublicKey val_ref;
19480 CHECK(*((uint32_t*)val) == 33);
19481 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19482 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
19485 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
19486 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
19487 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
19488 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
19489 LDKPublicKey my_current_per_commitment_point_arg_ref;
19490 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
19491 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
19492 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
19493 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19494 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19495 uint64_t ret_ref = (uint64_t)ret_var.inner;
19496 if (ret_var.is_owned) {
19502 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
19503 LDKDataLossProtect orig_conv;
19504 orig_conv.inner = (void*)(orig & (~1));
19505 orig_conv.is_owned = false;
19506 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
19507 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19508 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19509 uint64_t ret_ref = (uint64_t)ret_var.inner;
19510 if (ret_var.is_owned) {
19516 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
19517 LDKChannelReestablish this_obj_conv;
19518 this_obj_conv.inner = (void*)(this_obj & (~1));
19519 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19520 ChannelReestablish_free(this_obj_conv);
19523 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
19524 LDKChannelReestablish this_ptr_conv;
19525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19526 this_ptr_conv.is_owned = false;
19527 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19528 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
19532 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19533 LDKChannelReestablish this_ptr_conv;
19534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19535 this_ptr_conv.is_owned = false;
19536 LDKThirtyTwoBytes val_ref;
19537 CHECK(*((uint32_t*)val) == 32);
19538 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19539 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
19542 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
19543 LDKChannelReestablish this_ptr_conv;
19544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19545 this_ptr_conv.is_owned = false;
19546 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
19550 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
19551 LDKChannelReestablish this_ptr_conv;
19552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19553 this_ptr_conv.is_owned = false;
19554 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
19557 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
19558 LDKChannelReestablish this_ptr_conv;
19559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19560 this_ptr_conv.is_owned = false;
19561 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
19565 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
19566 LDKChannelReestablish this_ptr_conv;
19567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19568 this_ptr_conv.is_owned = false;
19569 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
19572 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
19573 LDKChannelReestablish orig_conv;
19574 orig_conv.inner = (void*)(orig & (~1));
19575 orig_conv.is_owned = false;
19576 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
19577 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19578 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19579 uint64_t ret_ref = (uint64_t)ret_var.inner;
19580 if (ret_var.is_owned) {
19586 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
19587 LDKAnnouncementSignatures this_obj_conv;
19588 this_obj_conv.inner = (void*)(this_obj & (~1));
19589 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19590 AnnouncementSignatures_free(this_obj_conv);
19593 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
19594 LDKAnnouncementSignatures this_ptr_conv;
19595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19596 this_ptr_conv.is_owned = false;
19597 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19598 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
19602 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19603 LDKAnnouncementSignatures this_ptr_conv;
19604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19605 this_ptr_conv.is_owned = false;
19606 LDKThirtyTwoBytes val_ref;
19607 CHECK(*((uint32_t*)val) == 32);
19608 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19609 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
19612 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
19613 LDKAnnouncementSignatures this_ptr_conv;
19614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19615 this_ptr_conv.is_owned = false;
19616 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
19620 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
19621 LDKAnnouncementSignatures this_ptr_conv;
19622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19623 this_ptr_conv.is_owned = false;
19624 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
19627 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
19628 LDKAnnouncementSignatures this_ptr_conv;
19629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19630 this_ptr_conv.is_owned = false;
19631 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19632 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
19636 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
19637 LDKAnnouncementSignatures this_ptr_conv;
19638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19639 this_ptr_conv.is_owned = false;
19640 LDKSignature val_ref;
19641 CHECK(*((uint32_t*)val) == 64);
19642 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19643 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
19646 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
19647 LDKAnnouncementSignatures this_ptr_conv;
19648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19649 this_ptr_conv.is_owned = false;
19650 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19651 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
19655 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
19656 LDKAnnouncementSignatures this_ptr_conv;
19657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19658 this_ptr_conv.is_owned = false;
19659 LDKSignature val_ref;
19660 CHECK(*((uint32_t*)val) == 64);
19661 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19662 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
19665 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) {
19666 LDKThirtyTwoBytes channel_id_arg_ref;
19667 CHECK(*((uint32_t*)channel_id_arg) == 32);
19668 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
19669 LDKSignature node_signature_arg_ref;
19670 CHECK(*((uint32_t*)node_signature_arg) == 64);
19671 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
19672 LDKSignature bitcoin_signature_arg_ref;
19673 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
19674 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
19675 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
19676 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19677 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19678 uint64_t ret_ref = (uint64_t)ret_var.inner;
19679 if (ret_var.is_owned) {
19685 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
19686 LDKAnnouncementSignatures orig_conv;
19687 orig_conv.inner = (void*)(orig & (~1));
19688 orig_conv.is_owned = false;
19689 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
19690 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19691 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19692 uint64_t ret_ref = (uint64_t)ret_var.inner;
19693 if (ret_var.is_owned) {
19699 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
19700 if ((this_ptr & 1) != 0) return;
19701 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19702 CHECK_ACCESS(this_ptr_ptr);
19703 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
19704 FREE((void*)this_ptr);
19705 NetAddress_free(this_ptr_conv);
19708 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
19709 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
19710 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19711 *ret_copy = NetAddress_clone(orig_conv);
19712 uint64_t ret_ref = (uint64_t)ret_copy;
19716 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
19717 LDKFourBytes addr_ref;
19718 CHECK(*((uint32_t*)addr) == 4);
19719 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 4);
19720 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19721 *ret_copy = NetAddress_ipv4(addr_ref, port);
19722 uint64_t ret_ref = (uint64_t)ret_copy;
19726 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
19727 LDKSixteenBytes addr_ref;
19728 CHECK(*((uint32_t*)addr) == 16);
19729 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 16);
19730 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19731 *ret_copy = NetAddress_ipv6(addr_ref, port);
19732 uint64_t ret_ref = (uint64_t)ret_copy;
19736 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray addr, int16_t port) {
19737 LDKTenBytes addr_ref;
19738 CHECK(*((uint32_t*)addr) == 10);
19739 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 10);
19740 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19741 *ret_copy = NetAddress_onion_v2(addr_ref, port);
19742 uint64_t ret_ref = (uint64_t)ret_copy;
19746 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
19747 LDKThirtyTwoBytes ed25519_pubkey_ref;
19748 CHECK(*((uint32_t*)ed25519_pubkey) == 32);
19749 memcpy(ed25519_pubkey_ref.data, (uint8_t*)(ed25519_pubkey + 4), 32);
19750 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19751 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
19752 uint64_t ret_ref = (uint64_t)ret_copy;
19756 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
19757 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
19758 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
19759 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19760 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19761 CVec_u8Z_free(ret_var);
19765 uint32_t __attribute__((visibility("default"))) TS_Result_read(int8_tArray ser) {
19766 LDKu8slice ser_ref;
19767 ser_ref.datalen = *((uint32_t*)ser);
19768 ser_ref.data = (int8_t*)(ser + 4);
19769 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
19770 *ret_conv = Result_read(ser_ref);
19771 return (uint64_t)ret_conv;
19774 uint32_t __attribute__((visibility("default"))) TS_NetAddress_read(int8_tArray ser) {
19775 LDKu8slice ser_ref;
19776 ser_ref.datalen = *((uint32_t*)ser);
19777 ser_ref.data = (int8_t*)(ser + 4);
19778 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19779 *ret_conv = NetAddress_read(ser_ref);
19780 return (uint64_t)ret_conv;
19783 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
19784 LDKUnsignedNodeAnnouncement this_obj_conv;
19785 this_obj_conv.inner = (void*)(this_obj & (~1));
19786 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19787 UnsignedNodeAnnouncement_free(this_obj_conv);
19790 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
19791 LDKUnsignedNodeAnnouncement this_ptr_conv;
19792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19793 this_ptr_conv.is_owned = false;
19794 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
19795 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19796 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19797 uint64_t ret_ref = (uint64_t)ret_var.inner;
19798 if (ret_var.is_owned) {
19804 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
19805 LDKUnsignedNodeAnnouncement this_ptr_conv;
19806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19807 this_ptr_conv.is_owned = false;
19808 LDKNodeFeatures val_conv;
19809 val_conv.inner = (void*)(val & (~1));
19810 val_conv.is_owned = (val & 1) || (val == 0);
19811 val_conv = NodeFeatures_clone(&val_conv);
19812 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
19815 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
19816 LDKUnsignedNodeAnnouncement this_ptr_conv;
19817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19818 this_ptr_conv.is_owned = false;
19819 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
19823 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
19824 LDKUnsignedNodeAnnouncement this_ptr_conv;
19825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19826 this_ptr_conv.is_owned = false;
19827 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
19830 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
19831 LDKUnsignedNodeAnnouncement this_ptr_conv;
19832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19833 this_ptr_conv.is_owned = false;
19834 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19835 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
19839 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
19840 LDKUnsignedNodeAnnouncement this_ptr_conv;
19841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19842 this_ptr_conv.is_owned = false;
19843 LDKPublicKey val_ref;
19844 CHECK(*((uint32_t*)val) == 33);
19845 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19846 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
19849 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
19850 LDKUnsignedNodeAnnouncement this_ptr_conv;
19851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19852 this_ptr_conv.is_owned = false;
19853 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
19854 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
19858 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
19859 LDKUnsignedNodeAnnouncement this_ptr_conv;
19860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19861 this_ptr_conv.is_owned = false;
19862 LDKThreeBytes val_ref;
19863 CHECK(*((uint32_t*)val) == 3);
19864 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
19865 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
19868 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
19869 LDKUnsignedNodeAnnouncement this_ptr_conv;
19870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19871 this_ptr_conv.is_owned = false;
19872 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19873 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
19877 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
19878 LDKUnsignedNodeAnnouncement this_ptr_conv;
19879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19880 this_ptr_conv.is_owned = false;
19881 LDKThirtyTwoBytes val_ref;
19882 CHECK(*((uint32_t*)val) == 32);
19883 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19884 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
19887 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
19888 LDKUnsignedNodeAnnouncement this_ptr_conv;
19889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19890 this_ptr_conv.is_owned = false;
19891 LDKCVec_NetAddressZ val_constr;
19892 val_constr.datalen = *((uint32_t*)val);
19893 if (val_constr.datalen > 0)
19894 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19896 val_constr.data = NULL;
19897 uint32_t* val_vals = (uint32_t*)(val + 4);
19898 for (size_t m = 0; m < val_constr.datalen; m++) {
19899 uint32_t val_conv_12 = val_vals[m];
19900 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
19901 CHECK_ACCESS(val_conv_12_ptr);
19902 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
19903 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
19904 val_constr.data[m] = val_conv_12_conv;
19906 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
19909 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
19910 LDKUnsignedNodeAnnouncement orig_conv;
19911 orig_conv.inner = (void*)(orig & (~1));
19912 orig_conv.is_owned = false;
19913 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
19914 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19915 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19916 uint64_t ret_ref = (uint64_t)ret_var.inner;
19917 if (ret_var.is_owned) {
19923 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
19924 LDKNodeAnnouncement this_obj_conv;
19925 this_obj_conv.inner = (void*)(this_obj & (~1));
19926 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19927 NodeAnnouncement_free(this_obj_conv);
19930 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
19931 LDKNodeAnnouncement this_ptr_conv;
19932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19933 this_ptr_conv.is_owned = false;
19934 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19935 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
19939 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
19940 LDKNodeAnnouncement this_ptr_conv;
19941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19942 this_ptr_conv.is_owned = false;
19943 LDKSignature val_ref;
19944 CHECK(*((uint32_t*)val) == 64);
19945 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19946 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
19949 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
19950 LDKNodeAnnouncement this_ptr_conv;
19951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19952 this_ptr_conv.is_owned = false;
19953 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
19954 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19955 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19956 uint64_t ret_ref = (uint64_t)ret_var.inner;
19957 if (ret_var.is_owned) {
19963 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
19964 LDKNodeAnnouncement this_ptr_conv;
19965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19966 this_ptr_conv.is_owned = false;
19967 LDKUnsignedNodeAnnouncement val_conv;
19968 val_conv.inner = (void*)(val & (~1));
19969 val_conv.is_owned = (val & 1) || (val == 0);
19970 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
19971 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
19974 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
19975 LDKSignature signature_arg_ref;
19976 CHECK(*((uint32_t*)signature_arg) == 64);
19977 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
19978 LDKUnsignedNodeAnnouncement contents_arg_conv;
19979 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19980 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19981 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
19982 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
19983 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19984 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19985 uint64_t ret_ref = (uint64_t)ret_var.inner;
19986 if (ret_var.is_owned) {
19992 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
19993 LDKNodeAnnouncement orig_conv;
19994 orig_conv.inner = (void*)(orig & (~1));
19995 orig_conv.is_owned = false;
19996 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
19997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19999 uint64_t ret_ref = (uint64_t)ret_var.inner;
20000 if (ret_var.is_owned) {
20006 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
20007 LDKUnsignedChannelAnnouncement this_obj_conv;
20008 this_obj_conv.inner = (void*)(this_obj & (~1));
20009 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20010 UnsignedChannelAnnouncement_free(this_obj_conv);
20013 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
20014 LDKUnsignedChannelAnnouncement this_ptr_conv;
20015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20016 this_ptr_conv.is_owned = false;
20017 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
20018 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20019 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20020 uint64_t ret_ref = (uint64_t)ret_var.inner;
20021 if (ret_var.is_owned) {
20027 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
20028 LDKUnsignedChannelAnnouncement this_ptr_conv;
20029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20030 this_ptr_conv.is_owned = false;
20031 LDKChannelFeatures val_conv;
20032 val_conv.inner = (void*)(val & (~1));
20033 val_conv.is_owned = (val & 1) || (val == 0);
20034 val_conv = ChannelFeatures_clone(&val_conv);
20035 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
20038 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
20039 LDKUnsignedChannelAnnouncement this_ptr_conv;
20040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20041 this_ptr_conv.is_owned = false;
20042 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20043 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
20047 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20048 LDKUnsignedChannelAnnouncement this_ptr_conv;
20049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20050 this_ptr_conv.is_owned = false;
20051 LDKThirtyTwoBytes val_ref;
20052 CHECK(*((uint32_t*)val) == 32);
20053 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20054 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
20057 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
20058 LDKUnsignedChannelAnnouncement this_ptr_conv;
20059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20060 this_ptr_conv.is_owned = false;
20061 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
20065 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
20066 LDKUnsignedChannelAnnouncement this_ptr_conv;
20067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20068 this_ptr_conv.is_owned = false;
20069 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
20072 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
20073 LDKUnsignedChannelAnnouncement this_ptr_conv;
20074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20075 this_ptr_conv.is_owned = false;
20076 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20077 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
20081 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
20082 LDKUnsignedChannelAnnouncement this_ptr_conv;
20083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20084 this_ptr_conv.is_owned = false;
20085 LDKPublicKey val_ref;
20086 CHECK(*((uint32_t*)val) == 33);
20087 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20088 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
20091 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
20092 LDKUnsignedChannelAnnouncement this_ptr_conv;
20093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20094 this_ptr_conv.is_owned = false;
20095 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20096 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
20100 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
20101 LDKUnsignedChannelAnnouncement this_ptr_conv;
20102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20103 this_ptr_conv.is_owned = false;
20104 LDKPublicKey val_ref;
20105 CHECK(*((uint32_t*)val) == 33);
20106 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20107 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
20110 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
20111 LDKUnsignedChannelAnnouncement this_ptr_conv;
20112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20113 this_ptr_conv.is_owned = false;
20114 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20115 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
20119 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
20120 LDKUnsignedChannelAnnouncement this_ptr_conv;
20121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20122 this_ptr_conv.is_owned = false;
20123 LDKPublicKey val_ref;
20124 CHECK(*((uint32_t*)val) == 33);
20125 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20126 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
20129 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
20130 LDKUnsignedChannelAnnouncement this_ptr_conv;
20131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20132 this_ptr_conv.is_owned = false;
20133 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20134 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
20138 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
20139 LDKUnsignedChannelAnnouncement this_ptr_conv;
20140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20141 this_ptr_conv.is_owned = false;
20142 LDKPublicKey val_ref;
20143 CHECK(*((uint32_t*)val) == 33);
20144 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20145 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
20148 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
20149 LDKUnsignedChannelAnnouncement orig_conv;
20150 orig_conv.inner = (void*)(orig & (~1));
20151 orig_conv.is_owned = false;
20152 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
20153 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20154 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20155 uint64_t ret_ref = (uint64_t)ret_var.inner;
20156 if (ret_var.is_owned) {
20162 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
20163 LDKChannelAnnouncement this_obj_conv;
20164 this_obj_conv.inner = (void*)(this_obj & (~1));
20165 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20166 ChannelAnnouncement_free(this_obj_conv);
20169 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
20170 LDKChannelAnnouncement this_ptr_conv;
20171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20172 this_ptr_conv.is_owned = false;
20173 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20174 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
20178 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
20179 LDKChannelAnnouncement this_ptr_conv;
20180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20181 this_ptr_conv.is_owned = false;
20182 LDKSignature val_ref;
20183 CHECK(*((uint32_t*)val) == 64);
20184 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
20185 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
20188 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
20189 LDKChannelAnnouncement this_ptr_conv;
20190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20191 this_ptr_conv.is_owned = false;
20192 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20193 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
20197 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
20198 LDKChannelAnnouncement this_ptr_conv;
20199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20200 this_ptr_conv.is_owned = false;
20201 LDKSignature val_ref;
20202 CHECK(*((uint32_t*)val) == 64);
20203 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
20204 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
20207 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
20208 LDKChannelAnnouncement this_ptr_conv;
20209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20210 this_ptr_conv.is_owned = false;
20211 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20212 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
20216 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
20217 LDKChannelAnnouncement this_ptr_conv;
20218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20219 this_ptr_conv.is_owned = false;
20220 LDKSignature val_ref;
20221 CHECK(*((uint32_t*)val) == 64);
20222 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
20223 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
20226 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
20227 LDKChannelAnnouncement this_ptr_conv;
20228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20229 this_ptr_conv.is_owned = false;
20230 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20231 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
20235 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
20236 LDKChannelAnnouncement this_ptr_conv;
20237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20238 this_ptr_conv.is_owned = false;
20239 LDKSignature val_ref;
20240 CHECK(*((uint32_t*)val) == 64);
20241 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
20242 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
20245 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
20246 LDKChannelAnnouncement this_ptr_conv;
20247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20248 this_ptr_conv.is_owned = false;
20249 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
20250 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20251 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20252 uint64_t ret_ref = (uint64_t)ret_var.inner;
20253 if (ret_var.is_owned) {
20259 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
20260 LDKChannelAnnouncement this_ptr_conv;
20261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20262 this_ptr_conv.is_owned = false;
20263 LDKUnsignedChannelAnnouncement val_conv;
20264 val_conv.inner = (void*)(val & (~1));
20265 val_conv.is_owned = (val & 1) || (val == 0);
20266 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
20267 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
20270 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) {
20271 LDKSignature node_signature_1_arg_ref;
20272 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
20273 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
20274 LDKSignature node_signature_2_arg_ref;
20275 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
20276 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
20277 LDKSignature bitcoin_signature_1_arg_ref;
20278 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
20279 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
20280 LDKSignature bitcoin_signature_2_arg_ref;
20281 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
20282 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
20283 LDKUnsignedChannelAnnouncement contents_arg_conv;
20284 contents_arg_conv.inner = (void*)(contents_arg & (~1));
20285 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
20286 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
20287 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);
20288 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20289 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20290 uint64_t ret_ref = (uint64_t)ret_var.inner;
20291 if (ret_var.is_owned) {
20297 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
20298 LDKChannelAnnouncement orig_conv;
20299 orig_conv.inner = (void*)(orig & (~1));
20300 orig_conv.is_owned = false;
20301 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
20302 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20303 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20304 uint64_t ret_ref = (uint64_t)ret_var.inner;
20305 if (ret_var.is_owned) {
20311 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
20312 LDKUnsignedChannelUpdate this_obj_conv;
20313 this_obj_conv.inner = (void*)(this_obj & (~1));
20314 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20315 UnsignedChannelUpdate_free(this_obj_conv);
20318 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
20319 LDKUnsignedChannelUpdate this_ptr_conv;
20320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20321 this_ptr_conv.is_owned = false;
20322 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20323 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
20327 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20328 LDKUnsignedChannelUpdate this_ptr_conv;
20329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20330 this_ptr_conv.is_owned = false;
20331 LDKThirtyTwoBytes val_ref;
20332 CHECK(*((uint32_t*)val) == 32);
20333 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20334 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
20337 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
20338 LDKUnsignedChannelUpdate this_ptr_conv;
20339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20340 this_ptr_conv.is_owned = false;
20341 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
20345 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
20346 LDKUnsignedChannelUpdate this_ptr_conv;
20347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20348 this_ptr_conv.is_owned = false;
20349 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
20352 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
20353 LDKUnsignedChannelUpdate this_ptr_conv;
20354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20355 this_ptr_conv.is_owned = false;
20356 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
20360 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
20361 LDKUnsignedChannelUpdate this_ptr_conv;
20362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20363 this_ptr_conv.is_owned = false;
20364 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
20367 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
20368 LDKUnsignedChannelUpdate this_ptr_conv;
20369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20370 this_ptr_conv.is_owned = false;
20371 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
20375 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
20376 LDKUnsignedChannelUpdate this_ptr_conv;
20377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20378 this_ptr_conv.is_owned = false;
20379 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
20382 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
20383 LDKUnsignedChannelUpdate this_ptr_conv;
20384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20385 this_ptr_conv.is_owned = false;
20386 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
20390 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
20391 LDKUnsignedChannelUpdate this_ptr_conv;
20392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20393 this_ptr_conv.is_owned = false;
20394 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
20397 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
20398 LDKUnsignedChannelUpdate this_ptr_conv;
20399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20400 this_ptr_conv.is_owned = false;
20401 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
20405 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
20406 LDKUnsignedChannelUpdate this_ptr_conv;
20407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20408 this_ptr_conv.is_owned = false;
20409 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
20412 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
20413 LDKUnsignedChannelUpdate this_ptr_conv;
20414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20415 this_ptr_conv.is_owned = false;
20416 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
20420 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
20421 LDKUnsignedChannelUpdate this_ptr_conv;
20422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20423 this_ptr_conv.is_owned = false;
20424 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
20427 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
20428 LDKUnsignedChannelUpdate this_ptr_conv;
20429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20430 this_ptr_conv.is_owned = false;
20431 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
20435 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
20436 LDKUnsignedChannelUpdate this_ptr_conv;
20437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20438 this_ptr_conv.is_owned = false;
20439 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
20442 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
20443 LDKUnsignedChannelUpdate orig_conv;
20444 orig_conv.inner = (void*)(orig & (~1));
20445 orig_conv.is_owned = false;
20446 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
20447 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20448 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20449 uint64_t ret_ref = (uint64_t)ret_var.inner;
20450 if (ret_var.is_owned) {
20456 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
20457 LDKChannelUpdate this_obj_conv;
20458 this_obj_conv.inner = (void*)(this_obj & (~1));
20459 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20460 ChannelUpdate_free(this_obj_conv);
20463 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
20464 LDKChannelUpdate this_ptr_conv;
20465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20466 this_ptr_conv.is_owned = false;
20467 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20468 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
20472 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
20473 LDKChannelUpdate this_ptr_conv;
20474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20475 this_ptr_conv.is_owned = false;
20476 LDKSignature val_ref;
20477 CHECK(*((uint32_t*)val) == 64);
20478 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
20479 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
20482 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
20483 LDKChannelUpdate this_ptr_conv;
20484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20485 this_ptr_conv.is_owned = false;
20486 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
20487 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20488 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20489 uint64_t ret_ref = (uint64_t)ret_var.inner;
20490 if (ret_var.is_owned) {
20496 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
20497 LDKChannelUpdate this_ptr_conv;
20498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20499 this_ptr_conv.is_owned = false;
20500 LDKUnsignedChannelUpdate val_conv;
20501 val_conv.inner = (void*)(val & (~1));
20502 val_conv.is_owned = (val & 1) || (val == 0);
20503 val_conv = UnsignedChannelUpdate_clone(&val_conv);
20504 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
20507 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
20508 LDKSignature signature_arg_ref;
20509 CHECK(*((uint32_t*)signature_arg) == 64);
20510 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
20511 LDKUnsignedChannelUpdate contents_arg_conv;
20512 contents_arg_conv.inner = (void*)(contents_arg & (~1));
20513 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
20514 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
20515 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
20516 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20517 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20518 uint64_t ret_ref = (uint64_t)ret_var.inner;
20519 if (ret_var.is_owned) {
20525 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
20526 LDKChannelUpdate orig_conv;
20527 orig_conv.inner = (void*)(orig & (~1));
20528 orig_conv.is_owned = false;
20529 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
20530 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20531 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20532 uint64_t ret_ref = (uint64_t)ret_var.inner;
20533 if (ret_var.is_owned) {
20539 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
20540 LDKQueryChannelRange this_obj_conv;
20541 this_obj_conv.inner = (void*)(this_obj & (~1));
20542 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20543 QueryChannelRange_free(this_obj_conv);
20546 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
20547 LDKQueryChannelRange this_ptr_conv;
20548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20549 this_ptr_conv.is_owned = false;
20550 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20551 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
20555 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20556 LDKQueryChannelRange this_ptr_conv;
20557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20558 this_ptr_conv.is_owned = false;
20559 LDKThirtyTwoBytes val_ref;
20560 CHECK(*((uint32_t*)val) == 32);
20561 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20562 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
20565 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
20566 LDKQueryChannelRange this_ptr_conv;
20567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20568 this_ptr_conv.is_owned = false;
20569 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
20573 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
20574 LDKQueryChannelRange this_ptr_conv;
20575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20576 this_ptr_conv.is_owned = false;
20577 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
20580 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
20581 LDKQueryChannelRange this_ptr_conv;
20582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20583 this_ptr_conv.is_owned = false;
20584 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
20588 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
20589 LDKQueryChannelRange this_ptr_conv;
20590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20591 this_ptr_conv.is_owned = false;
20592 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
20595 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
20596 LDKThirtyTwoBytes chain_hash_arg_ref;
20597 CHECK(*((uint32_t*)chain_hash_arg) == 32);
20598 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
20599 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
20600 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20601 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20602 uint64_t ret_ref = (uint64_t)ret_var.inner;
20603 if (ret_var.is_owned) {
20609 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
20610 LDKQueryChannelRange orig_conv;
20611 orig_conv.inner = (void*)(orig & (~1));
20612 orig_conv.is_owned = false;
20613 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
20614 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20615 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20616 uint64_t ret_ref = (uint64_t)ret_var.inner;
20617 if (ret_var.is_owned) {
20623 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
20624 LDKReplyChannelRange this_obj_conv;
20625 this_obj_conv.inner = (void*)(this_obj & (~1));
20626 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20627 ReplyChannelRange_free(this_obj_conv);
20630 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
20631 LDKReplyChannelRange this_ptr_conv;
20632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20633 this_ptr_conv.is_owned = false;
20634 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20635 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
20639 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20640 LDKReplyChannelRange this_ptr_conv;
20641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20642 this_ptr_conv.is_owned = false;
20643 LDKThirtyTwoBytes val_ref;
20644 CHECK(*((uint32_t*)val) == 32);
20645 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20646 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
20649 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
20650 LDKReplyChannelRange this_ptr_conv;
20651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20652 this_ptr_conv.is_owned = false;
20653 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
20657 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
20658 LDKReplyChannelRange this_ptr_conv;
20659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20660 this_ptr_conv.is_owned = false;
20661 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
20664 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
20665 LDKReplyChannelRange this_ptr_conv;
20666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20667 this_ptr_conv.is_owned = false;
20668 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
20672 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
20673 LDKReplyChannelRange this_ptr_conv;
20674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20675 this_ptr_conv.is_owned = false;
20676 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
20679 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
20680 LDKReplyChannelRange this_ptr_conv;
20681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20682 this_ptr_conv.is_owned = false;
20683 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
20687 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
20688 LDKReplyChannelRange this_ptr_conv;
20689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20690 this_ptr_conv.is_owned = false;
20691 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
20694 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
20695 LDKReplyChannelRange this_ptr_conv;
20696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20697 this_ptr_conv.is_owned = false;
20698 LDKCVec_u64Z val_constr;
20699 val_constr.datalen = *((uint32_t*)val);
20700 if (val_constr.datalen > 0)
20701 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20703 val_constr.data = NULL;
20704 int64_t* val_vals = (int64_t*)(val + 4);
20705 for (size_t i = 0; i < val_constr.datalen; i++) {
20706 int64_t val_conv_8 = val_vals[i];
20707 val_constr.data[i] = val_conv_8;
20709 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
20712 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) {
20713 LDKThirtyTwoBytes chain_hash_arg_ref;
20714 CHECK(*((uint32_t*)chain_hash_arg) == 32);
20715 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
20716 LDKCVec_u64Z short_channel_ids_arg_constr;
20717 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
20718 if (short_channel_ids_arg_constr.datalen > 0)
20719 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20721 short_channel_ids_arg_constr.data = NULL;
20722 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
20723 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
20724 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
20725 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
20727 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
20728 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20729 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20730 uint64_t ret_ref = (uint64_t)ret_var.inner;
20731 if (ret_var.is_owned) {
20737 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
20738 LDKReplyChannelRange orig_conv;
20739 orig_conv.inner = (void*)(orig & (~1));
20740 orig_conv.is_owned = false;
20741 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
20742 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20743 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20744 uint64_t ret_ref = (uint64_t)ret_var.inner;
20745 if (ret_var.is_owned) {
20751 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
20752 LDKQueryShortChannelIds this_obj_conv;
20753 this_obj_conv.inner = (void*)(this_obj & (~1));
20754 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20755 QueryShortChannelIds_free(this_obj_conv);
20758 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
20759 LDKQueryShortChannelIds this_ptr_conv;
20760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20761 this_ptr_conv.is_owned = false;
20762 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20763 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
20767 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20768 LDKQueryShortChannelIds this_ptr_conv;
20769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20770 this_ptr_conv.is_owned = false;
20771 LDKThirtyTwoBytes val_ref;
20772 CHECK(*((uint32_t*)val) == 32);
20773 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20774 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
20777 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
20778 LDKQueryShortChannelIds this_ptr_conv;
20779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20780 this_ptr_conv.is_owned = false;
20781 LDKCVec_u64Z val_constr;
20782 val_constr.datalen = *((uint32_t*)val);
20783 if (val_constr.datalen > 0)
20784 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20786 val_constr.data = NULL;
20787 int64_t* val_vals = (int64_t*)(val + 4);
20788 for (size_t i = 0; i < val_constr.datalen; i++) {
20789 int64_t val_conv_8 = val_vals[i];
20790 val_constr.data[i] = val_conv_8;
20792 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
20795 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
20796 LDKThirtyTwoBytes chain_hash_arg_ref;
20797 CHECK(*((uint32_t*)chain_hash_arg) == 32);
20798 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
20799 LDKCVec_u64Z short_channel_ids_arg_constr;
20800 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
20801 if (short_channel_ids_arg_constr.datalen > 0)
20802 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20804 short_channel_ids_arg_constr.data = NULL;
20805 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
20806 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
20807 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
20808 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
20810 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
20811 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20812 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20813 uint64_t ret_ref = (uint64_t)ret_var.inner;
20814 if (ret_var.is_owned) {
20820 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
20821 LDKQueryShortChannelIds orig_conv;
20822 orig_conv.inner = (void*)(orig & (~1));
20823 orig_conv.is_owned = false;
20824 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
20825 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20826 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20827 uint64_t ret_ref = (uint64_t)ret_var.inner;
20828 if (ret_var.is_owned) {
20834 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
20835 LDKReplyShortChannelIdsEnd this_obj_conv;
20836 this_obj_conv.inner = (void*)(this_obj & (~1));
20837 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20838 ReplyShortChannelIdsEnd_free(this_obj_conv);
20841 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
20842 LDKReplyShortChannelIdsEnd this_ptr_conv;
20843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20844 this_ptr_conv.is_owned = false;
20845 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20846 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
20850 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20851 LDKReplyShortChannelIdsEnd this_ptr_conv;
20852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20853 this_ptr_conv.is_owned = false;
20854 LDKThirtyTwoBytes val_ref;
20855 CHECK(*((uint32_t*)val) == 32);
20856 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20857 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
20860 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
20861 LDKReplyShortChannelIdsEnd this_ptr_conv;
20862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20863 this_ptr_conv.is_owned = false;
20864 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
20868 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
20869 LDKReplyShortChannelIdsEnd this_ptr_conv;
20870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20871 this_ptr_conv.is_owned = false;
20872 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
20875 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
20876 LDKThirtyTwoBytes chain_hash_arg_ref;
20877 CHECK(*((uint32_t*)chain_hash_arg) == 32);
20878 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
20879 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
20880 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20881 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20882 uint64_t ret_ref = (uint64_t)ret_var.inner;
20883 if (ret_var.is_owned) {
20889 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
20890 LDKReplyShortChannelIdsEnd orig_conv;
20891 orig_conv.inner = (void*)(orig & (~1));
20892 orig_conv.is_owned = false;
20893 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
20894 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20895 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20896 uint64_t ret_ref = (uint64_t)ret_var.inner;
20897 if (ret_var.is_owned) {
20903 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
20904 LDKGossipTimestampFilter this_obj_conv;
20905 this_obj_conv.inner = (void*)(this_obj & (~1));
20906 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20907 GossipTimestampFilter_free(this_obj_conv);
20910 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
20911 LDKGossipTimestampFilter this_ptr_conv;
20912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20913 this_ptr_conv.is_owned = false;
20914 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20915 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
20919 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20920 LDKGossipTimestampFilter this_ptr_conv;
20921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20922 this_ptr_conv.is_owned = false;
20923 LDKThirtyTwoBytes val_ref;
20924 CHECK(*((uint32_t*)val) == 32);
20925 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20926 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
20929 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
20930 LDKGossipTimestampFilter this_ptr_conv;
20931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20932 this_ptr_conv.is_owned = false;
20933 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
20937 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
20938 LDKGossipTimestampFilter this_ptr_conv;
20939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20940 this_ptr_conv.is_owned = false;
20941 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
20944 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
20945 LDKGossipTimestampFilter this_ptr_conv;
20946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20947 this_ptr_conv.is_owned = false;
20948 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
20952 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
20953 LDKGossipTimestampFilter this_ptr_conv;
20954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20955 this_ptr_conv.is_owned = false;
20956 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
20959 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
20960 LDKThirtyTwoBytes chain_hash_arg_ref;
20961 CHECK(*((uint32_t*)chain_hash_arg) == 32);
20962 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
20963 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
20964 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20965 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20966 uint64_t ret_ref = (uint64_t)ret_var.inner;
20967 if (ret_var.is_owned) {
20973 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
20974 LDKGossipTimestampFilter orig_conv;
20975 orig_conv.inner = (void*)(orig & (~1));
20976 orig_conv.is_owned = false;
20977 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
20978 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20979 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20980 uint64_t ret_ref = (uint64_t)ret_var.inner;
20981 if (ret_var.is_owned) {
20987 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
20988 if ((this_ptr & 1) != 0) return;
20989 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20990 CHECK_ACCESS(this_ptr_ptr);
20991 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
20992 FREE((void*)this_ptr);
20993 ErrorAction_free(this_ptr_conv);
20996 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
20997 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
20998 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
20999 *ret_copy = ErrorAction_clone(orig_conv);
21000 uint64_t ret_ref = (uint64_t)ret_copy;
21004 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
21005 LDKErrorMessage msg_conv;
21006 msg_conv.inner = (void*)(msg & (~1));
21007 msg_conv.is_owned = (msg & 1) || (msg == 0);
21008 msg_conv = ErrorMessage_clone(&msg_conv);
21009 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21010 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
21011 uint64_t ret_ref = (uint64_t)ret_copy;
21015 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_error() {
21016 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21017 *ret_copy = ErrorAction_ignore_error();
21018 uint64_t ret_ref = (uint64_t)ret_copy;
21022 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
21023 LDKLevel a_conv = LDKLevel_from_js(a);
21024 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21025 *ret_copy = ErrorAction_ignore_and_log(a_conv);
21026 uint64_t ret_ref = (uint64_t)ret_copy;
21030 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) {
21031 LDKErrorMessage msg_conv;
21032 msg_conv.inner = (void*)(msg & (~1));
21033 msg_conv.is_owned = (msg & 1) || (msg == 0);
21034 msg_conv = ErrorMessage_clone(&msg_conv);
21035 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21036 *ret_copy = ErrorAction_send_error_message(msg_conv);
21037 uint64_t ret_ref = (uint64_t)ret_copy;
21041 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
21042 LDKLightningError this_obj_conv;
21043 this_obj_conv.inner = (void*)(this_obj & (~1));
21044 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21045 LightningError_free(this_obj_conv);
21048 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
21049 LDKLightningError this_ptr_conv;
21050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21051 this_ptr_conv.is_owned = false;
21052 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
21053 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
21058 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
21059 LDKLightningError this_ptr_conv;
21060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21061 this_ptr_conv.is_owned = false;
21062 LDKStr val_conv = str_ref_to_owned_c(val);
21063 LightningError_set_err(&this_ptr_conv, val_conv);
21066 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
21067 LDKLightningError this_ptr_conv;
21068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21069 this_ptr_conv.is_owned = false;
21070 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21071 *ret_copy = LightningError_get_action(&this_ptr_conv);
21072 uint64_t ret_ref = (uint64_t)ret_copy;
21076 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
21077 LDKLightningError this_ptr_conv;
21078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21079 this_ptr_conv.is_owned = false;
21080 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21081 CHECK_ACCESS(val_ptr);
21082 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
21083 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
21084 LightningError_set_action(&this_ptr_conv, val_conv);
21087 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
21088 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
21089 void* action_arg_ptr = (void*)(((uint64_t)action_arg) & ~1);
21090 CHECK_ACCESS(action_arg_ptr);
21091 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
21092 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
21093 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
21094 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21095 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21096 uint64_t ret_ref = (uint64_t)ret_var.inner;
21097 if (ret_var.is_owned) {
21103 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
21104 LDKLightningError orig_conv;
21105 orig_conv.inner = (void*)(orig & (~1));
21106 orig_conv.is_owned = false;
21107 LDKLightningError ret_var = LightningError_clone(&orig_conv);
21108 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21109 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21110 uint64_t ret_ref = (uint64_t)ret_var.inner;
21111 if (ret_var.is_owned) {
21117 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
21118 LDKCommitmentUpdate this_obj_conv;
21119 this_obj_conv.inner = (void*)(this_obj & (~1));
21120 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21121 CommitmentUpdate_free(this_obj_conv);
21124 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
21125 LDKCommitmentUpdate this_ptr_conv;
21126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21127 this_ptr_conv.is_owned = false;
21128 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
21129 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
21130 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21131 for (size_t p = 0; p < ret_var.datalen; p++) {
21132 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
21133 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21134 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21135 uint64_t ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
21136 if (ret_conv_15_var.is_owned) {
21137 ret_conv_15_ref |= 1;
21139 ret_arr_ptr[p] = ret_conv_15_ref;
21141 FREE(ret_var.data);
21145 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
21146 LDKCommitmentUpdate this_ptr_conv;
21147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21148 this_ptr_conv.is_owned = false;
21149 LDKCVec_UpdateAddHTLCZ val_constr;
21150 val_constr.datalen = *((uint32_t*)val);
21151 if (val_constr.datalen > 0)
21152 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
21154 val_constr.data = NULL;
21155 uint32_t* val_vals = (uint32_t*)(val + 4);
21156 for (size_t p = 0; p < val_constr.datalen; p++) {
21157 uint32_t val_conv_15 = val_vals[p];
21158 LDKUpdateAddHTLC val_conv_15_conv;
21159 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
21160 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
21161 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
21162 val_constr.data[p] = val_conv_15_conv;
21164 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
21167 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
21168 LDKCommitmentUpdate this_ptr_conv;
21169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21170 this_ptr_conv.is_owned = false;
21171 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
21172 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
21173 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21174 for (size_t t = 0; t < ret_var.datalen; t++) {
21175 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
21176 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21177 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21178 uint64_t ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
21179 if (ret_conv_19_var.is_owned) {
21180 ret_conv_19_ref |= 1;
21182 ret_arr_ptr[t] = ret_conv_19_ref;
21184 FREE(ret_var.data);
21188 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
21189 LDKCommitmentUpdate this_ptr_conv;
21190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21191 this_ptr_conv.is_owned = false;
21192 LDKCVec_UpdateFulfillHTLCZ val_constr;
21193 val_constr.datalen = *((uint32_t*)val);
21194 if (val_constr.datalen > 0)
21195 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
21197 val_constr.data = NULL;
21198 uint32_t* val_vals = (uint32_t*)(val + 4);
21199 for (size_t t = 0; t < val_constr.datalen; t++) {
21200 uint32_t val_conv_19 = val_vals[t];
21201 LDKUpdateFulfillHTLC val_conv_19_conv;
21202 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
21203 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
21204 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
21205 val_constr.data[t] = val_conv_19_conv;
21207 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
21210 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
21211 LDKCommitmentUpdate this_ptr_conv;
21212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21213 this_ptr_conv.is_owned = false;
21214 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
21215 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
21216 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21217 for (size_t q = 0; q < ret_var.datalen; q++) {
21218 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
21219 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21220 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21221 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21222 if (ret_conv_16_var.is_owned) {
21223 ret_conv_16_ref |= 1;
21225 ret_arr_ptr[q] = ret_conv_16_ref;
21227 FREE(ret_var.data);
21231 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
21232 LDKCommitmentUpdate this_ptr_conv;
21233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21234 this_ptr_conv.is_owned = false;
21235 LDKCVec_UpdateFailHTLCZ val_constr;
21236 val_constr.datalen = *((uint32_t*)val);
21237 if (val_constr.datalen > 0)
21238 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
21240 val_constr.data = NULL;
21241 uint32_t* val_vals = (uint32_t*)(val + 4);
21242 for (size_t q = 0; q < val_constr.datalen; q++) {
21243 uint32_t val_conv_16 = val_vals[q];
21244 LDKUpdateFailHTLC val_conv_16_conv;
21245 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
21246 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
21247 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
21248 val_constr.data[q] = val_conv_16_conv;
21250 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
21253 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
21254 LDKCommitmentUpdate this_ptr_conv;
21255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21256 this_ptr_conv.is_owned = false;
21257 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
21258 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
21259 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21260 for (size_t z = 0; z < ret_var.datalen; z++) {
21261 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
21262 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21263 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21264 uint64_t ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
21265 if (ret_conv_25_var.is_owned) {
21266 ret_conv_25_ref |= 1;
21268 ret_arr_ptr[z] = ret_conv_25_ref;
21270 FREE(ret_var.data);
21274 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
21275 LDKCommitmentUpdate this_ptr_conv;
21276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21277 this_ptr_conv.is_owned = false;
21278 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
21279 val_constr.datalen = *((uint32_t*)val);
21280 if (val_constr.datalen > 0)
21281 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
21283 val_constr.data = NULL;
21284 uint32_t* val_vals = (uint32_t*)(val + 4);
21285 for (size_t z = 0; z < val_constr.datalen; z++) {
21286 uint32_t val_conv_25 = val_vals[z];
21287 LDKUpdateFailMalformedHTLC val_conv_25_conv;
21288 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
21289 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
21290 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
21291 val_constr.data[z] = val_conv_25_conv;
21293 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
21296 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
21297 LDKCommitmentUpdate this_ptr_conv;
21298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21299 this_ptr_conv.is_owned = false;
21300 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
21301 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21302 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21303 uint64_t ret_ref = (uint64_t)ret_var.inner;
21304 if (ret_var.is_owned) {
21310 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
21311 LDKCommitmentUpdate this_ptr_conv;
21312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21313 this_ptr_conv.is_owned = false;
21314 LDKUpdateFee val_conv;
21315 val_conv.inner = (void*)(val & (~1));
21316 val_conv.is_owned = (val & 1) || (val == 0);
21317 val_conv = UpdateFee_clone(&val_conv);
21318 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
21321 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
21322 LDKCommitmentUpdate this_ptr_conv;
21323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21324 this_ptr_conv.is_owned = false;
21325 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
21326 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21327 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21328 uint64_t ret_ref = (uint64_t)ret_var.inner;
21329 if (ret_var.is_owned) {
21335 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
21336 LDKCommitmentUpdate this_ptr_conv;
21337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21338 this_ptr_conv.is_owned = false;
21339 LDKCommitmentSigned val_conv;
21340 val_conv.inner = (void*)(val & (~1));
21341 val_conv.is_owned = (val & 1) || (val == 0);
21342 val_conv = CommitmentSigned_clone(&val_conv);
21343 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
21346 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) {
21347 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
21348 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
21349 if (update_add_htlcs_arg_constr.datalen > 0)
21350 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
21352 update_add_htlcs_arg_constr.data = NULL;
21353 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
21354 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
21355 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
21356 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
21357 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
21358 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
21359 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
21360 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
21362 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
21363 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
21364 if (update_fulfill_htlcs_arg_constr.datalen > 0)
21365 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
21367 update_fulfill_htlcs_arg_constr.data = NULL;
21368 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
21369 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
21370 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
21371 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
21372 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
21373 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
21374 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
21375 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
21377 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
21378 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
21379 if (update_fail_htlcs_arg_constr.datalen > 0)
21380 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
21382 update_fail_htlcs_arg_constr.data = NULL;
21383 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
21384 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
21385 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
21386 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
21387 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
21388 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
21389 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
21390 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
21392 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
21393 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
21394 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
21395 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
21397 update_fail_malformed_htlcs_arg_constr.data = NULL;
21398 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
21399 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
21400 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
21401 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
21402 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
21403 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);
21404 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
21405 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
21407 LDKUpdateFee update_fee_arg_conv;
21408 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
21409 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
21410 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
21411 LDKCommitmentSigned commitment_signed_arg_conv;
21412 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
21413 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
21414 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
21415 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);
21416 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21417 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21418 uint64_t ret_ref = (uint64_t)ret_var.inner;
21419 if (ret_var.is_owned) {
21425 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
21426 LDKCommitmentUpdate orig_conv;
21427 orig_conv.inner = (void*)(orig & (~1));
21428 orig_conv.is_owned = false;
21429 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
21430 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21431 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21432 uint64_t ret_ref = (uint64_t)ret_var.inner;
21433 if (ret_var.is_owned) {
21439 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
21440 if ((this_ptr & 1) != 0) return;
21441 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21442 CHECK_ACCESS(this_ptr_ptr);
21443 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
21444 FREE((void*)this_ptr);
21445 ChannelMessageHandler_free(this_ptr_conv);
21448 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
21449 if ((this_ptr & 1) != 0) return;
21450 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21451 CHECK_ACCESS(this_ptr_ptr);
21452 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
21453 FREE((void*)this_ptr);
21454 RoutingMessageHandler_free(this_ptr_conv);
21457 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
21458 LDKAcceptChannel obj_conv;
21459 obj_conv.inner = (void*)(obj & (~1));
21460 obj_conv.is_owned = false;
21461 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
21462 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21463 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21464 CVec_u8Z_free(ret_var);
21468 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
21469 LDKu8slice ser_ref;
21470 ser_ref.datalen = *((uint32_t*)ser);
21471 ser_ref.data = (int8_t*)(ser + 4);
21472 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21473 *ret_conv = AcceptChannel_read(ser_ref);
21474 return (uint64_t)ret_conv;
21477 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
21478 LDKAnnouncementSignatures obj_conv;
21479 obj_conv.inner = (void*)(obj & (~1));
21480 obj_conv.is_owned = false;
21481 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
21482 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21483 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21484 CVec_u8Z_free(ret_var);
21488 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
21489 LDKu8slice ser_ref;
21490 ser_ref.datalen = *((uint32_t*)ser);
21491 ser_ref.data = (int8_t*)(ser + 4);
21492 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21493 *ret_conv = AnnouncementSignatures_read(ser_ref);
21494 return (uint64_t)ret_conv;
21497 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
21498 LDKChannelReestablish obj_conv;
21499 obj_conv.inner = (void*)(obj & (~1));
21500 obj_conv.is_owned = false;
21501 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
21502 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21503 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21504 CVec_u8Z_free(ret_var);
21508 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
21509 LDKu8slice ser_ref;
21510 ser_ref.datalen = *((uint32_t*)ser);
21511 ser_ref.data = (int8_t*)(ser + 4);
21512 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21513 *ret_conv = ChannelReestablish_read(ser_ref);
21514 return (uint64_t)ret_conv;
21517 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
21518 LDKClosingSigned obj_conv;
21519 obj_conv.inner = (void*)(obj & (~1));
21520 obj_conv.is_owned = false;
21521 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
21522 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21523 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21524 CVec_u8Z_free(ret_var);
21528 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
21529 LDKu8slice ser_ref;
21530 ser_ref.datalen = *((uint32_t*)ser);
21531 ser_ref.data = (int8_t*)(ser + 4);
21532 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21533 *ret_conv = ClosingSigned_read(ser_ref);
21534 return (uint64_t)ret_conv;
21537 int8_tArray __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
21538 LDKClosingSignedFeeRange obj_conv;
21539 obj_conv.inner = (void*)(obj & (~1));
21540 obj_conv.is_owned = false;
21541 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
21542 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21543 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21544 CVec_u8Z_free(ret_var);
21548 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
21549 LDKu8slice ser_ref;
21550 ser_ref.datalen = *((uint32_t*)ser);
21551 ser_ref.data = (int8_t*)(ser + 4);
21552 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21553 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
21554 return (uint64_t)ret_conv;
21557 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
21558 LDKCommitmentSigned obj_conv;
21559 obj_conv.inner = (void*)(obj & (~1));
21560 obj_conv.is_owned = false;
21561 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
21562 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21563 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21564 CVec_u8Z_free(ret_var);
21568 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
21569 LDKu8slice ser_ref;
21570 ser_ref.datalen = *((uint32_t*)ser);
21571 ser_ref.data = (int8_t*)(ser + 4);
21572 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21573 *ret_conv = CommitmentSigned_read(ser_ref);
21574 return (uint64_t)ret_conv;
21577 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
21578 LDKFundingCreated obj_conv;
21579 obj_conv.inner = (void*)(obj & (~1));
21580 obj_conv.is_owned = false;
21581 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
21582 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21583 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21584 CVec_u8Z_free(ret_var);
21588 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
21589 LDKu8slice ser_ref;
21590 ser_ref.datalen = *((uint32_t*)ser);
21591 ser_ref.data = (int8_t*)(ser + 4);
21592 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21593 *ret_conv = FundingCreated_read(ser_ref);
21594 return (uint64_t)ret_conv;
21597 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
21598 LDKFundingSigned obj_conv;
21599 obj_conv.inner = (void*)(obj & (~1));
21600 obj_conv.is_owned = false;
21601 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
21602 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21603 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21604 CVec_u8Z_free(ret_var);
21608 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
21609 LDKu8slice ser_ref;
21610 ser_ref.datalen = *((uint32_t*)ser);
21611 ser_ref.data = (int8_t*)(ser + 4);
21612 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21613 *ret_conv = FundingSigned_read(ser_ref);
21614 return (uint64_t)ret_conv;
21617 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
21618 LDKFundingLocked obj_conv;
21619 obj_conv.inner = (void*)(obj & (~1));
21620 obj_conv.is_owned = false;
21621 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
21622 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21623 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21624 CVec_u8Z_free(ret_var);
21628 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
21629 LDKu8slice ser_ref;
21630 ser_ref.datalen = *((uint32_t*)ser);
21631 ser_ref.data = (int8_t*)(ser + 4);
21632 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21633 *ret_conv = FundingLocked_read(ser_ref);
21634 return (uint64_t)ret_conv;
21637 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
21639 obj_conv.inner = (void*)(obj & (~1));
21640 obj_conv.is_owned = false;
21641 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
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 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
21649 LDKu8slice ser_ref;
21650 ser_ref.datalen = *((uint32_t*)ser);
21651 ser_ref.data = (int8_t*)(ser + 4);
21652 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21653 *ret_conv = Init_read(ser_ref);
21654 return (uint64_t)ret_conv;
21657 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
21658 LDKOpenChannel obj_conv;
21659 obj_conv.inner = (void*)(obj & (~1));
21660 obj_conv.is_owned = false;
21661 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
21662 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21663 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21664 CVec_u8Z_free(ret_var);
21668 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
21669 LDKu8slice ser_ref;
21670 ser_ref.datalen = *((uint32_t*)ser);
21671 ser_ref.data = (int8_t*)(ser + 4);
21672 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21673 *ret_conv = OpenChannel_read(ser_ref);
21674 return (uint64_t)ret_conv;
21677 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
21678 LDKRevokeAndACK obj_conv;
21679 obj_conv.inner = (void*)(obj & (~1));
21680 obj_conv.is_owned = false;
21681 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
21682 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21683 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21684 CVec_u8Z_free(ret_var);
21688 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
21689 LDKu8slice ser_ref;
21690 ser_ref.datalen = *((uint32_t*)ser);
21691 ser_ref.data = (int8_t*)(ser + 4);
21692 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21693 *ret_conv = RevokeAndACK_read(ser_ref);
21694 return (uint64_t)ret_conv;
21697 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
21698 LDKShutdown obj_conv;
21699 obj_conv.inner = (void*)(obj & (~1));
21700 obj_conv.is_owned = false;
21701 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
21702 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21703 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21704 CVec_u8Z_free(ret_var);
21708 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
21709 LDKu8slice ser_ref;
21710 ser_ref.datalen = *((uint32_t*)ser);
21711 ser_ref.data = (int8_t*)(ser + 4);
21712 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21713 *ret_conv = Shutdown_read(ser_ref);
21714 return (uint64_t)ret_conv;
21717 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
21718 LDKUpdateFailHTLC obj_conv;
21719 obj_conv.inner = (void*)(obj & (~1));
21720 obj_conv.is_owned = false;
21721 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
21722 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21723 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21724 CVec_u8Z_free(ret_var);
21728 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
21729 LDKu8slice ser_ref;
21730 ser_ref.datalen = *((uint32_t*)ser);
21731 ser_ref.data = (int8_t*)(ser + 4);
21732 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21733 *ret_conv = UpdateFailHTLC_read(ser_ref);
21734 return (uint64_t)ret_conv;
21737 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
21738 LDKUpdateFailMalformedHTLC obj_conv;
21739 obj_conv.inner = (void*)(obj & (~1));
21740 obj_conv.is_owned = false;
21741 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
21742 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21743 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21744 CVec_u8Z_free(ret_var);
21748 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
21749 LDKu8slice ser_ref;
21750 ser_ref.datalen = *((uint32_t*)ser);
21751 ser_ref.data = (int8_t*)(ser + 4);
21752 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21753 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
21754 return (uint64_t)ret_conv;
21757 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
21758 LDKUpdateFee obj_conv;
21759 obj_conv.inner = (void*)(obj & (~1));
21760 obj_conv.is_owned = false;
21761 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
21762 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21763 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21764 CVec_u8Z_free(ret_var);
21768 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
21769 LDKu8slice ser_ref;
21770 ser_ref.datalen = *((uint32_t*)ser);
21771 ser_ref.data = (int8_t*)(ser + 4);
21772 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21773 *ret_conv = UpdateFee_read(ser_ref);
21774 return (uint64_t)ret_conv;
21777 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
21778 LDKUpdateFulfillHTLC obj_conv;
21779 obj_conv.inner = (void*)(obj & (~1));
21780 obj_conv.is_owned = false;
21781 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
21782 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21783 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21784 CVec_u8Z_free(ret_var);
21788 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
21789 LDKu8slice ser_ref;
21790 ser_ref.datalen = *((uint32_t*)ser);
21791 ser_ref.data = (int8_t*)(ser + 4);
21792 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21793 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
21794 return (uint64_t)ret_conv;
21797 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
21798 LDKUpdateAddHTLC obj_conv;
21799 obj_conv.inner = (void*)(obj & (~1));
21800 obj_conv.is_owned = false;
21801 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
21802 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21803 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21804 CVec_u8Z_free(ret_var);
21808 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
21809 LDKu8slice ser_ref;
21810 ser_ref.datalen = *((uint32_t*)ser);
21811 ser_ref.data = (int8_t*)(ser + 4);
21812 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21813 *ret_conv = UpdateAddHTLC_read(ser_ref);
21814 return (uint64_t)ret_conv;
21817 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
21819 obj_conv.inner = (void*)(obj & (~1));
21820 obj_conv.is_owned = false;
21821 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
21822 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21823 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21824 CVec_u8Z_free(ret_var);
21828 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
21829 LDKu8slice ser_ref;
21830 ser_ref.datalen = *((uint32_t*)ser);
21831 ser_ref.data = (int8_t*)(ser + 4);
21832 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21833 *ret_conv = Ping_read(ser_ref);
21834 return (uint64_t)ret_conv;
21837 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
21839 obj_conv.inner = (void*)(obj & (~1));
21840 obj_conv.is_owned = false;
21841 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
21842 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21843 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21844 CVec_u8Z_free(ret_var);
21848 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
21849 LDKu8slice ser_ref;
21850 ser_ref.datalen = *((uint32_t*)ser);
21851 ser_ref.data = (int8_t*)(ser + 4);
21852 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21853 *ret_conv = Pong_read(ser_ref);
21854 return (uint64_t)ret_conv;
21857 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
21858 LDKUnsignedChannelAnnouncement obj_conv;
21859 obj_conv.inner = (void*)(obj & (~1));
21860 obj_conv.is_owned = false;
21861 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
21862 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21863 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21864 CVec_u8Z_free(ret_var);
21868 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
21869 LDKu8slice ser_ref;
21870 ser_ref.datalen = *((uint32_t*)ser);
21871 ser_ref.data = (int8_t*)(ser + 4);
21872 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21873 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
21874 return (uint64_t)ret_conv;
21877 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
21878 LDKChannelAnnouncement obj_conv;
21879 obj_conv.inner = (void*)(obj & (~1));
21880 obj_conv.is_owned = false;
21881 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
21882 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21883 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21884 CVec_u8Z_free(ret_var);
21888 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
21889 LDKu8slice ser_ref;
21890 ser_ref.datalen = *((uint32_t*)ser);
21891 ser_ref.data = (int8_t*)(ser + 4);
21892 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21893 *ret_conv = ChannelAnnouncement_read(ser_ref);
21894 return (uint64_t)ret_conv;
21897 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
21898 LDKUnsignedChannelUpdate obj_conv;
21899 obj_conv.inner = (void*)(obj & (~1));
21900 obj_conv.is_owned = false;
21901 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
21902 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21903 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21904 CVec_u8Z_free(ret_var);
21908 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
21909 LDKu8slice ser_ref;
21910 ser_ref.datalen = *((uint32_t*)ser);
21911 ser_ref.data = (int8_t*)(ser + 4);
21912 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21913 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
21914 return (uint64_t)ret_conv;
21917 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
21918 LDKChannelUpdate obj_conv;
21919 obj_conv.inner = (void*)(obj & (~1));
21920 obj_conv.is_owned = false;
21921 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
21922 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21923 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21924 CVec_u8Z_free(ret_var);
21928 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
21929 LDKu8slice ser_ref;
21930 ser_ref.datalen = *((uint32_t*)ser);
21931 ser_ref.data = (int8_t*)(ser + 4);
21932 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21933 *ret_conv = ChannelUpdate_read(ser_ref);
21934 return (uint64_t)ret_conv;
21937 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
21938 LDKErrorMessage obj_conv;
21939 obj_conv.inner = (void*)(obj & (~1));
21940 obj_conv.is_owned = false;
21941 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
21942 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21943 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21944 CVec_u8Z_free(ret_var);
21948 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
21949 LDKu8slice ser_ref;
21950 ser_ref.datalen = *((uint32_t*)ser);
21951 ser_ref.data = (int8_t*)(ser + 4);
21952 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21953 *ret_conv = ErrorMessage_read(ser_ref);
21954 return (uint64_t)ret_conv;
21957 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
21958 LDKUnsignedNodeAnnouncement obj_conv;
21959 obj_conv.inner = (void*)(obj & (~1));
21960 obj_conv.is_owned = false;
21961 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
21962 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21963 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21964 CVec_u8Z_free(ret_var);
21968 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
21969 LDKu8slice ser_ref;
21970 ser_ref.datalen = *((uint32_t*)ser);
21971 ser_ref.data = (int8_t*)(ser + 4);
21972 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21973 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
21974 return (uint64_t)ret_conv;
21977 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
21978 LDKNodeAnnouncement obj_conv;
21979 obj_conv.inner = (void*)(obj & (~1));
21980 obj_conv.is_owned = false;
21981 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
21982 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21983 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21984 CVec_u8Z_free(ret_var);
21988 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
21989 LDKu8slice ser_ref;
21990 ser_ref.datalen = *((uint32_t*)ser);
21991 ser_ref.data = (int8_t*)(ser + 4);
21992 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21993 *ret_conv = NodeAnnouncement_read(ser_ref);
21994 return (uint64_t)ret_conv;
21997 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
21998 LDKu8slice ser_ref;
21999 ser_ref.datalen = *((uint32_t*)ser);
22000 ser_ref.data = (int8_t*)(ser + 4);
22001 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22002 *ret_conv = QueryShortChannelIds_read(ser_ref);
22003 return (uint64_t)ret_conv;
22006 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
22007 LDKQueryShortChannelIds obj_conv;
22008 obj_conv.inner = (void*)(obj & (~1));
22009 obj_conv.is_owned = false;
22010 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
22011 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22012 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22013 CVec_u8Z_free(ret_var);
22017 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
22018 LDKReplyShortChannelIdsEnd obj_conv;
22019 obj_conv.inner = (void*)(obj & (~1));
22020 obj_conv.is_owned = false;
22021 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
22022 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22023 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22024 CVec_u8Z_free(ret_var);
22028 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
22029 LDKu8slice ser_ref;
22030 ser_ref.datalen = *((uint32_t*)ser);
22031 ser_ref.data = (int8_t*)(ser + 4);
22032 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22033 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
22034 return (uint64_t)ret_conv;
22037 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
22038 LDKQueryChannelRange this_arg_conv;
22039 this_arg_conv.inner = (void*)(this_arg & (~1));
22040 this_arg_conv.is_owned = false;
22041 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
22045 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
22046 LDKQueryChannelRange obj_conv;
22047 obj_conv.inner = (void*)(obj & (~1));
22048 obj_conv.is_owned = false;
22049 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
22050 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22051 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22052 CVec_u8Z_free(ret_var);
22056 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
22057 LDKu8slice ser_ref;
22058 ser_ref.datalen = *((uint32_t*)ser);
22059 ser_ref.data = (int8_t*)(ser + 4);
22060 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22061 *ret_conv = QueryChannelRange_read(ser_ref);
22062 return (uint64_t)ret_conv;
22065 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
22066 LDKu8slice ser_ref;
22067 ser_ref.datalen = *((uint32_t*)ser);
22068 ser_ref.data = (int8_t*)(ser + 4);
22069 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22070 *ret_conv = ReplyChannelRange_read(ser_ref);
22071 return (uint64_t)ret_conv;
22074 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
22075 LDKReplyChannelRange obj_conv;
22076 obj_conv.inner = (void*)(obj & (~1));
22077 obj_conv.is_owned = false;
22078 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
22079 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22080 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22081 CVec_u8Z_free(ret_var);
22085 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
22086 LDKGossipTimestampFilter obj_conv;
22087 obj_conv.inner = (void*)(obj & (~1));
22088 obj_conv.is_owned = false;
22089 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
22090 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22091 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22092 CVec_u8Z_free(ret_var);
22096 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
22097 LDKu8slice ser_ref;
22098 ser_ref.datalen = *((uint32_t*)ser);
22099 ser_ref.data = (int8_t*)(ser + 4);
22100 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22101 *ret_conv = GossipTimestampFilter_read(ser_ref);
22102 return (uint64_t)ret_conv;
22105 void __attribute__((visibility("default"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
22106 if ((this_ptr & 1) != 0) return;
22107 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
22108 CHECK_ACCESS(this_ptr_ptr);
22109 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
22110 FREE((void*)this_ptr);
22111 CustomMessageHandler_free(this_ptr_conv);
22114 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
22115 LDKIgnoringMessageHandler this_obj_conv;
22116 this_obj_conv.inner = (void*)(this_obj & (~1));
22117 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22118 IgnoringMessageHandler_free(this_obj_conv);
22121 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
22122 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
22123 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22124 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22125 uint64_t ret_ref = (uint64_t)ret_var.inner;
22126 if (ret_var.is_owned) {
22132 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
22133 LDKIgnoringMessageHandler this_arg_conv;
22134 this_arg_conv.inner = (void*)(this_arg & (~1));
22135 this_arg_conv.is_owned = false;
22136 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
22137 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
22138 return (uint64_t)ret_ret;
22141 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
22142 LDKIgnoringMessageHandler this_arg_conv;
22143 this_arg_conv.inner = (void*)(this_arg & (~1));
22144 this_arg_conv.is_owned = false;
22145 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
22146 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
22147 return (uint64_t)ret_ret;
22150 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
22151 LDKIgnoringMessageHandler this_arg_conv;
22152 this_arg_conv.inner = (void*)(this_arg & (~1));
22153 this_arg_conv.is_owned = false;
22154 LDKCustomMessageReader* ret_ret =MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
22155 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
22156 return (uint64_t)ret_ret;
22159 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
22160 LDKIgnoringMessageHandler this_arg_conv;
22161 this_arg_conv.inner = (void*)(this_arg & (~1));
22162 this_arg_conv.is_owned = false;
22163 LDKCustomMessageHandler* ret_ret =MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
22164 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
22165 return (uint64_t)ret_ret;
22168 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
22169 LDKErroringMessageHandler this_obj_conv;
22170 this_obj_conv.inner = (void*)(this_obj & (~1));
22171 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22172 ErroringMessageHandler_free(this_obj_conv);
22175 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
22176 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
22177 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22178 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22179 uint64_t ret_ref = (uint64_t)ret_var.inner;
22180 if (ret_var.is_owned) {
22186 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
22187 LDKErroringMessageHandler this_arg_conv;
22188 this_arg_conv.inner = (void*)(this_arg & (~1));
22189 this_arg_conv.is_owned = false;
22190 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
22191 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
22192 return (uint64_t)ret_ret;
22195 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
22196 LDKErroringMessageHandler this_arg_conv;
22197 this_arg_conv.inner = (void*)(this_arg & (~1));
22198 this_arg_conv.is_owned = false;
22199 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
22200 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
22201 return (uint64_t)ret_ret;
22204 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
22205 LDKMessageHandler this_obj_conv;
22206 this_obj_conv.inner = (void*)(this_obj & (~1));
22207 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22208 MessageHandler_free(this_obj_conv);
22211 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
22212 LDKMessageHandler this_ptr_conv;
22213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22214 this_ptr_conv.is_owned = false;
22215 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
22219 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
22220 LDKMessageHandler this_ptr_conv;
22221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22222 this_ptr_conv.is_owned = false;
22223 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22224 CHECK_ACCESS(val_ptr);
22225 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
22226 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
22229 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
22230 LDKMessageHandler this_ptr_conv;
22231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22232 this_ptr_conv.is_owned = false;
22233 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
22237 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
22238 LDKMessageHandler this_ptr_conv;
22239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22240 this_ptr_conv.is_owned = false;
22241 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22242 CHECK_ACCESS(val_ptr);
22243 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
22244 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
22247 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
22248 void* chan_handler_arg_ptr = (void*)(((uint64_t)chan_handler_arg) & ~1);
22249 CHECK_ACCESS(chan_handler_arg_ptr);
22250 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
22251 void* route_handler_arg_ptr = (void*)(((uint64_t)route_handler_arg) & ~1);
22252 CHECK_ACCESS(route_handler_arg_ptr);
22253 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
22254 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_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 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
22265 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
22266 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
22267 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
22268 LDKSocketDescriptor* ret_ret =MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
22269 *ret_ret = SocketDescriptor_clone(orig_conv);
22270 return (uint64_t)ret_ret;
22273 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
22274 if ((this_ptr & 1) != 0) return;
22275 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
22276 CHECK_ACCESS(this_ptr_ptr);
22277 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
22278 FREE((void*)this_ptr);
22279 SocketDescriptor_free(this_ptr_conv);
22282 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
22283 LDKPeerHandleError this_obj_conv;
22284 this_obj_conv.inner = (void*)(this_obj & (~1));
22285 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22286 PeerHandleError_free(this_obj_conv);
22289 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
22290 LDKPeerHandleError this_ptr_conv;
22291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22292 this_ptr_conv.is_owned = false;
22293 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
22297 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
22298 LDKPeerHandleError this_ptr_conv;
22299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22300 this_ptr_conv.is_owned = false;
22301 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
22304 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
22305 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
22306 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22307 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22308 uint64_t ret_ref = (uint64_t)ret_var.inner;
22309 if (ret_var.is_owned) {
22315 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
22316 LDKPeerHandleError orig_conv;
22317 orig_conv.inner = (void*)(orig & (~1));
22318 orig_conv.is_owned = false;
22319 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
22320 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22321 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22322 uint64_t ret_ref = (uint64_t)ret_var.inner;
22323 if (ret_var.is_owned) {
22329 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
22330 LDKPeerManager this_obj_conv;
22331 this_obj_conv.inner = (void*)(this_obj & (~1));
22332 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22333 PeerManager_free(this_obj_conv);
22336 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) {
22337 LDKMessageHandler message_handler_conv;
22338 message_handler_conv.inner = (void*)(message_handler & (~1));
22339 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
22340 // Warning: we need a move here but no clone is available for LDKMessageHandler
22341 LDKSecretKey our_node_secret_ref;
22342 CHECK(*((uint32_t*)our_node_secret) == 32);
22343 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
22344 unsigned char ephemeral_random_data_arr[32];
22345 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
22346 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
22347 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
22348 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
22349 CHECK_ACCESS(logger_ptr);
22350 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22351 void* custom_message_handler_ptr = (void*)(((uint64_t)custom_message_handler) & ~1);
22352 CHECK_ACCESS(custom_message_handler_ptr);
22353 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
22354 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
22355 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22356 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22357 uint64_t ret_ref = (uint64_t)ret_var.inner;
22358 if (ret_var.is_owned) {
22364 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
22365 LDKPeerManager this_arg_conv;
22366 this_arg_conv.inner = (void*)(this_arg & (~1));
22367 this_arg_conv.is_owned = false;
22368 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
22369 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
22370 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
22371 for (size_t m = 0; m < ret_var.datalen; m++) {
22372 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22373 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
22374 ret_arr_ptr[m] = ret_conv_12_arr;
22376 FREE(ret_var.data);
22380 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
22381 LDKPeerManager this_arg_conv;
22382 this_arg_conv.inner = (void*)(this_arg & (~1));
22383 this_arg_conv.is_owned = false;
22384 LDKPublicKey their_node_id_ref;
22385 CHECK(*((uint32_t*)their_node_id) == 33);
22386 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
22387 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
22388 CHECK_ACCESS(descriptor_ptr);
22389 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
22390 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22391 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
22392 return (uint64_t)ret_conv;
22395 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
22396 LDKPeerManager this_arg_conv;
22397 this_arg_conv.inner = (void*)(this_arg & (~1));
22398 this_arg_conv.is_owned = false;
22399 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
22400 CHECK_ACCESS(descriptor_ptr);
22401 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
22402 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22403 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
22404 return (uint64_t)ret_conv;
22407 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
22408 LDKPeerManager this_arg_conv;
22409 this_arg_conv.inner = (void*)(this_arg & (~1));
22410 this_arg_conv.is_owned = false;
22411 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
22412 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
22413 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
22414 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22415 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
22416 return (uint64_t)ret_conv;
22419 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
22420 LDKPeerManager this_arg_conv;
22421 this_arg_conv.inner = (void*)(this_arg & (~1));
22422 this_arg_conv.is_owned = false;
22423 void* peer_descriptor_ptr = (void*)(((uint64_t)peer_descriptor) & ~1);
22424 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
22425 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
22426 LDKu8slice data_ref;
22427 data_ref.datalen = *((uint32_t*)data);
22428 data_ref.data = (int8_t*)(data + 4);
22429 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22430 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
22431 return (uint64_t)ret_conv;
22434 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
22435 LDKPeerManager this_arg_conv;
22436 this_arg_conv.inner = (void*)(this_arg & (~1));
22437 this_arg_conv.is_owned = false;
22438 PeerManager_process_events(&this_arg_conv);
22441 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
22442 LDKPeerManager this_arg_conv;
22443 this_arg_conv.inner = (void*)(this_arg & (~1));
22444 this_arg_conv.is_owned = false;
22445 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
22446 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
22447 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
22448 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
22451 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
22452 LDKPeerManager this_arg_conv;
22453 this_arg_conv.inner = (void*)(this_arg & (~1));
22454 this_arg_conv.is_owned = false;
22455 LDKPublicKey node_id_ref;
22456 CHECK(*((uint32_t*)node_id) == 33);
22457 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
22458 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
22461 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
22462 LDKPeerManager this_arg_conv;
22463 this_arg_conv.inner = (void*)(this_arg & (~1));
22464 this_arg_conv.is_owned = false;
22465 PeerManager_timer_tick_occurred(&this_arg_conv);
22468 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
22469 unsigned char commitment_seed_arr[32];
22470 CHECK(*((uint32_t*)commitment_seed) == 32);
22471 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
22472 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
22473 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22474 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
22478 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) {
22479 LDKCVec_u8Z to_holder_script_ref;
22480 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
22481 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
22482 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
22483 LDKCVec_u8Z to_counterparty_script_ref;
22484 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
22485 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
22486 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
22487 LDKOutPoint funding_outpoint_conv;
22488 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
22489 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
22490 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
22491 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);
22492 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22493 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22494 Transaction_free(ret_var);
22498 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
22499 LDKPublicKey per_commitment_point_ref;
22500 CHECK(*((uint32_t*)per_commitment_point) == 33);
22501 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
22502 unsigned char base_secret_arr[32];
22503 CHECK(*((uint32_t*)base_secret) == 32);
22504 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
22505 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
22506 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
22507 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
22508 return (uint64_t)ret_conv;
22511 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
22512 LDKPublicKey per_commitment_point_ref;
22513 CHECK(*((uint32_t*)per_commitment_point) == 33);
22514 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
22515 LDKPublicKey base_point_ref;
22516 CHECK(*((uint32_t*)base_point) == 33);
22517 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
22518 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22519 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
22520 return (uint64_t)ret_conv;
22523 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
22524 unsigned char per_commitment_secret_arr[32];
22525 CHECK(*((uint32_t*)per_commitment_secret) == 32);
22526 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
22527 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
22528 unsigned char countersignatory_revocation_base_secret_arr[32];
22529 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
22530 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
22531 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
22532 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
22533 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
22534 return (uint64_t)ret_conv;
22537 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
22538 LDKPublicKey per_commitment_point_ref;
22539 CHECK(*((uint32_t*)per_commitment_point) == 33);
22540 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
22541 LDKPublicKey countersignatory_revocation_base_point_ref;
22542 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
22543 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
22544 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22545 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
22546 return (uint64_t)ret_conv;
22549 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
22550 LDKTxCreationKeys this_obj_conv;
22551 this_obj_conv.inner = (void*)(this_obj & (~1));
22552 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22553 TxCreationKeys_free(this_obj_conv);
22556 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
22557 LDKTxCreationKeys this_ptr_conv;
22558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22559 this_ptr_conv.is_owned = false;
22560 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22561 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
22565 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
22566 LDKTxCreationKeys this_ptr_conv;
22567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22568 this_ptr_conv.is_owned = false;
22569 LDKPublicKey val_ref;
22570 CHECK(*((uint32_t*)val) == 33);
22571 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22572 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
22575 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
22576 LDKTxCreationKeys this_ptr_conv;
22577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22578 this_ptr_conv.is_owned = false;
22579 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22580 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
22584 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
22585 LDKTxCreationKeys this_ptr_conv;
22586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22587 this_ptr_conv.is_owned = false;
22588 LDKPublicKey val_ref;
22589 CHECK(*((uint32_t*)val) == 33);
22590 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22591 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
22594 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
22595 LDKTxCreationKeys this_ptr_conv;
22596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22597 this_ptr_conv.is_owned = false;
22598 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22599 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
22603 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
22604 LDKTxCreationKeys this_ptr_conv;
22605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22606 this_ptr_conv.is_owned = false;
22607 LDKPublicKey val_ref;
22608 CHECK(*((uint32_t*)val) == 33);
22609 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22610 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
22613 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
22614 LDKTxCreationKeys this_ptr_conv;
22615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22616 this_ptr_conv.is_owned = false;
22617 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22618 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
22622 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
22623 LDKTxCreationKeys this_ptr_conv;
22624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22625 this_ptr_conv.is_owned = false;
22626 LDKPublicKey val_ref;
22627 CHECK(*((uint32_t*)val) == 33);
22628 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22629 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
22632 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
22633 LDKTxCreationKeys this_ptr_conv;
22634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22635 this_ptr_conv.is_owned = false;
22636 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22637 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
22641 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
22642 LDKTxCreationKeys this_ptr_conv;
22643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22644 this_ptr_conv.is_owned = false;
22645 LDKPublicKey val_ref;
22646 CHECK(*((uint32_t*)val) == 33);
22647 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22648 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
22651 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) {
22652 LDKPublicKey per_commitment_point_arg_ref;
22653 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
22654 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
22655 LDKPublicKey revocation_key_arg_ref;
22656 CHECK(*((uint32_t*)revocation_key_arg) == 33);
22657 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
22658 LDKPublicKey broadcaster_htlc_key_arg_ref;
22659 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
22660 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
22661 LDKPublicKey countersignatory_htlc_key_arg_ref;
22662 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
22663 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
22664 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
22665 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
22666 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
22667 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);
22668 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22669 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22670 uint64_t ret_ref = (uint64_t)ret_var.inner;
22671 if (ret_var.is_owned) {
22677 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
22678 LDKTxCreationKeys orig_conv;
22679 orig_conv.inner = (void*)(orig & (~1));
22680 orig_conv.is_owned = false;
22681 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
22682 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22683 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22684 uint64_t ret_ref = (uint64_t)ret_var.inner;
22685 if (ret_var.is_owned) {
22691 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
22692 LDKTxCreationKeys obj_conv;
22693 obj_conv.inner = (void*)(obj & (~1));
22694 obj_conv.is_owned = false;
22695 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
22696 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22697 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22698 CVec_u8Z_free(ret_var);
22702 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
22703 LDKu8slice ser_ref;
22704 ser_ref.datalen = *((uint32_t*)ser);
22705 ser_ref.data = (int8_t*)(ser + 4);
22706 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
22707 *ret_conv = TxCreationKeys_read(ser_ref);
22708 return (uint64_t)ret_conv;
22711 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
22712 LDKChannelPublicKeys this_obj_conv;
22713 this_obj_conv.inner = (void*)(this_obj & (~1));
22714 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22715 ChannelPublicKeys_free(this_obj_conv);
22718 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
22719 LDKChannelPublicKeys this_ptr_conv;
22720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22721 this_ptr_conv.is_owned = false;
22722 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22723 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
22727 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
22728 LDKChannelPublicKeys this_ptr_conv;
22729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22730 this_ptr_conv.is_owned = false;
22731 LDKPublicKey val_ref;
22732 CHECK(*((uint32_t*)val) == 33);
22733 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22734 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
22737 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
22738 LDKChannelPublicKeys this_ptr_conv;
22739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22740 this_ptr_conv.is_owned = false;
22741 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22742 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
22746 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
22747 LDKChannelPublicKeys this_ptr_conv;
22748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22749 this_ptr_conv.is_owned = false;
22750 LDKPublicKey val_ref;
22751 CHECK(*((uint32_t*)val) == 33);
22752 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22753 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
22756 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
22757 LDKChannelPublicKeys this_ptr_conv;
22758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22759 this_ptr_conv.is_owned = false;
22760 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22761 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
22765 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
22766 LDKChannelPublicKeys this_ptr_conv;
22767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22768 this_ptr_conv.is_owned = false;
22769 LDKPublicKey val_ref;
22770 CHECK(*((uint32_t*)val) == 33);
22771 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22772 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
22775 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
22776 LDKChannelPublicKeys this_ptr_conv;
22777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22778 this_ptr_conv.is_owned = false;
22779 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22780 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
22784 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
22785 LDKChannelPublicKeys this_ptr_conv;
22786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22787 this_ptr_conv.is_owned = false;
22788 LDKPublicKey val_ref;
22789 CHECK(*((uint32_t*)val) == 33);
22790 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22791 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
22794 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
22795 LDKChannelPublicKeys this_ptr_conv;
22796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22797 this_ptr_conv.is_owned = false;
22798 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22799 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
22803 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
22804 LDKChannelPublicKeys this_ptr_conv;
22805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22806 this_ptr_conv.is_owned = false;
22807 LDKPublicKey val_ref;
22808 CHECK(*((uint32_t*)val) == 33);
22809 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22810 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
22813 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) {
22814 LDKPublicKey funding_pubkey_arg_ref;
22815 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
22816 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
22817 LDKPublicKey revocation_basepoint_arg_ref;
22818 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
22819 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
22820 LDKPublicKey payment_point_arg_ref;
22821 CHECK(*((uint32_t*)payment_point_arg) == 33);
22822 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
22823 LDKPublicKey delayed_payment_basepoint_arg_ref;
22824 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
22825 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
22826 LDKPublicKey htlc_basepoint_arg_ref;
22827 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
22828 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
22829 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);
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_ChannelPublicKeys_clone(uint32_t orig) {
22840 LDKChannelPublicKeys orig_conv;
22841 orig_conv.inner = (void*)(orig & (~1));
22842 orig_conv.is_owned = false;
22843 LDKChannelPublicKeys ret_var = ChannelPublicKeys_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 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
22854 LDKChannelPublicKeys obj_conv;
22855 obj_conv.inner = (void*)(obj & (~1));
22856 obj_conv.is_owned = false;
22857 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
22858 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22859 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22860 CVec_u8Z_free(ret_var);
22864 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
22865 LDKu8slice ser_ref;
22866 ser_ref.datalen = *((uint32_t*)ser);
22867 ser_ref.data = (int8_t*)(ser + 4);
22868 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
22869 *ret_conv = ChannelPublicKeys_read(ser_ref);
22870 return (uint64_t)ret_conv;
22873 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) {
22874 LDKPublicKey per_commitment_point_ref;
22875 CHECK(*((uint32_t*)per_commitment_point) == 33);
22876 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
22877 LDKPublicKey broadcaster_delayed_payment_base_ref;
22878 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
22879 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
22880 LDKPublicKey broadcaster_htlc_base_ref;
22881 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
22882 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
22883 LDKPublicKey countersignatory_revocation_base_ref;
22884 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
22885 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
22886 LDKPublicKey countersignatory_htlc_base_ref;
22887 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
22888 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
22889 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
22890 *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);
22891 return (uint64_t)ret_conv;
22894 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
22895 LDKPublicKey per_commitment_point_ref;
22896 CHECK(*((uint32_t*)per_commitment_point) == 33);
22897 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
22898 LDKChannelPublicKeys broadcaster_keys_conv;
22899 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
22900 broadcaster_keys_conv.is_owned = false;
22901 LDKChannelPublicKeys countersignatory_keys_conv;
22902 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
22903 countersignatory_keys_conv.is_owned = false;
22904 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
22905 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
22906 return (uint64_t)ret_conv;
22909 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
22910 LDKPublicKey revocation_key_ref;
22911 CHECK(*((uint32_t*)revocation_key) == 33);
22912 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
22913 LDKPublicKey broadcaster_delayed_payment_key_ref;
22914 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
22915 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
22916 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
22917 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22918 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22919 CVec_u8Z_free(ret_var);
22923 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
22924 LDKHTLCOutputInCommitment this_obj_conv;
22925 this_obj_conv.inner = (void*)(this_obj & (~1));
22926 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22927 HTLCOutputInCommitment_free(this_obj_conv);
22930 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
22931 LDKHTLCOutputInCommitment this_ptr_conv;
22932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22933 this_ptr_conv.is_owned = false;
22934 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
22938 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
22939 LDKHTLCOutputInCommitment this_ptr_conv;
22940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22941 this_ptr_conv.is_owned = false;
22942 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
22945 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
22946 LDKHTLCOutputInCommitment this_ptr_conv;
22947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22948 this_ptr_conv.is_owned = false;
22949 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
22953 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
22954 LDKHTLCOutputInCommitment this_ptr_conv;
22955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22956 this_ptr_conv.is_owned = false;
22957 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
22960 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
22961 LDKHTLCOutputInCommitment this_ptr_conv;
22962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22963 this_ptr_conv.is_owned = false;
22964 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
22968 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
22969 LDKHTLCOutputInCommitment this_ptr_conv;
22970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22971 this_ptr_conv.is_owned = false;
22972 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
22975 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
22976 LDKHTLCOutputInCommitment this_ptr_conv;
22977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22978 this_ptr_conv.is_owned = false;
22979 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22980 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
22984 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
22985 LDKHTLCOutputInCommitment this_ptr_conv;
22986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22987 this_ptr_conv.is_owned = false;
22988 LDKThirtyTwoBytes val_ref;
22989 CHECK(*((uint32_t*)val) == 32);
22990 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22991 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
22994 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
22995 LDKHTLCOutputInCommitment this_ptr_conv;
22996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22997 this_ptr_conv.is_owned = false;
22998 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
22999 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
23000 uint64_t ret_ref = (uint64_t)ret_copy;
23004 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
23005 LDKHTLCOutputInCommitment this_ptr_conv;
23006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23007 this_ptr_conv.is_owned = false;
23008 void* val_ptr = (void*)(((uint64_t)val) & ~1);
23009 CHECK_ACCESS(val_ptr);
23010 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
23011 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
23012 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
23015 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) {
23016 LDKThirtyTwoBytes payment_hash_arg_ref;
23017 CHECK(*((uint32_t*)payment_hash_arg) == 32);
23018 memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
23019 void* transaction_output_index_arg_ptr = (void*)(((uint64_t)transaction_output_index_arg) & ~1);
23020 CHECK_ACCESS(transaction_output_index_arg_ptr);
23021 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
23022 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
23023 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
23024 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23025 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23026 uint64_t ret_ref = (uint64_t)ret_var.inner;
23027 if (ret_var.is_owned) {
23033 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
23034 LDKHTLCOutputInCommitment orig_conv;
23035 orig_conv.inner = (void*)(orig & (~1));
23036 orig_conv.is_owned = false;
23037 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
23038 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23039 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23040 uint64_t ret_ref = (uint64_t)ret_var.inner;
23041 if (ret_var.is_owned) {
23047 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
23048 LDKHTLCOutputInCommitment obj_conv;
23049 obj_conv.inner = (void*)(obj & (~1));
23050 obj_conv.is_owned = false;
23051 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
23052 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23053 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23054 CVec_u8Z_free(ret_var);
23058 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
23059 LDKu8slice ser_ref;
23060 ser_ref.datalen = *((uint32_t*)ser);
23061 ser_ref.data = (int8_t*)(ser + 4);
23062 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
23063 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
23064 return (uint64_t)ret_conv;
23067 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
23068 LDKHTLCOutputInCommitment htlc_conv;
23069 htlc_conv.inner = (void*)(htlc & (~1));
23070 htlc_conv.is_owned = false;
23071 LDKTxCreationKeys keys_conv;
23072 keys_conv.inner = (void*)(keys & (~1));
23073 keys_conv.is_owned = false;
23074 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
23075 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23076 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23077 CVec_u8Z_free(ret_var);
23081 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
23082 LDKPublicKey broadcaster_ref;
23083 CHECK(*((uint32_t*)broadcaster) == 33);
23084 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
23085 LDKPublicKey countersignatory_ref;
23086 CHECK(*((uint32_t*)countersignatory) == 33);
23087 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
23088 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
23089 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23090 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23091 CVec_u8Z_free(ret_var);
23095 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) {
23096 unsigned char commitment_txid_arr[32];
23097 CHECK(*((uint32_t*)commitment_txid) == 32);
23098 memcpy(commitment_txid_arr, (uint8_t*)(commitment_txid + 4), 32);
23099 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
23100 LDKHTLCOutputInCommitment htlc_conv;
23101 htlc_conv.inner = (void*)(htlc & (~1));
23102 htlc_conv.is_owned = false;
23103 LDKPublicKey broadcaster_delayed_payment_key_ref;
23104 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
23105 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
23106 LDKPublicKey revocation_key_ref;
23107 CHECK(*((uint32_t*)revocation_key) == 33);
23108 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
23109 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
23110 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23111 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23112 Transaction_free(ret_var);
23116 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
23117 LDKChannelTransactionParameters this_obj_conv;
23118 this_obj_conv.inner = (void*)(this_obj & (~1));
23119 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23120 ChannelTransactionParameters_free(this_obj_conv);
23123 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
23124 LDKChannelTransactionParameters this_ptr_conv;
23125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23126 this_ptr_conv.is_owned = false;
23127 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
23128 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23129 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23130 uint64_t ret_ref = (uint64_t)ret_var.inner;
23131 if (ret_var.is_owned) {
23137 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
23138 LDKChannelTransactionParameters this_ptr_conv;
23139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23140 this_ptr_conv.is_owned = false;
23141 LDKChannelPublicKeys val_conv;
23142 val_conv.inner = (void*)(val & (~1));
23143 val_conv.is_owned = (val & 1) || (val == 0);
23144 val_conv = ChannelPublicKeys_clone(&val_conv);
23145 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
23148 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
23149 LDKChannelTransactionParameters this_ptr_conv;
23150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23151 this_ptr_conv.is_owned = false;
23152 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
23156 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
23157 LDKChannelTransactionParameters this_ptr_conv;
23158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23159 this_ptr_conv.is_owned = false;
23160 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
23163 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
23164 LDKChannelTransactionParameters this_ptr_conv;
23165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23166 this_ptr_conv.is_owned = false;
23167 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
23171 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
23172 LDKChannelTransactionParameters this_ptr_conv;
23173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23174 this_ptr_conv.is_owned = false;
23175 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
23178 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
23179 LDKChannelTransactionParameters this_ptr_conv;
23180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23181 this_ptr_conv.is_owned = false;
23182 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
23183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23185 uint64_t ret_ref = (uint64_t)ret_var.inner;
23186 if (ret_var.is_owned) {
23192 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
23193 LDKChannelTransactionParameters this_ptr_conv;
23194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23195 this_ptr_conv.is_owned = false;
23196 LDKCounterpartyChannelTransactionParameters val_conv;
23197 val_conv.inner = (void*)(val & (~1));
23198 val_conv.is_owned = (val & 1) || (val == 0);
23199 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
23200 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
23203 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
23204 LDKChannelTransactionParameters this_ptr_conv;
23205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23206 this_ptr_conv.is_owned = false;
23207 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
23208 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23209 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23210 uint64_t ret_ref = (uint64_t)ret_var.inner;
23211 if (ret_var.is_owned) {
23217 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
23218 LDKChannelTransactionParameters this_ptr_conv;
23219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23220 this_ptr_conv.is_owned = false;
23221 LDKOutPoint val_conv;
23222 val_conv.inner = (void*)(val & (~1));
23223 val_conv.is_owned = (val & 1) || (val == 0);
23224 val_conv = OutPoint_clone(&val_conv);
23225 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
23228 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) {
23229 LDKChannelPublicKeys holder_pubkeys_arg_conv;
23230 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
23231 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
23232 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
23233 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
23234 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
23235 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
23236 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
23237 LDKOutPoint funding_outpoint_arg_conv;
23238 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
23239 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
23240 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
23241 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);
23242 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23243 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23244 uint64_t ret_ref = (uint64_t)ret_var.inner;
23245 if (ret_var.is_owned) {
23251 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
23252 LDKChannelTransactionParameters orig_conv;
23253 orig_conv.inner = (void*)(orig & (~1));
23254 orig_conv.is_owned = false;
23255 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
23256 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23257 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23258 uint64_t ret_ref = (uint64_t)ret_var.inner;
23259 if (ret_var.is_owned) {
23265 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
23266 LDKCounterpartyChannelTransactionParameters this_obj_conv;
23267 this_obj_conv.inner = (void*)(this_obj & (~1));
23268 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23269 CounterpartyChannelTransactionParameters_free(this_obj_conv);
23272 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
23273 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
23274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23275 this_ptr_conv.is_owned = false;
23276 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
23277 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23278 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23279 uint64_t ret_ref = (uint64_t)ret_var.inner;
23280 if (ret_var.is_owned) {
23286 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
23287 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
23288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23289 this_ptr_conv.is_owned = false;
23290 LDKChannelPublicKeys val_conv;
23291 val_conv.inner = (void*)(val & (~1));
23292 val_conv.is_owned = (val & 1) || (val == 0);
23293 val_conv = ChannelPublicKeys_clone(&val_conv);
23294 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
23297 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
23298 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
23299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23300 this_ptr_conv.is_owned = false;
23301 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
23305 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
23306 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
23307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23308 this_ptr_conv.is_owned = false;
23309 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
23312 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
23313 LDKChannelPublicKeys pubkeys_arg_conv;
23314 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
23315 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
23316 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
23317 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
23318 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23319 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23320 uint64_t ret_ref = (uint64_t)ret_var.inner;
23321 if (ret_var.is_owned) {
23327 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
23328 LDKCounterpartyChannelTransactionParameters orig_conv;
23329 orig_conv.inner = (void*)(orig & (~1));
23330 orig_conv.is_owned = false;
23331 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
23332 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23333 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23334 uint64_t ret_ref = (uint64_t)ret_var.inner;
23335 if (ret_var.is_owned) {
23341 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
23342 LDKChannelTransactionParameters this_arg_conv;
23343 this_arg_conv.inner = (void*)(this_arg & (~1));
23344 this_arg_conv.is_owned = false;
23345 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
23349 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
23350 LDKChannelTransactionParameters this_arg_conv;
23351 this_arg_conv.inner = (void*)(this_arg & (~1));
23352 this_arg_conv.is_owned = false;
23353 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
23354 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23355 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23356 uint64_t ret_ref = (uint64_t)ret_var.inner;
23357 if (ret_var.is_owned) {
23363 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
23364 LDKChannelTransactionParameters this_arg_conv;
23365 this_arg_conv.inner = (void*)(this_arg & (~1));
23366 this_arg_conv.is_owned = false;
23367 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
23368 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23369 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23370 uint64_t ret_ref = (uint64_t)ret_var.inner;
23371 if (ret_var.is_owned) {
23377 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
23378 LDKCounterpartyChannelTransactionParameters obj_conv;
23379 obj_conv.inner = (void*)(obj & (~1));
23380 obj_conv.is_owned = false;
23381 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
23382 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23383 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23384 CVec_u8Z_free(ret_var);
23388 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
23389 LDKu8slice ser_ref;
23390 ser_ref.datalen = *((uint32_t*)ser);
23391 ser_ref.data = (int8_t*)(ser + 4);
23392 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
23393 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
23394 return (uint64_t)ret_conv;
23397 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
23398 LDKChannelTransactionParameters obj_conv;
23399 obj_conv.inner = (void*)(obj & (~1));
23400 obj_conv.is_owned = false;
23401 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
23402 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23403 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23404 CVec_u8Z_free(ret_var);
23408 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
23409 LDKu8slice ser_ref;
23410 ser_ref.datalen = *((uint32_t*)ser);
23411 ser_ref.data = (int8_t*)(ser + 4);
23412 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
23413 *ret_conv = ChannelTransactionParameters_read(ser_ref);
23414 return (uint64_t)ret_conv;
23417 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
23418 LDKDirectedChannelTransactionParameters this_obj_conv;
23419 this_obj_conv.inner = (void*)(this_obj & (~1));
23420 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23421 DirectedChannelTransactionParameters_free(this_obj_conv);
23424 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
23425 LDKDirectedChannelTransactionParameters this_arg_conv;
23426 this_arg_conv.inner = (void*)(this_arg & (~1));
23427 this_arg_conv.is_owned = false;
23428 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
23429 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23430 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23431 uint64_t ret_ref = (uint64_t)ret_var.inner;
23432 if (ret_var.is_owned) {
23438 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
23439 LDKDirectedChannelTransactionParameters this_arg_conv;
23440 this_arg_conv.inner = (void*)(this_arg & (~1));
23441 this_arg_conv.is_owned = false;
23442 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
23443 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23444 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23445 uint64_t ret_ref = (uint64_t)ret_var.inner;
23446 if (ret_var.is_owned) {
23452 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
23453 LDKDirectedChannelTransactionParameters this_arg_conv;
23454 this_arg_conv.inner = (void*)(this_arg & (~1));
23455 this_arg_conv.is_owned = false;
23456 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
23460 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
23461 LDKDirectedChannelTransactionParameters this_arg_conv;
23462 this_arg_conv.inner = (void*)(this_arg & (~1));
23463 this_arg_conv.is_owned = false;
23464 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
23468 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
23469 LDKDirectedChannelTransactionParameters this_arg_conv;
23470 this_arg_conv.inner = (void*)(this_arg & (~1));
23471 this_arg_conv.is_owned = false;
23472 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_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 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
23483 LDKHolderCommitmentTransaction this_obj_conv;
23484 this_obj_conv.inner = (void*)(this_obj & (~1));
23485 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23486 HolderCommitmentTransaction_free(this_obj_conv);
23489 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
23490 LDKHolderCommitmentTransaction this_ptr_conv;
23491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23492 this_ptr_conv.is_owned = false;
23493 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
23494 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
23498 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
23499 LDKHolderCommitmentTransaction this_ptr_conv;
23500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23501 this_ptr_conv.is_owned = false;
23502 LDKSignature val_ref;
23503 CHECK(*((uint32_t*)val) == 64);
23504 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
23505 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
23508 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
23509 LDKHolderCommitmentTransaction this_ptr_conv;
23510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23511 this_ptr_conv.is_owned = false;
23512 LDKCVec_SignatureZ val_constr;
23513 val_constr.datalen = *((uint32_t*)val);
23514 if (val_constr.datalen > 0)
23515 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
23517 val_constr.data = NULL;
23518 int8_tArray* val_vals = (int8_tArray*)(val + 4);
23519 for (size_t m = 0; m < val_constr.datalen; m++) {
23520 int8_tArray val_conv_12 = val_vals[m];
23521 LDKSignature val_conv_12_ref;
23522 CHECK(*((uint32_t*)val_conv_12) == 64);
23523 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
23524 val_constr.data[m] = val_conv_12_ref;
23526 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
23529 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
23530 LDKHolderCommitmentTransaction orig_conv;
23531 orig_conv.inner = (void*)(orig & (~1));
23532 orig_conv.is_owned = false;
23533 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
23534 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23535 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23536 uint64_t ret_ref = (uint64_t)ret_var.inner;
23537 if (ret_var.is_owned) {
23543 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
23544 LDKHolderCommitmentTransaction obj_conv;
23545 obj_conv.inner = (void*)(obj & (~1));
23546 obj_conv.is_owned = false;
23547 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
23548 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23549 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23550 CVec_u8Z_free(ret_var);
23554 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
23555 LDKu8slice ser_ref;
23556 ser_ref.datalen = *((uint32_t*)ser);
23557 ser_ref.data = (int8_t*)(ser + 4);
23558 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
23559 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
23560 return (uint64_t)ret_conv;
23563 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) {
23564 LDKCommitmentTransaction commitment_tx_conv;
23565 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
23566 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
23567 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
23568 LDKSignature counterparty_sig_ref;
23569 CHECK(*((uint32_t*)counterparty_sig) == 64);
23570 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
23571 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
23572 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
23573 if (counterparty_htlc_sigs_constr.datalen > 0)
23574 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
23576 counterparty_htlc_sigs_constr.data = NULL;
23577 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
23578 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
23579 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
23580 LDKSignature counterparty_htlc_sigs_conv_12_ref;
23581 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
23582 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
23583 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
23585 LDKPublicKey holder_funding_key_ref;
23586 CHECK(*((uint32_t*)holder_funding_key) == 33);
23587 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
23588 LDKPublicKey counterparty_funding_key_ref;
23589 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
23590 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
23591 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
23592 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23593 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23594 uint64_t ret_ref = (uint64_t)ret_var.inner;
23595 if (ret_var.is_owned) {
23601 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
23602 LDKBuiltCommitmentTransaction this_obj_conv;
23603 this_obj_conv.inner = (void*)(this_obj & (~1));
23604 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23605 BuiltCommitmentTransaction_free(this_obj_conv);
23608 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
23609 LDKBuiltCommitmentTransaction this_ptr_conv;
23610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23611 this_ptr_conv.is_owned = false;
23612 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
23613 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23614 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23615 Transaction_free(ret_var);
23619 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
23620 LDKBuiltCommitmentTransaction this_ptr_conv;
23621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23622 this_ptr_conv.is_owned = false;
23623 LDKTransaction val_ref;
23624 val_ref.datalen = *((uint32_t*)val);
23625 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
23626 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
23627 val_ref.data_is_owned = true;
23628 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
23631 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
23632 LDKBuiltCommitmentTransaction this_ptr_conv;
23633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23634 this_ptr_conv.is_owned = false;
23635 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23636 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
23640 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
23641 LDKBuiltCommitmentTransaction this_ptr_conv;
23642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23643 this_ptr_conv.is_owned = false;
23644 LDKThirtyTwoBytes val_ref;
23645 CHECK(*((uint32_t*)val) == 32);
23646 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23647 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
23650 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
23651 LDKTransaction transaction_arg_ref;
23652 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
23653 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
23654 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
23655 transaction_arg_ref.data_is_owned = true;
23656 LDKThirtyTwoBytes txid_arg_ref;
23657 CHECK(*((uint32_t*)txid_arg) == 32);
23658 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
23659 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
23660 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23661 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23662 uint64_t ret_ref = (uint64_t)ret_var.inner;
23663 if (ret_var.is_owned) {
23669 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
23670 LDKBuiltCommitmentTransaction orig_conv;
23671 orig_conv.inner = (void*)(orig & (~1));
23672 orig_conv.is_owned = false;
23673 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
23674 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23675 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23676 uint64_t ret_ref = (uint64_t)ret_var.inner;
23677 if (ret_var.is_owned) {
23683 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
23684 LDKBuiltCommitmentTransaction obj_conv;
23685 obj_conv.inner = (void*)(obj & (~1));
23686 obj_conv.is_owned = false;
23687 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
23688 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23689 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23690 CVec_u8Z_free(ret_var);
23694 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
23695 LDKu8slice ser_ref;
23696 ser_ref.datalen = *((uint32_t*)ser);
23697 ser_ref.data = (int8_t*)(ser + 4);
23698 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
23699 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
23700 return (uint64_t)ret_conv;
23703 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
23704 LDKBuiltCommitmentTransaction this_arg_conv;
23705 this_arg_conv.inner = (void*)(this_arg & (~1));
23706 this_arg_conv.is_owned = false;
23707 LDKu8slice funding_redeemscript_ref;
23708 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
23709 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
23710 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23711 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
23715 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) {
23716 LDKBuiltCommitmentTransaction this_arg_conv;
23717 this_arg_conv.inner = (void*)(this_arg & (~1));
23718 this_arg_conv.is_owned = false;
23719 unsigned char funding_key_arr[32];
23720 CHECK(*((uint32_t*)funding_key) == 32);
23721 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
23722 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
23723 LDKu8slice funding_redeemscript_ref;
23724 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
23725 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
23726 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
23727 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
23731 void __attribute__((visibility("default"))) TS_ClosingTransaction_free(uint32_t this_obj) {
23732 LDKClosingTransaction this_obj_conv;
23733 this_obj_conv.inner = (void*)(this_obj & (~1));
23734 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23735 ClosingTransaction_free(this_obj_conv);
23738 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_clone(uint32_t orig) {
23739 LDKClosingTransaction orig_conv;
23740 orig_conv.inner = (void*)(orig & (~1));
23741 orig_conv.is_owned = false;
23742 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
23743 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23744 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23745 uint64_t ret_ref = (uint64_t)ret_var.inner;
23746 if (ret_var.is_owned) {
23752 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_hash(uint32_t o) {
23753 LDKClosingTransaction o_conv;
23754 o_conv.inner = (void*)(o & (~1));
23755 o_conv.is_owned = false;
23756 int64_t ret_val = ClosingTransaction_hash(&o_conv);
23760 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) {
23761 LDKCVec_u8Z to_holder_script_ref;
23762 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
23763 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
23764 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
23765 LDKCVec_u8Z to_counterparty_script_ref;
23766 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
23767 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
23768 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
23769 LDKOutPoint funding_outpoint_conv;
23770 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
23771 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
23772 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
23773 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
23774 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23775 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23776 uint64_t ret_ref = (uint64_t)ret_var.inner;
23777 if (ret_var.is_owned) {
23783 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
23784 LDKClosingTransaction this_arg_conv;
23785 this_arg_conv.inner = (void*)(this_arg & (~1));
23786 this_arg_conv.is_owned = false;
23787 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
23788 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23789 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23790 uint64_t ret_ref = (uint64_t)ret_var.inner;
23791 if (ret_var.is_owned) {
23797 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
23798 LDKClosingTransaction this_arg_conv;
23799 this_arg_conv.inner = (void*)(this_arg & (~1));
23800 this_arg_conv.is_owned = false;
23801 LDKOutPoint funding_outpoint_conv;
23802 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
23803 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
23804 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
23805 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
23806 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
23807 return (uint64_t)ret_conv;
23810 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
23811 LDKClosingTransaction this_arg_conv;
23812 this_arg_conv.inner = (void*)(this_arg & (~1));
23813 this_arg_conv.is_owned = false;
23814 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
23818 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
23819 LDKClosingTransaction this_arg_conv;
23820 this_arg_conv.inner = (void*)(this_arg & (~1));
23821 this_arg_conv.is_owned = false;
23822 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
23826 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
23827 LDKClosingTransaction this_arg_conv;
23828 this_arg_conv.inner = (void*)(this_arg & (~1));
23829 this_arg_conv.is_owned = false;
23830 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
23831 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23832 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23836 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
23837 LDKClosingTransaction this_arg_conv;
23838 this_arg_conv.inner = (void*)(this_arg & (~1));
23839 this_arg_conv.is_owned = false;
23840 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
23841 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23842 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23846 void __attribute__((visibility("default"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
23847 LDKTrustedClosingTransaction this_obj_conv;
23848 this_obj_conv.inner = (void*)(this_obj & (~1));
23849 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23850 TrustedClosingTransaction_free(this_obj_conv);
23853 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
23854 LDKTrustedClosingTransaction this_arg_conv;
23855 this_arg_conv.inner = (void*)(this_arg & (~1));
23856 this_arg_conv.is_owned = false;
23857 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
23858 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23859 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23860 Transaction_free(ret_var);
23864 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
23865 LDKTrustedClosingTransaction this_arg_conv;
23866 this_arg_conv.inner = (void*)(this_arg & (~1));
23867 this_arg_conv.is_owned = false;
23868 LDKu8slice funding_redeemscript_ref;
23869 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
23870 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
23871 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23872 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
23876 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) {
23877 LDKTrustedClosingTransaction this_arg_conv;
23878 this_arg_conv.inner = (void*)(this_arg & (~1));
23879 this_arg_conv.is_owned = false;
23880 unsigned char funding_key_arr[32];
23881 CHECK(*((uint32_t*)funding_key) == 32);
23882 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
23883 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
23884 LDKu8slice funding_redeemscript_ref;
23885 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
23886 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
23887 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
23888 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
23892 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
23893 LDKCommitmentTransaction this_obj_conv;
23894 this_obj_conv.inner = (void*)(this_obj & (~1));
23895 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23896 CommitmentTransaction_free(this_obj_conv);
23899 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
23900 LDKCommitmentTransaction orig_conv;
23901 orig_conv.inner = (void*)(orig & (~1));
23902 orig_conv.is_owned = false;
23903 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
23904 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23905 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23906 uint64_t ret_ref = (uint64_t)ret_var.inner;
23907 if (ret_var.is_owned) {
23913 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
23914 LDKCommitmentTransaction obj_conv;
23915 obj_conv.inner = (void*)(obj & (~1));
23916 obj_conv.is_owned = false;
23917 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
23918 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23919 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23920 CVec_u8Z_free(ret_var);
23924 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
23925 LDKu8slice ser_ref;
23926 ser_ref.datalen = *((uint32_t*)ser);
23927 ser_ref.data = (int8_t*)(ser + 4);
23928 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
23929 *ret_conv = CommitmentTransaction_read(ser_ref);
23930 return (uint64_t)ret_conv;
23933 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
23934 LDKCommitmentTransaction this_arg_conv;
23935 this_arg_conv.inner = (void*)(this_arg & (~1));
23936 this_arg_conv.is_owned = false;
23937 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
23941 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
23942 LDKCommitmentTransaction this_arg_conv;
23943 this_arg_conv.inner = (void*)(this_arg & (~1));
23944 this_arg_conv.is_owned = false;
23945 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
23949 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
23950 LDKCommitmentTransaction this_arg_conv;
23951 this_arg_conv.inner = (void*)(this_arg & (~1));
23952 this_arg_conv.is_owned = false;
23953 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
23957 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
23958 LDKCommitmentTransaction this_arg_conv;
23959 this_arg_conv.inner = (void*)(this_arg & (~1));
23960 this_arg_conv.is_owned = false;
23961 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
23965 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
23966 LDKCommitmentTransaction this_arg_conv;
23967 this_arg_conv.inner = (void*)(this_arg & (~1));
23968 this_arg_conv.is_owned = false;
23969 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
23970 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23971 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23972 uint64_t ret_ref = (uint64_t)ret_var.inner;
23973 if (ret_var.is_owned) {
23979 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
23980 LDKCommitmentTransaction this_arg_conv;
23981 this_arg_conv.inner = (void*)(this_arg & (~1));
23982 this_arg_conv.is_owned = false;
23983 LDKDirectedChannelTransactionParameters channel_parameters_conv;
23984 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
23985 channel_parameters_conv.is_owned = false;
23986 LDKChannelPublicKeys broadcaster_keys_conv;
23987 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
23988 broadcaster_keys_conv.is_owned = false;
23989 LDKChannelPublicKeys countersignatory_keys_conv;
23990 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
23991 countersignatory_keys_conv.is_owned = false;
23992 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
23993 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
23994 return (uint64_t)ret_conv;
23997 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
23998 LDKTrustedCommitmentTransaction this_obj_conv;
23999 this_obj_conv.inner = (void*)(this_obj & (~1));
24000 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24001 TrustedCommitmentTransaction_free(this_obj_conv);
24004 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
24005 LDKTrustedCommitmentTransaction this_arg_conv;
24006 this_arg_conv.inner = (void*)(this_arg & (~1));
24007 this_arg_conv.is_owned = false;
24008 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24009 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
24013 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
24014 LDKTrustedCommitmentTransaction this_arg_conv;
24015 this_arg_conv.inner = (void*)(this_arg & (~1));
24016 this_arg_conv.is_owned = false;
24017 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
24018 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24019 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24020 uint64_t ret_ref = (uint64_t)ret_var.inner;
24021 if (ret_var.is_owned) {
24027 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
24028 LDKTrustedCommitmentTransaction this_arg_conv;
24029 this_arg_conv.inner = (void*)(this_arg & (~1));
24030 this_arg_conv.is_owned = false;
24031 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
24032 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24033 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24034 uint64_t ret_ref = (uint64_t)ret_var.inner;
24035 if (ret_var.is_owned) {
24041 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
24042 LDKTrustedCommitmentTransaction this_arg_conv;
24043 this_arg_conv.inner = (void*)(this_arg & (~1));
24044 this_arg_conv.is_owned = false;
24045 unsigned char htlc_base_key_arr[32];
24046 CHECK(*((uint32_t*)htlc_base_key) == 32);
24047 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
24048 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
24049 LDKDirectedChannelTransactionParameters channel_parameters_conv;
24050 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
24051 channel_parameters_conv.is_owned = false;
24052 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
24053 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
24054 return (uint64_t)ret_conv;
24057 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) {
24058 LDKPublicKey broadcaster_payment_basepoint_ref;
24059 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
24060 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
24061 LDKPublicKey countersignatory_payment_basepoint_ref;
24062 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
24063 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
24064 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
24068 jboolean __attribute__((visibility("default"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
24069 LDKInitFeatures a_conv;
24070 a_conv.inner = (void*)(a & (~1));
24071 a_conv.is_owned = false;
24072 LDKInitFeatures b_conv;
24073 b_conv.inner = (void*)(b & (~1));
24074 b_conv.is_owned = false;
24075 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
24079 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
24080 LDKNodeFeatures a_conv;
24081 a_conv.inner = (void*)(a & (~1));
24082 a_conv.is_owned = false;
24083 LDKNodeFeatures b_conv;
24084 b_conv.inner = (void*)(b & (~1));
24085 b_conv.is_owned = false;
24086 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
24090 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
24091 LDKChannelFeatures a_conv;
24092 a_conv.inner = (void*)(a & (~1));
24093 a_conv.is_owned = false;
24094 LDKChannelFeatures b_conv;
24095 b_conv.inner = (void*)(b & (~1));
24096 b_conv.is_owned = false;
24097 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
24101 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
24102 LDKInvoiceFeatures a_conv;
24103 a_conv.inner = (void*)(a & (~1));
24104 a_conv.is_owned = false;
24105 LDKInvoiceFeatures b_conv;
24106 b_conv.inner = (void*)(b & (~1));
24107 b_conv.is_owned = false;
24108 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
24112 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
24113 LDKInitFeatures orig_conv;
24114 orig_conv.inner = (void*)(orig & (~1));
24115 orig_conv.is_owned = false;
24116 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
24117 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24118 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24119 uint64_t ret_ref = (uint64_t)ret_var.inner;
24120 if (ret_var.is_owned) {
24126 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
24127 LDKNodeFeatures orig_conv;
24128 orig_conv.inner = (void*)(orig & (~1));
24129 orig_conv.is_owned = false;
24130 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
24131 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24132 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24133 uint64_t ret_ref = (uint64_t)ret_var.inner;
24134 if (ret_var.is_owned) {
24140 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
24141 LDKChannelFeatures orig_conv;
24142 orig_conv.inner = (void*)(orig & (~1));
24143 orig_conv.is_owned = false;
24144 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
24145 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24146 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24147 uint64_t ret_ref = (uint64_t)ret_var.inner;
24148 if (ret_var.is_owned) {
24154 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
24155 LDKInvoiceFeatures orig_conv;
24156 orig_conv.inner = (void*)(orig & (~1));
24157 orig_conv.is_owned = false;
24158 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
24159 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24160 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24161 uint64_t ret_ref = (uint64_t)ret_var.inner;
24162 if (ret_var.is_owned) {
24168 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
24169 LDKInitFeatures this_obj_conv;
24170 this_obj_conv.inner = (void*)(this_obj & (~1));
24171 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24172 InitFeatures_free(this_obj_conv);
24175 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
24176 LDKNodeFeatures this_obj_conv;
24177 this_obj_conv.inner = (void*)(this_obj & (~1));
24178 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24179 NodeFeatures_free(this_obj_conv);
24182 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
24183 LDKChannelFeatures this_obj_conv;
24184 this_obj_conv.inner = (void*)(this_obj & (~1));
24185 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24186 ChannelFeatures_free(this_obj_conv);
24189 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
24190 LDKInvoiceFeatures this_obj_conv;
24191 this_obj_conv.inner = (void*)(this_obj & (~1));
24192 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24193 InvoiceFeatures_free(this_obj_conv);
24196 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
24197 LDKInitFeatures ret_var = InitFeatures_empty();
24198 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24199 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24200 uint64_t ret_ref = (uint64_t)ret_var.inner;
24201 if (ret_var.is_owned) {
24207 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
24208 LDKInitFeatures ret_var = InitFeatures_known();
24209 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24210 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24211 uint64_t ret_ref = (uint64_t)ret_var.inner;
24212 if (ret_var.is_owned) {
24218 jboolean __attribute__((visibility("default"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
24219 LDKInitFeatures this_arg_conv;
24220 this_arg_conv.inner = (void*)(this_arg & (~1));
24221 this_arg_conv.is_owned = false;
24222 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
24226 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
24227 LDKNodeFeatures ret_var = NodeFeatures_empty();
24228 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24229 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24230 uint64_t ret_ref = (uint64_t)ret_var.inner;
24231 if (ret_var.is_owned) {
24237 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
24238 LDKNodeFeatures ret_var = NodeFeatures_known();
24239 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24240 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24241 uint64_t ret_ref = (uint64_t)ret_var.inner;
24242 if (ret_var.is_owned) {
24248 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
24249 LDKNodeFeatures this_arg_conv;
24250 this_arg_conv.inner = (void*)(this_arg & (~1));
24251 this_arg_conv.is_owned = false;
24252 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
24256 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
24257 LDKChannelFeatures ret_var = ChannelFeatures_empty();
24258 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24259 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24260 uint64_t ret_ref = (uint64_t)ret_var.inner;
24261 if (ret_var.is_owned) {
24267 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
24268 LDKChannelFeatures ret_var = ChannelFeatures_known();
24269 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24270 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24271 uint64_t ret_ref = (uint64_t)ret_var.inner;
24272 if (ret_var.is_owned) {
24278 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
24279 LDKChannelFeatures this_arg_conv;
24280 this_arg_conv.inner = (void*)(this_arg & (~1));
24281 this_arg_conv.is_owned = false;
24282 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
24286 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
24287 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
24288 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24289 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24290 uint64_t ret_ref = (uint64_t)ret_var.inner;
24291 if (ret_var.is_owned) {
24297 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
24298 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
24299 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24300 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24301 uint64_t ret_ref = (uint64_t)ret_var.inner;
24302 if (ret_var.is_owned) {
24308 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
24309 LDKInvoiceFeatures this_arg_conv;
24310 this_arg_conv.inner = (void*)(this_arg & (~1));
24311 this_arg_conv.is_owned = false;
24312 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
24316 jboolean __attribute__((visibility("default"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
24317 LDKInitFeatures this_arg_conv;
24318 this_arg_conv.inner = (void*)(this_arg & (~1));
24319 this_arg_conv.is_owned = false;
24320 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
24324 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) {
24325 LDKNodeFeatures this_arg_conv;
24326 this_arg_conv.inner = (void*)(this_arg & (~1));
24327 this_arg_conv.is_owned = false;
24328 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
24332 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) {
24333 LDKInvoiceFeatures this_arg_conv;
24334 this_arg_conv.inner = (void*)(this_arg & (~1));
24335 this_arg_conv.is_owned = false;
24336 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
24340 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
24341 LDKInitFeatures obj_conv;
24342 obj_conv.inner = (void*)(obj & (~1));
24343 obj_conv.is_owned = false;
24344 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
24345 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24346 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24347 CVec_u8Z_free(ret_var);
24351 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
24352 LDKNodeFeatures obj_conv;
24353 obj_conv.inner = (void*)(obj & (~1));
24354 obj_conv.is_owned = false;
24355 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
24356 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24357 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24358 CVec_u8Z_free(ret_var);
24362 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
24363 LDKChannelFeatures obj_conv;
24364 obj_conv.inner = (void*)(obj & (~1));
24365 obj_conv.is_owned = false;
24366 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
24367 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24368 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24369 CVec_u8Z_free(ret_var);
24373 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
24374 LDKInvoiceFeatures obj_conv;
24375 obj_conv.inner = (void*)(obj & (~1));
24376 obj_conv.is_owned = false;
24377 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
24378 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24379 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24380 CVec_u8Z_free(ret_var);
24384 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
24385 LDKu8slice ser_ref;
24386 ser_ref.datalen = *((uint32_t*)ser);
24387 ser_ref.data = (int8_t*)(ser + 4);
24388 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
24389 *ret_conv = InitFeatures_read(ser_ref);
24390 return (uint64_t)ret_conv;
24393 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
24394 LDKu8slice ser_ref;
24395 ser_ref.datalen = *((uint32_t*)ser);
24396 ser_ref.data = (int8_t*)(ser + 4);
24397 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
24398 *ret_conv = NodeFeatures_read(ser_ref);
24399 return (uint64_t)ret_conv;
24402 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
24403 LDKu8slice ser_ref;
24404 ser_ref.datalen = *((uint32_t*)ser);
24405 ser_ref.data = (int8_t*)(ser + 4);
24406 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
24407 *ret_conv = ChannelFeatures_read(ser_ref);
24408 return (uint64_t)ret_conv;
24411 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
24412 LDKu8slice ser_ref;
24413 ser_ref.datalen = *((uint32_t*)ser);
24414 ser_ref.data = (int8_t*)(ser + 4);
24415 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
24416 *ret_conv = InvoiceFeatures_read(ser_ref);
24417 return (uint64_t)ret_conv;
24420 void __attribute__((visibility("default"))) TS_ShutdownScript_free(uint32_t this_obj) {
24421 LDKShutdownScript this_obj_conv;
24422 this_obj_conv.inner = (void*)(this_obj & (~1));
24423 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24424 ShutdownScript_free(this_obj_conv);
24427 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_clone(uint32_t orig) {
24428 LDKShutdownScript orig_conv;
24429 orig_conv.inner = (void*)(orig & (~1));
24430 orig_conv.is_owned = false;
24431 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_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_InvalidShutdownScript_free(uint32_t this_obj) {
24442 LDKInvalidShutdownScript this_obj_conv;
24443 this_obj_conv.inner = (void*)(this_obj & (~1));
24444 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24445 InvalidShutdownScript_free(this_obj_conv);
24448 int8_tArray __attribute__((visibility("default"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
24449 LDKInvalidShutdownScript this_ptr_conv;
24450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24451 this_ptr_conv.is_owned = false;
24452 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
24453 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24454 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24458 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
24459 LDKInvalidShutdownScript this_ptr_conv;
24460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24461 this_ptr_conv.is_owned = false;
24462 LDKCVec_u8Z val_ref;
24463 val_ref.datalen = *((uint32_t*)val);
24464 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
24465 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
24466 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
24469 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
24470 LDKCVec_u8Z script_arg_ref;
24471 script_arg_ref.datalen = *((uint32_t*)script_arg);
24472 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
24473 memcpy(script_arg_ref.data, (uint8_t*)(script_arg + 4), script_arg_ref.datalen);
24474 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
24475 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24476 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24477 uint64_t ret_ref = (uint64_t)ret_var.inner;
24478 if (ret_var.is_owned) {
24484 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_clone(uint32_t orig) {
24485 LDKInvalidShutdownScript orig_conv;
24486 orig_conv.inner = (void*)(orig & (~1));
24487 orig_conv.is_owned = false;
24488 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
24489 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24490 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24491 uint64_t ret_ref = (uint64_t)ret_var.inner;
24492 if (ret_var.is_owned) {
24498 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_write(uint32_t obj) {
24499 LDKShutdownScript obj_conv;
24500 obj_conv.inner = (void*)(obj & (~1));
24501 obj_conv.is_owned = false;
24502 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
24503 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24504 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24505 CVec_u8Z_free(ret_var);
24509 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_read(int8_tArray ser) {
24510 LDKu8slice ser_ref;
24511 ser_ref.datalen = *((uint32_t*)ser);
24512 ser_ref.data = (int8_t*)(ser + 4);
24513 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
24514 *ret_conv = ShutdownScript_read(ser_ref);
24515 return (uint64_t)ret_conv;
24518 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
24519 unsigned char pubkey_hash_arr[20];
24520 CHECK(*((uint32_t*)pubkey_hash) == 20);
24521 memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
24522 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
24523 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
24524 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24525 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24526 uint64_t ret_ref = (uint64_t)ret_var.inner;
24527 if (ret_var.is_owned) {
24533 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
24534 unsigned char script_hash_arr[32];
24535 CHECK(*((uint32_t*)script_hash) == 32);
24536 memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 32);
24537 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
24538 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
24539 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24540 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24541 uint64_t ret_ref = (uint64_t)ret_var.inner;
24542 if (ret_var.is_owned) {
24548 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
24549 LDKu8slice program_ref;
24550 program_ref.datalen = *((uint32_t*)program);
24551 program_ref.data = (int8_t*)(program + 4);
24552 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
24553 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
24554 return (uint64_t)ret_conv;
24557 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
24558 LDKShutdownScript this_arg_conv;
24559 this_arg_conv.inner = (void*)(this_arg & (~1));
24560 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24561 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
24562 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
24563 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24564 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24565 CVec_u8Z_free(ret_var);
24569 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
24570 LDKShutdownScript this_arg_conv;
24571 this_arg_conv.inner = (void*)(this_arg & (~1));
24572 this_arg_conv.is_owned = false;
24573 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24574 memcpy((uint8_t*)(ret_arr + 4), ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
24578 jboolean __attribute__((visibility("default"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
24579 LDKShutdownScript this_arg_conv;
24580 this_arg_conv.inner = (void*)(this_arg & (~1));
24581 this_arg_conv.is_owned = false;
24582 LDKInitFeatures features_conv;
24583 features_conv.inner = (void*)(features & (~1));
24584 features_conv.is_owned = false;
24585 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
24589 void __attribute__((visibility("default"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
24590 if ((this_ptr & 1) != 0) return;
24591 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
24592 CHECK_ACCESS(this_ptr_ptr);
24593 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
24594 FREE((void*)this_ptr);
24595 CustomMessageReader_free(this_ptr_conv);
24598 uint32_t __attribute__((visibility("default"))) TS_Type_clone(uint32_t orig) {
24599 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
24600 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
24601 LDKType* orig_conv = (LDKType*)orig_ptr;
24602 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
24603 *ret_ret = Type_clone(orig_conv);
24604 return (uint64_t)ret_ret;
24607 void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) {
24608 if ((this_ptr & 1) != 0) return;
24609 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
24610 CHECK_ACCESS(this_ptr_ptr);
24611 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
24612 FREE((void*)this_ptr);
24613 Type_free(this_ptr_conv);
24616 void __attribute__((visibility("default"))) TS_Score_free(uint32_t this_ptr) {
24617 if ((this_ptr & 1) != 0) return;
24618 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
24619 CHECK_ACCESS(this_ptr_ptr);
24620 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
24621 FREE((void*)this_ptr);
24622 Score_free(this_ptr_conv);
24625 void __attribute__((visibility("default"))) TS_NodeId_free(uint32_t this_obj) {
24626 LDKNodeId this_obj_conv;
24627 this_obj_conv.inner = (void*)(this_obj & (~1));
24628 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24629 NodeId_free(this_obj_conv);
24632 uint32_t __attribute__((visibility("default"))) TS_NodeId_clone(uint32_t orig) {
24633 LDKNodeId orig_conv;
24634 orig_conv.inner = (void*)(orig & (~1));
24635 orig_conv.is_owned = false;
24636 LDKNodeId ret_var = NodeId_clone(&orig_conv);
24637 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24638 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24639 uint64_t ret_ref = (uint64_t)ret_var.inner;
24640 if (ret_var.is_owned) {
24646 uint32_t __attribute__((visibility("default"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
24647 LDKPublicKey pubkey_ref;
24648 CHECK(*((uint32_t*)pubkey) == 33);
24649 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
24650 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
24651 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24652 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24653 uint64_t ret_ref = (uint64_t)ret_var.inner;
24654 if (ret_var.is_owned) {
24660 int8_tArray __attribute__((visibility("default"))) TS_NodeId_as_slice(uint32_t this_arg) {
24661 LDKNodeId this_arg_conv;
24662 this_arg_conv.inner = (void*)(this_arg & (~1));
24663 this_arg_conv.is_owned = false;
24664 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
24665 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24666 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24670 int64_t __attribute__((visibility("default"))) TS_NodeId_hash(uint32_t o) {
24672 o_conv.inner = (void*)(o & (~1));
24673 o_conv.is_owned = false;
24674 int64_t ret_val = NodeId_hash(&o_conv);
24678 int8_tArray __attribute__((visibility("default"))) TS_NodeId_write(uint32_t obj) {
24679 LDKNodeId obj_conv;
24680 obj_conv.inner = (void*)(obj & (~1));
24681 obj_conv.is_owned = false;
24682 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
24683 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24684 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24685 CVec_u8Z_free(ret_var);
24689 uint32_t __attribute__((visibility("default"))) TS_NodeId_read(int8_tArray ser) {
24690 LDKu8slice ser_ref;
24691 ser_ref.datalen = *((uint32_t*)ser);
24692 ser_ref.data = (int8_t*)(ser + 4);
24693 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24694 *ret_conv = NodeId_read(ser_ref);
24695 return (uint64_t)ret_conv;
24698 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
24699 LDKNetworkGraph this_obj_conv;
24700 this_obj_conv.inner = (void*)(this_obj & (~1));
24701 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24702 NetworkGraph_free(this_obj_conv);
24705 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
24706 LDKNetworkGraph orig_conv;
24707 orig_conv.inner = (void*)(orig & (~1));
24708 orig_conv.is_owned = false;
24709 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
24710 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24711 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24712 uint64_t ret_ref = (uint64_t)ret_var.inner;
24713 if (ret_var.is_owned) {
24719 void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
24720 LDKReadOnlyNetworkGraph this_obj_conv;
24721 this_obj_conv.inner = (void*)(this_obj & (~1));
24722 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24723 ReadOnlyNetworkGraph_free(this_obj_conv);
24726 void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
24727 if ((this_ptr & 1) != 0) return;
24728 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
24729 CHECK_ACCESS(this_ptr_ptr);
24730 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
24731 FREE((void*)this_ptr);
24732 NetworkUpdate_free(this_ptr_conv);
24735 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) {
24736 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
24737 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
24738 *ret_copy = NetworkUpdate_clone(orig_conv);
24739 uint64_t ret_ref = (uint64_t)ret_copy;
24743 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
24744 LDKChannelUpdate msg_conv;
24745 msg_conv.inner = (void*)(msg & (~1));
24746 msg_conv.is_owned = (msg & 1) || (msg == 0);
24747 msg_conv = ChannelUpdate_clone(&msg_conv);
24748 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
24749 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
24750 uint64_t ret_ref = (uint64_t)ret_copy;
24754 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
24755 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
24756 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
24757 uint64_t ret_ref = (uint64_t)ret_copy;
24761 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
24762 LDKPublicKey node_id_ref;
24763 CHECK(*((uint32_t*)node_id) == 33);
24764 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
24765 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
24766 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
24767 uint64_t ret_ref = (uint64_t)ret_copy;
24771 int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) {
24772 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
24773 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
24774 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24775 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24776 CVec_u8Z_free(ret_var);
24780 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
24781 LDKNetGraphMsgHandler this_arg_conv;
24782 this_arg_conv.inner = (void*)(this_arg & (~1));
24783 this_arg_conv.is_owned = false;
24784 LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
24785 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
24786 return (uint64_t)ret_ret;
24789 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
24790 LDKNetGraphMsgHandler this_obj_conv;
24791 this_obj_conv.inner = (void*)(this_obj & (~1));
24792 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24793 NetGraphMsgHandler_free(this_obj_conv);
24796 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_get_network_graph(uint32_t this_ptr) {
24797 LDKNetGraphMsgHandler this_ptr_conv;
24798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24799 this_ptr_conv.is_owned = false;
24800 LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv);
24801 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24802 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24803 uint64_t ret_ref = (uint64_t)ret_var.inner;
24804 if (ret_var.is_owned) {
24810 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_set_network_graph(uint32_t this_ptr, uint32_t val) {
24811 LDKNetGraphMsgHandler this_ptr_conv;
24812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24813 this_ptr_conv.is_owned = false;
24814 LDKNetworkGraph val_conv;
24815 val_conv.inner = (void*)(val & (~1));
24816 val_conv.is_owned = (val & 1) || (val == 0);
24817 val_conv = NetworkGraph_clone(&val_conv);
24818 NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv);
24821 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
24822 LDKNetworkGraph network_graph_conv;
24823 network_graph_conv.inner = (void*)(network_graph & (~1));
24824 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
24825 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
24826 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
24827 CHECK_ACCESS(chain_access_ptr);
24828 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
24829 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
24830 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
24831 // Manually implement clone for Java trait instances
24833 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
24834 CHECK_ACCESS(logger_ptr);
24835 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24836 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv);
24837 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24838 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24839 uint64_t ret_ref = (uint64_t)ret_var.inner;
24840 if (ret_var.is_owned) {
24846 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
24847 LDKNetGraphMsgHandler this_arg_conv;
24848 this_arg_conv.inner = (void*)(this_arg & (~1));
24849 this_arg_conv.is_owned = false;
24850 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
24851 CHECK_ACCESS(chain_access_ptr);
24852 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
24853 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
24854 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
24855 // Manually implement clone for Java trait instances
24857 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
24860 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
24861 LDKNetGraphMsgHandler this_arg_conv;
24862 this_arg_conv.inner = (void*)(this_arg & (~1));
24863 this_arg_conv.is_owned = false;
24864 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
24865 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
24866 return (uint64_t)ret_ret;
24869 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
24870 LDKNetGraphMsgHandler this_arg_conv;
24871 this_arg_conv.inner = (void*)(this_arg & (~1));
24872 this_arg_conv.is_owned = false;
24873 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
24874 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
24875 return (uint64_t)ret_ret;
24878 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
24879 LDKDirectionalChannelInfo this_obj_conv;
24880 this_obj_conv.inner = (void*)(this_obj & (~1));
24881 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24882 DirectionalChannelInfo_free(this_obj_conv);
24885 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
24886 LDKDirectionalChannelInfo this_ptr_conv;
24887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24888 this_ptr_conv.is_owned = false;
24889 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
24893 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
24894 LDKDirectionalChannelInfo this_ptr_conv;
24895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24896 this_ptr_conv.is_owned = false;
24897 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
24900 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
24901 LDKDirectionalChannelInfo this_ptr_conv;
24902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24903 this_ptr_conv.is_owned = false;
24904 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
24908 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
24909 LDKDirectionalChannelInfo this_ptr_conv;
24910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24911 this_ptr_conv.is_owned = false;
24912 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
24915 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
24916 LDKDirectionalChannelInfo this_ptr_conv;
24917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24918 this_ptr_conv.is_owned = false;
24919 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
24923 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
24924 LDKDirectionalChannelInfo this_ptr_conv;
24925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24926 this_ptr_conv.is_owned = false;
24927 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
24930 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
24931 LDKDirectionalChannelInfo this_ptr_conv;
24932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24933 this_ptr_conv.is_owned = false;
24934 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
24938 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
24939 LDKDirectionalChannelInfo this_ptr_conv;
24940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24941 this_ptr_conv.is_owned = false;
24942 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
24945 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
24946 LDKDirectionalChannelInfo this_ptr_conv;
24947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24948 this_ptr_conv.is_owned = false;
24949 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24950 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
24951 uint64_t ret_ref = (uint64_t)ret_copy;
24955 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
24956 LDKDirectionalChannelInfo this_ptr_conv;
24957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24958 this_ptr_conv.is_owned = false;
24959 void* val_ptr = (void*)(((uint64_t)val) & ~1);
24960 CHECK_ACCESS(val_ptr);
24961 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
24962 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
24963 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
24966 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
24967 LDKDirectionalChannelInfo this_ptr_conv;
24968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24969 this_ptr_conv.is_owned = false;
24970 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
24971 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24972 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24973 uint64_t ret_ref = (uint64_t)ret_var.inner;
24974 if (ret_var.is_owned) {
24980 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
24981 LDKDirectionalChannelInfo this_ptr_conv;
24982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24983 this_ptr_conv.is_owned = false;
24984 LDKRoutingFees val_conv;
24985 val_conv.inner = (void*)(val & (~1));
24986 val_conv.is_owned = (val & 1) || (val == 0);
24987 val_conv = RoutingFees_clone(&val_conv);
24988 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
24991 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
24992 LDKDirectionalChannelInfo this_ptr_conv;
24993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24994 this_ptr_conv.is_owned = false;
24995 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
24996 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24997 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24998 uint64_t ret_ref = (uint64_t)ret_var.inner;
24999 if (ret_var.is_owned) {
25005 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
25006 LDKDirectionalChannelInfo this_ptr_conv;
25007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25008 this_ptr_conv.is_owned = false;
25009 LDKChannelUpdate val_conv;
25010 val_conv.inner = (void*)(val & (~1));
25011 val_conv.is_owned = (val & 1) || (val == 0);
25012 val_conv = ChannelUpdate_clone(&val_conv);
25013 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
25016 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) {
25017 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
25018 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
25019 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
25020 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
25021 LDKRoutingFees fees_arg_conv;
25022 fees_arg_conv.inner = (void*)(fees_arg & (~1));
25023 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
25024 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
25025 LDKChannelUpdate last_update_message_arg_conv;
25026 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
25027 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
25028 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
25029 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);
25030 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25031 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25032 uint64_t ret_ref = (uint64_t)ret_var.inner;
25033 if (ret_var.is_owned) {
25039 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
25040 LDKDirectionalChannelInfo orig_conv;
25041 orig_conv.inner = (void*)(orig & (~1));
25042 orig_conv.is_owned = false;
25043 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
25044 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25045 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25046 uint64_t ret_ref = (uint64_t)ret_var.inner;
25047 if (ret_var.is_owned) {
25053 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
25054 LDKDirectionalChannelInfo obj_conv;
25055 obj_conv.inner = (void*)(obj & (~1));
25056 obj_conv.is_owned = false;
25057 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
25058 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25059 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25060 CVec_u8Z_free(ret_var);
25064 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
25065 LDKu8slice ser_ref;
25066 ser_ref.datalen = *((uint32_t*)ser);
25067 ser_ref.data = (int8_t*)(ser + 4);
25068 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
25069 *ret_conv = DirectionalChannelInfo_read(ser_ref);
25070 return (uint64_t)ret_conv;
25073 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
25074 LDKChannelInfo this_obj_conv;
25075 this_obj_conv.inner = (void*)(this_obj & (~1));
25076 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25077 ChannelInfo_free(this_obj_conv);
25080 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
25081 LDKChannelInfo this_ptr_conv;
25082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25083 this_ptr_conv.is_owned = false;
25084 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
25085 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25086 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25087 uint64_t ret_ref = (uint64_t)ret_var.inner;
25088 if (ret_var.is_owned) {
25094 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
25095 LDKChannelInfo this_ptr_conv;
25096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25097 this_ptr_conv.is_owned = false;
25098 LDKChannelFeatures val_conv;
25099 val_conv.inner = (void*)(val & (~1));
25100 val_conv.is_owned = (val & 1) || (val == 0);
25101 val_conv = ChannelFeatures_clone(&val_conv);
25102 ChannelInfo_set_features(&this_ptr_conv, val_conv);
25105 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
25106 LDKChannelInfo this_ptr_conv;
25107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25108 this_ptr_conv.is_owned = false;
25109 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
25110 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25111 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25112 uint64_t ret_ref = (uint64_t)ret_var.inner;
25113 if (ret_var.is_owned) {
25119 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
25120 LDKChannelInfo this_ptr_conv;
25121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25122 this_ptr_conv.is_owned = false;
25123 LDKNodeId val_conv;
25124 val_conv.inner = (void*)(val & (~1));
25125 val_conv.is_owned = (val & 1) || (val == 0);
25126 val_conv = NodeId_clone(&val_conv);
25127 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
25130 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
25131 LDKChannelInfo this_ptr_conv;
25132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25133 this_ptr_conv.is_owned = false;
25134 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
25135 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25136 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25137 uint64_t ret_ref = (uint64_t)ret_var.inner;
25138 if (ret_var.is_owned) {
25144 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
25145 LDKChannelInfo this_ptr_conv;
25146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25147 this_ptr_conv.is_owned = false;
25148 LDKDirectionalChannelInfo val_conv;
25149 val_conv.inner = (void*)(val & (~1));
25150 val_conv.is_owned = (val & 1) || (val == 0);
25151 val_conv = DirectionalChannelInfo_clone(&val_conv);
25152 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
25155 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
25156 LDKChannelInfo this_ptr_conv;
25157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25158 this_ptr_conv.is_owned = false;
25159 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
25160 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25161 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25162 uint64_t ret_ref = (uint64_t)ret_var.inner;
25163 if (ret_var.is_owned) {
25169 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
25170 LDKChannelInfo this_ptr_conv;
25171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25172 this_ptr_conv.is_owned = false;
25173 LDKNodeId val_conv;
25174 val_conv.inner = (void*)(val & (~1));
25175 val_conv.is_owned = (val & 1) || (val == 0);
25176 val_conv = NodeId_clone(&val_conv);
25177 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
25180 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
25181 LDKChannelInfo this_ptr_conv;
25182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25183 this_ptr_conv.is_owned = false;
25184 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
25185 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25186 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25187 uint64_t ret_ref = (uint64_t)ret_var.inner;
25188 if (ret_var.is_owned) {
25194 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
25195 LDKChannelInfo this_ptr_conv;
25196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25197 this_ptr_conv.is_owned = false;
25198 LDKDirectionalChannelInfo val_conv;
25199 val_conv.inner = (void*)(val & (~1));
25200 val_conv.is_owned = (val & 1) || (val == 0);
25201 val_conv = DirectionalChannelInfo_clone(&val_conv);
25202 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
25205 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
25206 LDKChannelInfo this_ptr_conv;
25207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25208 this_ptr_conv.is_owned = false;
25209 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25210 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
25211 uint64_t ret_ref = (uint64_t)ret_copy;
25215 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
25216 LDKChannelInfo this_ptr_conv;
25217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25218 this_ptr_conv.is_owned = false;
25219 void* val_ptr = (void*)(((uint64_t)val) & ~1);
25220 CHECK_ACCESS(val_ptr);
25221 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25222 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
25223 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
25226 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
25227 LDKChannelInfo this_ptr_conv;
25228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25229 this_ptr_conv.is_owned = false;
25230 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
25231 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25232 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25233 uint64_t ret_ref = (uint64_t)ret_var.inner;
25234 if (ret_var.is_owned) {
25240 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
25241 LDKChannelInfo this_ptr_conv;
25242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25243 this_ptr_conv.is_owned = false;
25244 LDKChannelAnnouncement val_conv;
25245 val_conv.inner = (void*)(val & (~1));
25246 val_conv.is_owned = (val & 1) || (val == 0);
25247 val_conv = ChannelAnnouncement_clone(&val_conv);
25248 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
25251 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_new(uint32_t features_arg, uint32_t node_one_arg, uint32_t one_to_two_arg, uint32_t node_two_arg, uint32_t two_to_one_arg, uint32_t capacity_sats_arg, uint32_t announcement_message_arg) {
25252 LDKChannelFeatures features_arg_conv;
25253 features_arg_conv.inner = (void*)(features_arg & (~1));
25254 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
25255 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
25256 LDKNodeId node_one_arg_conv;
25257 node_one_arg_conv.inner = (void*)(node_one_arg & (~1));
25258 node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0);
25259 node_one_arg_conv = NodeId_clone(&node_one_arg_conv);
25260 LDKDirectionalChannelInfo one_to_two_arg_conv;
25261 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
25262 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
25263 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
25264 LDKNodeId node_two_arg_conv;
25265 node_two_arg_conv.inner = (void*)(node_two_arg & (~1));
25266 node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0);
25267 node_two_arg_conv = NodeId_clone(&node_two_arg_conv);
25268 LDKDirectionalChannelInfo two_to_one_arg_conv;
25269 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
25270 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
25271 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
25272 void* capacity_sats_arg_ptr = (void*)(((uint64_t)capacity_sats_arg) & ~1);
25273 CHECK_ACCESS(capacity_sats_arg_ptr);
25274 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(capacity_sats_arg_ptr);
25275 capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
25276 LDKChannelAnnouncement announcement_message_arg_conv;
25277 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
25278 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
25279 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
25280 LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_conv, one_to_two_arg_conv, node_two_arg_conv, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv);
25281 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25282 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25283 uint64_t ret_ref = (uint64_t)ret_var.inner;
25284 if (ret_var.is_owned) {
25290 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
25291 LDKChannelInfo orig_conv;
25292 orig_conv.inner = (void*)(orig & (~1));
25293 orig_conv.is_owned = false;
25294 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
25295 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25296 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25297 uint64_t ret_ref = (uint64_t)ret_var.inner;
25298 if (ret_var.is_owned) {
25304 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
25305 LDKChannelInfo obj_conv;
25306 obj_conv.inner = (void*)(obj & (~1));
25307 obj_conv.is_owned = false;
25308 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
25309 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25310 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25311 CVec_u8Z_free(ret_var);
25315 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
25316 LDKu8slice ser_ref;
25317 ser_ref.datalen = *((uint32_t*)ser);
25318 ser_ref.data = (int8_t*)(ser + 4);
25319 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
25320 *ret_conv = ChannelInfo_read(ser_ref);
25321 return (uint64_t)ret_conv;
25324 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
25325 LDKRoutingFees this_obj_conv;
25326 this_obj_conv.inner = (void*)(this_obj & (~1));
25327 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25328 RoutingFees_free(this_obj_conv);
25331 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
25332 LDKRoutingFees this_ptr_conv;
25333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25334 this_ptr_conv.is_owned = false;
25335 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
25339 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
25340 LDKRoutingFees this_ptr_conv;
25341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25342 this_ptr_conv.is_owned = false;
25343 RoutingFees_set_base_msat(&this_ptr_conv, val);
25346 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
25347 LDKRoutingFees this_ptr_conv;
25348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25349 this_ptr_conv.is_owned = false;
25350 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
25354 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
25355 LDKRoutingFees this_ptr_conv;
25356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25357 this_ptr_conv.is_owned = false;
25358 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
25361 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
25362 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
25363 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25364 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25365 uint64_t ret_ref = (uint64_t)ret_var.inner;
25366 if (ret_var.is_owned) {
25372 jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
25373 LDKRoutingFees a_conv;
25374 a_conv.inner = (void*)(a & (~1));
25375 a_conv.is_owned = false;
25376 LDKRoutingFees b_conv;
25377 b_conv.inner = (void*)(b & (~1));
25378 b_conv.is_owned = false;
25379 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
25383 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
25384 LDKRoutingFees orig_conv;
25385 orig_conv.inner = (void*)(orig & (~1));
25386 orig_conv.is_owned = false;
25387 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
25388 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25389 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25390 uint64_t ret_ref = (uint64_t)ret_var.inner;
25391 if (ret_var.is_owned) {
25397 int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) {
25398 LDKRoutingFees o_conv;
25399 o_conv.inner = (void*)(o & (~1));
25400 o_conv.is_owned = false;
25401 int64_t ret_val = RoutingFees_hash(&o_conv);
25405 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
25406 LDKRoutingFees obj_conv;
25407 obj_conv.inner = (void*)(obj & (~1));
25408 obj_conv.is_owned = false;
25409 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
25410 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25411 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25412 CVec_u8Z_free(ret_var);
25416 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
25417 LDKu8slice ser_ref;
25418 ser_ref.datalen = *((uint32_t*)ser);
25419 ser_ref.data = (int8_t*)(ser + 4);
25420 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
25421 *ret_conv = RoutingFees_read(ser_ref);
25422 return (uint64_t)ret_conv;
25425 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
25426 LDKNodeAnnouncementInfo this_obj_conv;
25427 this_obj_conv.inner = (void*)(this_obj & (~1));
25428 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25429 NodeAnnouncementInfo_free(this_obj_conv);
25432 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
25433 LDKNodeAnnouncementInfo this_ptr_conv;
25434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25435 this_ptr_conv.is_owned = false;
25436 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
25437 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25438 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25439 uint64_t ret_ref = (uint64_t)ret_var.inner;
25440 if (ret_var.is_owned) {
25446 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
25447 LDKNodeAnnouncementInfo this_ptr_conv;
25448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25449 this_ptr_conv.is_owned = false;
25450 LDKNodeFeatures val_conv;
25451 val_conv.inner = (void*)(val & (~1));
25452 val_conv.is_owned = (val & 1) || (val == 0);
25453 val_conv = NodeFeatures_clone(&val_conv);
25454 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
25457 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
25458 LDKNodeAnnouncementInfo this_ptr_conv;
25459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25460 this_ptr_conv.is_owned = false;
25461 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
25465 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
25466 LDKNodeAnnouncementInfo this_ptr_conv;
25467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25468 this_ptr_conv.is_owned = false;
25469 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
25472 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
25473 LDKNodeAnnouncementInfo this_ptr_conv;
25474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25475 this_ptr_conv.is_owned = false;
25476 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
25477 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
25481 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
25482 LDKNodeAnnouncementInfo this_ptr_conv;
25483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25484 this_ptr_conv.is_owned = false;
25485 LDKThreeBytes val_ref;
25486 CHECK(*((uint32_t*)val) == 3);
25487 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
25488 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
25491 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
25492 LDKNodeAnnouncementInfo this_ptr_conv;
25493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25494 this_ptr_conv.is_owned = false;
25495 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25496 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
25500 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
25501 LDKNodeAnnouncementInfo this_ptr_conv;
25502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25503 this_ptr_conv.is_owned = false;
25504 LDKThirtyTwoBytes val_ref;
25505 CHECK(*((uint32_t*)val) == 32);
25506 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
25507 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
25510 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
25511 LDKNodeAnnouncementInfo this_ptr_conv;
25512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25513 this_ptr_conv.is_owned = false;
25514 LDKCVec_NetAddressZ val_constr;
25515 val_constr.datalen = *((uint32_t*)val);
25516 if (val_constr.datalen > 0)
25517 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
25519 val_constr.data = NULL;
25520 uint32_t* val_vals = (uint32_t*)(val + 4);
25521 for (size_t m = 0; m < val_constr.datalen; m++) {
25522 uint32_t val_conv_12 = val_vals[m];
25523 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
25524 CHECK_ACCESS(val_conv_12_ptr);
25525 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
25526 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
25527 val_constr.data[m] = val_conv_12_conv;
25529 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
25532 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
25533 LDKNodeAnnouncementInfo this_ptr_conv;
25534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25535 this_ptr_conv.is_owned = false;
25536 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
25537 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25538 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25539 uint64_t ret_ref = (uint64_t)ret_var.inner;
25540 if (ret_var.is_owned) {
25546 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
25547 LDKNodeAnnouncementInfo this_ptr_conv;
25548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25549 this_ptr_conv.is_owned = false;
25550 LDKNodeAnnouncement val_conv;
25551 val_conv.inner = (void*)(val & (~1));
25552 val_conv.is_owned = (val & 1) || (val == 0);
25553 val_conv = NodeAnnouncement_clone(&val_conv);
25554 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
25557 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) {
25558 LDKNodeFeatures features_arg_conv;
25559 features_arg_conv.inner = (void*)(features_arg & (~1));
25560 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
25561 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
25562 LDKThreeBytes rgb_arg_ref;
25563 CHECK(*((uint32_t*)rgb_arg) == 3);
25564 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
25565 LDKThirtyTwoBytes alias_arg_ref;
25566 CHECK(*((uint32_t*)alias_arg) == 32);
25567 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
25568 LDKCVec_NetAddressZ addresses_arg_constr;
25569 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
25570 if (addresses_arg_constr.datalen > 0)
25571 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
25573 addresses_arg_constr.data = NULL;
25574 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
25575 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
25576 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
25577 void* addresses_arg_conv_12_ptr = (void*)(((uint64_t)addresses_arg_conv_12) & ~1);
25578 CHECK_ACCESS(addresses_arg_conv_12_ptr);
25579 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
25580 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
25582 LDKNodeAnnouncement announcement_message_arg_conv;
25583 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
25584 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
25585 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
25586 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
25587 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25588 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25589 uint64_t ret_ref = (uint64_t)ret_var.inner;
25590 if (ret_var.is_owned) {
25596 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
25597 LDKNodeAnnouncementInfo orig_conv;
25598 orig_conv.inner = (void*)(orig & (~1));
25599 orig_conv.is_owned = false;
25600 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
25601 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25602 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25603 uint64_t ret_ref = (uint64_t)ret_var.inner;
25604 if (ret_var.is_owned) {
25610 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
25611 LDKNodeAnnouncementInfo obj_conv;
25612 obj_conv.inner = (void*)(obj & (~1));
25613 obj_conv.is_owned = false;
25614 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
25615 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25616 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25617 CVec_u8Z_free(ret_var);
25621 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
25622 LDKu8slice ser_ref;
25623 ser_ref.datalen = *((uint32_t*)ser);
25624 ser_ref.data = (int8_t*)(ser + 4);
25625 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
25626 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
25627 return (uint64_t)ret_conv;
25630 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
25631 LDKNodeInfo this_obj_conv;
25632 this_obj_conv.inner = (void*)(this_obj & (~1));
25633 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25634 NodeInfo_free(this_obj_conv);
25637 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
25638 LDKNodeInfo this_ptr_conv;
25639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25640 this_ptr_conv.is_owned = false;
25641 LDKCVec_u64Z val_constr;
25642 val_constr.datalen = *((uint32_t*)val);
25643 if (val_constr.datalen > 0)
25644 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
25646 val_constr.data = NULL;
25647 int64_t* val_vals = (int64_t*)(val + 4);
25648 for (size_t i = 0; i < val_constr.datalen; i++) {
25649 int64_t val_conv_8 = val_vals[i];
25650 val_constr.data[i] = val_conv_8;
25652 NodeInfo_set_channels(&this_ptr_conv, val_constr);
25655 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
25656 LDKNodeInfo this_ptr_conv;
25657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25658 this_ptr_conv.is_owned = false;
25659 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
25660 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25661 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25662 uint64_t ret_ref = (uint64_t)ret_var.inner;
25663 if (ret_var.is_owned) {
25669 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
25670 LDKNodeInfo this_ptr_conv;
25671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25672 this_ptr_conv.is_owned = false;
25673 LDKRoutingFees val_conv;
25674 val_conv.inner = (void*)(val & (~1));
25675 val_conv.is_owned = (val & 1) || (val == 0);
25676 val_conv = RoutingFees_clone(&val_conv);
25677 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
25680 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
25681 LDKNodeInfo this_ptr_conv;
25682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25683 this_ptr_conv.is_owned = false;
25684 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
25685 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25686 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25687 uint64_t ret_ref = (uint64_t)ret_var.inner;
25688 if (ret_var.is_owned) {
25694 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
25695 LDKNodeInfo this_ptr_conv;
25696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25697 this_ptr_conv.is_owned = false;
25698 LDKNodeAnnouncementInfo val_conv;
25699 val_conv.inner = (void*)(val & (~1));
25700 val_conv.is_owned = (val & 1) || (val == 0);
25701 val_conv = NodeAnnouncementInfo_clone(&val_conv);
25702 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
25705 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
25706 LDKCVec_u64Z channels_arg_constr;
25707 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
25708 if (channels_arg_constr.datalen > 0)
25709 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
25711 channels_arg_constr.data = NULL;
25712 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
25713 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
25714 int64_t channels_arg_conv_8 = channels_arg_vals[i];
25715 channels_arg_constr.data[i] = channels_arg_conv_8;
25717 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
25718 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
25719 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
25720 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
25721 LDKNodeAnnouncementInfo announcement_info_arg_conv;
25722 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
25723 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
25724 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
25725 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
25726 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25727 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25728 uint64_t ret_ref = (uint64_t)ret_var.inner;
25729 if (ret_var.is_owned) {
25735 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
25736 LDKNodeInfo orig_conv;
25737 orig_conv.inner = (void*)(orig & (~1));
25738 orig_conv.is_owned = false;
25739 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
25740 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25741 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25742 uint64_t ret_ref = (uint64_t)ret_var.inner;
25743 if (ret_var.is_owned) {
25749 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
25750 LDKNodeInfo obj_conv;
25751 obj_conv.inner = (void*)(obj & (~1));
25752 obj_conv.is_owned = false;
25753 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
25754 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25755 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25756 CVec_u8Z_free(ret_var);
25760 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
25761 LDKu8slice ser_ref;
25762 ser_ref.datalen = *((uint32_t*)ser);
25763 ser_ref.data = (int8_t*)(ser + 4);
25764 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
25765 *ret_conv = NodeInfo_read(ser_ref);
25766 return (uint64_t)ret_conv;
25769 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
25770 LDKNetworkGraph obj_conv;
25771 obj_conv.inner = (void*)(obj & (~1));
25772 obj_conv.is_owned = false;
25773 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
25774 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25775 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25776 CVec_u8Z_free(ret_var);
25780 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
25781 LDKu8slice ser_ref;
25782 ser_ref.datalen = *((uint32_t*)ser);
25783 ser_ref.data = (int8_t*)(ser + 4);
25784 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
25785 *ret_conv = NetworkGraph_read(ser_ref);
25786 return (uint64_t)ret_conv;
25789 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
25790 LDKThirtyTwoBytes genesis_hash_ref;
25791 CHECK(*((uint32_t*)genesis_hash) == 32);
25792 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
25793 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
25794 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25795 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25796 uint64_t ret_ref = (uint64_t)ret_var.inner;
25797 if (ret_var.is_owned) {
25803 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
25804 LDKNetworkGraph this_arg_conv;
25805 this_arg_conv.inner = (void*)(this_arg & (~1));
25806 this_arg_conv.is_owned = false;
25807 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
25808 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25809 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25810 uint64_t ret_ref = (uint64_t)ret_var.inner;
25811 if (ret_var.is_owned) {
25817 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
25818 LDKNetworkGraph this_arg_conv;
25819 this_arg_conv.inner = (void*)(this_arg & (~1));
25820 this_arg_conv.is_owned = false;
25821 LDKNodeAnnouncement msg_conv;
25822 msg_conv.inner = (void*)(msg & (~1));
25823 msg_conv.is_owned = false;
25824 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25825 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
25826 return (uint64_t)ret_conv;
25829 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
25830 LDKNetworkGraph this_arg_conv;
25831 this_arg_conv.inner = (void*)(this_arg & (~1));
25832 this_arg_conv.is_owned = false;
25833 LDKUnsignedNodeAnnouncement msg_conv;
25834 msg_conv.inner = (void*)(msg & (~1));
25835 msg_conv.is_owned = false;
25836 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25837 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
25838 return (uint64_t)ret_conv;
25841 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
25842 LDKNetworkGraph this_arg_conv;
25843 this_arg_conv.inner = (void*)(this_arg & (~1));
25844 this_arg_conv.is_owned = false;
25845 LDKChannelAnnouncement msg_conv;
25846 msg_conv.inner = (void*)(msg & (~1));
25847 msg_conv.is_owned = false;
25848 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
25849 CHECK_ACCESS(chain_access_ptr);
25850 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
25851 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
25852 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
25853 // Manually implement clone for Java trait instances
25855 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25856 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
25857 return (uint64_t)ret_conv;
25860 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
25861 LDKNetworkGraph this_arg_conv;
25862 this_arg_conv.inner = (void*)(this_arg & (~1));
25863 this_arg_conv.is_owned = false;
25864 LDKUnsignedChannelAnnouncement msg_conv;
25865 msg_conv.inner = (void*)(msg & (~1));
25866 msg_conv.is_owned = false;
25867 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
25868 CHECK_ACCESS(chain_access_ptr);
25869 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
25870 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
25871 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
25872 // Manually implement clone for Java trait instances
25874 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25875 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
25876 return (uint64_t)ret_conv;
25879 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
25880 LDKNetworkGraph this_arg_conv;
25881 this_arg_conv.inner = (void*)(this_arg & (~1));
25882 this_arg_conv.is_owned = false;
25883 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
25886 void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
25887 LDKNetworkGraph this_arg_conv;
25888 this_arg_conv.inner = (void*)(this_arg & (~1));
25889 this_arg_conv.is_owned = false;
25890 LDKPublicKey _node_id_ref;
25891 CHECK(*((uint32_t*)_node_id) == 33);
25892 memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33);
25893 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
25896 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
25897 LDKNetworkGraph this_arg_conv;
25898 this_arg_conv.inner = (void*)(this_arg & (~1));
25899 this_arg_conv.is_owned = false;
25900 LDKChannelUpdate msg_conv;
25901 msg_conv.inner = (void*)(msg & (~1));
25902 msg_conv.is_owned = false;
25903 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25904 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
25905 return (uint64_t)ret_conv;
25908 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
25909 LDKNetworkGraph this_arg_conv;
25910 this_arg_conv.inner = (void*)(this_arg & (~1));
25911 this_arg_conv.is_owned = false;
25912 LDKUnsignedChannelUpdate msg_conv;
25913 msg_conv.inner = (void*)(msg & (~1));
25914 msg_conv.is_owned = false;
25915 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25916 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
25917 return (uint64_t)ret_conv;
25920 uint32_t __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
25921 LDKReadOnlyNetworkGraph this_arg_conv;
25922 this_arg_conv.inner = (void*)(this_arg & (~1));
25923 this_arg_conv.is_owned = false;
25924 LDKPublicKey pubkey_ref;
25925 CHECK(*((uint32_t*)pubkey) == 33);
25926 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
25927 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
25928 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
25929 uint64_t ret_ref = (uint64_t)ret_copy;
25933 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
25934 LDKRouteHop this_obj_conv;
25935 this_obj_conv.inner = (void*)(this_obj & (~1));
25936 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25937 RouteHop_free(this_obj_conv);
25940 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
25941 LDKRouteHop this_ptr_conv;
25942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25943 this_ptr_conv.is_owned = false;
25944 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25945 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
25949 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
25950 LDKRouteHop this_ptr_conv;
25951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25952 this_ptr_conv.is_owned = false;
25953 LDKPublicKey val_ref;
25954 CHECK(*((uint32_t*)val) == 33);
25955 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25956 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
25959 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
25960 LDKRouteHop this_ptr_conv;
25961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25962 this_ptr_conv.is_owned = false;
25963 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
25964 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25965 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25966 uint64_t ret_ref = (uint64_t)ret_var.inner;
25967 if (ret_var.is_owned) {
25973 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
25974 LDKRouteHop this_ptr_conv;
25975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25976 this_ptr_conv.is_owned = false;
25977 LDKNodeFeatures val_conv;
25978 val_conv.inner = (void*)(val & (~1));
25979 val_conv.is_owned = (val & 1) || (val == 0);
25980 val_conv = NodeFeatures_clone(&val_conv);
25981 RouteHop_set_node_features(&this_ptr_conv, val_conv);
25984 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
25985 LDKRouteHop this_ptr_conv;
25986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25987 this_ptr_conv.is_owned = false;
25988 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
25992 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25993 LDKRouteHop this_ptr_conv;
25994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25995 this_ptr_conv.is_owned = false;
25996 RouteHop_set_short_channel_id(&this_ptr_conv, val);
25999 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
26000 LDKRouteHop this_ptr_conv;
26001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26002 this_ptr_conv.is_owned = false;
26003 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
26004 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26005 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26006 uint64_t ret_ref = (uint64_t)ret_var.inner;
26007 if (ret_var.is_owned) {
26013 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
26014 LDKRouteHop this_ptr_conv;
26015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26016 this_ptr_conv.is_owned = false;
26017 LDKChannelFeatures val_conv;
26018 val_conv.inner = (void*)(val & (~1));
26019 val_conv.is_owned = (val & 1) || (val == 0);
26020 val_conv = ChannelFeatures_clone(&val_conv);
26021 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
26024 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
26025 LDKRouteHop this_ptr_conv;
26026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26027 this_ptr_conv.is_owned = false;
26028 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
26032 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
26033 LDKRouteHop this_ptr_conv;
26034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26035 this_ptr_conv.is_owned = false;
26036 RouteHop_set_fee_msat(&this_ptr_conv, val);
26039 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
26040 LDKRouteHop this_ptr_conv;
26041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26042 this_ptr_conv.is_owned = false;
26043 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
26047 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
26048 LDKRouteHop this_ptr_conv;
26049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26050 this_ptr_conv.is_owned = false;
26051 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
26054 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) {
26055 LDKPublicKey pubkey_arg_ref;
26056 CHECK(*((uint32_t*)pubkey_arg) == 33);
26057 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
26058 LDKNodeFeatures node_features_arg_conv;
26059 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
26060 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
26061 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
26062 LDKChannelFeatures channel_features_arg_conv;
26063 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
26064 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
26065 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
26066 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);
26067 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26068 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26069 uint64_t ret_ref = (uint64_t)ret_var.inner;
26070 if (ret_var.is_owned) {
26076 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
26077 LDKRouteHop orig_conv;
26078 orig_conv.inner = (void*)(orig & (~1));
26079 orig_conv.is_owned = false;
26080 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
26081 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26082 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26083 uint64_t ret_ref = (uint64_t)ret_var.inner;
26084 if (ret_var.is_owned) {
26090 int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) {
26091 LDKRouteHop o_conv;
26092 o_conv.inner = (void*)(o & (~1));
26093 o_conv.is_owned = false;
26094 int64_t ret_val = RouteHop_hash(&o_conv);
26098 jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
26099 LDKRouteHop a_conv;
26100 a_conv.inner = (void*)(a & (~1));
26101 a_conv.is_owned = false;
26102 LDKRouteHop b_conv;
26103 b_conv.inner = (void*)(b & (~1));
26104 b_conv.is_owned = false;
26105 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
26109 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
26110 LDKRouteHop obj_conv;
26111 obj_conv.inner = (void*)(obj & (~1));
26112 obj_conv.is_owned = false;
26113 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
26114 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
26115 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
26116 CVec_u8Z_free(ret_var);
26120 uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) {
26121 LDKu8slice ser_ref;
26122 ser_ref.datalen = *((uint32_t*)ser);
26123 ser_ref.data = (int8_t*)(ser + 4);
26124 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26125 *ret_conv = RouteHop_read(ser_ref);
26126 return (uint64_t)ret_conv;
26129 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
26130 LDKRoute this_obj_conv;
26131 this_obj_conv.inner = (void*)(this_obj & (~1));
26132 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26133 Route_free(this_obj_conv);
26136 ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) {
26137 LDKRoute this_ptr_conv;
26138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26139 this_ptr_conv.is_owned = false;
26140 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
26141 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
26142 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4);
26143 for (size_t m = 0; m < ret_var.datalen; m++) {
26144 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
26145 uint32_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26146 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4);
26147 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
26148 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
26149 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26150 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26151 uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
26152 if (ret_conv_12_conv_10_var.is_owned) {
26153 ret_conv_12_conv_10_ref |= 1;
26155 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
26157 FREE(ret_conv_12_var.data);
26158 ret_arr_ptr[m] = ret_conv_12_arr;
26160 FREE(ret_var.data);
26164 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
26165 LDKRoute this_ptr_conv;
26166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26167 this_ptr_conv.is_owned = false;
26168 LDKCVec_CVec_RouteHopZZ val_constr;
26169 val_constr.datalen = *((uint32_t*)val);
26170 if (val_constr.datalen > 0)
26171 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
26173 val_constr.data = NULL;
26174 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
26175 for (size_t m = 0; m < val_constr.datalen; m++) {
26176 uint32_tArray val_conv_12 = val_vals[m];
26177 LDKCVec_RouteHopZ val_conv_12_constr;
26178 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
26179 if (val_conv_12_constr.datalen > 0)
26180 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26182 val_conv_12_constr.data = NULL;
26183 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
26184 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
26185 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
26186 LDKRouteHop val_conv_12_conv_10_conv;
26187 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
26188 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
26189 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
26190 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
26192 val_constr.data[m] = val_conv_12_constr;
26194 Route_set_paths(&this_ptr_conv, val_constr);
26197 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) {
26198 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
26199 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
26200 if (paths_arg_constr.datalen > 0)
26201 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
26203 paths_arg_constr.data = NULL;
26204 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
26205 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
26206 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
26207 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
26208 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
26209 if (paths_arg_conv_12_constr.datalen > 0)
26210 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26212 paths_arg_conv_12_constr.data = NULL;
26213 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
26214 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
26215 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
26216 LDKRouteHop paths_arg_conv_12_conv_10_conv;
26217 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
26218 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
26219 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
26220 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
26222 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
26224 LDKRoute ret_var = Route_new(paths_arg_constr);
26225 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26226 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26227 uint64_t ret_ref = (uint64_t)ret_var.inner;
26228 if (ret_var.is_owned) {
26234 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
26235 LDKRoute orig_conv;
26236 orig_conv.inner = (void*)(orig & (~1));
26237 orig_conv.is_owned = false;
26238 LDKRoute ret_var = Route_clone(&orig_conv);
26239 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26240 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26241 uint64_t ret_ref = (uint64_t)ret_var.inner;
26242 if (ret_var.is_owned) {
26248 int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) {
26250 o_conv.inner = (void*)(o & (~1));
26251 o_conv.is_owned = false;
26252 int64_t ret_val = Route_hash(&o_conv);
26256 jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) {
26258 a_conv.inner = (void*)(a & (~1));
26259 a_conv.is_owned = false;
26261 b_conv.inner = (void*)(b & (~1));
26262 b_conv.is_owned = false;
26263 jboolean ret_val = Route_eq(&a_conv, &b_conv);
26267 int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) {
26268 LDKRoute this_arg_conv;
26269 this_arg_conv.inner = (void*)(this_arg & (~1));
26270 this_arg_conv.is_owned = false;
26271 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
26275 int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) {
26276 LDKRoute this_arg_conv;
26277 this_arg_conv.inner = (void*)(this_arg & (~1));
26278 this_arg_conv.is_owned = false;
26279 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
26283 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
26285 obj_conv.inner = (void*)(obj & (~1));
26286 obj_conv.is_owned = false;
26287 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
26288 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
26289 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
26290 CVec_u8Z_free(ret_var);
26294 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
26295 LDKu8slice ser_ref;
26296 ser_ref.datalen = *((uint32_t*)ser);
26297 ser_ref.data = (int8_t*)(ser + 4);
26298 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
26299 *ret_conv = Route_read(ser_ref);
26300 return (uint64_t)ret_conv;
26303 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
26304 LDKRouteHint this_obj_conv;
26305 this_obj_conv.inner = (void*)(this_obj & (~1));
26306 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26307 RouteHint_free(this_obj_conv);
26310 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
26311 LDKRouteHint orig_conv;
26312 orig_conv.inner = (void*)(orig & (~1));
26313 orig_conv.is_owned = false;
26314 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
26315 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26316 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26317 uint64_t ret_ref = (uint64_t)ret_var.inner;
26318 if (ret_var.is_owned) {
26324 int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) {
26325 LDKRouteHint o_conv;
26326 o_conv.inner = (void*)(o & (~1));
26327 o_conv.is_owned = false;
26328 int64_t ret_val = RouteHint_hash(&o_conv);
26332 jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
26333 LDKRouteHint a_conv;
26334 a_conv.inner = (void*)(a & (~1));
26335 a_conv.is_owned = false;
26336 LDKRouteHint b_conv;
26337 b_conv.inner = (void*)(b & (~1));
26338 b_conv.is_owned = false;
26339 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
26343 void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
26344 LDKRouteHintHop this_obj_conv;
26345 this_obj_conv.inner = (void*)(this_obj & (~1));
26346 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26347 RouteHintHop_free(this_obj_conv);
26350 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
26351 LDKRouteHintHop this_ptr_conv;
26352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26353 this_ptr_conv.is_owned = false;
26354 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
26355 memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
26359 void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
26360 LDKRouteHintHop this_ptr_conv;
26361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26362 this_ptr_conv.is_owned = false;
26363 LDKPublicKey val_ref;
26364 CHECK(*((uint32_t*)val) == 33);
26365 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
26366 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
26369 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
26370 LDKRouteHintHop this_ptr_conv;
26371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26372 this_ptr_conv.is_owned = false;
26373 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
26377 void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
26378 LDKRouteHintHop this_ptr_conv;
26379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26380 this_ptr_conv.is_owned = false;
26381 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
26384 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
26385 LDKRouteHintHop this_ptr_conv;
26386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26387 this_ptr_conv.is_owned = false;
26388 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
26389 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26390 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26391 uint64_t ret_ref = (uint64_t)ret_var.inner;
26392 if (ret_var.is_owned) {
26398 void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
26399 LDKRouteHintHop this_ptr_conv;
26400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26401 this_ptr_conv.is_owned = false;
26402 LDKRoutingFees val_conv;
26403 val_conv.inner = (void*)(val & (~1));
26404 val_conv.is_owned = (val & 1) || (val == 0);
26405 val_conv = RoutingFees_clone(&val_conv);
26406 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
26409 int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
26410 LDKRouteHintHop this_ptr_conv;
26411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26412 this_ptr_conv.is_owned = false;
26413 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
26417 void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
26418 LDKRouteHintHop this_ptr_conv;
26419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26420 this_ptr_conv.is_owned = false;
26421 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
26424 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
26425 LDKRouteHintHop this_ptr_conv;
26426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26427 this_ptr_conv.is_owned = false;
26428 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26429 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
26430 uint64_t ret_ref = (uint64_t)ret_copy;
26434 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
26435 LDKRouteHintHop this_ptr_conv;
26436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26437 this_ptr_conv.is_owned = false;
26438 void* val_ptr = (void*)(((uint64_t)val) & ~1);
26439 CHECK_ACCESS(val_ptr);
26440 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26441 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
26442 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
26445 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
26446 LDKRouteHintHop this_ptr_conv;
26447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26448 this_ptr_conv.is_owned = false;
26449 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26450 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
26451 uint64_t ret_ref = (uint64_t)ret_copy;
26455 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
26456 LDKRouteHintHop this_ptr_conv;
26457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26458 this_ptr_conv.is_owned = false;
26459 void* val_ptr = (void*)(((uint64_t)val) & ~1);
26460 CHECK_ACCESS(val_ptr);
26461 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26462 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
26463 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
26466 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) {
26467 LDKPublicKey src_node_id_arg_ref;
26468 CHECK(*((uint32_t*)src_node_id_arg) == 33);
26469 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
26470 LDKRoutingFees fees_arg_conv;
26471 fees_arg_conv.inner = (void*)(fees_arg & (~1));
26472 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
26473 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
26474 void* htlc_minimum_msat_arg_ptr = (void*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
26475 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
26476 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
26477 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
26478 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
26479 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
26480 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
26481 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
26482 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);
26483 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26484 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26485 uint64_t ret_ref = (uint64_t)ret_var.inner;
26486 if (ret_var.is_owned) {
26492 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
26493 LDKRouteHintHop orig_conv;
26494 orig_conv.inner = (void*)(orig & (~1));
26495 orig_conv.is_owned = false;
26496 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
26497 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26498 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26499 uint64_t ret_ref = (uint64_t)ret_var.inner;
26500 if (ret_var.is_owned) {
26506 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) {
26507 LDKRouteHintHop o_conv;
26508 o_conv.inner = (void*)(o & (~1));
26509 o_conv.is_owned = false;
26510 int64_t ret_val = RouteHintHop_hash(&o_conv);
26514 jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
26515 LDKRouteHintHop a_conv;
26516 a_conv.inner = (void*)(a & (~1));
26517 a_conv.is_owned = false;
26518 LDKRouteHintHop b_conv;
26519 b_conv.inner = (void*)(b & (~1));
26520 b_conv.is_owned = false;
26521 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
26525 uint32_t __attribute__((visibility("default"))) TS_get_keysend_route(int8_tArray our_node_pubkey, uint32_t network, int8_tArray payee, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger, uint32_t scorer) {
26526 LDKPublicKey our_node_pubkey_ref;
26527 CHECK(*((uint32_t*)our_node_pubkey) == 33);
26528 memcpy(our_node_pubkey_ref.compressed_form, (uint8_t*)(our_node_pubkey + 4), 33);
26529 LDKNetworkGraph network_conv;
26530 network_conv.inner = (void*)(network & (~1));
26531 network_conv.is_owned = false;
26532 LDKPublicKey payee_ref;
26533 CHECK(*((uint32_t*)payee) == 33);
26534 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
26535 LDKCVec_ChannelDetailsZ first_hops_constr;
26536 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
26537 if (first_hops != 0) {
26538 first_hops_constr.datalen = *((uint32_t*)first_hops);
26539 if (first_hops_constr.datalen > 0)
26540 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
26542 first_hops_constr.data = NULL;
26543 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
26544 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
26545 uint32_t first_hops_conv_16 = first_hops_vals[q];
26546 LDKChannelDetails first_hops_conv_16_conv;
26547 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
26548 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
26549 first_hops_constr.data[q] = first_hops_conv_16_conv;
26551 first_hops_ptr = &first_hops_constr;
26553 LDKCVec_RouteHintZ last_hops_constr;
26554 last_hops_constr.datalen = *((uint32_t*)last_hops);
26555 if (last_hops_constr.datalen > 0)
26556 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
26558 last_hops_constr.data = NULL;
26559 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
26560 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
26561 uint32_t last_hops_conv_11 = last_hops_vals[l];
26562 LDKRouteHint last_hops_conv_11_conv;
26563 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
26564 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
26565 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
26566 last_hops_constr.data[l] = last_hops_conv_11_conv;
26568 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
26569 CHECK_ACCESS(logger_ptr);
26570 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26571 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
26572 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
26573 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
26574 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26575 *ret_conv = get_keysend_route(our_node_pubkey_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv, scorer_conv);
26576 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
26577 return (uint64_t)ret_conv;
26580 uint32_t __attribute__((visibility("default"))) TS_get_route(int8_tArray our_node_pubkey, uint32_t network, int8_tArray payee, uint32_t payee_features, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger, uint32_t scorer) {
26581 LDKPublicKey our_node_pubkey_ref;
26582 CHECK(*((uint32_t*)our_node_pubkey) == 33);
26583 memcpy(our_node_pubkey_ref.compressed_form, (uint8_t*)(our_node_pubkey + 4), 33);
26584 LDKNetworkGraph network_conv;
26585 network_conv.inner = (void*)(network & (~1));
26586 network_conv.is_owned = false;
26587 LDKPublicKey payee_ref;
26588 CHECK(*((uint32_t*)payee) == 33);
26589 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
26590 LDKInvoiceFeatures payee_features_conv;
26591 payee_features_conv.inner = (void*)(payee_features & (~1));
26592 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
26593 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
26594 LDKCVec_ChannelDetailsZ first_hops_constr;
26595 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
26596 if (first_hops != 0) {
26597 first_hops_constr.datalen = *((uint32_t*)first_hops);
26598 if (first_hops_constr.datalen > 0)
26599 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
26601 first_hops_constr.data = NULL;
26602 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
26603 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
26604 uint32_t first_hops_conv_16 = first_hops_vals[q];
26605 LDKChannelDetails first_hops_conv_16_conv;
26606 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
26607 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
26608 first_hops_constr.data[q] = first_hops_conv_16_conv;
26610 first_hops_ptr = &first_hops_constr;
26612 LDKCVec_RouteHintZ last_hops_constr;
26613 last_hops_constr.datalen = *((uint32_t*)last_hops);
26614 if (last_hops_constr.datalen > 0)
26615 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
26617 last_hops_constr.data = NULL;
26618 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
26619 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
26620 uint32_t last_hops_conv_11 = last_hops_vals[l];
26621 LDKRouteHint last_hops_conv_11_conv;
26622 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
26623 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
26624 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
26625 last_hops_constr.data[l] = last_hops_conv_11_conv;
26627 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
26628 CHECK_ACCESS(logger_ptr);
26629 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26630 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
26631 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
26632 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
26633 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26634 *ret_conv = get_route(our_node_pubkey_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv, scorer_conv);
26635 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
26636 return (uint64_t)ret_conv;
26639 void __attribute__((visibility("default"))) TS_Scorer_free(uint32_t this_obj) {
26640 LDKScorer this_obj_conv;
26641 this_obj_conv.inner = (void*)(this_obj & (~1));
26642 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26643 Scorer_free(this_obj_conv);
26646 uint32_t __attribute__((visibility("default"))) TS_Scorer_new(int64_t base_penalty_msat) {
26647 LDKScorer ret_var = Scorer_new(base_penalty_msat);
26648 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26649 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26650 uint64_t ret_ref = (uint64_t)ret_var.inner;
26651 if (ret_var.is_owned) {
26657 uint32_t __attribute__((visibility("default"))) TS_Scorer_default() {
26658 LDKScorer ret_var = Scorer_default();
26659 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26660 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26661 uint64_t ret_ref = (uint64_t)ret_var.inner;
26662 if (ret_var.is_owned) {
26668 uint32_t __attribute__((visibility("default"))) TS_Scorer_as_Score(uint32_t this_arg) {
26669 LDKScorer this_arg_conv;
26670 this_arg_conv.inner = (void*)(this_arg & (~1));
26671 this_arg_conv.is_owned = false;
26672 LDKScore* ret_ret =MALLOC(sizeof(LDKScore), "LDKScore");
26673 *ret_ret = Scorer_as_Score(&this_arg_conv);
26674 return (uint64_t)ret_ret;
26677 void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) {
26678 LDKFilesystemPersister this_obj_conv;
26679 this_obj_conv.inner = (void*)(this_obj & (~1));
26680 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26681 FilesystemPersister_free(this_obj_conv);
26684 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_new(jstring path_to_channel_data) {
26685 LDKStr path_to_channel_data_conv = str_ref_to_owned_c(path_to_channel_data);
26686 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
26687 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26688 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26689 uint64_t ret_ref = (uint64_t)ret_var.inner;
26690 if (ret_var.is_owned) {
26696 jstring __attribute__((visibility("default"))) TS_FilesystemPersister_get_data_dir(uint32_t this_arg) {
26697 LDKFilesystemPersister this_arg_conv;
26698 this_arg_conv.inner = (void*)(this_arg & (~1));
26699 this_arg_conv.is_owned = false;
26700 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
26701 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26706 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_persist_manager(jstring data_dir, uint32_t manager) {
26707 LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
26708 LDKChannelManager manager_conv;
26709 manager_conv.inner = (void*)(manager & (~1));
26710 manager_conv.is_owned = false;
26711 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
26712 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
26713 return (uint64_t)ret_conv;
26716 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_read_channelmonitors(uint32_t this_arg, uint32_t keys_manager) {
26717 LDKFilesystemPersister this_arg_conv;
26718 this_arg_conv.inner = (void*)(this_arg & (~1));
26719 this_arg_conv.is_owned = false;
26720 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
26721 CHECK_ACCESS(keys_manager_ptr);
26722 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
26723 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
26724 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
26725 return (uint64_t)ret_conv;
26728 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_as_Persist(uint32_t this_arg) {
26729 LDKFilesystemPersister this_arg_conv;
26730 this_arg_conv.inner = (void*)(this_arg & (~1));
26731 this_arg_conv.is_owned = false;
26732 LDKPersist* ret_ret =MALLOC(sizeof(LDKPersist), "LDKPersist");
26733 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
26734 return (uint64_t)ret_ret;
26737 void __attribute__((visibility("default"))) TS_BackgroundProcessor_free(uint32_t this_obj) {
26738 LDKBackgroundProcessor this_obj_conv;
26739 this_obj_conv.inner = (void*)(this_obj & (~1));
26740 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26741 BackgroundProcessor_free(this_obj_conv);
26744 void __attribute__((visibility("default"))) TS_ChannelManagerPersister_free(uint32_t this_ptr) {
26745 if ((this_ptr & 1) != 0) return;
26746 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
26747 CHECK_ACCESS(this_ptr_ptr);
26748 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(this_ptr_ptr);
26749 FREE((void*)this_ptr);
26750 ChannelManagerPersister_free(this_ptr_conv);
26753 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) {
26754 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
26755 CHECK_ACCESS(persister_ptr);
26756 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(persister_ptr);
26757 void* event_handler_ptr = (void*)(((uint64_t)event_handler) & ~1);
26758 CHECK_ACCESS(event_handler_ptr);
26759 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
26760 LDKChainMonitor chain_monitor_conv;
26761 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
26762 chain_monitor_conv.is_owned = false;
26763 LDKChannelManager channel_manager_conv;
26764 channel_manager_conv.inner = (void*)(channel_manager & (~1));
26765 channel_manager_conv.is_owned = false;
26766 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
26767 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
26768 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
26769 LDKPeerManager peer_manager_conv;
26770 peer_manager_conv.inner = (void*)(peer_manager & (~1));
26771 peer_manager_conv.is_owned = false;
26772 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
26773 CHECK_ACCESS(logger_ptr);
26774 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26775 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);
26776 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26777 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26778 uint64_t ret_ref = (uint64_t)ret_var.inner;
26779 if (ret_var.is_owned) {
26785 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_join(uint32_t this_arg) {
26786 LDKBackgroundProcessor this_arg_conv;
26787 this_arg_conv.inner = (void*)(this_arg & (~1));
26788 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26789 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
26790 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
26791 *ret_conv = BackgroundProcessor_join(this_arg_conv);
26792 return (uint64_t)ret_conv;
26795 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_stop(uint32_t this_arg) {
26796 LDKBackgroundProcessor this_arg_conv;
26797 this_arg_conv.inner = (void*)(this_arg & (~1));
26798 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26799 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
26800 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
26801 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
26802 return (uint64_t)ret_conv;
26805 void __attribute__((visibility("default"))) TS_check_platform() {
26809 void __attribute__((visibility("default"))) TS_Invoice_free(uint32_t this_obj) {
26810 LDKInvoice this_obj_conv;
26811 this_obj_conv.inner = (void*)(this_obj & (~1));
26812 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26813 Invoice_free(this_obj_conv);
26816 jboolean __attribute__((visibility("default"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
26818 a_conv.inner = (void*)(a & (~1));
26819 a_conv.is_owned = false;
26821 b_conv.inner = (void*)(b & (~1));
26822 b_conv.is_owned = false;
26823 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
26827 uint32_t __attribute__((visibility("default"))) TS_Invoice_clone(uint32_t orig) {
26828 LDKInvoice orig_conv;
26829 orig_conv.inner = (void*)(orig & (~1));
26830 orig_conv.is_owned = false;
26831 LDKInvoice ret_var = Invoice_clone(&orig_conv);
26832 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26833 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26834 uint64_t ret_ref = (uint64_t)ret_var.inner;
26835 if (ret_var.is_owned) {
26841 void __attribute__((visibility("default"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
26842 LDKSignedRawInvoice this_obj_conv;
26843 this_obj_conv.inner = (void*)(this_obj & (~1));
26844 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26845 SignedRawInvoice_free(this_obj_conv);
26848 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
26849 LDKSignedRawInvoice a_conv;
26850 a_conv.inner = (void*)(a & (~1));
26851 a_conv.is_owned = false;
26852 LDKSignedRawInvoice b_conv;
26853 b_conv.inner = (void*)(b & (~1));
26854 b_conv.is_owned = false;
26855 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
26859 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_clone(uint32_t orig) {
26860 LDKSignedRawInvoice orig_conv;
26861 orig_conv.inner = (void*)(orig & (~1));
26862 orig_conv.is_owned = false;
26863 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
26864 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26865 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26866 uint64_t ret_ref = (uint64_t)ret_var.inner;
26867 if (ret_var.is_owned) {
26873 void __attribute__((visibility("default"))) TS_RawInvoice_free(uint32_t this_obj) {
26874 LDKRawInvoice this_obj_conv;
26875 this_obj_conv.inner = (void*)(this_obj & (~1));
26876 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26877 RawInvoice_free(this_obj_conv);
26880 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
26881 LDKRawInvoice this_ptr_conv;
26882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26883 this_ptr_conv.is_owned = false;
26884 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
26885 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26886 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26887 uint64_t ret_ref = (uint64_t)ret_var.inner;
26888 if (ret_var.is_owned) {
26894 void __attribute__((visibility("default"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
26895 LDKRawInvoice this_ptr_conv;
26896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26897 this_ptr_conv.is_owned = false;
26898 LDKRawDataPart val_conv;
26899 val_conv.inner = (void*)(val & (~1));
26900 val_conv.is_owned = (val & 1) || (val == 0);
26901 val_conv = RawDataPart_clone(&val_conv);
26902 RawInvoice_set_data(&this_ptr_conv, val_conv);
26905 jboolean __attribute__((visibility("default"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
26906 LDKRawInvoice a_conv;
26907 a_conv.inner = (void*)(a & (~1));
26908 a_conv.is_owned = false;
26909 LDKRawInvoice b_conv;
26910 b_conv.inner = (void*)(b & (~1));
26911 b_conv.is_owned = false;
26912 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
26916 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_clone(uint32_t orig) {
26917 LDKRawInvoice orig_conv;
26918 orig_conv.inner = (void*)(orig & (~1));
26919 orig_conv.is_owned = false;
26920 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
26921 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26922 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26923 uint64_t ret_ref = (uint64_t)ret_var.inner;
26924 if (ret_var.is_owned) {
26930 void __attribute__((visibility("default"))) TS_RawDataPart_free(uint32_t this_obj) {
26931 LDKRawDataPart this_obj_conv;
26932 this_obj_conv.inner = (void*)(this_obj & (~1));
26933 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26934 RawDataPart_free(this_obj_conv);
26937 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
26938 LDKRawDataPart this_ptr_conv;
26939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26940 this_ptr_conv.is_owned = false;
26941 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
26942 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26943 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26944 uint64_t ret_ref = (uint64_t)ret_var.inner;
26945 if (ret_var.is_owned) {
26951 void __attribute__((visibility("default"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
26952 LDKRawDataPart this_ptr_conv;
26953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26954 this_ptr_conv.is_owned = false;
26955 LDKPositiveTimestamp val_conv;
26956 val_conv.inner = (void*)(val & (~1));
26957 val_conv.is_owned = (val & 1) || (val == 0);
26958 val_conv = PositiveTimestamp_clone(&val_conv);
26959 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
26962 jboolean __attribute__((visibility("default"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
26963 LDKRawDataPart a_conv;
26964 a_conv.inner = (void*)(a & (~1));
26965 a_conv.is_owned = false;
26966 LDKRawDataPart b_conv;
26967 b_conv.inner = (void*)(b & (~1));
26968 b_conv.is_owned = false;
26969 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
26973 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_clone(uint32_t orig) {
26974 LDKRawDataPart orig_conv;
26975 orig_conv.inner = (void*)(orig & (~1));
26976 orig_conv.is_owned = false;
26977 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
26978 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26979 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26980 uint64_t ret_ref = (uint64_t)ret_var.inner;
26981 if (ret_var.is_owned) {
26987 void __attribute__((visibility("default"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
26988 LDKPositiveTimestamp this_obj_conv;
26989 this_obj_conv.inner = (void*)(this_obj & (~1));
26990 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26991 PositiveTimestamp_free(this_obj_conv);
26994 jboolean __attribute__((visibility("default"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
26995 LDKPositiveTimestamp a_conv;
26996 a_conv.inner = (void*)(a & (~1));
26997 a_conv.is_owned = false;
26998 LDKPositiveTimestamp b_conv;
26999 b_conv.inner = (void*)(b & (~1));
27000 b_conv.is_owned = false;
27001 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
27005 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_clone(uint32_t orig) {
27006 LDKPositiveTimestamp orig_conv;
27007 orig_conv.inner = (void*)(orig & (~1));
27008 orig_conv.is_owned = false;
27009 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
27010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27012 uint64_t ret_ref = (uint64_t)ret_var.inner;
27013 if (ret_var.is_owned) {
27019 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_clone(uint32_t orig) {
27020 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
27021 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
27025 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_milli() {
27026 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
27030 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_micro() {
27031 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
27035 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_nano() {
27036 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
27040 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_pico() {
27041 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
27045 jboolean __attribute__((visibility("default"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
27046 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
27047 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
27048 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
27052 int64_t __attribute__((visibility("default"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
27053 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
27054 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
27058 uint32_t __attribute__((visibility("default"))) TS_Currency_clone(uint32_t orig) {
27059 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
27060 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
27064 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin() {
27065 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
27069 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin_testnet() {
27070 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
27074 uint32_t __attribute__((visibility("default"))) TS_Currency_regtest() {
27075 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
27079 uint32_t __attribute__((visibility("default"))) TS_Currency_simnet() {
27080 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
27084 uint32_t __attribute__((visibility("default"))) TS_Currency_signet() {
27085 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
27089 int64_t __attribute__((visibility("default"))) TS_Currency_hash(uint32_t o) {
27090 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
27091 int64_t ret_val = Currency_hash(o_conv);
27095 jboolean __attribute__((visibility("default"))) TS_Currency_eq(uint32_t a, uint32_t b) {
27096 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
27097 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
27098 jboolean ret_val = Currency_eq(a_conv, b_conv);
27102 void __attribute__((visibility("default"))) TS_Sha256_free(uint32_t this_obj) {
27103 LDKSha256 this_obj_conv;
27104 this_obj_conv.inner = (void*)(this_obj & (~1));
27105 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27106 Sha256_free(this_obj_conv);
27109 uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
27110 LDKSha256 orig_conv;
27111 orig_conv.inner = (void*)(orig & (~1));
27112 orig_conv.is_owned = false;
27113 LDKSha256 ret_var = Sha256_clone(&orig_conv);
27114 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27115 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27116 uint64_t ret_ref = (uint64_t)ret_var.inner;
27117 if (ret_var.is_owned) {
27123 int64_t __attribute__((visibility("default"))) TS_Sha256_hash(uint32_t o) {
27125 o_conv.inner = (void*)(o & (~1));
27126 o_conv.is_owned = false;
27127 int64_t ret_val = Sha256_hash(&o_conv);
27131 jboolean __attribute__((visibility("default"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
27133 a_conv.inner = (void*)(a & (~1));
27134 a_conv.is_owned = false;
27136 b_conv.inner = (void*)(b & (~1));
27137 b_conv.is_owned = false;
27138 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
27142 void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
27143 LDKDescription this_obj_conv;
27144 this_obj_conv.inner = (void*)(this_obj & (~1));
27145 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27146 Description_free(this_obj_conv);
27149 uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
27150 LDKDescription orig_conv;
27151 orig_conv.inner = (void*)(orig & (~1));
27152 orig_conv.is_owned = false;
27153 LDKDescription ret_var = Description_clone(&orig_conv);
27154 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27155 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27156 uint64_t ret_ref = (uint64_t)ret_var.inner;
27157 if (ret_var.is_owned) {
27163 int64_t __attribute__((visibility("default"))) TS_Description_hash(uint32_t o) {
27164 LDKDescription o_conv;
27165 o_conv.inner = (void*)(o & (~1));
27166 o_conv.is_owned = false;
27167 int64_t ret_val = Description_hash(&o_conv);
27171 jboolean __attribute__((visibility("default"))) TS_Description_eq(uint32_t a, uint32_t b) {
27172 LDKDescription a_conv;
27173 a_conv.inner = (void*)(a & (~1));
27174 a_conv.is_owned = false;
27175 LDKDescription b_conv;
27176 b_conv.inner = (void*)(b & (~1));
27177 b_conv.is_owned = false;
27178 jboolean ret_val = Description_eq(&a_conv, &b_conv);
27182 void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
27183 LDKPayeePubKey this_obj_conv;
27184 this_obj_conv.inner = (void*)(this_obj & (~1));
27185 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27186 PayeePubKey_free(this_obj_conv);
27189 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
27190 LDKPayeePubKey orig_conv;
27191 orig_conv.inner = (void*)(orig & (~1));
27192 orig_conv.is_owned = false;
27193 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
27194 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27195 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27196 uint64_t ret_ref = (uint64_t)ret_var.inner;
27197 if (ret_var.is_owned) {
27203 int64_t __attribute__((visibility("default"))) TS_PayeePubKey_hash(uint32_t o) {
27204 LDKPayeePubKey o_conv;
27205 o_conv.inner = (void*)(o & (~1));
27206 o_conv.is_owned = false;
27207 int64_t ret_val = PayeePubKey_hash(&o_conv);
27211 jboolean __attribute__((visibility("default"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
27212 LDKPayeePubKey a_conv;
27213 a_conv.inner = (void*)(a & (~1));
27214 a_conv.is_owned = false;
27215 LDKPayeePubKey b_conv;
27216 b_conv.inner = (void*)(b & (~1));
27217 b_conv.is_owned = false;
27218 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
27222 void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
27223 LDKExpiryTime this_obj_conv;
27224 this_obj_conv.inner = (void*)(this_obj & (~1));
27225 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27226 ExpiryTime_free(this_obj_conv);
27229 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
27230 LDKExpiryTime orig_conv;
27231 orig_conv.inner = (void*)(orig & (~1));
27232 orig_conv.is_owned = false;
27233 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
27234 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27235 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27236 uint64_t ret_ref = (uint64_t)ret_var.inner;
27237 if (ret_var.is_owned) {
27243 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_hash(uint32_t o) {
27244 LDKExpiryTime o_conv;
27245 o_conv.inner = (void*)(o & (~1));
27246 o_conv.is_owned = false;
27247 int64_t ret_val = ExpiryTime_hash(&o_conv);
27251 jboolean __attribute__((visibility("default"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
27252 LDKExpiryTime a_conv;
27253 a_conv.inner = (void*)(a & (~1));
27254 a_conv.is_owned = false;
27255 LDKExpiryTime b_conv;
27256 b_conv.inner = (void*)(b & (~1));
27257 b_conv.is_owned = false;
27258 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
27262 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
27263 LDKMinFinalCltvExpiry this_obj_conv;
27264 this_obj_conv.inner = (void*)(this_obj & (~1));
27265 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27266 MinFinalCltvExpiry_free(this_obj_conv);
27269 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
27270 LDKMinFinalCltvExpiry orig_conv;
27271 orig_conv.inner = (void*)(orig & (~1));
27272 orig_conv.is_owned = false;
27273 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
27274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27276 uint64_t ret_ref = (uint64_t)ret_var.inner;
27277 if (ret_var.is_owned) {
27283 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
27284 LDKMinFinalCltvExpiry o_conv;
27285 o_conv.inner = (void*)(o & (~1));
27286 o_conv.is_owned = false;
27287 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
27291 jboolean __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
27292 LDKMinFinalCltvExpiry a_conv;
27293 a_conv.inner = (void*)(a & (~1));
27294 a_conv.is_owned = false;
27295 LDKMinFinalCltvExpiry b_conv;
27296 b_conv.inner = (void*)(b & (~1));
27297 b_conv.is_owned = false;
27298 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
27302 void __attribute__((visibility("default"))) TS_Fallback_free(uint32_t this_ptr) {
27303 if ((this_ptr & 1) != 0) return;
27304 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27305 CHECK_ACCESS(this_ptr_ptr);
27306 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
27307 FREE((void*)this_ptr);
27308 Fallback_free(this_ptr_conv);
27311 uint32_t __attribute__((visibility("default"))) TS_Fallback_clone(uint32_t orig) {
27312 LDKFallback* orig_conv = (LDKFallback*)orig;
27313 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
27314 *ret_copy = Fallback_clone(orig_conv);
27315 uint64_t ret_ref = (uint64_t)ret_copy;
27319 uint32_t __attribute__((visibility("default"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
27321 LDKCVec_u8Z program_ref;
27322 program_ref.datalen = *((uint32_t*)program);
27323 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
27324 memcpy(program_ref.data, (uint8_t*)(program + 4), program_ref.datalen);
27325 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
27326 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
27327 uint64_t ret_ref = (uint64_t)ret_copy;
27331 uint32_t __attribute__((visibility("default"))) TS_Fallback_pub_key_hash(int8_tArray a) {
27332 LDKTwentyBytes a_ref;
27333 CHECK(*((uint32_t*)a) == 20);
27334 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
27335 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
27336 *ret_copy = Fallback_pub_key_hash(a_ref);
27337 uint64_t ret_ref = (uint64_t)ret_copy;
27341 uint32_t __attribute__((visibility("default"))) TS_Fallback_script_hash(int8_tArray a) {
27342 LDKTwentyBytes a_ref;
27343 CHECK(*((uint32_t*)a) == 20);
27344 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
27345 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
27346 *ret_copy = Fallback_script_hash(a_ref);
27347 uint64_t ret_ref = (uint64_t)ret_copy;
27351 int64_t __attribute__((visibility("default"))) TS_Fallback_hash(uint32_t o) {
27352 LDKFallback* o_conv = (LDKFallback*)o;
27353 int64_t ret_val = Fallback_hash(o_conv);
27357 jboolean __attribute__((visibility("default"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
27358 LDKFallback* a_conv = (LDKFallback*)a;
27359 LDKFallback* b_conv = (LDKFallback*)b;
27360 jboolean ret_val = Fallback_eq(a_conv, b_conv);
27364 void __attribute__((visibility("default"))) TS_InvoiceSignature_free(uint32_t this_obj) {
27365 LDKInvoiceSignature this_obj_conv;
27366 this_obj_conv.inner = (void*)(this_obj & (~1));
27367 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27368 InvoiceSignature_free(this_obj_conv);
27371 uint32_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone(uint32_t orig) {
27372 LDKInvoiceSignature orig_conv;
27373 orig_conv.inner = (void*)(orig & (~1));
27374 orig_conv.is_owned = false;
27375 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
27376 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27377 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27378 uint64_t ret_ref = (uint64_t)ret_var.inner;
27379 if (ret_var.is_owned) {
27385 jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
27386 LDKInvoiceSignature a_conv;
27387 a_conv.inner = (void*)(a & (~1));
27388 a_conv.is_owned = false;
27389 LDKInvoiceSignature b_conv;
27390 b_conv.inner = (void*)(b & (~1));
27391 b_conv.is_owned = false;
27392 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
27396 void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
27397 LDKPrivateRoute this_obj_conv;
27398 this_obj_conv.inner = (void*)(this_obj & (~1));
27399 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27400 PrivateRoute_free(this_obj_conv);
27403 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_clone(uint32_t orig) {
27404 LDKPrivateRoute orig_conv;
27405 orig_conv.inner = (void*)(orig & (~1));
27406 orig_conv.is_owned = false;
27407 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
27408 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27409 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27410 uint64_t ret_ref = (uint64_t)ret_var.inner;
27411 if (ret_var.is_owned) {
27417 int64_t __attribute__((visibility("default"))) TS_PrivateRoute_hash(uint32_t o) {
27418 LDKPrivateRoute o_conv;
27419 o_conv.inner = (void*)(o & (~1));
27420 o_conv.is_owned = false;
27421 int64_t ret_val = PrivateRoute_hash(&o_conv);
27425 jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
27426 LDKPrivateRoute a_conv;
27427 a_conv.inner = (void*)(a & (~1));
27428 a_conv.is_owned = false;
27429 LDKPrivateRoute b_conv;
27430 b_conv.inner = (void*)(b & (~1));
27431 b_conv.is_owned = false;
27432 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
27436 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
27437 LDKSignedRawInvoice this_arg_conv;
27438 this_arg_conv.inner = (void*)(this_arg & (~1));
27439 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27440 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
27441 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
27442 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
27443 return ((uint64_t)ret_conv);
27446 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
27447 LDKSignedRawInvoice this_arg_conv;
27448 this_arg_conv.inner = (void*)(this_arg & (~1));
27449 this_arg_conv.is_owned = false;
27450 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
27451 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27452 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27453 uint64_t ret_ref = (uint64_t)ret_var.inner;
27454 if (ret_var.is_owned) {
27460 int8_tArray __attribute__((visibility("default"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
27461 LDKSignedRawInvoice this_arg_conv;
27462 this_arg_conv.inner = (void*)(this_arg & (~1));
27463 this_arg_conv.is_owned = false;
27464 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
27465 memcpy((uint8_t*)(ret_arr + 4), *SignedRawInvoice_hash(&this_arg_conv), 32);
27469 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
27470 LDKSignedRawInvoice this_arg_conv;
27471 this_arg_conv.inner = (void*)(this_arg & (~1));
27472 this_arg_conv.is_owned = false;
27473 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
27474 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27475 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27476 uint64_t ret_ref = (uint64_t)ret_var.inner;
27477 if (ret_var.is_owned) {
27483 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
27484 LDKSignedRawInvoice this_arg_conv;
27485 this_arg_conv.inner = (void*)(this_arg & (~1));
27486 this_arg_conv.is_owned = false;
27487 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
27488 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
27489 return (uint64_t)ret_conv;
27492 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
27493 LDKSignedRawInvoice this_arg_conv;
27494 this_arg_conv.inner = (void*)(this_arg & (~1));
27495 this_arg_conv.is_owned = false;
27496 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
27500 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_hash(uint32_t this_arg) {
27501 LDKRawInvoice this_arg_conv;
27502 this_arg_conv.inner = (void*)(this_arg & (~1));
27503 this_arg_conv.is_owned = false;
27504 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
27505 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_hash(&this_arg_conv).data, 32);
27509 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
27510 LDKRawInvoice this_arg_conv;
27511 this_arg_conv.inner = (void*)(this_arg & (~1));
27512 this_arg_conv.is_owned = false;
27513 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
27514 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27515 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27516 uint64_t ret_ref = (uint64_t)ret_var.inner;
27517 if (ret_var.is_owned) {
27523 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description(uint32_t this_arg) {
27524 LDKRawInvoice this_arg_conv;
27525 this_arg_conv.inner = (void*)(this_arg & (~1));
27526 this_arg_conv.is_owned = false;
27527 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
27528 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27529 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27530 uint64_t ret_ref = (uint64_t)ret_var.inner;
27531 if (ret_var.is_owned) {
27537 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
27538 LDKRawInvoice this_arg_conv;
27539 this_arg_conv.inner = (void*)(this_arg & (~1));
27540 this_arg_conv.is_owned = false;
27541 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
27542 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27543 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27544 uint64_t ret_ref = (uint64_t)ret_var.inner;
27545 if (ret_var.is_owned) {
27551 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
27552 LDKRawInvoice this_arg_conv;
27553 this_arg_conv.inner = (void*)(this_arg & (~1));
27554 this_arg_conv.is_owned = false;
27555 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
27556 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27557 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27558 uint64_t ret_ref = (uint64_t)ret_var.inner;
27559 if (ret_var.is_owned) {
27565 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
27566 LDKRawInvoice this_arg_conv;
27567 this_arg_conv.inner = (void*)(this_arg & (~1));
27568 this_arg_conv.is_owned = false;
27569 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
27570 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27571 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27572 uint64_t ret_ref = (uint64_t)ret_var.inner;
27573 if (ret_var.is_owned) {
27579 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
27580 LDKRawInvoice this_arg_conv;
27581 this_arg_conv.inner = (void*)(this_arg & (~1));
27582 this_arg_conv.is_owned = false;
27583 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
27584 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27585 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27586 uint64_t ret_ref = (uint64_t)ret_var.inner;
27587 if (ret_var.is_owned) {
27593 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
27594 LDKRawInvoice this_arg_conv;
27595 this_arg_conv.inner = (void*)(this_arg & (~1));
27596 this_arg_conv.is_owned = false;
27597 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
27598 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_payment_secret(&this_arg_conv).data, 32);
27602 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_features(uint32_t this_arg) {
27603 LDKRawInvoice this_arg_conv;
27604 this_arg_conv.inner = (void*)(this_arg & (~1));
27605 this_arg_conv.is_owned = false;
27606 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
27607 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27608 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27609 uint64_t ret_ref = (uint64_t)ret_var.inner;
27610 if (ret_var.is_owned) {
27616 uint32_tArray __attribute__((visibility("default"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
27617 LDKRawInvoice this_arg_conv;
27618 this_arg_conv.inner = (void*)(this_arg & (~1));
27619 this_arg_conv.is_owned = false;
27620 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
27621 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
27622 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27623 for (size_t o = 0; o < ret_var.datalen; o++) {
27624 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
27625 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27626 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27627 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
27628 if (ret_conv_14_var.is_owned) {
27629 ret_conv_14_ref |= 1;
27631 ret_arr_ptr[o] = ret_conv_14_ref;
27633 FREE(ret_var.data);
27637 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
27638 LDKRawInvoice this_arg_conv;
27639 this_arg_conv.inner = (void*)(this_arg & (~1));
27640 this_arg_conv.is_owned = false;
27641 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27642 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
27643 uint64_t ret_ref = (uint64_t)ret_copy;
27647 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_currency(uint32_t this_arg) {
27648 LDKRawInvoice this_arg_conv;
27649 this_arg_conv.inner = (void*)(this_arg & (~1));
27650 this_arg_conv.is_owned = false;
27651 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
27655 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
27656 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27657 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
27658 return (uint64_t)ret_conv;
27661 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_system_time(int64_t time) {
27662 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27663 *ret_conv = PositiveTimestamp_from_system_time(time);
27664 return (uint64_t)ret_conv;
27667 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
27668 LDKPositiveTimestamp this_arg_conv;
27669 this_arg_conv.inner = (void*)(this_arg & (~1));
27670 this_arg_conv.is_owned = false;
27671 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
27675 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_time(uint32_t this_arg) {
27676 LDKPositiveTimestamp this_arg_conv;
27677 this_arg_conv.inner = (void*)(this_arg & (~1));
27678 this_arg_conv.is_owned = false;
27679 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
27683 uint32_t __attribute__((visibility("default"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
27684 LDKInvoice this_arg_conv;
27685 this_arg_conv.inner = (void*)(this_arg & (~1));
27686 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27687 this_arg_conv = Invoice_clone(&this_arg_conv);
27688 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
27689 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27690 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27691 uint64_t ret_ref = (uint64_t)ret_var.inner;
27692 if (ret_var.is_owned) {
27698 uint32_t __attribute__((visibility("default"))) TS_Invoice_check_signature(uint32_t this_arg) {
27699 LDKInvoice this_arg_conv;
27700 this_arg_conv.inner = (void*)(this_arg & (~1));
27701 this_arg_conv.is_owned = false;
27702 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
27703 *ret_conv = Invoice_check_signature(&this_arg_conv);
27704 return (uint64_t)ret_conv;
27707 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
27708 LDKSignedRawInvoice signed_invoice_conv;
27709 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
27710 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
27711 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
27712 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
27713 *ret_conv = Invoice_from_signed(signed_invoice_conv);
27714 return (uint64_t)ret_conv;
27717 int64_t __attribute__((visibility("default"))) TS_Invoice_timestamp(uint32_t this_arg) {
27718 LDKInvoice this_arg_conv;
27719 this_arg_conv.inner = (void*)(this_arg & (~1));
27720 this_arg_conv.is_owned = false;
27721 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
27725 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_hash(uint32_t this_arg) {
27726 LDKInvoice this_arg_conv;
27727 this_arg_conv.inner = (void*)(this_arg & (~1));
27728 this_arg_conv.is_owned = false;
27729 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
27730 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_hash(&this_arg_conv), 32);
27734 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
27735 LDKInvoice this_arg_conv;
27736 this_arg_conv.inner = (void*)(this_arg & (~1));
27737 this_arg_conv.is_owned = false;
27738 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
27739 memcpy((uint8_t*)(ret_arr + 4), Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
27743 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_secret(uint32_t this_arg) {
27744 LDKInvoice this_arg_conv;
27745 this_arg_conv.inner = (void*)(this_arg & (~1));
27746 this_arg_conv.is_owned = false;
27747 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
27748 memcpy((uint8_t*)(ret_arr + 4), Invoice_payment_secret(&this_arg_conv).data, 32);
27752 uint32_t __attribute__((visibility("default"))) TS_Invoice_features(uint32_t this_arg) {
27753 LDKInvoice this_arg_conv;
27754 this_arg_conv.inner = (void*)(this_arg & (~1));
27755 this_arg_conv.is_owned = false;
27756 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
27757 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27758 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27759 uint64_t ret_ref = (uint64_t)ret_var.inner;
27760 if (ret_var.is_owned) {
27766 int8_tArray __attribute__((visibility("default"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
27767 LDKInvoice this_arg_conv;
27768 this_arg_conv.inner = (void*)(this_arg & (~1));
27769 this_arg_conv.is_owned = false;
27770 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
27771 memcpy((uint8_t*)(ret_arr + 4), Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
27775 int64_t __attribute__((visibility("default"))) TS_Invoice_expiry_time(uint32_t this_arg) {
27776 LDKInvoice this_arg_conv;
27777 this_arg_conv.inner = (void*)(this_arg & (~1));
27778 this_arg_conv.is_owned = false;
27779 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
27783 int64_t __attribute__((visibility("default"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
27784 LDKInvoice this_arg_conv;
27785 this_arg_conv.inner = (void*)(this_arg & (~1));
27786 this_arg_conv.is_owned = false;
27787 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
27791 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_private_routes(uint32_t this_arg) {
27792 LDKInvoice this_arg_conv;
27793 this_arg_conv.inner = (void*)(this_arg & (~1));
27794 this_arg_conv.is_owned = false;
27795 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
27796 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
27797 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27798 for (size_t o = 0; o < ret_var.datalen; o++) {
27799 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
27800 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27801 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27802 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
27803 if (ret_conv_14_var.is_owned) {
27804 ret_conv_14_ref |= 1;
27806 ret_arr_ptr[o] = ret_conv_14_ref;
27808 FREE(ret_var.data);
27812 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_route_hints(uint32_t this_arg) {
27813 LDKInvoice this_arg_conv;
27814 this_arg_conv.inner = (void*)(this_arg & (~1));
27815 this_arg_conv.is_owned = false;
27816 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
27817 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
27818 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27819 for (size_t l = 0; l < ret_var.datalen; l++) {
27820 LDKRouteHint ret_conv_11_var = ret_var.data[l];
27821 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27822 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27823 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
27824 if (ret_conv_11_var.is_owned) {
27825 ret_conv_11_ref |= 1;
27827 ret_arr_ptr[l] = ret_conv_11_ref;
27829 FREE(ret_var.data);
27833 uint32_t __attribute__((visibility("default"))) TS_Invoice_currency(uint32_t this_arg) {
27834 LDKInvoice this_arg_conv;
27835 this_arg_conv.inner = (void*)(this_arg & (~1));
27836 this_arg_conv.is_owned = false;
27837 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
27841 uint32_t __attribute__((visibility("default"))) TS_Invoice_amount_pico_btc(uint32_t this_arg) {
27842 LDKInvoice this_arg_conv;
27843 this_arg_conv.inner = (void*)(this_arg & (~1));
27844 this_arg_conv.is_owned = false;
27845 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27846 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
27847 uint64_t ret_ref = (uint64_t)ret_copy;
27851 uint32_t __attribute__((visibility("default"))) TS_Description_new(jstring description) {
27852 LDKStr description_conv = str_ref_to_owned_c(description);
27853 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27854 *ret_conv = Description_new(description_conv);
27855 return (uint64_t)ret_conv;
27858 jstring __attribute__((visibility("default"))) TS_Description_into_inner(uint32_t this_arg) {
27859 LDKDescription this_arg_conv;
27860 this_arg_conv.inner = (void*)(this_arg & (~1));
27861 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27862 this_arg_conv = Description_clone(&this_arg_conv);
27863 LDKStr ret_str = Description_into_inner(this_arg_conv);
27864 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27869 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
27870 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
27871 *ret_conv = ExpiryTime_from_seconds(seconds);
27872 return (uint64_t)ret_conv;
27875 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_duration(int64_t duration) {
27876 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
27877 *ret_conv = ExpiryTime_from_duration(duration);
27878 return (uint64_t)ret_conv;
27881 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
27882 LDKExpiryTime this_arg_conv;
27883 this_arg_conv.inner = (void*)(this_arg & (~1));
27884 this_arg_conv.is_owned = false;
27885 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
27889 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
27890 LDKExpiryTime this_arg_conv;
27891 this_arg_conv.inner = (void*)(this_arg & (~1));
27892 this_arg_conv.is_owned = false;
27893 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
27897 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_new(uint32_t hops) {
27898 LDKRouteHint hops_conv;
27899 hops_conv.inner = (void*)(hops & (~1));
27900 hops_conv.is_owned = (hops & 1) || (hops == 0);
27901 hops_conv = RouteHint_clone(&hops_conv);
27902 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27903 *ret_conv = PrivateRoute_new(hops_conv);
27904 return (uint64_t)ret_conv;
27907 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
27908 LDKPrivateRoute this_arg_conv;
27909 this_arg_conv.inner = (void*)(this_arg & (~1));
27910 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27911 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
27912 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
27913 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27914 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27915 uint64_t ret_ref = (uint64_t)ret_var.inner;
27916 if (ret_var.is_owned) {
27922 uint32_t __attribute__((visibility("default"))) TS_CreationError_clone(uint32_t orig) {
27923 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
27924 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
27928 uint32_t __attribute__((visibility("default"))) TS_CreationError_description_too_long() {
27929 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
27933 uint32_t __attribute__((visibility("default"))) TS_CreationError_route_too_long() {
27934 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
27938 uint32_t __attribute__((visibility("default"))) TS_CreationError_timestamp_out_of_bounds() {
27939 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
27943 uint32_t __attribute__((visibility("default"))) TS_CreationError_expiry_time_out_of_bounds() {
27944 uint32_t ret_conv = LDKCreationError_to_js(CreationError_expiry_time_out_of_bounds());
27948 jboolean __attribute__((visibility("default"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
27949 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
27950 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
27951 jboolean ret_val = CreationError_eq(a_conv, b_conv);
27955 jstring __attribute__((visibility("default"))) TS_CreationError_to_str(uint32_t o) {
27956 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
27957 LDKStr ret_str = CreationError_to_str(o_conv);
27958 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27963 uint32_t __attribute__((visibility("default"))) TS_SemanticError_clone(uint32_t orig) {
27964 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
27965 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
27969 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_hash() {
27970 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
27974 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_hashes() {
27975 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
27979 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_description() {
27980 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
27984 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_descriptions() {
27985 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
27989 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_secret() {
27990 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
27994 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_secrets() {
27995 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
27999 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_features() {
28000 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
28004 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_recovery_id() {
28005 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
28009 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_signature() {
28010 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
28014 uint32_t __attribute__((visibility("default"))) TS_SemanticError_imprecise_amount() {
28015 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
28019 jboolean __attribute__((visibility("default"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
28020 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
28021 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
28022 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
28026 jstring __attribute__((visibility("default"))) TS_SemanticError_to_str(uint32_t o) {
28027 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
28028 LDKStr ret_str = SemanticError_to_str(o_conv);
28029 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28034 void __attribute__((visibility("default"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
28035 if ((this_ptr & 1) != 0) return;
28036 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
28037 CHECK_ACCESS(this_ptr_ptr);
28038 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
28039 FREE((void*)this_ptr);
28040 SignOrCreationError_free(this_ptr_conv);
28043 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_clone(uint32_t orig) {
28044 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
28045 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
28046 *ret_copy = SignOrCreationError_clone(orig_conv);
28047 uint64_t ret_ref = (uint64_t)ret_copy;
28051 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_sign_error() {
28052 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
28053 *ret_copy = SignOrCreationError_sign_error();
28054 uint64_t ret_ref = (uint64_t)ret_copy;
28058 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_creation_error(uint32_t a) {
28059 LDKCreationError a_conv = LDKCreationError_from_js(a);
28060 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
28061 *ret_copy = SignOrCreationError_creation_error(a_conv);
28062 uint64_t ret_ref = (uint64_t)ret_copy;
28066 jboolean __attribute__((visibility("default"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
28067 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
28068 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
28069 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
28073 jstring __attribute__((visibility("default"))) TS_SignOrCreationError_to_str(uint32_t o) {
28074 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
28075 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
28076 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28081 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) {
28082 LDKChannelManager channelmanager_conv;
28083 channelmanager_conv.inner = (void*)(channelmanager & (~1));
28084 channelmanager_conv.is_owned = false;
28085 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
28086 CHECK_ACCESS(keys_manager_ptr);
28087 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
28088 LDKCurrency network_conv = LDKCurrency_from_js(network);
28089 void* amt_msat_ptr = (void*)(((uint64_t)amt_msat) & ~1);
28090 CHECK_ACCESS(amt_msat_ptr);
28091 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
28092 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
28093 LDKStr description_conv = str_ref_to_owned_c(description);
28094 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
28095 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
28096 return (uint64_t)ret_conv;
28099 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_from_str(jstring s) {
28100 LDKStr s_conv = str_ref_to_owned_c(s);
28101 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
28102 *ret_conv = SiPrefix_from_str(s_conv);
28103 return (uint64_t)ret_conv;
28106 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_str(jstring s) {
28107 LDKStr s_conv = str_ref_to_owned_c(s);
28108 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
28109 *ret_conv = Invoice_from_str(s_conv);
28110 return (uint64_t)ret_conv;
28113 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_from_str(jstring s) {
28114 LDKStr s_conv = str_ref_to_owned_c(s);
28115 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
28116 *ret_conv = SignedRawInvoice_from_str(s_conv);
28117 return (uint64_t)ret_conv;
28120 jstring __attribute__((visibility("default"))) TS_Invoice_to_str(uint32_t o) {
28122 o_conv.inner = (void*)(o & (~1));
28123 o_conv.is_owned = false;
28124 LDKStr ret_str = Invoice_to_str(&o_conv);
28125 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28130 jstring __attribute__((visibility("default"))) TS_SignedRawInvoice_to_str(uint32_t o) {
28131 LDKSignedRawInvoice o_conv;
28132 o_conv.inner = (void*)(o & (~1));
28133 o_conv.is_owned = false;
28134 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
28135 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28140 jstring __attribute__((visibility("default"))) TS_Currency_to_str(uint32_t o) {
28141 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
28142 LDKStr ret_str = Currency_to_str(o_conv);
28143 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28148 jstring __attribute__((visibility("default"))) TS_SiPrefix_to_str(uint32_t o) {
28149 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
28150 LDKStr ret_str = SiPrefix_to_str(o_conv);
28151 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);