1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
7 // These should be provided...somehow...
8 void *memset(void *s, int c, size_t n);
9 void *memcpy(void *dest, const void *src, size_t n);
10 int memcmp(const void *s1, const void *s2, size_t n);
12 void __attribute__((noreturn)) abort(void);
13 static inline void assert(bool expression) {
14 if (!expression) { abort(); }
17 void *malloc(size_t size);
20 #define MALLOC(a, _) malloc(a)
21 #define FREE(p) if ((unsigned long)(p) > 1024) { free(p); }
22 #define DO_ASSERT(a) (void)(a)
24 #define CHECK_ACCESS(p)
26 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
27 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
28 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
29 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
31 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
33 typedef uint32_t int64_tArray;
34 typedef uint32_t int8_tArray;
35 typedef uint32_t uint32_tArray;
36 typedef uint32_t ptrArray;
37 typedef uint32_t jstring;
39 static inline uint32_t init_arr(size_t arr_len, size_t elem_size, const char *type_desc) {
40 uint32_t *elems = (uint32_t*)MALLOC(arr_len * elem_size + 4, type_desc);
42 return (uint32_t)elems;
45 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
46 char* err_buf = MALLOC(len + 4, "str conv buf");
47 *((uint32_t*)err_buf) = len;
48 memcpy(err_buf + 4, chars, len);
49 return (uint32_t) err_buf;
51 static inline LDKStr str_ref_to_owned_c(jstring str) {
52 uint32_t *str_len = (uint32_t*)str;
53 char* newchars = MALLOC(*str_len + 1, "String chars");
54 memcpy(newchars, (const char*)(str + 4), *str_len);
55 newchars[*str_len] = 0;
59 .chars_is_owned = true
64 typedef bool jboolean;
66 uint32_t __attribute__((visibility("default"))) TS_malloc(uint32_t size) {
67 return (uint32_t)MALLOC(size, "JS-Called malloc");
69 void __attribute__((visibility("default"))) TS_free(uint32_t ptr) {
72 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
73 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
75 case 0: return LDKAccessError_UnknownChain;
76 case 1: return LDKAccessError_UnknownTx;
80 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
82 case LDKAccessError_UnknownChain: return 0;
83 case LDKAccessError_UnknownTx: return 1;
87 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
89 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
90 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
94 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
96 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
97 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
101 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
103 case 0: return LDKConfirmationTarget_Background;
104 case 1: return LDKConfirmationTarget_Normal;
105 case 2: return LDKConfirmationTarget_HighPriority;
109 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
111 case LDKConfirmationTarget_Background: return 0;
112 case LDKConfirmationTarget_Normal: return 1;
113 case LDKConfirmationTarget_HighPriority: return 2;
117 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
119 case 0: return LDKCreationError_DescriptionTooLong;
120 case 1: return LDKCreationError_RouteTooLong;
121 case 2: return LDKCreationError_TimestampOutOfBounds;
122 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
126 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
128 case LDKCreationError_DescriptionTooLong: return 0;
129 case LDKCreationError_RouteTooLong: return 1;
130 case LDKCreationError_TimestampOutOfBounds: return 2;
131 case LDKCreationError_ExpiryTimeOutOfBounds: return 3;
135 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
137 case 0: return LDKCurrency_Bitcoin;
138 case 1: return LDKCurrency_BitcoinTestnet;
139 case 2: return LDKCurrency_Regtest;
140 case 3: return LDKCurrency_Simnet;
141 case 4: return LDKCurrency_Signet;
145 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
147 case LDKCurrency_Bitcoin: return 0;
148 case LDKCurrency_BitcoinTestnet: return 1;
149 case LDKCurrency_Regtest: return 2;
150 case LDKCurrency_Simnet: return 3;
151 case LDKCurrency_Signet: return 4;
155 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
157 case 0: return LDKIOError_NotFound;
158 case 1: return LDKIOError_PermissionDenied;
159 case 2: return LDKIOError_ConnectionRefused;
160 case 3: return LDKIOError_ConnectionReset;
161 case 4: return LDKIOError_ConnectionAborted;
162 case 5: return LDKIOError_NotConnected;
163 case 6: return LDKIOError_AddrInUse;
164 case 7: return LDKIOError_AddrNotAvailable;
165 case 8: return LDKIOError_BrokenPipe;
166 case 9: return LDKIOError_AlreadyExists;
167 case 10: return LDKIOError_WouldBlock;
168 case 11: return LDKIOError_InvalidInput;
169 case 12: return LDKIOError_InvalidData;
170 case 13: return LDKIOError_TimedOut;
171 case 14: return LDKIOError_WriteZero;
172 case 15: return LDKIOError_Interrupted;
173 case 16: return LDKIOError_Other;
174 case 17: return LDKIOError_UnexpectedEof;
178 static inline int32_t LDKIOError_to_js(LDKIOError val) {
180 case LDKIOError_NotFound: return 0;
181 case LDKIOError_PermissionDenied: return 1;
182 case LDKIOError_ConnectionRefused: return 2;
183 case LDKIOError_ConnectionReset: return 3;
184 case LDKIOError_ConnectionAborted: return 4;
185 case LDKIOError_NotConnected: return 5;
186 case LDKIOError_AddrInUse: return 6;
187 case LDKIOError_AddrNotAvailable: return 7;
188 case LDKIOError_BrokenPipe: return 8;
189 case LDKIOError_AlreadyExists: return 9;
190 case LDKIOError_WouldBlock: return 10;
191 case LDKIOError_InvalidInput: return 11;
192 case LDKIOError_InvalidData: return 12;
193 case LDKIOError_TimedOut: return 13;
194 case LDKIOError_WriteZero: return 14;
195 case LDKIOError_Interrupted: return 15;
196 case LDKIOError_Other: return 16;
197 case LDKIOError_UnexpectedEof: return 17;
201 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
203 case 0: return LDKLevel_Trace;
204 case 1: return LDKLevel_Debug;
205 case 2: return LDKLevel_Info;
206 case 3: return LDKLevel_Warn;
207 case 4: return LDKLevel_Error;
211 static inline int32_t LDKLevel_to_js(LDKLevel val) {
213 case LDKLevel_Trace: return 0;
214 case LDKLevel_Debug: return 1;
215 case LDKLevel_Info: return 2;
216 case LDKLevel_Warn: return 3;
217 case LDKLevel_Error: return 4;
221 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
223 case 0: return LDKNetwork_Bitcoin;
224 case 1: return LDKNetwork_Testnet;
225 case 2: return LDKNetwork_Regtest;
226 case 3: return LDKNetwork_Signet;
230 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
232 case LDKNetwork_Bitcoin: return 0;
233 case LDKNetwork_Testnet: return 1;
234 case LDKNetwork_Regtest: return 2;
235 case LDKNetwork_Signet: return 3;
239 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
241 case 0: return LDKSecp256k1Error_IncorrectSignature;
242 case 1: return LDKSecp256k1Error_InvalidMessage;
243 case 2: return LDKSecp256k1Error_InvalidPublicKey;
244 case 3: return LDKSecp256k1Error_InvalidSignature;
245 case 4: return LDKSecp256k1Error_InvalidSecretKey;
246 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
247 case 6: return LDKSecp256k1Error_InvalidTweak;
248 case 7: return LDKSecp256k1Error_TweakCheckFailed;
249 case 8: return LDKSecp256k1Error_NotEnoughMemory;
253 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
255 case LDKSecp256k1Error_IncorrectSignature: return 0;
256 case LDKSecp256k1Error_InvalidMessage: return 1;
257 case LDKSecp256k1Error_InvalidPublicKey: return 2;
258 case LDKSecp256k1Error_InvalidSignature: return 3;
259 case LDKSecp256k1Error_InvalidSecretKey: return 4;
260 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
261 case LDKSecp256k1Error_InvalidTweak: return 6;
262 case LDKSecp256k1Error_TweakCheckFailed: return 7;
263 case LDKSecp256k1Error_NotEnoughMemory: return 8;
267 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
269 case 0: return LDKSemanticError_NoPaymentHash;
270 case 1: return LDKSemanticError_MultiplePaymentHashes;
271 case 2: return LDKSemanticError_NoDescription;
272 case 3: return LDKSemanticError_MultipleDescriptions;
273 case 4: return LDKSemanticError_NoPaymentSecret;
274 case 5: return LDKSemanticError_MultiplePaymentSecrets;
275 case 6: return LDKSemanticError_InvalidFeatures;
276 case 7: return LDKSemanticError_InvalidRecoveryId;
277 case 8: return LDKSemanticError_InvalidSignature;
278 case 9: return LDKSemanticError_ImpreciseAmount;
282 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
284 case LDKSemanticError_NoPaymentHash: return 0;
285 case LDKSemanticError_MultiplePaymentHashes: return 1;
286 case LDKSemanticError_NoDescription: return 2;
287 case LDKSemanticError_MultipleDescriptions: return 3;
288 case LDKSemanticError_NoPaymentSecret: return 4;
289 case LDKSemanticError_MultiplePaymentSecrets: return 5;
290 case LDKSemanticError_InvalidFeatures: return 6;
291 case LDKSemanticError_InvalidRecoveryId: return 7;
292 case LDKSemanticError_InvalidSignature: return 8;
293 case LDKSemanticError_ImpreciseAmount: return 9;
297 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
299 case 0: return LDKSiPrefix_Milli;
300 case 1: return LDKSiPrefix_Micro;
301 case 2: return LDKSiPrefix_Nano;
302 case 3: return LDKSiPrefix_Pico;
306 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
308 case LDKSiPrefix_Milli: return 0;
309 case LDKSiPrefix_Micro: return 1;
310 case LDKSiPrefix_Nano: return 2;
311 case LDKSiPrefix_Pico: return 3;
315 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u8Z_new(int8_tArray elems) {
316 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
317 ret->datalen = *((uint32_t*)elems);
318 if (ret->datalen == 0) {
321 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
322 int8_t *java_elems = (int8_t*)(elems + 4);
323 for (size_t i = 0; i < ret->datalen; i++) {
324 ret->data[i] = java_elems[i];
327 return (uint64_t)ret;
329 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
330 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
331 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
334 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) {
335 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
336 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
337 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
338 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
339 CVec_u8Z_free(ret_var);
343 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t __attribute__((visibility("default"))) TS_TxOut_get_value(uint32_t thing) {
344 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
345 int64_t ret_val = TxOut_get_value(thing_conv);
349 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_result_ok(uint32_t arg) {
350 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
352 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_ok(uint32_t arg) {
353 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
354 CHECK(val->result_ok);
355 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
356 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).bytes, 32);
359 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_err(uint32_t arg) {
360 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
361 CHECK(!val->result_ok);
362 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
365 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_result_ok(uint32_t arg) {
366 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
368 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_ok(uint32_t arg) {
369 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
370 CHECK(val->result_ok);
371 int8_tArray res_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
372 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compressed_form, 33);
375 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_err(uint32_t arg) {
376 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
377 CHECK(!val->result_ok);
378 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
381 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_result_ok(uint32_t arg) {
382 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
384 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t arg) {
385 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
386 CHECK(val->result_ok);
387 LDKTxCreationKeys res_var = (*val->contents.result);
388 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
389 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
390 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
393 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t arg) {
394 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
395 CHECK(!val->result_ok);
396 LDKDecodeError err_var = (*val->contents.err);
397 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
398 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
399 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
402 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_result_ok(uint32_t arg) {
403 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
405 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t arg) {
406 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
407 CHECK(val->result_ok);
408 LDKChannelPublicKeys res_var = (*val->contents.result);
409 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
410 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
411 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
414 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t arg) {
415 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
416 CHECK(!val->result_ok);
417 LDKDecodeError err_var = (*val->contents.err);
418 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
419 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
420 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
423 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_result_ok(uint32_t arg) {
424 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
426 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_ok(uint32_t arg) {
427 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
428 CHECK(val->result_ok);
429 LDKTxCreationKeys res_var = (*val->contents.result);
430 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
431 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
432 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
435 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_err(uint32_t arg) {
436 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
437 CHECK(!val->result_ok);
438 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
441 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u32Z_ref_from_ptr(uint32_t ptr) {
442 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
444 case LDKCOption_u32Z_Some: {
445 return 0 /* LDKCOption_u32Z - Some */; (void) obj->some;
447 case LDKCOption_u32Z_None: {
448 return 0 /* LDKCOption_u32Z - None */;
453 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_result_ok(uint32_t arg) {
454 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
456 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
457 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
458 CHECK(val->result_ok);
459 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
460 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
461 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
462 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
465 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
466 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
467 CHECK(!val->result_ok);
468 LDKDecodeError err_var = (*val->contents.err);
469 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
470 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
471 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
474 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
475 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
477 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
478 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
479 CHECK(val->result_ok);
480 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
481 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
482 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
483 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
486 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
487 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
488 CHECK(!val->result_ok);
489 LDKDecodeError err_var = (*val->contents.err);
490 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
491 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
492 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
495 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
496 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
498 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
499 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
500 CHECK(val->result_ok);
501 LDKChannelTransactionParameters res_var = (*val->contents.result);
502 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
503 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
504 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
507 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
508 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
509 CHECK(!val->result_ok);
510 LDKDecodeError err_var = (*val->contents.err);
511 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
512 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
513 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
516 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
517 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
519 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
520 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
521 CHECK(val->result_ok);
522 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
523 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
524 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
525 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
528 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
529 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
530 CHECK(!val->result_ok);
531 LDKDecodeError err_var = (*val->contents.err);
532 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
533 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
534 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
537 jboolean __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
538 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
540 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
541 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
542 CHECK(val->result_ok);
543 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
544 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
545 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
546 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
549 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
550 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
551 CHECK(!val->result_ok);
552 LDKDecodeError err_var = (*val->contents.err);
553 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
554 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
555 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
558 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_result_ok(uint32_t arg) {
559 return ((LDKCResult_TrustedClosingTransactionNoneZ*)arg)->result_ok;
561 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t arg) {
562 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
563 CHECK(val->result_ok);
564 LDKTrustedClosingTransaction res_var = (*val->contents.result);
565 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
566 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
567 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
570 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_err(uint32_t arg) {
571 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
572 CHECK(!val->result_ok);
573 return *val->contents.err;
575 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
576 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
578 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
579 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
580 CHECK(val->result_ok);
581 LDKCommitmentTransaction res_var = (*val->contents.result);
582 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
583 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
584 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
587 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
588 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
589 CHECK(!val->result_ok);
590 LDKDecodeError err_var = (*val->contents.err);
591 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
592 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
593 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
596 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_result_ok(uint32_t arg) {
597 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
599 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
600 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
601 CHECK(val->result_ok);
602 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
603 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
604 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
605 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
608 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
609 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
610 CHECK(!val->result_ok);
611 return *val->contents.err;
613 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_result_ok(uint32_t arg) {
614 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
616 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
617 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
618 CHECK(val->result_ok);
619 LDKCVec_SignatureZ res_var = (*val->contents.result);
620 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
621 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
622 for (size_t m = 0; m < res_var.datalen; m++) {
623 int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
624 memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64);
625 res_arr_ptr[m] = res_conv_12_arr;
629 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
630 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
631 CHECK(!val->result_ok);
632 return *val->contents.err;
634 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_result_ok(uint32_t arg) {
635 return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
637 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t arg) {
638 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
639 CHECK(val->result_ok);
640 LDKShutdownScript res_var = (*val->contents.result);
641 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
642 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
643 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
646 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t arg) {
647 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
648 CHECK(!val->result_ok);
649 LDKDecodeError err_var = (*val->contents.err);
650 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
651 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
652 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
655 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_result_ok(uint32_t arg) {
656 return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
658 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t arg) {
659 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
660 CHECK(val->result_ok);
661 LDKShutdownScript res_var = (*val->contents.result);
662 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
663 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
664 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
667 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t arg) {
668 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
669 CHECK(!val->result_ok);
670 LDKInvalidShutdownScript err_var = (*val->contents.err);
671 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
672 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
673 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
676 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_result_ok(uint32_t arg) {
677 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
679 void __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_ok(uint32_t arg) {
680 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
681 CHECK(val->result_ok);
682 return *val->contents.result;
684 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_err(uint32_t arg) {
685 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
686 CHECK(!val->result_ok);
687 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
690 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_result_ok(uint32_t arg) {
691 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
693 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_ok(uint32_t arg) {
694 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
695 CHECK(val->result_ok);
696 LDKRouteHop res_var = (*val->contents.result);
697 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
698 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
699 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
702 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_err(uint32_t arg) {
703 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
704 CHECK(!val->result_ok);
705 LDKDecodeError err_var = (*val->contents.err);
706 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
707 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
708 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
711 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) {
712 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
713 ret->datalen = *((uint32_t*)elems);
714 if (ret->datalen == 0) {
717 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
718 uint32_t *java_elems = (uint32_t*)(elems + 4);
719 for (size_t i = 0; i < ret->datalen; i++) {
720 uint32_t arr_elem = java_elems[i];
721 LDKRouteHop arr_elem_conv;
722 arr_elem_conv.inner = (void*)(arr_elem & (~1));
723 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
724 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
725 ret->data[i] = arr_elem_conv;
728 return (uint64_t)ret;
730 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
731 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
732 for (size_t i = 0; i < ret.datalen; i++) {
733 ret.data[i] = RouteHop_clone(&orig->data[i]);
737 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
738 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
739 for (size_t i = 0; i < ret.datalen; i++) {
740 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
744 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_result_ok(uint32_t arg) {
745 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
747 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
748 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
749 CHECK(val->result_ok);
750 LDKRoute res_var = (*val->contents.result);
751 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
752 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
753 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
756 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
757 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
758 CHECK(!val->result_ok);
759 LDKDecodeError err_var = (*val->contents.err);
760 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
761 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
762 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
765 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
766 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
768 case LDKCOption_u64Z_Some: {
769 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
771 case LDKCOption_u64Z_None: {
772 return 0 /* LDKCOption_u64Z - None */;
777 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) {
778 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
779 ret->datalen = *((uint32_t*)elems);
780 if (ret->datalen == 0) {
783 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
784 uint32_t *java_elems = (uint32_t*)(elems + 4);
785 for (size_t i = 0; i < ret->datalen; i++) {
786 uint32_t arr_elem = java_elems[i];
787 LDKChannelDetails arr_elem_conv;
788 arr_elem_conv.inner = (void*)(arr_elem & (~1));
789 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
790 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
791 ret->data[i] = arr_elem_conv;
794 return (uint64_t)ret;
796 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
797 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
798 for (size_t i = 0; i < ret.datalen; i++) {
799 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
803 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintZ_new(uint32_tArray elems) {
804 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
805 ret->datalen = *((uint32_t*)elems);
806 if (ret->datalen == 0) {
809 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
810 uint32_t *java_elems = (uint32_t*)(elems + 4);
811 for (size_t i = 0; i < ret->datalen; i++) {
812 uint32_t arr_elem = java_elems[i];
813 LDKRouteHint arr_elem_conv;
814 arr_elem_conv.inner = (void*)(arr_elem & (~1));
815 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
816 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
817 ret->data[i] = arr_elem_conv;
820 return (uint64_t)ret;
822 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
823 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
824 for (size_t i = 0; i < ret.datalen; i++) {
825 ret.data[i] = RouteHint_clone(&orig->data[i]);
829 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_result_ok(uint32_t arg) {
830 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
832 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
833 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
834 CHECK(val->result_ok);
835 LDKRoute res_var = (*val->contents.result);
836 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
837 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
838 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
841 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
842 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
843 CHECK(!val->result_ok);
844 LDKLightningError err_var = (*val->contents.err);
845 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
846 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
847 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
850 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_result_ok(uint32_t arg) {
851 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
853 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
854 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
855 CHECK(val->result_ok);
856 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
857 return (uint64_t)res_ref;
859 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
860 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
861 CHECK(!val->result_ok);
862 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
865 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
868 int64_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_a(uint32_t tuple) {
869 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
870 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(tuple_conv);
874 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
877 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_b(uint32_t tuple) {
878 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
879 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(tuple_conv);
880 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
881 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
882 Transaction_free(ret_var);
886 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_usizeTransactionZZ_new(uint32_tArray elems) {
887 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
888 ret->datalen = *((uint32_t*)elems);
889 if (ret->datalen == 0) {
892 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
893 uint32_t *java_elems = (uint32_t*)(elems + 4);
894 for (size_t i = 0; i < ret->datalen; i++) {
895 uint32_t arr_elem = java_elems[i];
896 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
897 CHECK_ACCESS(arr_elem_ptr);
898 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(arr_elem_ptr);
899 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
900 ret->data[i] = arr_elem_conv;
903 return (uint64_t)ret;
905 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
906 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
907 for (size_t i = 0; i < ret.datalen; i++) {
908 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
912 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
913 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
914 for (size_t i = 0; i < ret.datalen; i++) {
915 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
919 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(uint32_t arg) {
920 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
922 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
923 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
924 CHECK(val->result_ok);
925 return *val->contents.result;
927 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
928 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
929 CHECK(!val->result_ok);
930 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
933 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
934 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
936 case LDKMonitorEvent_HTLCEvent: {
937 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
938 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
939 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
940 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
941 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
943 case LDKMonitorEvent_CommitmentTxConfirmed: {
944 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
945 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
946 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
947 uint64_t commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
948 return 0 /* LDKMonitorEvent - CommitmentTxConfirmed */; (void) commitment_tx_confirmed_ref;
953 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) {
954 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
955 ret->datalen = *((uint32_t*)elems);
956 if (ret->datalen == 0) {
959 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
960 uint32_t *java_elems = (uint32_t*)(elems + 4);
961 for (size_t i = 0; i < ret->datalen; i++) {
962 uint32_t arr_elem = java_elems[i];
963 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
964 CHECK_ACCESS(arr_elem_ptr);
965 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(arr_elem_ptr);
966 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
967 ret->data[i] = arr_elem_conv;
970 return (uint64_t)ret;
972 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
973 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
974 for (size_t i = 0; i < ret.datalen; i++) {
975 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
979 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
980 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
982 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
983 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
984 *some_conv = obj->some;
985 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
986 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) ((uint64_t)some_conv);
988 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
989 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
994 uint32_t __attribute__((visibility("default"))) TS_LDKNetworkUpdate_ref_from_ptr(uint32_t ptr) {
995 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
997 case LDKNetworkUpdate_ChannelUpdateMessage: {
998 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
999 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1000 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1001 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1002 return 0 /* LDKNetworkUpdate - ChannelUpdateMessage */; (void) msg_ref;
1004 case LDKNetworkUpdate_ChannelClosed: {
1005 return 0 /* LDKNetworkUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
1007 case LDKNetworkUpdate_NodeFailure: {
1008 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1009 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
1010 return 0 /* LDKNetworkUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
1015 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_NetworkUpdateZ_ref_from_ptr(uint32_t ptr) {
1016 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1018 case LDKCOption_NetworkUpdateZ_Some: {
1019 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1020 return 0 /* LDKCOption_NetworkUpdateZ - Some */; (void) some_ref;
1022 case LDKCOption_NetworkUpdateZ_None: {
1023 return 0 /* LDKCOption_NetworkUpdateZ - None */;
1028 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
1029 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1031 case LDKSpendableOutputDescriptor_StaticOutput: {
1032 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1033 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1034 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1035 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1036 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1037 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (uint64_t)output_ref;
1039 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1040 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1041 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1042 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1043 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1044 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
1046 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1047 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1048 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1049 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1050 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1051 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
1056 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_SpendableOutputDescriptorZ_new(uint32_tArray elems) {
1057 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1058 ret->datalen = *((uint32_t*)elems);
1059 if (ret->datalen == 0) {
1062 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1063 uint32_t *java_elems = (uint32_t*)(elems + 4);
1064 for (size_t i = 0; i < ret->datalen; i++) {
1065 uint32_t arr_elem = java_elems[i];
1066 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
1067 CHECK_ACCESS(arr_elem_ptr);
1068 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(arr_elem_ptr);
1069 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1070 ret->data[i] = arr_elem_conv;
1073 return (uint64_t)ret;
1075 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1076 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1077 for (size_t i = 0; i < ret.datalen; i++) {
1078 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1082 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
1083 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1085 case LDKErrorAction_DisconnectPeer: {
1086 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1087 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1088 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1089 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1090 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
1092 case LDKErrorAction_IgnoreError: {
1093 return 0 /* LDKErrorAction - IgnoreError */;
1095 case LDKErrorAction_IgnoreAndLog: {
1096 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
1097 return 0 /* LDKErrorAction - IgnoreAndLog */; (void) ignore_and_log_conv;
1099 case LDKErrorAction_SendErrorMessage: {
1100 LDKErrorMessage msg_var = obj->send_error_message.msg;
1101 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1102 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1103 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1104 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
1109 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
1110 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1112 case LDKMessageSendEvent_SendAcceptChannel: {
1113 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1114 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
1115 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1116 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1117 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1118 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1119 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
1121 case LDKMessageSendEvent_SendOpenChannel: {
1122 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1123 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
1124 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1125 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1126 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1127 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1128 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
1130 case LDKMessageSendEvent_SendFundingCreated: {
1131 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1132 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
1133 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1134 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1135 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1136 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1137 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
1139 case LDKMessageSendEvent_SendFundingSigned: {
1140 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1141 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
1142 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1143 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1144 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1145 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1146 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
1148 case LDKMessageSendEvent_SendFundingLocked: {
1149 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1150 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
1151 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1152 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1153 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1154 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1155 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
1157 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1158 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1159 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
1160 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1161 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1162 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1163 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1164 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
1166 case LDKMessageSendEvent_UpdateHTLCs: {
1167 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1168 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
1169 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1170 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1171 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1172 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1173 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
1175 case LDKMessageSendEvent_SendRevokeAndACK: {
1176 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1177 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
1178 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1179 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1180 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1181 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1182 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
1184 case LDKMessageSendEvent_SendClosingSigned: {
1185 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1186 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
1187 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1188 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1189 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1190 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1191 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
1193 case LDKMessageSendEvent_SendShutdown: {
1194 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1195 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
1196 LDKShutdown msg_var = obj->send_shutdown.msg;
1197 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1198 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1199 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1200 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
1202 case LDKMessageSendEvent_SendChannelReestablish: {
1203 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1204 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
1205 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1206 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1207 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1208 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1209 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
1211 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1212 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1213 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1214 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1215 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1216 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1217 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1218 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1219 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1220 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
1222 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1223 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1224 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1225 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1226 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1227 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
1229 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1230 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1231 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1232 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1233 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1234 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
1236 case LDKMessageSendEvent_SendChannelUpdate: {
1237 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1238 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_update.node_id.compressed_form, 33);
1239 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1240 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1241 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1242 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1243 return 0 /* LDKMessageSendEvent - SendChannelUpdate */; (void) node_id_arr; (void) msg_ref;
1245 case LDKMessageSendEvent_HandleError: {
1246 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1247 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
1248 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1249 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
1251 case LDKMessageSendEvent_SendChannelRangeQuery: {
1252 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1253 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
1254 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1255 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1256 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1257 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1258 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
1260 case LDKMessageSendEvent_SendShortIdsQuery: {
1261 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1262 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
1263 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1264 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1265 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1266 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1267 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
1269 case LDKMessageSendEvent_SendReplyChannelRange: {
1270 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1271 memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33);
1272 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1273 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1274 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1275 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1276 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
1281 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MessageSendEventZ_new(uint32_tArray elems) {
1282 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1283 ret->datalen = *((uint32_t*)elems);
1284 if (ret->datalen == 0) {
1287 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1288 uint32_t *java_elems = (uint32_t*)(elems + 4);
1289 for (size_t i = 0; i < ret->datalen; i++) {
1290 uint32_t arr_elem = java_elems[i];
1291 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
1292 CHECK_ACCESS(arr_elem_ptr);
1293 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(arr_elem_ptr);
1294 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1295 ret->data[i] = arr_elem_conv;
1298 return (uint64_t)ret;
1300 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1301 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1302 for (size_t i = 0; i < ret.datalen; i++) {
1303 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1307 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1308 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1310 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1311 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1312 CHECK(val->result_ok);
1313 LDKInitFeatures res_var = (*val->contents.result);
1314 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1315 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1316 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1319 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1320 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1321 CHECK(!val->result_ok);
1322 LDKDecodeError err_var = (*val->contents.err);
1323 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1324 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1325 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1328 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1329 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1331 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1332 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1333 CHECK(val->result_ok);
1334 LDKNodeFeatures res_var = (*val->contents.result);
1335 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1336 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1337 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1340 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1341 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1342 CHECK(!val->result_ok);
1343 LDKDecodeError err_var = (*val->contents.err);
1344 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1345 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1346 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1349 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1350 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1352 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1353 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1354 CHECK(val->result_ok);
1355 LDKChannelFeatures res_var = (*val->contents.result);
1356 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1357 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1358 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1361 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1362 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1363 CHECK(!val->result_ok);
1364 LDKDecodeError err_var = (*val->contents.err);
1365 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1366 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1367 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1370 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1371 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1373 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1374 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1375 CHECK(val->result_ok);
1376 LDKInvoiceFeatures res_var = (*val->contents.result);
1377 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1378 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1379 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1382 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1383 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1384 CHECK(!val->result_ok);
1385 LDKDecodeError err_var = (*val->contents.err);
1386 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1387 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1388 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1391 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1392 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1394 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1395 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1396 CHECK(val->result_ok);
1397 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1398 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1399 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1400 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1403 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1404 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1405 CHECK(!val->result_ok);
1406 LDKDecodeError err_var = (*val->contents.err);
1407 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1408 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1409 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1412 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1413 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1415 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1416 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1417 CHECK(val->result_ok);
1418 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1419 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1420 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1421 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1424 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1425 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1426 CHECK(!val->result_ok);
1427 LDKDecodeError err_var = (*val->contents.err);
1428 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1429 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1430 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1433 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1434 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1436 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1437 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1438 CHECK(val->result_ok);
1439 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1442 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1443 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1444 CHECK(!val->result_ok);
1445 LDKDecodeError err_var = (*val->contents.err);
1446 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1447 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1448 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1451 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_result_ok(uint32_t arg) {
1452 return ((LDKCResult_NoneNoneZ*)arg)->result_ok;
1454 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_ok(uint32_t arg) {
1455 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1456 CHECK(val->result_ok);
1457 return *val->contents.result;
1459 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_err(uint32_t arg) {
1460 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1461 CHECK(!val->result_ok);
1462 return *val->contents.err;
1464 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
1467 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t tuple) {
1468 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
1469 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1470 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_SignatureCVec_SignatureZZ_get_a(tuple_conv).compact_form, 64);
1474 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
1477 ptrArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t tuple) {
1478 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
1479 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(tuple_conv);
1480 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1481 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
1482 for (size_t m = 0; m < ret_var.datalen; m++) {
1483 int8_tArray ret_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1484 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compact_form, 64);
1485 ret_arr_ptr[m] = ret_conv_12_arr;
1491 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(uint32_t arg) {
1492 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1494 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1495 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1496 CHECK(val->result_ok);
1497 LDKC2Tuple_SignatureCVec_SignatureZZ* res_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1498 *res_conv = (*val->contents.result);
1499 *res_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(res_conv);
1500 return ((uint64_t)res_conv);
1502 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1503 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1504 CHECK(!val->result_ok);
1505 return *val->contents.err;
1507 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_result_ok(uint32_t arg) {
1508 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1510 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1511 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1512 CHECK(val->result_ok);
1513 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1514 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1517 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1518 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1519 CHECK(!val->result_ok);
1520 return *val->contents.err;
1522 typedef struct LDKBaseSign_JCalls {
1523 atomic_size_t refcnt;
1524 uint32_t get_per_commitment_point_meth;
1525 uint32_t release_commitment_secret_meth;
1526 uint32_t validate_holder_commitment_meth;
1527 uint32_t channel_keys_id_meth;
1528 uint32_t sign_counterparty_commitment_meth;
1529 uint32_t validate_counterparty_revocation_meth;
1530 uint32_t sign_holder_commitment_and_htlcs_meth;
1531 uint32_t sign_justice_revoked_output_meth;
1532 uint32_t sign_justice_revoked_htlc_meth;
1533 uint32_t sign_counterparty_htlc_transaction_meth;
1534 uint32_t sign_closing_transaction_meth;
1535 uint32_t sign_channel_announcement_meth;
1536 uint32_t ready_channel_meth;
1537 } LDKBaseSign_JCalls;
1538 static void LDKBaseSign_JCalls_free(void* this_arg) {
1539 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1540 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1541 js_free(j_calls->get_per_commitment_point_meth);
1542 js_free(j_calls->release_commitment_secret_meth);
1543 js_free(j_calls->validate_holder_commitment_meth);
1544 js_free(j_calls->channel_keys_id_meth);
1545 js_free(j_calls->sign_counterparty_commitment_meth);
1546 js_free(j_calls->validate_counterparty_revocation_meth);
1547 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1548 js_free(j_calls->sign_justice_revoked_output_meth);
1549 js_free(j_calls->sign_justice_revoked_htlc_meth);
1550 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1551 js_free(j_calls->sign_closing_transaction_meth);
1552 js_free(j_calls->sign_channel_announcement_meth);
1553 js_free(j_calls->ready_channel_meth);
1557 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1558 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1559 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1560 LDKPublicKey ret_ref;
1561 CHECK(*((uint32_t*)ret) == 33);
1562 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1565 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1566 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1567 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1568 LDKThirtyTwoBytes ret_ref;
1569 CHECK(*((uint32_t*)ret) == 32);
1570 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1573 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
1574 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1575 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1576 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
1577 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1578 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1579 uint64_t holder_tx_ref = (uint64_t)holder_tx_var.inner;
1580 if (holder_tx_var.is_owned) {
1583 uint32_t ret = js_invoke_function_1(j_calls->validate_holder_commitment_meth, holder_tx_ref);
1584 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1585 CHECK_ACCESS(ret_ptr);
1586 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1587 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
1590 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1591 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1592 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1593 LDKThirtyTwoBytes ret_ref;
1594 CHECK(*((uint32_t*)ret) == 32);
1595 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1598 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1599 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1600 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1601 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1602 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1603 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1604 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1605 if (commitment_tx_var.is_owned) {
1606 commitment_tx_ref |= 1;
1608 uint32_t ret = js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1609 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1610 CHECK_ACCESS(ret_ptr);
1611 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1612 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1615 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1616 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1617 int8_tArray secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1618 memcpy((uint8_t*)(secret_arr + 4), *secret, 32);
1619 uint32_t ret = js_invoke_function_2(j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
1620 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1621 CHECK_ACCESS(ret_ptr);
1622 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1623 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
1626 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1627 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1628 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1629 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1630 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1631 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1632 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1633 if (commitment_tx_var.is_owned) {
1634 commitment_tx_ref |= 1;
1636 uint32_t ret = js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1637 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1638 CHECK_ACCESS(ret_ptr);
1639 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1640 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1643 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]) {
1644 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1645 LDKTransaction justice_tx_var = justice_tx;
1646 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1647 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1648 Transaction_free(justice_tx_var);
1649 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1650 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1651 uint32_t ret = js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
1652 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1653 CHECK_ACCESS(ret_ptr);
1654 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1655 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1658 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) {
1659 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1660 LDKTransaction justice_tx_var = justice_tx;
1661 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1662 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1663 Transaction_free(justice_tx_var);
1664 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1665 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1666 LDKHTLCOutputInCommitment htlc_var = *htlc;
1667 htlc_var = HTLCOutputInCommitment_clone(htlc);
1668 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1669 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1670 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
1671 if (htlc_var.is_owned) {
1674 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);
1675 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1676 CHECK_ACCESS(ret_ptr);
1677 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1678 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1681 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) {
1682 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1683 LDKTransaction htlc_tx_var = htlc_tx;
1684 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1685 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1686 Transaction_free(htlc_tx_var);
1687 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1688 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1689 LDKHTLCOutputInCommitment htlc_var = *htlc;
1690 htlc_var = HTLCOutputInCommitment_clone(htlc);
1691 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1692 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1693 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
1694 if (htlc_var.is_owned) {
1697 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);
1698 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1699 CHECK_ACCESS(ret_ptr);
1700 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1701 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1704 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
1705 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1706 LDKClosingTransaction closing_tx_var = *closing_tx;
1707 closing_tx_var = ClosingTransaction_clone(closing_tx);
1708 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1709 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1710 uint64_t closing_tx_ref = (uint64_t)closing_tx_var.inner;
1711 if (closing_tx_var.is_owned) {
1712 closing_tx_ref |= 1;
1714 uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_ref);
1715 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1716 CHECK_ACCESS(ret_ptr);
1717 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1718 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1721 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1722 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1723 LDKUnsignedChannelAnnouncement msg_var = *msg;
1724 msg_var = UnsignedChannelAnnouncement_clone(msg);
1725 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1726 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1727 uint64_t msg_ref = (uint64_t)msg_var.inner;
1728 if (msg_var.is_owned) {
1731 uint32_t ret = js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
1732 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1733 CHECK_ACCESS(ret_ptr);
1734 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1735 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1738 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1739 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1740 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1741 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1742 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1743 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1744 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
1745 if (channel_parameters_var.is_owned) {
1746 channel_parameters_ref |= 1;
1748 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
1750 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
1751 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
1752 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1754 static inline LDKBaseSign LDKBaseSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1755 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
1756 atomic_init(&calls->refcnt, 1);
1757 //TODO: Assign calls->o from o
1759 LDKChannelPublicKeys pubkeys_conv;
1760 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1761 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1762 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1765 .this_arg = (void*) calls,
1766 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
1767 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
1768 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
1769 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
1770 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
1771 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
1772 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
1773 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
1774 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
1775 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
1776 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
1777 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
1778 .ready_channel = ready_channel_LDKBaseSign_jcall,
1779 .free = LDKBaseSign_JCalls_free,
1780 .pubkeys = pubkeys_conv,
1781 .set_pubkeys = NULL,
1785 long __attribute__((visibility("default"))) TS_LDKBaseSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1786 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
1787 *res_ptr = LDKBaseSign_init(o, pubkeys);
1788 return (long)res_ptr;
1790 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
1791 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1792 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1793 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1794 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1795 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1799 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
1800 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1801 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1802 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1803 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1804 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1808 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx) {
1809 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1810 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1811 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1812 LDKHolderCommitmentTransaction holder_tx_conv;
1813 holder_tx_conv.inner = (void*)(holder_tx & (~1));
1814 holder_tx_conv.is_owned = false;
1815 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1816 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
1817 return (uint64_t)ret_conv;
1820 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
1821 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1822 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1823 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1824 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1825 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1829 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
1830 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1831 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1832 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1833 LDKCommitmentTransaction commitment_tx_conv;
1834 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1835 commitment_tx_conv.is_owned = false;
1836 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1837 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1838 return (uint64_t)ret_conv;
1841 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_counterparty_revocation(uint32_t this_arg, int64_t idx, int8_tArray secret) {
1842 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1843 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1844 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1845 unsigned char secret_arr[32];
1846 CHECK(*((uint32_t*)secret) == 32);
1847 memcpy(secret_arr, (uint8_t*)(secret + 4), 32);
1848 unsigned char (*secret_ref)[32] = &secret_arr;
1849 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1850 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
1851 return (uint64_t)ret_conv;
1854 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
1855 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1856 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1857 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1858 LDKHolderCommitmentTransaction commitment_tx_conv;
1859 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1860 commitment_tx_conv.is_owned = false;
1861 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1862 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1863 return (uint64_t)ret_conv;
1866 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) {
1867 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1868 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1869 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1870 LDKTransaction justice_tx_ref;
1871 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1872 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1873 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1874 justice_tx_ref.data_is_owned = true;
1875 unsigned char per_commitment_key_arr[32];
1876 CHECK(*((uint32_t*)per_commitment_key) == 32);
1877 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1878 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1879 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1880 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
1881 return (uint64_t)ret_conv;
1884 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) {
1885 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1886 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1887 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1888 LDKTransaction justice_tx_ref;
1889 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1890 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1891 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1892 justice_tx_ref.data_is_owned = true;
1893 unsigned char per_commitment_key_arr[32];
1894 CHECK(*((uint32_t*)per_commitment_key) == 32);
1895 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1896 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1897 LDKHTLCOutputInCommitment htlc_conv;
1898 htlc_conv.inner = (void*)(htlc & (~1));
1899 htlc_conv.is_owned = false;
1900 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1901 *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);
1902 return (uint64_t)ret_conv;
1905 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) {
1906 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1907 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1908 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1909 LDKTransaction htlc_tx_ref;
1910 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
1911 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1912 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
1913 htlc_tx_ref.data_is_owned = true;
1914 LDKPublicKey per_commitment_point_ref;
1915 CHECK(*((uint32_t*)per_commitment_point) == 33);
1916 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
1917 LDKHTLCOutputInCommitment htlc_conv;
1918 htlc_conv.inner = (void*)(htlc & (~1));
1919 htlc_conv.is_owned = false;
1920 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1921 *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);
1922 return (uint64_t)ret_conv;
1925 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
1926 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1927 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1928 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1929 LDKClosingTransaction closing_tx_conv;
1930 closing_tx_conv.inner = (void*)(closing_tx & (~1));
1931 closing_tx_conv.is_owned = false;
1932 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1933 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
1934 return (uint64_t)ret_conv;
1937 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
1938 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1939 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1940 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1941 LDKUnsignedChannelAnnouncement msg_conv;
1942 msg_conv.inner = (void*)(msg & (~1));
1943 msg_conv.is_owned = false;
1944 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1945 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1946 return (uint64_t)ret_conv;
1949 void __attribute__((visibility("default"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
1950 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1951 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1952 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1953 LDKChannelTransactionParameters channel_parameters_conv;
1954 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1955 channel_parameters_conv.is_owned = false;
1956 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1959 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
1960 if (this_arg->set_pubkeys != NULL)
1961 this_arg->set_pubkeys(this_arg);
1962 return this_arg->pubkeys;
1964 uint32_t __attribute__((visibility("default"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
1965 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1966 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1967 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1968 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
1969 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1970 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1971 uint64_t ret_ref = (uint64_t)ret_var.inner;
1972 if (ret_var.is_owned) {
1978 typedef struct LDKSign_JCalls {
1979 atomic_size_t refcnt;
1980 LDKBaseSign_JCalls* BaseSign;
1981 uint32_t write_meth;
1983 static void LDKSign_JCalls_free(void* this_arg) {
1984 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1985 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1986 js_free(j_calls->write_meth);
1990 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
1991 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1992 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
1993 LDKCVec_u8Z ret_ref;
1994 ret_ref.datalen = *((uint32_t*)ret);
1995 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
1996 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
1999 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2000 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2001 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2002 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2004 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* BaseSign, uint32_t pubkeys) {
2005 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2006 atomic_init(&calls->refcnt, 1);
2007 //TODO: Assign calls->o from o
2009 LDKChannelPublicKeys pubkeys_conv;
2010 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2011 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2012 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2015 .this_arg = (void*) calls,
2016 .write = write_LDKSign_jcall,
2017 .cloned = LDKSign_JCalls_cloned,
2018 .free = LDKSign_JCalls_free,
2019 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
2021 calls->BaseSign = ret.BaseSign.this_arg;
2024 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* BaseSign, uint32_t pubkeys) {
2025 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2026 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
2027 return (long)res_ptr;
2029 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
2030 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2031 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2032 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
2033 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2034 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2035 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2036 CVec_u8Z_free(ret_var);
2040 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_result_ok(uint32_t arg) {
2041 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2043 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
2044 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2045 CHECK(val->result_ok);
2046 LDKSign* res_ret =MALLOC(sizeof(LDKSign), "LDKSign");
2047 *res_ret = Sign_clone(&(*val->contents.result));
2048 return (uint64_t)res_ret;
2050 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
2051 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2052 CHECK(!val->result_ok);
2053 LDKDecodeError err_var = (*val->contents.err);
2054 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2055 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2056 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2059 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_result_ok(uint32_t arg) {
2060 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2062 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_ok(uint32_t arg) {
2063 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2064 CHECK(val->result_ok);
2065 int8_tArray es_arr = init_arr(68, sizeof(uint8_t), "Native int8_tArray Bytes");
2066 memcpy((uint8_t*)(es_arr + 4), (*val->contents.result).serialized_form, 68);
2069 void __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_err(uint32_t arg) {
2070 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2071 CHECK(!val->result_ok);
2072 return *val->contents.err;
2074 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2075 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2076 for (size_t i = 0; i < ret.datalen; i++) {
2077 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2081 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(uint32_t arg) {
2082 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2084 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
2085 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2086 CHECK(val->result_ok);
2087 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2088 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
2089 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
2090 for (size_t m = 0; m < res_var.datalen; m++) {
2091 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
2092 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2093 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
2094 res_arr_ptr[m] = res_conv_12_arr;
2098 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
2099 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2100 CHECK(!val->result_ok);
2101 return *val->contents.err;
2103 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_result_ok(uint32_t arg) {
2104 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2106 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
2107 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2108 CHECK(val->result_ok);
2109 LDKInMemorySigner res_var = (*val->contents.result);
2110 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2111 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2112 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2115 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
2116 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2117 CHECK(!val->result_ok);
2118 LDKDecodeError err_var = (*val->contents.err);
2119 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2120 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2121 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2124 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_TxOutZ_new(uint32_tArray elems) {
2125 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2126 ret->datalen = *((uint32_t*)elems);
2127 if (ret->datalen == 0) {
2130 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2131 uint32_t *java_elems = (uint32_t*)(elems + 4);
2132 for (size_t i = 0; i < ret->datalen; i++) {
2133 uint32_t arr_elem = java_elems[i];
2134 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
2135 CHECK_ACCESS(arr_elem_ptr);
2136 LDKTxOut arr_elem_conv = *(LDKTxOut*)(arr_elem_ptr);
2137 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
2138 ret->data[i] = arr_elem_conv;
2141 return (uint64_t)ret;
2143 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2144 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2145 for (size_t i = 0; i < ret.datalen; i++) {
2146 ret.data[i] = TxOut_clone(&orig->data[i]);
2150 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_result_ok(uint32_t arg) {
2151 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2153 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
2154 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2155 CHECK(val->result_ok);
2156 LDKTransaction res_var = (*val->contents.result);
2157 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2158 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
2161 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
2162 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2163 CHECK(!val->result_ok);
2164 return *val->contents.err;
2166 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
2167 return ThirtyTwoBytes_clone(&tuple->a);
2169 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t tuple) {
2170 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
2171 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2172 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_BlockHashChannelMonitorZ_get_a(tuple_conv).data, 32);
2176 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
2177 return ChannelMonitor_clone(&tuple->b);
2179 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t tuple) {
2180 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
2181 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(tuple_conv);
2182 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2183 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2184 uint64_t ret_ref = (uint64_t)ret_var.inner;
2185 if (ret_var.is_owned) {
2191 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_BlockHashChannelMonitorZZ_new(uint32_tArray elems) {
2192 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2193 ret->datalen = *((uint32_t*)elems);
2194 if (ret->datalen == 0) {
2197 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2198 uint32_t *java_elems = (uint32_t*)(elems + 4);
2199 for (size_t i = 0; i < ret->datalen; i++) {
2200 uint32_t arr_elem = java_elems[i];
2201 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
2202 CHECK_ACCESS(arr_elem_ptr);
2203 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(arr_elem_ptr);
2204 arr_elem_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1));
2205 ret->data[i] = arr_elem_conv;
2208 return (uint64_t)ret;
2210 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
2211 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
2212 for (size_t i = 0; i < ret.datalen; i++) {
2213 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
2217 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_result_ok(uint32_t arg) {
2218 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
2220 uint32_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(uint32_t arg) {
2221 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2222 CHECK(val->result_ok);
2223 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2224 uint32_tArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2225 uint32_t *res_arr_ptr = (uint32_t*)(res_arr + 4);
2226 for (size_t j = 0; j < res_var.datalen; j++) {
2227 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2228 *res_conv_35_conv = res_var.data[j];
2229 *res_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv_35_conv);
2230 res_arr_ptr[j] = ((uint64_t)res_conv_35_conv);
2234 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(uint32_t arg) {
2235 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2236 CHECK(!val->result_ok);
2237 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
2240 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdDecodeErrorZ_result_ok(uint32_t arg) {
2241 return ((LDKCResult_PaymentIdDecodeErrorZ*)arg)->result_ok;
2243 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdDecodeErrorZ_get_ok(uint32_t arg) {
2244 LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1);
2245 CHECK(val->result_ok);
2246 LDKPaymentId res_var = (*val->contents.result);
2247 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2248 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2249 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2252 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdDecodeErrorZ_get_err(uint32_t arg) {
2253 LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1);
2254 CHECK(!val->result_ok);
2255 LDKDecodeError err_var = (*val->contents.err);
2256 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2257 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2258 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2261 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) {
2262 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
2264 case LDKCOption_u16Z_Some: {
2265 return 0 /* LDKCOption_u16Z - Some */; (void) obj->some;
2267 case LDKCOption_u16Z_None: {
2268 return 0 /* LDKCOption_u16Z - None */;
2273 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2274 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2276 case LDKAPIError_APIMisuseError: {
2277 LDKStr err_str = obj->api_misuse_error.err;
2278 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2279 return 0 /* LDKAPIError - APIMisuseError */; (void) err_conv;
2281 case LDKAPIError_FeeRateTooHigh: {
2282 LDKStr err_str = obj->fee_rate_too_high.err;
2283 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2284 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_conv; (void) obj->fee_rate_too_high.feerate;
2286 case LDKAPIError_RouteError: {
2287 LDKStr err_str = obj->route_error.err;
2288 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2289 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2291 case LDKAPIError_ChannelUnavailable: {
2292 LDKStr err_str = obj->channel_unavailable.err;
2293 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2294 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_conv;
2296 case LDKAPIError_MonitorUpdateFailed: {
2297 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2299 case LDKAPIError_IncompatibleShutdownScript: {
2300 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
2301 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2302 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2303 uint64_t script_ref = (uint64_t)script_var.inner & ~1;
2304 return 0 /* LDKAPIError - IncompatibleShutdownScript */; (void) script_ref;
2309 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
2310 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2312 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2313 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2314 CHECK(val->result_ok);
2315 return *val->contents.result;
2317 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2318 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2319 CHECK(!val->result_ok);
2320 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2323 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) {
2324 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2325 ret->datalen = *((uint32_t*)elems);
2326 if (ret->datalen == 0) {
2329 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2330 uint32_t *java_elems = (uint32_t*)(elems + 4);
2331 for (size_t i = 0; i < ret->datalen; i++) {
2332 uint32_t arr_elem = java_elems[i];
2333 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
2334 CHECK_ACCESS(arr_elem_ptr);
2335 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(arr_elem_ptr);
2336 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
2337 ret->data[i] = arr_elem_conv;
2340 return (uint64_t)ret;
2342 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2343 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2344 for (size_t i = 0; i < ret.datalen; i++) {
2345 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2349 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) {
2350 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2351 ret->datalen = *((uint32_t*)elems);
2352 if (ret->datalen == 0) {
2355 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2356 uint32_t *java_elems = (uint32_t*)(elems + 4);
2357 for (size_t i = 0; i < ret->datalen; i++) {
2358 uint32_t arr_elem = java_elems[i];
2359 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
2360 CHECK_ACCESS(arr_elem_ptr);
2361 LDKAPIError arr_elem_conv = *(LDKAPIError*)(arr_elem_ptr);
2362 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
2363 ret->data[i] = arr_elem_conv;
2366 return (uint64_t)ret;
2368 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2369 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2370 for (size_t i = 0; i < ret.datalen; i++) {
2371 ret.data[i] = APIError_clone(&orig->data[i]);
2375 jboolean __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_result_ok(uint32_t arg) {
2376 return ((LDKCResult__u832APIErrorZ*)arg)->result_ok;
2378 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_ok(uint32_t arg) {
2379 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
2380 CHECK(val->result_ok);
2381 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2382 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2385 uint32_t __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_err(uint32_t arg) {
2386 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
2387 CHECK(!val->result_ok);
2388 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2391 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2392 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
2394 case LDKPaymentSendFailure_ParameterError: {
2395 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
2396 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
2398 case LDKPaymentSendFailure_PathParameterError: {
2399 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
2400 uint32_tArray path_parameter_error_arr = init_arr(path_parameter_error_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2401 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
2402 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
2403 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2404 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
2405 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
2406 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
2408 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
2410 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2411 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
2412 uint32_tArray all_failed_retry_safe_arr = init_arr(all_failed_retry_safe_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2413 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
2414 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
2415 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
2416 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
2418 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
2420 case LDKPaymentSendFailure_PartialFailure: {
2421 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
2422 uint32_tArray partial_failure_arr = init_arr(partial_failure_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2423 uint32_t *partial_failure_arr_ptr = (uint32_t*)(partial_failure_arr + 4);
2424 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
2425 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2426 *partial_failure_conv_22_conv = partial_failure_var.data[w];
2427 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
2428 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
2430 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) partial_failure_arr;
2435 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_result_ok(uint32_t arg) {
2436 return ((LDKCResult_PaymentIdPaymentSendFailureZ*)arg)->result_ok;
2438 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t arg) {
2439 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
2440 CHECK(val->result_ok);
2441 LDKPaymentId res_var = (*val->contents.result);
2442 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2443 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2444 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2447 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t arg) {
2448 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
2449 CHECK(!val->result_ok);
2450 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2453 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
2454 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2456 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2457 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2458 CHECK(val->result_ok);
2459 return *val->contents.result;
2461 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2462 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2463 CHECK(!val->result_ok);
2464 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2467 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
2468 return ThirtyTwoBytes_clone(&tuple->a);
2470 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t tuple) {
2471 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
2472 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2473 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentIdZ_get_a(tuple_conv).data, 32);
2477 static inline struct LDKPaymentId C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
2478 return PaymentId_clone(&tuple->b);
2480 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t tuple) {
2481 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
2482 LDKPaymentId ret_var = C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv);
2483 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2484 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2485 uint64_t ret_ref = (uint64_t)ret_var.inner;
2486 if (ret_var.is_owned) {
2492 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_result_ok(uint32_t arg) {
2493 return ((LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)arg)->result_ok;
2495 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t arg) {
2496 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
2497 CHECK(val->result_ok);
2498 LDKC2Tuple_PaymentHashPaymentIdZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
2499 *res_conv = (*val->contents.result);
2500 *res_conv = C2Tuple_PaymentHashPaymentIdZ_clone(res_conv);
2501 return ((uint64_t)res_conv);
2503 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t arg) {
2504 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
2505 CHECK(!val->result_ok);
2506 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2509 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
2510 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
2512 case LDKNetAddress_IPv4: {
2513 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
2514 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
2515 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
2517 case LDKNetAddress_IPv6: {
2518 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
2519 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
2520 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
2522 case LDKNetAddress_OnionV2: {
2523 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
2524 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
2525 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
2527 case LDKNetAddress_OnionV3: {
2528 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2529 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
2530 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
2535 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
2536 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2537 ret->datalen = *((uint32_t*)elems);
2538 if (ret->datalen == 0) {
2541 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2542 uint32_t *java_elems = (uint32_t*)(elems + 4);
2543 for (size_t i = 0; i < ret->datalen; i++) {
2544 uint32_t arr_elem = java_elems[i];
2545 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
2546 CHECK_ACCESS(arr_elem_ptr);
2547 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(arr_elem_ptr);
2548 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
2549 ret->data[i] = arr_elem_conv;
2552 return (uint64_t)ret;
2554 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2555 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2556 for (size_t i = 0; i < ret.datalen; i++) {
2557 ret.data[i] = NetAddress_clone(&orig->data[i]);
2561 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
2562 return ThirtyTwoBytes_clone(&tuple->a);
2564 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t tuple) {
2565 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
2566 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2567 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentSecretZ_get_a(tuple_conv).data, 32);
2571 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
2572 return ThirtyTwoBytes_clone(&tuple->b);
2574 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t tuple) {
2575 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
2576 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2577 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentSecretZ_get_b(tuple_conv).data, 32);
2581 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_result_ok(uint32_t arg) {
2582 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
2584 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_ok(uint32_t arg) {
2585 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2586 CHECK(val->result_ok);
2587 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2588 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2591 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_err(uint32_t arg) {
2592 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2593 CHECK(!val->result_ok);
2594 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2597 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
2598 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2599 ret->datalen = *((uint32_t*)elems);
2600 if (ret->datalen == 0) {
2603 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2604 uint32_t *java_elems = (uint32_t*)(elems + 4);
2605 for (size_t i = 0; i < ret->datalen; i++) {
2606 uint32_t arr_elem = java_elems[i];
2607 LDKChannelMonitor arr_elem_conv;
2608 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2609 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2610 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2611 ret->data[i] = arr_elem_conv;
2614 return (uint64_t)ret;
2616 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2617 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2618 for (size_t i = 0; i < ret.datalen; i++) {
2619 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2623 typedef struct LDKWatch_JCalls {
2624 atomic_size_t refcnt;
2625 uint32_t watch_channel_meth;
2626 uint32_t update_channel_meth;
2627 uint32_t release_pending_monitor_events_meth;
2629 static void LDKWatch_JCalls_free(void* this_arg) {
2630 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2631 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2632 js_free(j_calls->watch_channel_meth);
2633 js_free(j_calls->update_channel_meth);
2634 js_free(j_calls->release_pending_monitor_events_meth);
2638 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2639 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2640 LDKOutPoint funding_txo_var = funding_txo;
2641 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2642 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2643 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2644 if (funding_txo_var.is_owned) {
2645 funding_txo_ref |= 1;
2647 LDKChannelMonitor monitor_var = monitor;
2648 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2649 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2650 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
2651 if (monitor_var.is_owned) {
2654 uint32_t ret = js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2655 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2656 CHECK_ACCESS(ret_ptr);
2657 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
2658 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2661 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2662 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2663 LDKOutPoint funding_txo_var = funding_txo;
2664 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2665 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2666 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2667 if (funding_txo_var.is_owned) {
2668 funding_txo_ref |= 1;
2670 LDKChannelMonitorUpdate update_var = update;
2671 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2672 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2673 uint64_t update_ref = (uint64_t)update_var.inner;
2674 if (update_var.is_owned) {
2677 uint32_t ret = js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2678 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2679 CHECK_ACCESS(ret_ptr);
2680 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
2681 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2684 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
2685 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2686 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2687 LDKCVec_MonitorEventZ ret_constr;
2688 ret_constr.datalen = *((uint32_t*)ret);
2689 if (ret_constr.datalen > 0)
2690 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2692 ret_constr.data = NULL;
2693 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2694 for (size_t o = 0; o < ret_constr.datalen; o++) {
2695 uint32_t ret_conv_14 = ret_vals[o];
2696 void* ret_conv_14_ptr = (void*)(((uint64_t)ret_conv_14) & ~1);
2697 CHECK_ACCESS(ret_conv_14_ptr);
2698 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
2699 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
2700 ret_constr.data[o] = ret_conv_14_conv;
2704 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
2705 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
2706 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2708 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2709 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2710 atomic_init(&calls->refcnt, 1);
2711 //TODO: Assign calls->o from o
2714 .this_arg = (void*) calls,
2715 .watch_channel = watch_channel_LDKWatch_jcall,
2716 .update_channel = update_channel_LDKWatch_jcall,
2717 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
2718 .free = LDKWatch_JCalls_free,
2722 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2723 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2724 *res_ptr = LDKWatch_init(o);
2725 return (long)res_ptr;
2727 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2728 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2729 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2730 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
2731 LDKOutPoint funding_txo_conv;
2732 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2733 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2734 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2735 LDKChannelMonitor monitor_conv;
2736 monitor_conv.inner = (void*)(monitor & (~1));
2737 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2738 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2739 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2740 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2741 return (uint64_t)ret_conv;
2744 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
2745 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2746 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2747 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
2748 LDKOutPoint funding_txo_conv;
2749 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2750 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2751 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2752 LDKChannelMonitorUpdate update_conv;
2753 update_conv.inner = (void*)(update & (~1));
2754 update_conv.is_owned = (update & 1) || (update == 0);
2755 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2756 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2757 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2758 return (uint64_t)ret_conv;
2761 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
2762 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2763 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2764 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
2765 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2766 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2767 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
2768 for (size_t o = 0; o < ret_var.datalen; o++) {
2769 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2770 *ret_conv_14_copy = ret_var.data[o];
2771 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
2772 ret_arr_ptr[o] = ret_conv_14_ref;
2778 typedef struct LDKBroadcasterInterface_JCalls {
2779 atomic_size_t refcnt;
2780 uint32_t broadcast_transaction_meth;
2781 } LDKBroadcasterInterface_JCalls;
2782 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2783 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2784 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2785 js_free(j_calls->broadcast_transaction_meth);
2789 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
2790 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2791 LDKTransaction tx_var = tx;
2792 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2793 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
2794 Transaction_free(tx_var);
2795 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
2797 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
2798 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
2799 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2801 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
2802 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2803 atomic_init(&calls->refcnt, 1);
2804 //TODO: Assign calls->o from o
2806 LDKBroadcasterInterface ret = {
2807 .this_arg = (void*) calls,
2808 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
2809 .free = LDKBroadcasterInterface_JCalls_free,
2813 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
2814 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2815 *res_ptr = LDKBroadcasterInterface_init(o);
2816 return (long)res_ptr;
2818 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
2819 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2820 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2821 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
2822 LDKTransaction tx_ref;
2823 tx_ref.datalen = *((uint32_t*)tx);
2824 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2825 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
2826 tx_ref.data_is_owned = true;
2827 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2830 typedef struct LDKKeysInterface_JCalls {
2831 atomic_size_t refcnt;
2832 uint32_t get_node_secret_meth;
2833 uint32_t get_destination_script_meth;
2834 uint32_t get_shutdown_scriptpubkey_meth;
2835 uint32_t get_channel_signer_meth;
2836 uint32_t get_secure_random_bytes_meth;
2837 uint32_t read_chan_signer_meth;
2838 uint32_t sign_invoice_meth;
2839 } LDKKeysInterface_JCalls;
2840 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2841 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2842 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2843 js_free(j_calls->get_node_secret_meth);
2844 js_free(j_calls->get_destination_script_meth);
2845 js_free(j_calls->get_shutdown_scriptpubkey_meth);
2846 js_free(j_calls->get_channel_signer_meth);
2847 js_free(j_calls->get_secure_random_bytes_meth);
2848 js_free(j_calls->read_chan_signer_meth);
2849 js_free(j_calls->sign_invoice_meth);
2853 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
2854 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2855 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
2856 LDKSecretKey ret_ref;
2857 CHECK(*((uint32_t*)ret) == 32);
2858 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
2861 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
2862 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2863 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
2864 LDKCVec_u8Z ret_ref;
2865 ret_ref.datalen = *((uint32_t*)ret);
2866 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2867 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2870 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
2871 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2872 uint32_t ret = js_invoke_function_0(j_calls->get_shutdown_scriptpubkey_meth);
2873 LDKShutdownScript ret_conv;
2874 ret_conv.inner = (void*)(ret & (~1));
2875 ret_conv.is_owned = (ret & 1) || (ret == 0);
2876 ret_conv = ShutdownScript_clone(&ret_conv);
2879 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2880 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2881 uint32_t ret = js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
2882 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2883 CHECK_ACCESS(ret_ptr);
2884 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
2885 ret_conv = Sign_clone(&ret_conv);
2888 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
2889 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2890 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
2891 LDKThirtyTwoBytes ret_ref;
2892 CHECK(*((uint32_t*)ret) == 32);
2893 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
2896 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
2897 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2898 LDKu8slice reader_var = reader;
2899 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2900 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
2901 uint32_t ret = js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
2902 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2903 CHECK_ACCESS(ret_ptr);
2904 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
2905 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
2908 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
2909 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2910 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
2911 int8_tArray invoice_preimage_arr = init_arr(invoice_preimage_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2912 memcpy((uint8_t*)(invoice_preimage_arr + 4), invoice_preimage_var.data, invoice_preimage_var.datalen);
2913 CVec_u8Z_free(invoice_preimage_var);
2914 uint32_t ret = js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
2915 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2916 CHECK_ACCESS(ret_ptr);
2917 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
2918 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
2921 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
2922 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
2923 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2925 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
2926 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2927 atomic_init(&calls->refcnt, 1);
2928 //TODO: Assign calls->o from o
2930 LDKKeysInterface ret = {
2931 .this_arg = (void*) calls,
2932 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
2933 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
2934 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
2935 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
2936 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
2937 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
2938 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
2939 .free = LDKKeysInterface_JCalls_free,
2943 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
2944 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2945 *res_ptr = LDKKeysInterface_init(o);
2946 return (long)res_ptr;
2948 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
2949 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2950 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2951 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
2952 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2953 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
2957 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
2958 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2959 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2960 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
2961 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2962 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2963 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2964 CVec_u8Z_free(ret_var);
2968 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
2969 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2970 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2971 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
2972 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
2973 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2974 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2975 uint64_t ret_ref = (uint64_t)ret_var.inner;
2976 if (ret_var.is_owned) {
2982 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2983 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2984 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2985 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
2986 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
2987 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2988 return (uint64_t)ret_ret;
2991 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
2992 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2993 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2994 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
2995 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2996 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
3000 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
3001 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3002 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3003 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3004 LDKu8slice reader_ref;
3005 reader_ref.datalen = *((uint32_t*)reader);
3006 reader_ref.data = (int8_t*)(reader + 4);
3007 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3008 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3009 return (uint64_t)ret_conv;
3012 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
3013 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3014 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3015 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3016 LDKCVec_u8Z invoice_preimage_ref;
3017 invoice_preimage_ref.datalen = *((uint32_t*)invoice_preimage);
3018 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
3019 memcpy(invoice_preimage_ref.data, (uint8_t*)(invoice_preimage + 4), invoice_preimage_ref.datalen);
3020 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
3021 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
3022 return (uint64_t)ret_conv;
3025 typedef struct LDKFeeEstimator_JCalls {
3026 atomic_size_t refcnt;
3027 uint32_t get_est_sat_per_1000_weight_meth;
3028 } LDKFeeEstimator_JCalls;
3029 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3030 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3031 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3032 js_free(j_calls->get_est_sat_per_1000_weight_meth);
3036 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3037 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3038 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
3039 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3041 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
3042 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
3043 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3045 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
3046 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3047 atomic_init(&calls->refcnt, 1);
3048 //TODO: Assign calls->o from o
3050 LDKFeeEstimator ret = {
3051 .this_arg = (void*) calls,
3052 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3053 .free = LDKFeeEstimator_JCalls_free,
3057 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
3058 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3059 *res_ptr = LDKFeeEstimator_init(o);
3060 return (long)res_ptr;
3062 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
3063 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3064 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3065 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
3066 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
3067 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3071 typedef struct LDKLogger_JCalls {
3072 atomic_size_t refcnt;
3075 static void LDKLogger_JCalls_free(void* this_arg) {
3076 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3077 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3078 js_free(j_calls->log_meth);
3082 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
3083 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3084 const char* record_str = record;
3085 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
3086 js_invoke_function_1(j_calls->log_meth, record_conv);
3088 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3089 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3090 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3092 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
3093 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3094 atomic_init(&calls->refcnt, 1);
3095 //TODO: Assign calls->o from o
3098 .this_arg = (void*) calls,
3099 .log = log_LDKLogger_jcall,
3100 .free = LDKLogger_JCalls_free,
3104 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
3105 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3106 *res_ptr = LDKLogger_init(o);
3107 return (long)res_ptr;
3109 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
3110 return ThirtyTwoBytes_clone(&tuple->a);
3112 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t tuple) {
3113 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
3114 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3115 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_BlockHashChannelManagerZ_get_a(tuple_conv).data, 32);
3119 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
3122 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t tuple) {
3123 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
3124 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(tuple_conv);
3125 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3126 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3127 uint64_t ret_ref = (uint64_t)ret_var.inner & ~1;
3131 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
3132 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
3134 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
3135 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3136 CHECK(val->result_ok);
3137 LDKC2Tuple_BlockHashChannelManagerZ* res_conv = &(*val->contents.result);
3138 // Warning: we really need to clone here, but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
3139 return ((uint64_t)res_conv) | 1;
3141 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
3142 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3143 CHECK(!val->result_ok);
3144 LDKDecodeError err_var = (*val->contents.err);
3145 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3146 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3147 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3150 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
3151 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
3153 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
3154 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
3155 CHECK(val->result_ok);
3156 LDKChannelConfig res_var = (*val->contents.result);
3157 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3158 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3159 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3162 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
3163 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
3164 CHECK(!val->result_ok);
3165 LDKDecodeError err_var = (*val->contents.err);
3166 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3167 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3168 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3171 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
3172 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
3174 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
3175 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3176 CHECK(val->result_ok);
3177 LDKOutPoint res_var = (*val->contents.result);
3178 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3179 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3180 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3183 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
3184 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3185 CHECK(!val->result_ok);
3186 LDKDecodeError err_var = (*val->contents.err);
3187 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3188 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3189 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3192 typedef struct LDKType_JCalls {
3193 atomic_size_t refcnt;
3194 uint32_t type_id_meth;
3195 uint32_t debug_str_meth;
3196 uint32_t write_meth;
3198 static void LDKType_JCalls_free(void* this_arg) {
3199 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3200 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3201 js_free(j_calls->type_id_meth);
3202 js_free(j_calls->debug_str_meth);
3203 js_free(j_calls->write_meth);
3207 uint16_t type_id_LDKType_jcall(const void* this_arg) {
3208 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3209 return js_invoke_function_0(j_calls->type_id_meth);
3211 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
3212 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3213 uint32_t ret = js_invoke_function_0(j_calls->debug_str_meth);
3214 LDKStr ret_conv = str_ref_to_owned_c(ret);
3217 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
3218 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3219 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
3220 LDKCVec_u8Z ret_ref;
3221 ret_ref.datalen = *((uint32_t*)ret);
3222 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3223 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
3226 static void LDKType_JCalls_cloned(LDKType* new_obj) {
3227 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
3228 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3230 static inline LDKType LDKType_init (/*TODO: JS Object Reference */void* o) {
3231 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
3232 atomic_init(&calls->refcnt, 1);
3233 //TODO: Assign calls->o from o
3236 .this_arg = (void*) calls,
3237 .type_id = type_id_LDKType_jcall,
3238 .debug_str = debug_str_LDKType_jcall,
3239 .write = write_LDKType_jcall,
3240 .cloned = LDKType_JCalls_cloned,
3241 .free = LDKType_JCalls_free,
3245 long __attribute__((visibility("default"))) TS_LDKType_new(/*TODO: JS Object Reference */void* o) {
3246 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
3247 *res_ptr = LDKType_init(o);
3248 return (long)res_ptr;
3250 int16_t __attribute__((visibility("default"))) TS_Type_type_id(uint32_t this_arg) {
3251 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3252 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3253 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3254 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
3258 jstring __attribute__((visibility("default"))) TS_Type_debug_str(uint32_t this_arg) {
3259 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3260 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3261 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3262 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
3263 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
3268 int8_tArray __attribute__((visibility("default"))) TS_Type_write(uint32_t this_arg) {
3269 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3270 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3271 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3272 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3273 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3274 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3275 CVec_u8Z_free(ret_var);
3279 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_TypeZ_ref_from_ptr(uint32_t ptr) {
3280 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
3282 case LDKCOption_TypeZ_Some: {
3283 LDKType* some_ret =MALLOC(sizeof(LDKType), "LDKType");
3284 *some_ret = Type_clone(&obj->some);
3285 return 0 /* LDKCOption_TypeZ - Some */; (void) (uint64_t)some_ret;
3287 case LDKCOption_TypeZ_None: {
3288 return 0 /* LDKCOption_TypeZ - None */;
3293 jboolean __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_result_ok(uint32_t arg) {
3294 return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
3296 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t arg) {
3297 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3298 CHECK(val->result_ok);
3299 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3302 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_err(uint32_t arg) {
3303 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3304 CHECK(!val->result_ok);
3305 LDKDecodeError err_var = (*val->contents.err);
3306 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3307 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3308 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3311 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_result_ok(uint32_t arg) {
3312 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
3314 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_ok(uint32_t arg) {
3315 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3316 CHECK(val->result_ok);
3317 uint32_t res_conv = LDKSiPrefix_to_js((*val->contents.result));
3320 void __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_err(uint32_t arg) {
3321 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3322 CHECK(!val->result_ok);
3323 return *val->contents.err;
3325 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_result_ok(uint32_t arg) {
3326 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
3328 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_ok(uint32_t arg) {
3329 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3330 CHECK(val->result_ok);
3331 LDKInvoice res_var = (*val->contents.result);
3332 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3333 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3334 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3337 void __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_err(uint32_t arg) {
3338 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3339 CHECK(!val->result_ok);
3340 return *val->contents.err;
3342 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_result_ok(uint32_t arg) {
3343 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
3345 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_ok(uint32_t arg) {
3346 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3347 CHECK(val->result_ok);
3348 LDKSignedRawInvoice res_var = (*val->contents.result);
3349 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3350 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3351 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3354 void __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_err(uint32_t arg) {
3355 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3356 CHECK(!val->result_ok);
3357 return *val->contents.err;
3359 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3360 return RawInvoice_clone(&tuple->a);
3362 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t tuple) {
3363 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3364 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(tuple_conv);
3365 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3366 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3367 uint64_t ret_ref = (uint64_t)ret_var.inner;
3368 if (ret_var.is_owned) {
3374 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3375 return ThirtyTwoBytes_clone(&tuple->b);
3377 int8_tArray __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t tuple) {
3378 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3379 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3380 memcpy((uint8_t*)(ret_arr + 4), C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(tuple_conv).data, 32);
3384 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3385 return InvoiceSignature_clone(&tuple->c);
3387 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t tuple) {
3388 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3389 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(tuple_conv);
3390 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3391 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3392 uint64_t ret_ref = (uint64_t)ret_var.inner;
3393 if (ret_var.is_owned) {
3399 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_result_ok(uint32_t arg) {
3400 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
3402 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_ok(uint32_t arg) {
3403 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3404 CHECK(val->result_ok);
3405 LDKPayeePubKey res_var = (*val->contents.result);
3406 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3407 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3408 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3411 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_err(uint32_t arg) {
3412 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3413 CHECK(!val->result_ok);
3414 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3417 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_PrivateRouteZ_new(uint32_tArray elems) {
3418 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
3419 ret->datalen = *((uint32_t*)elems);
3420 if (ret->datalen == 0) {
3423 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
3424 uint32_t *java_elems = (uint32_t*)(elems + 4);
3425 for (size_t i = 0; i < ret->datalen; i++) {
3426 uint32_t arr_elem = java_elems[i];
3427 LDKPrivateRoute arr_elem_conv;
3428 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3429 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3430 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
3431 ret->data[i] = arr_elem_conv;
3434 return (uint64_t)ret;
3436 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
3437 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
3438 for (size_t i = 0; i < ret.datalen; i++) {
3439 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
3443 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_result_ok(uint32_t arg) {
3444 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
3446 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t arg) {
3447 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3448 CHECK(val->result_ok);
3449 LDKPositiveTimestamp res_var = (*val->contents.result);
3450 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3451 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3452 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3455 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_err(uint32_t arg) {
3456 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3457 CHECK(!val->result_ok);
3458 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3461 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_result_ok(uint32_t arg) {
3462 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
3464 void __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_ok(uint32_t arg) {
3465 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3466 CHECK(val->result_ok);
3467 return *val->contents.result;
3469 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_err(uint32_t arg) {
3470 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3471 CHECK(!val->result_ok);
3472 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3475 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_result_ok(uint32_t arg) {
3476 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
3478 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_ok(uint32_t arg) {
3479 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3480 CHECK(val->result_ok);
3481 LDKInvoice res_var = (*val->contents.result);
3482 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3483 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3484 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3487 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_err(uint32_t arg) {
3488 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3489 CHECK(!val->result_ok);
3490 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3493 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_result_ok(uint32_t arg) {
3494 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
3496 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_ok(uint32_t arg) {
3497 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3498 CHECK(val->result_ok);
3499 LDKDescription res_var = (*val->contents.result);
3500 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3501 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3502 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3505 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_err(uint32_t arg) {
3506 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3507 CHECK(!val->result_ok);
3508 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3511 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_result_ok(uint32_t arg) {
3512 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
3514 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_ok(uint32_t arg) {
3515 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3516 CHECK(val->result_ok);
3517 LDKExpiryTime res_var = (*val->contents.result);
3518 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3519 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3520 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3523 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_err(uint32_t arg) {
3524 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3525 CHECK(!val->result_ok);
3526 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3529 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_result_ok(uint32_t arg) {
3530 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
3532 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_ok(uint32_t arg) {
3533 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3534 CHECK(val->result_ok);
3535 LDKPrivateRoute res_var = (*val->contents.result);
3536 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3537 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3538 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3541 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_err(uint32_t arg) {
3542 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3543 CHECK(!val->result_ok);
3544 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3547 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_result_ok(uint32_t arg) {
3548 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
3550 jstring __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_ok(uint32_t arg) {
3551 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3552 CHECK(val->result_ok);
3553 LDKStr res_str = (*val->contents.result);
3554 jstring res_conv = str_ref_to_ts(res_str.chars, res_str.len);
3557 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_err(uint32_t arg) {
3558 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3559 CHECK(!val->result_ok);
3560 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3563 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3564 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
3566 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3567 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3568 CHECK(val->result_ok);
3569 LDKChannelMonitorUpdate res_var = (*val->contents.result);
3570 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3571 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3572 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3575 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
3576 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3577 CHECK(!val->result_ok);
3578 LDKDecodeError err_var = (*val->contents.err);
3579 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3580 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3581 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3584 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3585 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
3587 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3588 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3589 CHECK(val->result_ok);
3590 LDKHTLCUpdate res_var = (*val->contents.result);
3591 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3592 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3593 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3596 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
3597 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3598 CHECK(!val->result_ok);
3599 LDKDecodeError err_var = (*val->contents.err);
3600 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3601 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3602 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3605 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
3606 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
3608 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
3609 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3610 CHECK(val->result_ok);
3611 return *val->contents.result;
3613 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
3614 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3615 CHECK(!val->result_ok);
3616 LDKMonitorUpdateError err_var = (*val->contents.err);
3617 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3618 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3619 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3622 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
3623 return OutPoint_clone(&tuple->a);
3625 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t tuple) {
3626 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
3627 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(tuple_conv);
3628 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3629 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3630 uint64_t ret_ref = (uint64_t)ret_var.inner;
3631 if (ret_var.is_owned) {
3637 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
3638 return CVec_u8Z_clone(&tuple->b);
3640 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t tuple) {
3641 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
3642 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(tuple_conv);
3643 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3644 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3645 CVec_u8Z_free(ret_var);
3649 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
3652 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t tuple) {
3653 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
3654 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(tuple_conv);
3658 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
3659 return CVec_u8Z_clone(&tuple->b);
3661 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t tuple) {
3662 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
3663 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(tuple_conv);
3664 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3665 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3666 CVec_u8Z_free(ret_var);
3670 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32ScriptZZ_new(uint32_tArray elems) {
3671 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
3672 ret->datalen = *((uint32_t*)elems);
3673 if (ret->datalen == 0) {
3676 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
3677 uint32_t *java_elems = (uint32_t*)(elems + 4);
3678 for (size_t i = 0; i < ret->datalen; i++) {
3679 uint32_t arr_elem = java_elems[i];
3680 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3681 CHECK_ACCESS(arr_elem_ptr);
3682 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(arr_elem_ptr);
3683 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
3684 ret->data[i] = arr_elem_conv;
3687 return (uint64_t)ret;
3689 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
3690 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
3691 for (size_t i = 0; i < ret.datalen; i++) {
3692 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
3696 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
3697 return ThirtyTwoBytes_clone(&tuple->a);
3699 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t tuple) {
3700 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
3701 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3702 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(tuple_conv).data, 32);
3706 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
3707 return CVec_C2Tuple_u32ScriptZZ_clone(&tuple->b);
3709 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t tuple) {
3710 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
3711 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(tuple_conv);
3712 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3713 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3714 for (size_t v = 0; v < ret_var.datalen; v++) {
3715 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
3716 *ret_conv_21_conv = ret_var.data[v];
3717 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv);
3723 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_new(uint32_tArray elems) {
3724 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
3725 ret->datalen = *((uint32_t*)elems);
3726 if (ret->datalen == 0) {
3729 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
3730 uint32_t *java_elems = (uint32_t*)(elems + 4);
3731 for (size_t i = 0; i < ret->datalen; i++) {
3732 uint32_t arr_elem = java_elems[i];
3733 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3734 CHECK_ACCESS(arr_elem_ptr);
3735 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arr_elem_ptr);
3736 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
3737 ret->data[i] = arr_elem_conv;
3740 return (uint64_t)ret;
3742 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
3743 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 };
3744 for (size_t i = 0; i < ret.datalen; i++) {
3745 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
3749 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_ptr(uint32_t ptr) {
3750 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
3752 case LDKPaymentPurpose_InvoicePayment: {
3753 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3754 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->invoice_payment.payment_preimage.data, 32);
3755 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3756 memcpy((uint8_t*)(payment_secret_arr + 4), obj->invoice_payment.payment_secret.data, 32);
3757 return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->invoice_payment.user_payment_id;
3759 case LDKPaymentPurpose_SpontaneousPayment: {
3760 int8_tArray spontaneous_payment_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3761 memcpy((uint8_t*)(spontaneous_payment_arr + 4), obj->spontaneous_payment.data, 32);
3762 return 0 /* LDKPaymentPurpose - SpontaneousPayment */; (void) spontaneous_payment_arr;
3767 uint32_t __attribute__((visibility("default"))) TS_LDKClosureReason_ref_from_ptr(uint32_t ptr) {
3768 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
3770 case LDKClosureReason_CounterpartyForceClosed: {
3771 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
3772 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
3773 return 0 /* LDKClosureReason - CounterpartyForceClosed */; (void) peer_msg_conv;
3775 case LDKClosureReason_HolderForceClosed: {
3776 return 0 /* LDKClosureReason - HolderForceClosed */;
3778 case LDKClosureReason_CooperativeClosure: {
3779 return 0 /* LDKClosureReason - CooperativeClosure */;
3781 case LDKClosureReason_CommitmentTxConfirmed: {
3782 return 0 /* LDKClosureReason - CommitmentTxConfirmed */;
3784 case LDKClosureReason_ProcessingError: {
3785 LDKStr err_str = obj->processing_error.err;
3786 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3787 return 0 /* LDKClosureReason - ProcessingError */; (void) err_conv;
3789 case LDKClosureReason_DisconnectedPeer: {
3790 return 0 /* LDKClosureReason - DisconnectedPeer */;
3792 case LDKClosureReason_OutdatedChannelManager: {
3793 return 0 /* LDKClosureReason - OutdatedChannelManager */;
3798 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
3799 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
3801 case LDKEvent_FundingGenerationReady: {
3802 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3803 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
3804 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
3805 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3806 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
3807 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;
3809 case LDKEvent_PaymentReceived: {
3810 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3811 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
3812 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
3813 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) obj->payment_received.amt; (void) purpose_ref;
3815 case LDKEvent_PaymentSent: {
3816 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3817 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
3818 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3819 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_sent.payment_hash.data, 32);
3820 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr; (void) payment_hash_arr;
3822 case LDKEvent_PaymentPathFailed: {
3823 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3824 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_path_failed.payment_hash.data, 32);
3825 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
3826 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
3827 uint32_tArray path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3828 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
3829 for (size_t k = 0; k < path_var.datalen; k++) {
3830 LDKRouteHop path_conv_10_var = path_var.data[k];
3831 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3832 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3833 uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
3834 path_arr_ptr[k] = path_conv_10_ref;
3836 uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1;
3837 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;
3839 case LDKEvent_PendingHTLCsForwardable: {
3840 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
3842 case LDKEvent_SpendableOutputs: {
3843 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
3844 uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3845 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
3846 for (size_t b = 0; b < outputs_var.datalen; b++) {
3847 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
3848 outputs_arr_ptr[b] = outputs_conv_27_ref;
3850 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
3852 case LDKEvent_PaymentForwarded: {
3853 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
3854 return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
3856 case LDKEvent_ChannelClosed: {
3857 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3858 memcpy((uint8_t*)(channel_id_arr + 4), obj->channel_closed.channel_id.data, 32);
3859 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
3860 return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) obj->channel_closed.user_channel_id; (void) reason_ref;
3862 case LDKEvent_DiscardFunding: {
3863 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3864 memcpy((uint8_t*)(channel_id_arr + 4), obj->discard_funding.channel_id.data, 32);
3865 LDKTransaction transaction_var = obj->discard_funding.transaction;
3866 int8_tArray transaction_arr = init_arr(transaction_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3867 memcpy((uint8_t*)(transaction_arr + 4), transaction_var.data, transaction_var.datalen);
3868 return 0 /* LDKEvent - DiscardFunding */; (void) channel_id_arr; (void) transaction_arr;
3873 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
3874 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
3875 ret->datalen = *((uint32_t*)elems);
3876 if (ret->datalen == 0) {
3879 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
3880 uint32_t *java_elems = (uint32_t*)(elems + 4);
3881 for (size_t i = 0; i < ret->datalen; i++) {
3882 uint32_t arr_elem = java_elems[i];
3883 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3884 CHECK_ACCESS(arr_elem_ptr);
3885 LDKEvent arr_elem_conv = *(LDKEvent*)(arr_elem_ptr);
3886 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
3887 ret->data[i] = arr_elem_conv;
3890 return (uint64_t)ret;
3892 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
3893 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
3894 for (size_t i = 0; i < ret.datalen; i++) {
3895 ret.data[i] = Event_clone(&orig->data[i]);
3899 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
3902 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t tuple) {
3903 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
3904 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(tuple_conv);
3908 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
3909 return TxOut_clone(&tuple->b);
3911 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t tuple) {
3912 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
3913 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3914 *ret_ref = C2Tuple_u32TxOutZ_get_b(tuple_conv);
3915 return (uint64_t)ret_ref;
3918 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
3919 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
3920 ret->datalen = *((uint32_t*)elems);
3921 if (ret->datalen == 0) {
3924 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
3925 uint32_t *java_elems = (uint32_t*)(elems + 4);
3926 for (size_t i = 0; i < ret->datalen; i++) {
3927 uint32_t arr_elem = java_elems[i];
3928 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3929 CHECK_ACCESS(arr_elem_ptr);
3930 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(arr_elem_ptr);
3931 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
3932 ret->data[i] = arr_elem_conv;
3935 return (uint64_t)ret;
3937 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
3938 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
3939 for (size_t i = 0; i < ret.datalen; i++) {
3940 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
3944 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
3945 return ThirtyTwoBytes_clone(&tuple->a);
3947 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t tuple) {
3948 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
3949 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3950 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(tuple_conv).data, 32);
3954 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
3955 return CVec_C2Tuple_u32TxOutZZ_clone(&tuple->b);
3957 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t tuple) {
3958 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
3959 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(tuple_conv);
3960 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3961 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3962 for (size_t u = 0; u < ret_var.datalen; u++) {
3963 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
3964 *ret_conv_20_conv = ret_var.data[u];
3965 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
3971 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
3972 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
3973 ret->datalen = *((uint32_t*)elems);
3974 if (ret->datalen == 0) {
3977 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
3978 uint32_t *java_elems = (uint32_t*)(elems + 4);
3979 for (size_t i = 0; i < ret->datalen; i++) {
3980 uint32_t arr_elem = java_elems[i];
3981 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3982 CHECK_ACCESS(arr_elem_ptr);
3983 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arr_elem_ptr);
3984 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
3985 ret->data[i] = arr_elem_conv;
3988 return (uint64_t)ret;
3990 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
3991 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 };
3992 for (size_t i = 0; i < ret.datalen; i++) {
3993 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
3997 uint32_t __attribute__((visibility("default"))) TS_LDKBalance_ref_from_ptr(uint32_t ptr) {
3998 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
4000 case LDKBalance_ClaimableOnChannelClose: {
4001 return 0 /* LDKBalance - ClaimableOnChannelClose */; (void) obj->claimable_on_channel_close.claimable_amount_satoshis;
4003 case LDKBalance_ClaimableAwaitingConfirmations: {
4004 return 0 /* LDKBalance - ClaimableAwaitingConfirmations */; (void) obj->claimable_awaiting_confirmations.claimable_amount_satoshis; (void) obj->claimable_awaiting_confirmations.confirmation_height;
4006 case LDKBalance_ContentiousClaimable: {
4007 return 0 /* LDKBalance - ContentiousClaimable */; (void) obj->contentious_claimable.claimable_amount_satoshis; (void) obj->contentious_claimable.timeout_height;
4009 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
4010 return 0 /* LDKBalance - MaybeClaimableHTLCAwaitingTimeout */; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
4015 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_BalanceZ_new(uint32_tArray elems) {
4016 LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
4017 ret->datalen = *((uint32_t*)elems);
4018 if (ret->datalen == 0) {
4021 ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
4022 uint32_t *java_elems = (uint32_t*)(elems + 4);
4023 for (size_t i = 0; i < ret->datalen; i++) {
4024 uint32_t arr_elem = java_elems[i];
4025 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
4026 CHECK_ACCESS(arr_elem_ptr);
4027 LDKBalance arr_elem_conv = *(LDKBalance*)(arr_elem_ptr);
4028 arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
4029 ret->data[i] = arr_elem_conv;
4032 return (uint64_t)ret;
4034 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
4035 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
4036 for (size_t i = 0; i < ret.datalen; i++) {
4037 ret.data[i] = Balance_clone(&orig->data[i]);
4041 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
4042 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
4044 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
4045 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4046 CHECK(val->result_ok);
4047 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
4048 *res_conv = (*val->contents.result);
4049 *res_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv);
4050 return ((uint64_t)res_conv);
4052 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
4053 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4054 CHECK(!val->result_ok);
4055 LDKDecodeError err_var = (*val->contents.err);
4056 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4057 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4058 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4061 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
4062 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
4064 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
4065 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4066 CHECK(val->result_ok);
4067 return *val->contents.result;
4069 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
4070 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4071 CHECK(!val->result_ok);
4072 LDKLightningError err_var = (*val->contents.err);
4073 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4074 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4075 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4078 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
4081 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t tuple) {
4082 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
4083 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4084 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PublicKeyTypeZ_get_a(tuple_conv).compressed_form, 33);
4088 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
4089 return Type_clone(&tuple->b);
4091 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t tuple) {
4092 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
4093 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
4094 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(tuple_conv);
4095 return (uint64_t)ret_ret;
4098 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_PublicKeyTypeZZ_new(uint32_tArray elems) {
4099 LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
4100 ret->datalen = *((uint32_t*)elems);
4101 if (ret->datalen == 0) {
4104 ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
4105 uint32_t *java_elems = (uint32_t*)(elems + 4);
4106 for (size_t i = 0; i < ret->datalen; i++) {
4107 uint32_t arr_elem = java_elems[i];
4108 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
4109 CHECK_ACCESS(arr_elem_ptr);
4110 LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(arr_elem_ptr);
4111 arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
4112 ret->data[i] = arr_elem_conv;
4115 return (uint64_t)ret;
4117 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
4118 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
4119 for (size_t i = 0; i < ret.datalen; i++) {
4120 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
4124 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
4125 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
4127 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
4128 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4129 CHECK(val->result_ok);
4130 return *val->contents.result;
4132 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
4133 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4134 CHECK(!val->result_ok);
4135 LDKLightningError err_var = (*val->contents.err);
4136 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4137 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4138 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4141 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4142 return ChannelAnnouncement_clone(&tuple->a);
4144 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t tuple) {
4145 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4146 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(tuple_conv);
4147 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4148 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4149 uint64_t ret_ref = (uint64_t)ret_var.inner;
4150 if (ret_var.is_owned) {
4156 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4157 return ChannelUpdate_clone(&tuple->b);
4159 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t tuple) {
4160 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4161 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(tuple_conv);
4162 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4163 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4164 uint64_t ret_ref = (uint64_t)ret_var.inner;
4165 if (ret_var.is_owned) {
4171 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4172 return ChannelUpdate_clone(&tuple->c);
4174 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t tuple) {
4175 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4176 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(tuple_conv);
4177 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4178 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4179 uint64_t ret_ref = (uint64_t)ret_var.inner;
4180 if (ret_var.is_owned) {
4186 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
4187 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
4188 ret->datalen = *((uint32_t*)elems);
4189 if (ret->datalen == 0) {
4192 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
4193 uint32_t *java_elems = (uint32_t*)(elems + 4);
4194 for (size_t i = 0; i < ret->datalen; i++) {
4195 uint32_t arr_elem = java_elems[i];
4196 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
4197 CHECK_ACCESS(arr_elem_ptr);
4198 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arr_elem_ptr);
4199 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
4200 ret->data[i] = arr_elem_conv;
4203 return (uint64_t)ret;
4205 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4206 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4207 for (size_t i = 0; i < ret.datalen; i++) {
4208 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4212 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
4213 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
4214 ret->datalen = *((uint32_t*)elems);
4215 if (ret->datalen == 0) {
4218 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
4219 uint32_t *java_elems = (uint32_t*)(elems + 4);
4220 for (size_t i = 0; i < ret->datalen; i++) {
4221 uint32_t arr_elem = java_elems[i];
4222 LDKNodeAnnouncement arr_elem_conv;
4223 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4224 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4225 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
4226 ret->data[i] = arr_elem_conv;
4229 return (uint64_t)ret;
4231 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4232 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4233 for (size_t i = 0; i < ret.datalen; i++) {
4234 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4238 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
4239 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4241 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
4242 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4243 CHECK(val->result_ok);
4244 LDKCVec_u8Z res_var = (*val->contents.result);
4245 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4246 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
4249 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
4250 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4251 CHECK(!val->result_ok);
4252 LDKPeerHandleError err_var = (*val->contents.err);
4253 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4254 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4255 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4258 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
4259 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
4261 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
4262 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4263 CHECK(val->result_ok);
4264 return *val->contents.result;
4266 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
4267 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4268 CHECK(!val->result_ok);
4269 LDKPeerHandleError err_var = (*val->contents.err);
4270 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4271 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4272 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4275 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
4276 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4278 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
4279 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4280 CHECK(val->result_ok);
4281 return *val->contents.result;
4283 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
4284 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4285 CHECK(!val->result_ok);
4286 LDKPeerHandleError err_var = (*val->contents.err);
4287 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4288 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4289 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4292 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_result_ok(uint32_t arg) {
4293 return ((LDKCResult_NodeIdDecodeErrorZ*)arg)->result_ok;
4295 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_ok(uint32_t arg) {
4296 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
4297 CHECK(val->result_ok);
4298 LDKNodeId res_var = (*val->contents.result);
4299 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4300 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4301 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4304 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_err(uint32_t arg) {
4305 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
4306 CHECK(!val->result_ok);
4307 LDKDecodeError err_var = (*val->contents.err);
4308 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4309 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4310 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4313 typedef struct LDKAccess_JCalls {
4314 atomic_size_t refcnt;
4315 uint32_t get_utxo_meth;
4317 static void LDKAccess_JCalls_free(void* this_arg) {
4318 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4319 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4320 js_free(j_calls->get_utxo_meth);
4324 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4325 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4326 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4327 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
4328 uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4329 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4330 CHECK_ACCESS(ret_ptr);
4331 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
4332 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
4335 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
4336 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
4337 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4339 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
4340 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4341 atomic_init(&calls->refcnt, 1);
4342 //TODO: Assign calls->o from o
4345 .this_arg = (void*) calls,
4346 .get_utxo = get_utxo_LDKAccess_jcall,
4347 .free = LDKAccess_JCalls_free,
4351 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
4352 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4353 *res_ptr = LDKAccess_init(o);
4354 return (long)res_ptr;
4356 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4357 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4358 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4359 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
4360 unsigned char genesis_hash_arr[32];
4361 CHECK(*((uint32_t*)genesis_hash) == 32);
4362 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
4363 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4364 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4365 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4366 return (uint64_t)ret_conv;
4369 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_AccessZ_ref_from_ptr(uint32_t ptr) {
4370 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
4372 case LDKCOption_AccessZ_Some: {
4373 LDKAccess* some_ret =MALLOC(sizeof(LDKAccess), "LDKAccess");
4374 *some_ret = obj->some;
4375 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
4376 return 0 /* LDKCOption_AccessZ - Some */; (void) (uint64_t)some_ret;
4378 case LDKCOption_AccessZ_None: {
4379 return 0 /* LDKCOption_AccessZ - None */;
4384 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
4385 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
4387 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4388 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4389 CHECK(val->result_ok);
4390 LDKDirectionalChannelInfo res_var = (*val->contents.result);
4391 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4392 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4393 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4396 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4397 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4398 CHECK(!val->result_ok);
4399 LDKDecodeError err_var = (*val->contents.err);
4400 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4401 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4402 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4405 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
4406 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
4408 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4409 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4410 CHECK(val->result_ok);
4411 LDKChannelInfo res_var = (*val->contents.result);
4412 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4413 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4414 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4417 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4418 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4419 CHECK(!val->result_ok);
4420 LDKDecodeError err_var = (*val->contents.err);
4421 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4422 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4423 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4426 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
4427 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
4429 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
4430 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4431 CHECK(val->result_ok);
4432 LDKRoutingFees res_var = (*val->contents.result);
4433 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4434 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4435 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4438 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
4439 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4440 CHECK(!val->result_ok);
4441 LDKDecodeError err_var = (*val->contents.err);
4442 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4443 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4444 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4447 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
4448 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
4450 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
4451 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4452 CHECK(val->result_ok);
4453 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
4454 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4455 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4456 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4459 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
4460 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4461 CHECK(!val->result_ok);
4462 LDKDecodeError err_var = (*val->contents.err);
4463 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4464 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4465 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4468 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
4469 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
4470 ret->datalen = *((uint32_t*)elems);
4471 if (ret->datalen == 0) {
4474 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
4475 int64_t *java_elems = (int64_t*)(elems + 4);
4476 for (size_t i = 0; i < ret->datalen; i++) {
4477 ret->data[i] = java_elems[i];
4480 return (uint64_t)ret;
4482 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4483 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4484 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4487 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
4488 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
4490 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
4491 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4492 CHECK(val->result_ok);
4493 LDKNodeInfo res_var = (*val->contents.result);
4494 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4495 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4496 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4499 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
4500 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4501 CHECK(!val->result_ok);
4502 LDKDecodeError err_var = (*val->contents.err);
4503 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4504 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4505 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4508 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
4509 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
4511 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
4512 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4513 CHECK(val->result_ok);
4514 LDKNetworkGraph res_var = (*val->contents.result);
4515 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4516 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4517 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4520 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
4521 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4522 CHECK(!val->result_ok);
4523 LDKDecodeError err_var = (*val->contents.err);
4524 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4525 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4526 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4529 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_CVec_NetAddressZZ_ref_from_ptr(uint32_t ptr) {
4530 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
4532 case LDKCOption_CVec_NetAddressZZ_Some: {
4533 LDKCVec_NetAddressZ some_var = obj->some;
4534 uint32_tArray some_arr = init_arr(some_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4535 uint32_t *some_arr_ptr = (uint32_t*)(some_arr + 4);
4536 for (size_t m = 0; m < some_var.datalen; m++) {
4537 uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1;
4538 some_arr_ptr[m] = some_conv_12_ref;
4540 return 0 /* LDKCOption_CVec_NetAddressZZ - Some */; (void) some_arr;
4542 case LDKCOption_CVec_NetAddressZZ_None: {
4543 return 0 /* LDKCOption_CVec_NetAddressZZ - None */;
4548 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) {
4549 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
4551 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_ok(uint32_t arg) {
4552 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
4553 CHECK(val->result_ok);
4554 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4557 int8_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_err(uint32_t arg) {
4558 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
4559 CHECK(!val->result_ok);
4560 return *val->contents.err;
4562 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_result_ok(uint32_t arg) {
4563 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
4565 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_ok(uint32_t arg) {
4566 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
4567 CHECK(val->result_ok);
4568 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
4569 *res_conv = (*val->contents.result);
4570 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
4571 return (uint64_t)res_conv;
4573 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_err(uint32_t arg) {
4574 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
4575 CHECK(!val->result_ok);
4576 LDKDecodeError err_var = (*val->contents.err);
4577 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4578 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4579 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4582 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_result_ok(uint32_t arg) {
4583 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
4585 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_ok(uint32_t arg) {
4586 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4587 CHECK(val->result_ok);
4588 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4591 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_err(uint32_t arg) {
4592 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4593 CHECK(!val->result_ok);
4594 LDKDecodeError err_var = (*val->contents.err);
4595 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4596 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4597 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4600 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
4601 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
4602 ret->datalen = *((uint32_t*)elems);
4603 if (ret->datalen == 0) {
4606 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
4607 uint32_t *java_elems = (uint32_t*)(elems + 4);
4608 for (size_t i = 0; i < ret->datalen; i++) {
4609 uint32_t arr_elem = java_elems[i];
4610 LDKUpdateAddHTLC arr_elem_conv;
4611 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4612 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4613 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
4614 ret->data[i] = arr_elem_conv;
4617 return (uint64_t)ret;
4619 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
4620 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
4621 for (size_t i = 0; i < ret.datalen; i++) {
4622 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
4626 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
4627 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
4628 ret->datalen = *((uint32_t*)elems);
4629 if (ret->datalen == 0) {
4632 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
4633 uint32_t *java_elems = (uint32_t*)(elems + 4);
4634 for (size_t i = 0; i < ret->datalen; i++) {
4635 uint32_t arr_elem = java_elems[i];
4636 LDKUpdateFulfillHTLC arr_elem_conv;
4637 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4638 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4639 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
4640 ret->data[i] = arr_elem_conv;
4643 return (uint64_t)ret;
4645 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
4646 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
4647 for (size_t i = 0; i < ret.datalen; i++) {
4648 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
4652 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
4653 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
4654 ret->datalen = *((uint32_t*)elems);
4655 if (ret->datalen == 0) {
4658 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
4659 uint32_t *java_elems = (uint32_t*)(elems + 4);
4660 for (size_t i = 0; i < ret->datalen; i++) {
4661 uint32_t arr_elem = java_elems[i];
4662 LDKUpdateFailHTLC arr_elem_conv;
4663 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4664 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4665 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
4666 ret->data[i] = arr_elem_conv;
4669 return (uint64_t)ret;
4671 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
4672 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
4673 for (size_t i = 0; i < ret.datalen; i++) {
4674 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
4678 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
4679 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
4680 ret->datalen = *((uint32_t*)elems);
4681 if (ret->datalen == 0) {
4684 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
4685 uint32_t *java_elems = (uint32_t*)(elems + 4);
4686 for (size_t i = 0; i < ret->datalen; i++) {
4687 uint32_t arr_elem = java_elems[i];
4688 LDKUpdateFailMalformedHTLC arr_elem_conv;
4689 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4690 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4691 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
4692 ret->data[i] = arr_elem_conv;
4695 return (uint64_t)ret;
4697 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
4698 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
4699 for (size_t i = 0; i < ret.datalen; i++) {
4700 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
4704 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
4705 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
4707 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
4708 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4709 CHECK(val->result_ok);
4710 LDKAcceptChannel res_var = (*val->contents.result);
4711 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4712 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4713 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4716 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
4717 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4718 CHECK(!val->result_ok);
4719 LDKDecodeError err_var = (*val->contents.err);
4720 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4721 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4722 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4725 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
4726 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
4728 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
4729 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4730 CHECK(val->result_ok);
4731 LDKAnnouncementSignatures res_var = (*val->contents.result);
4732 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4733 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4734 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4737 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
4738 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4739 CHECK(!val->result_ok);
4740 LDKDecodeError err_var = (*val->contents.err);
4741 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4742 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4743 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4746 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
4747 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
4749 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
4750 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4751 CHECK(val->result_ok);
4752 LDKChannelReestablish res_var = (*val->contents.result);
4753 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4754 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4755 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4758 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
4759 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4760 CHECK(!val->result_ok);
4761 LDKDecodeError err_var = (*val->contents.err);
4762 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4763 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4764 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4767 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4768 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
4770 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4771 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4772 CHECK(val->result_ok);
4773 LDKClosingSigned res_var = (*val->contents.result);
4774 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4775 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4776 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4779 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
4780 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4781 CHECK(!val->result_ok);
4782 LDKDecodeError err_var = (*val->contents.err);
4783 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4784 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4785 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4788 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_result_ok(uint32_t arg) {
4789 return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
4791 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t arg) {
4792 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4793 CHECK(val->result_ok);
4794 LDKClosingSignedFeeRange res_var = (*val->contents.result);
4795 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4796 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4797 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4800 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t arg) {
4801 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4802 CHECK(!val->result_ok);
4803 LDKDecodeError err_var = (*val->contents.err);
4804 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4805 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4806 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4809 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
4810 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
4812 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
4813 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4814 CHECK(val->result_ok);
4815 LDKCommitmentSigned res_var = (*val->contents.result);
4816 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4817 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4818 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4821 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
4822 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4823 CHECK(!val->result_ok);
4824 LDKDecodeError err_var = (*val->contents.err);
4825 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4826 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4827 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4830 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
4831 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
4833 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
4834 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4835 CHECK(val->result_ok);
4836 LDKFundingCreated res_var = (*val->contents.result);
4837 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4838 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4839 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4842 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
4843 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4844 CHECK(!val->result_ok);
4845 LDKDecodeError err_var = (*val->contents.err);
4846 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4847 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4848 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4851 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4852 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
4854 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4855 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4856 CHECK(val->result_ok);
4857 LDKFundingSigned res_var = (*val->contents.result);
4858 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4859 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4860 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4863 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
4864 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4865 CHECK(!val->result_ok);
4866 LDKDecodeError err_var = (*val->contents.err);
4867 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4868 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4869 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4872 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
4873 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
4875 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
4876 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4877 CHECK(val->result_ok);
4878 LDKFundingLocked res_var = (*val->contents.result);
4879 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4880 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4881 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4884 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
4885 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4886 CHECK(!val->result_ok);
4887 LDKDecodeError err_var = (*val->contents.err);
4888 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4889 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4890 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4893 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_result_ok(uint32_t arg) {
4894 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
4896 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
4897 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4898 CHECK(val->result_ok);
4899 LDKInit res_var = (*val->contents.result);
4900 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4901 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4902 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4905 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
4906 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4907 CHECK(!val->result_ok);
4908 LDKDecodeError err_var = (*val->contents.err);
4909 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4910 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4911 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4914 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
4915 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
4917 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
4918 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4919 CHECK(val->result_ok);
4920 LDKOpenChannel res_var = (*val->contents.result);
4921 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4922 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4923 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4926 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
4927 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4928 CHECK(!val->result_ok);
4929 LDKDecodeError err_var = (*val->contents.err);
4930 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4931 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4932 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4935 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
4936 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
4938 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
4939 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4940 CHECK(val->result_ok);
4941 LDKRevokeAndACK res_var = (*val->contents.result);
4942 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4943 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4944 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4947 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
4948 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4949 CHECK(!val->result_ok);
4950 LDKDecodeError err_var = (*val->contents.err);
4951 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4952 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4953 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4956 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
4957 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
4959 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
4960 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4961 CHECK(val->result_ok);
4962 LDKShutdown res_var = (*val->contents.result);
4963 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4964 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4965 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4968 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
4969 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4970 CHECK(!val->result_ok);
4971 LDKDecodeError err_var = (*val->contents.err);
4972 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4973 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4974 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4977 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4978 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
4980 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4981 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4982 CHECK(val->result_ok);
4983 LDKUpdateFailHTLC res_var = (*val->contents.result);
4984 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4985 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4986 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4989 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
4990 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4991 CHECK(!val->result_ok);
4992 LDKDecodeError err_var = (*val->contents.err);
4993 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4994 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4995 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4998 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4999 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
5001 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
5002 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5003 CHECK(val->result_ok);
5004 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
5005 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5006 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5007 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5010 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
5011 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5012 CHECK(!val->result_ok);
5013 LDKDecodeError err_var = (*val->contents.err);
5014 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5015 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5016 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5019 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
5020 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
5022 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
5023 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5024 CHECK(val->result_ok);
5025 LDKUpdateFee res_var = (*val->contents.result);
5026 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5027 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5028 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5031 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
5032 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5033 CHECK(!val->result_ok);
5034 LDKDecodeError err_var = (*val->contents.err);
5035 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5036 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5037 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5040 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
5041 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
5043 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
5044 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5045 CHECK(val->result_ok);
5046 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
5047 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5048 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5049 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5052 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
5053 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5054 CHECK(!val->result_ok);
5055 LDKDecodeError err_var = (*val->contents.err);
5056 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5057 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5058 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5061 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
5062 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
5064 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
5065 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5066 CHECK(val->result_ok);
5067 LDKUpdateAddHTLC res_var = (*val->contents.result);
5068 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5069 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5070 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5073 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
5074 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5075 CHECK(!val->result_ok);
5076 LDKDecodeError err_var = (*val->contents.err);
5077 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5078 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5079 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5082 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_result_ok(uint32_t arg) {
5083 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
5085 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
5086 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5087 CHECK(val->result_ok);
5088 LDKPing res_var = (*val->contents.result);
5089 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5090 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5091 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5094 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
5095 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5096 CHECK(!val->result_ok);
5097 LDKDecodeError err_var = (*val->contents.err);
5098 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5099 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5100 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5103 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_result_ok(uint32_t arg) {
5104 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
5106 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
5107 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5108 CHECK(val->result_ok);
5109 LDKPong res_var = (*val->contents.result);
5110 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5111 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5112 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5115 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
5116 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5117 CHECK(!val->result_ok);
5118 LDKDecodeError err_var = (*val->contents.err);
5119 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5120 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5121 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5124 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5125 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5127 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5128 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5129 CHECK(val->result_ok);
5130 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
5131 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5132 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5133 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5136 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5137 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5138 CHECK(!val->result_ok);
5139 LDKDecodeError err_var = (*val->contents.err);
5140 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5141 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5142 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5145 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5146 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5148 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5149 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5150 CHECK(val->result_ok);
5151 LDKChannelAnnouncement res_var = (*val->contents.result);
5152 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5153 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5154 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5157 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5158 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5159 CHECK(!val->result_ok);
5160 LDKDecodeError err_var = (*val->contents.err);
5161 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5162 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5163 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5166 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
5167 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
5169 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
5170 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5171 CHECK(val->result_ok);
5172 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
5173 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5174 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5175 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5178 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
5179 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5180 CHECK(!val->result_ok);
5181 LDKDecodeError err_var = (*val->contents.err);
5182 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5183 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5184 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5187 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
5188 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
5190 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
5191 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5192 CHECK(val->result_ok);
5193 LDKChannelUpdate res_var = (*val->contents.result);
5194 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5195 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5196 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5199 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
5200 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5201 CHECK(!val->result_ok);
5202 LDKDecodeError err_var = (*val->contents.err);
5203 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5204 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5205 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5208 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
5209 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
5211 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
5212 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5213 CHECK(val->result_ok);
5214 LDKErrorMessage res_var = (*val->contents.result);
5215 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5216 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5217 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5220 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
5221 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5222 CHECK(!val->result_ok);
5223 LDKDecodeError err_var = (*val->contents.err);
5224 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5225 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5226 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5229 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5230 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5232 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5233 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5234 CHECK(val->result_ok);
5235 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
5236 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5237 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5238 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5241 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5242 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5243 CHECK(!val->result_ok);
5244 LDKDecodeError err_var = (*val->contents.err);
5245 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5246 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5247 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5250 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5251 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5253 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5254 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5255 CHECK(val->result_ok);
5256 LDKNodeAnnouncement res_var = (*val->contents.result);
5257 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5258 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5259 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5262 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5263 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5264 CHECK(!val->result_ok);
5265 LDKDecodeError err_var = (*val->contents.err);
5266 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5267 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5268 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5271 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
5272 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
5274 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
5275 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5276 CHECK(val->result_ok);
5277 LDKQueryShortChannelIds res_var = (*val->contents.result);
5278 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5279 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5280 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5283 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
5284 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5285 CHECK(!val->result_ok);
5286 LDKDecodeError err_var = (*val->contents.err);
5287 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5288 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5289 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5292 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
5293 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
5295 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
5296 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5297 CHECK(val->result_ok);
5298 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
5299 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5300 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5301 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5304 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
5305 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5306 CHECK(!val->result_ok);
5307 LDKDecodeError err_var = (*val->contents.err);
5308 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5309 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5310 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5313 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
5314 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
5316 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5317 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5318 CHECK(val->result_ok);
5319 LDKQueryChannelRange res_var = (*val->contents.result);
5320 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5321 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5322 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5325 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5326 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5327 CHECK(!val->result_ok);
5328 LDKDecodeError err_var = (*val->contents.err);
5329 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5330 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5331 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5334 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
5335 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
5337 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5338 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5339 CHECK(val->result_ok);
5340 LDKReplyChannelRange res_var = (*val->contents.result);
5341 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5342 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5343 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5346 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5347 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5348 CHECK(!val->result_ok);
5349 LDKDecodeError err_var = (*val->contents.err);
5350 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5351 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5352 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5355 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
5356 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
5358 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
5359 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5360 CHECK(val->result_ok);
5361 LDKGossipTimestampFilter res_var = (*val->contents.result);
5362 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5363 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5364 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5367 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
5368 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5369 CHECK(!val->result_ok);
5370 LDKDecodeError err_var = (*val->contents.err);
5371 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5372 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5373 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5376 uint32_t __attribute__((visibility("default"))) TS_LDKSignOrCreationError_ref_from_ptr(uint32_t ptr) {
5377 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
5379 case LDKSignOrCreationError_SignError: {
5380 return 0 /* LDKSignOrCreationError - SignError */;
5382 case LDKSignOrCreationError_CreationError: {
5383 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
5384 return 0 /* LDKSignOrCreationError - CreationError */; (void) creation_error_conv;
5389 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_result_ok(uint32_t arg) {
5390 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
5392 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t arg) {
5393 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5394 CHECK(val->result_ok);
5395 LDKInvoice res_var = (*val->contents.result);
5396 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5397 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5398 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5401 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t arg) {
5402 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5403 CHECK(!val->result_ok);
5404 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
5407 typedef struct LDKFilter_JCalls {
5408 atomic_size_t refcnt;
5409 uint32_t register_tx_meth;
5410 uint32_t register_output_meth;
5412 static void LDKFilter_JCalls_free(void* this_arg) {
5413 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5414 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5415 js_free(j_calls->register_tx_meth);
5416 js_free(j_calls->register_output_meth);
5420 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5421 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5422 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5423 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5424 LDKu8slice script_pubkey_var = script_pubkey;
5425 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5426 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
5427 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
5429 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5430 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5431 LDKWatchedOutput output_var = output;
5432 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5433 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5434 uint64_t output_ref = (uint64_t)output_var.inner;
5435 if (output_var.is_owned) {
5438 uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
5439 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5440 CHECK_ACCESS(ret_ptr);
5441 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
5442 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
5445 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5446 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5447 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5449 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
5450 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5451 atomic_init(&calls->refcnt, 1);
5452 //TODO: Assign calls->o from o
5455 .this_arg = (void*) calls,
5456 .register_tx = register_tx_LDKFilter_jcall,
5457 .register_output = register_output_LDKFilter_jcall,
5458 .free = LDKFilter_JCalls_free,
5462 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
5463 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5464 *res_ptr = LDKFilter_init(o);
5465 return (long)res_ptr;
5467 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5468 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5469 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5470 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5471 unsigned char txid_arr[32];
5472 CHECK(*((uint32_t*)txid) == 32);
5473 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5474 unsigned char (*txid_ref)[32] = &txid_arr;
5475 LDKu8slice script_pubkey_ref;
5476 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
5477 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
5478 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5481 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5482 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5483 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5484 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5485 LDKWatchedOutput output_conv;
5486 output_conv.inner = (void*)(output & (~1));
5487 output_conv.is_owned = (output & 1) || (output == 0);
5488 output_conv = WatchedOutput_clone(&output_conv);
5489 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5490 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5491 uint64_t ret_ref = (uint64_t)ret_copy;
5495 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_FilterZ_ref_from_ptr(uint32_t ptr) {
5496 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
5498 case LDKCOption_FilterZ_Some: {
5499 LDKFilter* some_ret =MALLOC(sizeof(LDKFilter), "LDKFilter");
5500 *some_ret = obj->some;
5501 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
5502 return 0 /* LDKCOption_FilterZ - Some */; (void) (uint64_t)some_ret;
5504 case LDKCOption_FilterZ_None: {
5505 return 0 /* LDKCOption_FilterZ - None */;
5510 jboolean __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_result_ok(uint32_t arg) {
5511 return ((LDKCResult_LockedChannelMonitorNoneZ*)arg)->result_ok;
5513 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_ok(uint32_t arg) {
5514 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
5515 CHECK(val->result_ok);
5516 LDKLockedChannelMonitor res_var = (*val->contents.result);
5517 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5518 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5519 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5522 void __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_err(uint32_t arg) {
5523 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
5524 CHECK(!val->result_ok);
5525 return *val->contents.err;
5527 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_OutPointZ_new(uint32_tArray elems) {
5528 LDKCVec_OutPointZ *ret = MALLOC(sizeof(LDKCVec_OutPointZ), "LDKCVec_OutPointZ");
5529 ret->datalen = *((uint32_t*)elems);
5530 if (ret->datalen == 0) {
5533 ret->data = MALLOC(sizeof(LDKOutPoint) * ret->datalen, "LDKCVec_OutPointZ Data");
5534 uint32_t *java_elems = (uint32_t*)(elems + 4);
5535 for (size_t i = 0; i < ret->datalen; i++) {
5536 uint32_t arr_elem = java_elems[i];
5537 LDKOutPoint arr_elem_conv;
5538 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5539 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5540 arr_elem_conv = OutPoint_clone(&arr_elem_conv);
5541 ret->data[i] = arr_elem_conv;
5544 return (uint64_t)ret;
5546 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
5547 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
5548 for (size_t i = 0; i < ret.datalen; i++) {
5549 ret.data[i] = OutPoint_clone(&orig->data[i]);
5553 typedef struct LDKMessageSendEventsProvider_JCalls {
5554 atomic_size_t refcnt;
5555 uint32_t get_and_clear_pending_msg_events_meth;
5556 } LDKMessageSendEventsProvider_JCalls;
5557 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
5558 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5559 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5560 js_free(j_calls->get_and_clear_pending_msg_events_meth);
5564 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
5565 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5566 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
5567 LDKCVec_MessageSendEventZ ret_constr;
5568 ret_constr.datalen = *((uint32_t*)ret);
5569 if (ret_constr.datalen > 0)
5570 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5572 ret_constr.data = NULL;
5573 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5574 for (size_t s = 0; s < ret_constr.datalen; s++) {
5575 uint32_t ret_conv_18 = ret_vals[s];
5576 void* ret_conv_18_ptr = (void*)(((uint64_t)ret_conv_18) & ~1);
5577 CHECK_ACCESS(ret_conv_18_ptr);
5578 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
5579 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
5580 ret_constr.data[s] = ret_conv_18_conv;
5584 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
5585 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
5586 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5588 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5589 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
5590 atomic_init(&calls->refcnt, 1);
5591 //TODO: Assign calls->o from o
5593 LDKMessageSendEventsProvider ret = {
5594 .this_arg = (void*) calls,
5595 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
5596 .free = LDKMessageSendEventsProvider_JCalls_free,
5600 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5601 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
5602 *res_ptr = LDKMessageSendEventsProvider_init(o);
5603 return (long)res_ptr;
5605 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
5606 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5607 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5608 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
5609 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
5610 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5611 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5612 for (size_t s = 0; s < ret_var.datalen; s++) {
5613 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5614 *ret_conv_18_copy = ret_var.data[s];
5615 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
5616 ret_arr_ptr[s] = ret_conv_18_ref;
5622 typedef struct LDKEventHandler_JCalls {
5623 atomic_size_t refcnt;
5624 uint32_t handle_event_meth;
5625 } LDKEventHandler_JCalls;
5626 static void LDKEventHandler_JCalls_free(void* this_arg) {
5627 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5628 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5629 js_free(j_calls->handle_event_meth);
5633 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
5634 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5635 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
5636 *ret_event = Event_clone(event);
5637 js_invoke_function_1(j_calls->handle_event_meth, (uint64_t)ret_event);
5639 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
5640 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
5641 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5643 static inline LDKEventHandler LDKEventHandler_init (/*TODO: JS Object Reference */void* o) {
5644 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
5645 atomic_init(&calls->refcnt, 1);
5646 //TODO: Assign calls->o from o
5648 LDKEventHandler ret = {
5649 .this_arg = (void*) calls,
5650 .handle_event = handle_event_LDKEventHandler_jcall,
5651 .free = LDKEventHandler_JCalls_free,
5655 long __attribute__((visibility("default"))) TS_LDKEventHandler_new(/*TODO: JS Object Reference */void* o) {
5656 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5657 *res_ptr = LDKEventHandler_init(o);
5658 return (long)res_ptr;
5660 void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
5661 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5662 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5663 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
5664 LDKEvent* event_conv = (LDKEvent*)event;
5665 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
5668 typedef struct LDKEventsProvider_JCalls {
5669 atomic_size_t refcnt;
5670 uint32_t process_pending_events_meth;
5671 } LDKEventsProvider_JCalls;
5672 static void LDKEventsProvider_JCalls_free(void* this_arg) {
5673 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5674 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5675 js_free(j_calls->process_pending_events_meth);
5679 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
5680 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5681 LDKEventHandler* handler_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5682 *handler_ret = handler;
5683 js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)handler_ret);
5685 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
5686 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
5687 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5689 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5690 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
5691 atomic_init(&calls->refcnt, 1);
5692 //TODO: Assign calls->o from o
5694 LDKEventsProvider ret = {
5695 .this_arg = (void*) calls,
5696 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
5697 .free = LDKEventsProvider_JCalls_free,
5701 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5702 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5703 *res_ptr = LDKEventsProvider_init(o);
5704 return (long)res_ptr;
5706 void __attribute__((visibility("default"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
5707 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5708 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5709 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
5710 void* handler_ptr = (void*)(((uint64_t)handler) & ~1);
5711 CHECK_ACCESS(handler_ptr);
5712 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
5713 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
5716 typedef struct LDKListen_JCalls {
5717 atomic_size_t refcnt;
5718 uint32_t block_connected_meth;
5719 uint32_t block_disconnected_meth;
5721 static void LDKListen_JCalls_free(void* this_arg) {
5722 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5723 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5724 js_free(j_calls->block_connected_meth);
5725 js_free(j_calls->block_disconnected_meth);
5729 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
5730 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5731 LDKu8slice block_var = block;
5732 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5733 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
5734 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
5736 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5737 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5738 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5739 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5740 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
5742 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
5743 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
5744 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5746 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
5747 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
5748 atomic_init(&calls->refcnt, 1);
5749 //TODO: Assign calls->o from o
5752 .this_arg = (void*) calls,
5753 .block_connected = block_connected_LDKListen_jcall,
5754 .block_disconnected = block_disconnected_LDKListen_jcall,
5755 .free = LDKListen_JCalls_free,
5759 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
5760 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
5761 *res_ptr = LDKListen_init(o);
5762 return (long)res_ptr;
5764 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
5765 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5766 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5767 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
5768 LDKu8slice block_ref;
5769 block_ref.datalen = *((uint32_t*)block);
5770 block_ref.data = (int8_t*)(block + 4);
5771 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
5774 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
5775 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5776 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5777 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
5778 unsigned char header_arr[80];
5779 CHECK(*((uint32_t*)header) == 80);
5780 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5781 unsigned char (*header_ref)[80] = &header_arr;
5782 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
5785 typedef struct LDKConfirm_JCalls {
5786 atomic_size_t refcnt;
5787 uint32_t transactions_confirmed_meth;
5788 uint32_t transaction_unconfirmed_meth;
5789 uint32_t best_block_updated_meth;
5790 uint32_t get_relevant_txids_meth;
5791 } LDKConfirm_JCalls;
5792 static void LDKConfirm_JCalls_free(void* this_arg) {
5793 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5794 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5795 js_free(j_calls->transactions_confirmed_meth);
5796 js_free(j_calls->transaction_unconfirmed_meth);
5797 js_free(j_calls->best_block_updated_meth);
5798 js_free(j_calls->get_relevant_txids_meth);
5802 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
5803 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5804 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5805 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5806 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
5807 uint32_tArray txdata_arr = init_arr(txdata_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5808 uint32_t *txdata_arr_ptr = (uint32_t*)(txdata_arr + 4);
5809 for (size_t c = 0; c < txdata_var.datalen; c++) {
5810 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5811 *txdata_conv_28_conv = txdata_var.data[c];
5812 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
5814 FREE(txdata_var.data);
5815 js_invoke_function_3(j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
5817 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
5818 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5819 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5820 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5821 js_invoke_function_1(j_calls->transaction_unconfirmed_meth, txid_arr);
5823 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5824 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5825 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5826 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5827 js_invoke_function_2(j_calls->best_block_updated_meth, header_arr, height);
5829 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
5830 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5831 ptrArray ret = js_invoke_function_0(j_calls->get_relevant_txids_meth);
5832 LDKCVec_TxidZ ret_constr;
5833 ret_constr.datalen = *((uint32_t*)ret);
5834 if (ret_constr.datalen > 0)
5835 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
5837 ret_constr.data = NULL;
5838 int8_tArray* ret_vals = (int8_tArray*)(ret + 4);
5839 for (size_t m = 0; m < ret_constr.datalen; m++) {
5840 int8_tArray ret_conv_12 = ret_vals[m];
5841 LDKThirtyTwoBytes ret_conv_12_ref;
5842 CHECK(*((uint32_t*)ret_conv_12) == 32);
5843 memcpy(ret_conv_12_ref.data, (uint8_t*)(ret_conv_12 + 4), 32);
5844 ret_constr.data[m] = ret_conv_12_ref;
5848 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
5849 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
5850 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5852 static inline LDKConfirm LDKConfirm_init (/*TODO: JS Object Reference */void* o) {
5853 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
5854 atomic_init(&calls->refcnt, 1);
5855 //TODO: Assign calls->o from o
5858 .this_arg = (void*) calls,
5859 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
5860 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
5861 .best_block_updated = best_block_updated_LDKConfirm_jcall,
5862 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
5863 .free = LDKConfirm_JCalls_free,
5867 long __attribute__((visibility("default"))) TS_LDKConfirm_new(/*TODO: JS Object Reference */void* o) {
5868 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
5869 *res_ptr = LDKConfirm_init(o);
5870 return (long)res_ptr;
5872 void __attribute__((visibility("default"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
5873 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5874 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5875 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5876 unsigned char header_arr[80];
5877 CHECK(*((uint32_t*)header) == 80);
5878 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5879 unsigned char (*header_ref)[80] = &header_arr;
5880 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5881 txdata_constr.datalen = *((uint32_t*)txdata);
5882 if (txdata_constr.datalen > 0)
5883 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5885 txdata_constr.data = NULL;
5886 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
5887 for (size_t c = 0; c < txdata_constr.datalen; c++) {
5888 uint32_t txdata_conv_28 = txdata_vals[c];
5889 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
5890 CHECK_ACCESS(txdata_conv_28_ptr);
5891 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
5892 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
5893 txdata_constr.data[c] = txdata_conv_28_conv;
5895 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
5898 void __attribute__((visibility("default"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
5899 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5900 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5901 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5902 unsigned char txid_arr[32];
5903 CHECK(*((uint32_t*)txid) == 32);
5904 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5905 unsigned char (*txid_ref)[32] = &txid_arr;
5906 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
5909 void __attribute__((visibility("default"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
5910 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5911 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5912 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5913 unsigned char header_arr[80];
5914 CHECK(*((uint32_t*)header) == 80);
5915 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5916 unsigned char (*header_ref)[80] = &header_arr;
5917 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
5920 ptrArray __attribute__((visibility("default"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
5921 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5922 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5923 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5924 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
5925 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
5926 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
5927 for (size_t m = 0; m < ret_var.datalen; m++) {
5928 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5929 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
5930 ret_arr_ptr[m] = ret_conv_12_arr;
5936 typedef struct LDKPersist_JCalls {
5937 atomic_size_t refcnt;
5938 uint32_t persist_new_channel_meth;
5939 uint32_t update_persisted_channel_meth;
5940 } LDKPersist_JCalls;
5941 static void LDKPersist_JCalls_free(void* this_arg) {
5942 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5943 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5944 js_free(j_calls->persist_new_channel_meth);
5945 js_free(j_calls->update_persisted_channel_meth);
5949 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
5950 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5951 LDKOutPoint id_var = id;
5952 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5953 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5954 uint64_t id_ref = (uint64_t)id_var.inner;
5955 if (id_var.is_owned) {
5958 LDKChannelMonitor data_var = *data;
5959 data_var = ChannelMonitor_clone(data);
5960 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5961 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5962 uint64_t data_ref = (uint64_t)data_var.inner;
5963 if (data_var.is_owned) {
5966 uint32_t ret = js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
5967 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5968 CHECK_ACCESS(ret_ptr);
5969 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5970 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
5973 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
5974 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5975 LDKOutPoint id_var = id;
5976 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5977 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5978 uint64_t id_ref = (uint64_t)id_var.inner;
5979 if (id_var.is_owned) {
5982 LDKChannelMonitorUpdate update_var = *update;
5983 update_var = ChannelMonitorUpdate_clone(update);
5984 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5985 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5986 uint64_t update_ref = (uint64_t)update_var.inner;
5987 if (update_var.is_owned) {
5990 LDKChannelMonitor data_var = *data;
5991 data_var = ChannelMonitor_clone(data);
5992 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5993 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5994 uint64_t data_ref = (uint64_t)data_var.inner;
5995 if (data_var.is_owned) {
5998 uint32_t ret = js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
5999 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6000 CHECK_ACCESS(ret_ptr);
6001 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6002 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6005 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
6006 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
6007 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6009 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
6010 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
6011 atomic_init(&calls->refcnt, 1);
6012 //TODO: Assign calls->o from o
6015 .this_arg = (void*) calls,
6016 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
6017 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
6018 .free = LDKPersist_JCalls_free,
6022 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
6023 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
6024 *res_ptr = LDKPersist_init(o);
6025 return (long)res_ptr;
6027 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t id, uint32_t data) {
6028 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6029 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6030 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
6031 LDKOutPoint id_conv;
6032 id_conv.inner = (void*)(id & (~1));
6033 id_conv.is_owned = (id & 1) || (id == 0);
6034 id_conv = OutPoint_clone(&id_conv);
6035 LDKChannelMonitor data_conv;
6036 data_conv.inner = (void*)(data & (~1));
6037 data_conv.is_owned = false;
6038 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6039 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
6040 return (uint64_t)ret_conv;
6043 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
6044 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6045 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6046 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
6047 LDKOutPoint id_conv;
6048 id_conv.inner = (void*)(id & (~1));
6049 id_conv.is_owned = (id & 1) || (id == 0);
6050 id_conv = OutPoint_clone(&id_conv);
6051 LDKChannelMonitorUpdate update_conv;
6052 update_conv.inner = (void*)(update & (~1));
6053 update_conv.is_owned = false;
6054 LDKChannelMonitor data_conv;
6055 data_conv.inner = (void*)(data & (~1));
6056 data_conv.is_owned = false;
6057 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6058 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
6059 return (uint64_t)ret_conv;
6062 typedef struct LDKChannelMessageHandler_JCalls {
6063 atomic_size_t refcnt;
6064 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6065 uint32_t handle_open_channel_meth;
6066 uint32_t handle_accept_channel_meth;
6067 uint32_t handle_funding_created_meth;
6068 uint32_t handle_funding_signed_meth;
6069 uint32_t handle_funding_locked_meth;
6070 uint32_t handle_shutdown_meth;
6071 uint32_t handle_closing_signed_meth;
6072 uint32_t handle_update_add_htlc_meth;
6073 uint32_t handle_update_fulfill_htlc_meth;
6074 uint32_t handle_update_fail_htlc_meth;
6075 uint32_t handle_update_fail_malformed_htlc_meth;
6076 uint32_t handle_commitment_signed_meth;
6077 uint32_t handle_revoke_and_ack_meth;
6078 uint32_t handle_update_fee_meth;
6079 uint32_t handle_announcement_signatures_meth;
6080 uint32_t peer_disconnected_meth;
6081 uint32_t peer_connected_meth;
6082 uint32_t handle_channel_reestablish_meth;
6083 uint32_t handle_channel_update_meth;
6084 uint32_t handle_error_meth;
6085 } LDKChannelMessageHandler_JCalls;
6086 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
6087 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6088 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6089 js_free(j_calls->handle_open_channel_meth);
6090 js_free(j_calls->handle_accept_channel_meth);
6091 js_free(j_calls->handle_funding_created_meth);
6092 js_free(j_calls->handle_funding_signed_meth);
6093 js_free(j_calls->handle_funding_locked_meth);
6094 js_free(j_calls->handle_shutdown_meth);
6095 js_free(j_calls->handle_closing_signed_meth);
6096 js_free(j_calls->handle_update_add_htlc_meth);
6097 js_free(j_calls->handle_update_fulfill_htlc_meth);
6098 js_free(j_calls->handle_update_fail_htlc_meth);
6099 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
6100 js_free(j_calls->handle_commitment_signed_meth);
6101 js_free(j_calls->handle_revoke_and_ack_meth);
6102 js_free(j_calls->handle_update_fee_meth);
6103 js_free(j_calls->handle_announcement_signatures_meth);
6104 js_free(j_calls->peer_disconnected_meth);
6105 js_free(j_calls->peer_connected_meth);
6106 js_free(j_calls->handle_channel_reestablish_meth);
6107 js_free(j_calls->handle_channel_update_meth);
6108 js_free(j_calls->handle_error_meth);
6112 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
6113 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6114 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6115 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6116 LDKInitFeatures their_features_var = their_features;
6117 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6118 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6119 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6120 if (their_features_var.is_owned) {
6121 their_features_ref |= 1;
6123 LDKOpenChannel msg_var = *msg;
6124 msg_var = OpenChannel_clone(msg);
6125 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6126 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6127 uint64_t msg_ref = (uint64_t)msg_var.inner;
6128 if (msg_var.is_owned) {
6131 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6133 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
6134 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6135 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6136 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6137 LDKInitFeatures their_features_var = their_features;
6138 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6139 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6140 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6141 if (their_features_var.is_owned) {
6142 their_features_ref |= 1;
6144 LDKAcceptChannel msg_var = *msg;
6145 msg_var = AcceptChannel_clone(msg);
6146 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6147 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6148 uint64_t msg_ref = (uint64_t)msg_var.inner;
6149 if (msg_var.is_owned) {
6152 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6154 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
6155 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6156 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6157 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6158 LDKFundingCreated msg_var = *msg;
6159 msg_var = FundingCreated_clone(msg);
6160 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6161 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6162 uint64_t msg_ref = (uint64_t)msg_var.inner;
6163 if (msg_var.is_owned) {
6166 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
6168 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
6169 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6170 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6171 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6172 LDKFundingSigned msg_var = *msg;
6173 msg_var = FundingSigned_clone(msg);
6174 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6175 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6176 uint64_t msg_ref = (uint64_t)msg_var.inner;
6177 if (msg_var.is_owned) {
6180 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
6182 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
6183 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6184 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6185 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6186 LDKFundingLocked msg_var = *msg;
6187 msg_var = FundingLocked_clone(msg);
6188 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6189 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6190 uint64_t msg_ref = (uint64_t)msg_var.inner;
6191 if (msg_var.is_owned) {
6194 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
6196 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
6197 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6198 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6199 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6200 LDKInitFeatures their_features_var = *their_features;
6201 their_features_var = InitFeatures_clone(their_features);
6202 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6203 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6204 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6205 if (their_features_var.is_owned) {
6206 their_features_ref |= 1;
6208 LDKShutdown msg_var = *msg;
6209 msg_var = Shutdown_clone(msg);
6210 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6211 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6212 uint64_t msg_ref = (uint64_t)msg_var.inner;
6213 if (msg_var.is_owned) {
6216 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
6218 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
6219 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6220 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6221 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6222 LDKClosingSigned msg_var = *msg;
6223 msg_var = ClosingSigned_clone(msg);
6224 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6225 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6226 uint64_t msg_ref = (uint64_t)msg_var.inner;
6227 if (msg_var.is_owned) {
6230 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
6232 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
6233 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6234 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6235 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6236 LDKUpdateAddHTLC msg_var = *msg;
6237 msg_var = UpdateAddHTLC_clone(msg);
6238 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6239 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6240 uint64_t msg_ref = (uint64_t)msg_var.inner;
6241 if (msg_var.is_owned) {
6244 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
6246 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
6247 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6248 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6249 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6250 LDKUpdateFulfillHTLC msg_var = *msg;
6251 msg_var = UpdateFulfillHTLC_clone(msg);
6252 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6253 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6254 uint64_t msg_ref = (uint64_t)msg_var.inner;
6255 if (msg_var.is_owned) {
6258 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
6260 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
6261 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6262 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6263 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6264 LDKUpdateFailHTLC msg_var = *msg;
6265 msg_var = UpdateFailHTLC_clone(msg);
6266 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6267 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6268 uint64_t msg_ref = (uint64_t)msg_var.inner;
6269 if (msg_var.is_owned) {
6272 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
6274 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
6275 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6276 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6277 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6278 LDKUpdateFailMalformedHTLC msg_var = *msg;
6279 msg_var = UpdateFailMalformedHTLC_clone(msg);
6280 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6281 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6282 uint64_t msg_ref = (uint64_t)msg_var.inner;
6283 if (msg_var.is_owned) {
6286 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
6288 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
6289 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6290 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6291 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6292 LDKCommitmentSigned msg_var = *msg;
6293 msg_var = CommitmentSigned_clone(msg);
6294 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6295 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6296 uint64_t msg_ref = (uint64_t)msg_var.inner;
6297 if (msg_var.is_owned) {
6300 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
6302 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
6303 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6304 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6305 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6306 LDKRevokeAndACK msg_var = *msg;
6307 msg_var = RevokeAndACK_clone(msg);
6308 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6309 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6310 uint64_t msg_ref = (uint64_t)msg_var.inner;
6311 if (msg_var.is_owned) {
6314 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
6316 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
6317 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6318 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6319 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6320 LDKUpdateFee msg_var = *msg;
6321 msg_var = UpdateFee_clone(msg);
6322 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6323 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6324 uint64_t msg_ref = (uint64_t)msg_var.inner;
6325 if (msg_var.is_owned) {
6328 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
6330 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
6331 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6332 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6333 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6334 LDKAnnouncementSignatures msg_var = *msg;
6335 msg_var = AnnouncementSignatures_clone(msg);
6336 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6337 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6338 uint64_t msg_ref = (uint64_t)msg_var.inner;
6339 if (msg_var.is_owned) {
6342 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
6344 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
6345 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6346 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6347 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6348 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
6350 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
6351 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6352 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6353 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6354 LDKInit msg_var = *msg;
6355 msg_var = Init_clone(msg);
6356 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6357 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6358 uint64_t msg_ref = (uint64_t)msg_var.inner;
6359 if (msg_var.is_owned) {
6362 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
6364 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
6365 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6366 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6367 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6368 LDKChannelReestablish msg_var = *msg;
6369 msg_var = ChannelReestablish_clone(msg);
6370 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6371 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6372 uint64_t msg_ref = (uint64_t)msg_var.inner;
6373 if (msg_var.is_owned) {
6376 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
6378 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
6379 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6380 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6381 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6382 LDKChannelUpdate msg_var = *msg;
6383 msg_var = ChannelUpdate_clone(msg);
6384 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6385 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6386 uint64_t msg_ref = (uint64_t)msg_var.inner;
6387 if (msg_var.is_owned) {
6390 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
6392 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
6393 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6394 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6395 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6396 LDKErrorMessage msg_var = *msg;
6397 msg_var = ErrorMessage_clone(msg);
6398 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6399 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6400 uint64_t msg_ref = (uint64_t)msg_var.inner;
6401 if (msg_var.is_owned) {
6404 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
6406 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
6407 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
6408 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6409 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6411 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6412 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
6413 atomic_init(&calls->refcnt, 1);
6414 //TODO: Assign calls->o from o
6416 LDKChannelMessageHandler ret = {
6417 .this_arg = (void*) calls,
6418 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
6419 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
6420 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
6421 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
6422 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
6423 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
6424 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
6425 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
6426 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
6427 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
6428 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
6429 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
6430 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
6431 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
6432 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
6433 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
6434 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
6435 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
6436 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
6437 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
6438 .free = LDKChannelMessageHandler_JCalls_free,
6439 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6441 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6444 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6445 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6446 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
6447 return (long)res_ptr;
6449 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) {
6450 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6451 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6452 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6453 LDKPublicKey their_node_id_ref;
6454 CHECK(*((uint32_t*)their_node_id) == 33);
6455 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6456 LDKInitFeatures their_features_conv;
6457 their_features_conv.inner = (void*)(their_features & (~1));
6458 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6459 their_features_conv = InitFeatures_clone(&their_features_conv);
6460 LDKOpenChannel msg_conv;
6461 msg_conv.inner = (void*)(msg & (~1));
6462 msg_conv.is_owned = false;
6463 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6466 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) {
6467 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6468 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6469 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6470 LDKPublicKey their_node_id_ref;
6471 CHECK(*((uint32_t*)their_node_id) == 33);
6472 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6473 LDKInitFeatures their_features_conv;
6474 their_features_conv.inner = (void*)(their_features & (~1));
6475 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6476 their_features_conv = InitFeatures_clone(&their_features_conv);
6477 LDKAcceptChannel msg_conv;
6478 msg_conv.inner = (void*)(msg & (~1));
6479 msg_conv.is_owned = false;
6480 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6483 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6484 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6485 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6486 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6487 LDKPublicKey their_node_id_ref;
6488 CHECK(*((uint32_t*)their_node_id) == 33);
6489 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6490 LDKFundingCreated msg_conv;
6491 msg_conv.inner = (void*)(msg & (~1));
6492 msg_conv.is_owned = false;
6493 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6496 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6497 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6498 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6499 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6500 LDKPublicKey their_node_id_ref;
6501 CHECK(*((uint32_t*)their_node_id) == 33);
6502 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6503 LDKFundingSigned msg_conv;
6504 msg_conv.inner = (void*)(msg & (~1));
6505 msg_conv.is_owned = false;
6506 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6509 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6510 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6511 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6512 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6513 LDKPublicKey their_node_id_ref;
6514 CHECK(*((uint32_t*)their_node_id) == 33);
6515 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6516 LDKFundingLocked msg_conv;
6517 msg_conv.inner = (void*)(msg & (~1));
6518 msg_conv.is_owned = false;
6519 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6522 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
6523 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6524 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6525 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6526 LDKPublicKey their_node_id_ref;
6527 CHECK(*((uint32_t*)their_node_id) == 33);
6528 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6529 LDKInitFeatures their_features_conv;
6530 their_features_conv.inner = (void*)(their_features & (~1));
6531 their_features_conv.is_owned = false;
6532 LDKShutdown msg_conv;
6533 msg_conv.inner = (void*)(msg & (~1));
6534 msg_conv.is_owned = false;
6535 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
6538 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6539 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6540 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6541 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6542 LDKPublicKey their_node_id_ref;
6543 CHECK(*((uint32_t*)their_node_id) == 33);
6544 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6545 LDKClosingSigned msg_conv;
6546 msg_conv.inner = (void*)(msg & (~1));
6547 msg_conv.is_owned = false;
6548 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6551 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6552 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6553 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6554 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6555 LDKPublicKey their_node_id_ref;
6556 CHECK(*((uint32_t*)their_node_id) == 33);
6557 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6558 LDKUpdateAddHTLC msg_conv;
6559 msg_conv.inner = (void*)(msg & (~1));
6560 msg_conv.is_owned = false;
6561 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6564 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6565 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6566 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6567 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6568 LDKPublicKey their_node_id_ref;
6569 CHECK(*((uint32_t*)their_node_id) == 33);
6570 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6571 LDKUpdateFulfillHTLC msg_conv;
6572 msg_conv.inner = (void*)(msg & (~1));
6573 msg_conv.is_owned = false;
6574 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6577 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6578 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6579 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6580 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6581 LDKPublicKey their_node_id_ref;
6582 CHECK(*((uint32_t*)their_node_id) == 33);
6583 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6584 LDKUpdateFailHTLC msg_conv;
6585 msg_conv.inner = (void*)(msg & (~1));
6586 msg_conv.is_owned = false;
6587 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6590 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6591 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6592 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6593 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6594 LDKPublicKey their_node_id_ref;
6595 CHECK(*((uint32_t*)their_node_id) == 33);
6596 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6597 LDKUpdateFailMalformedHTLC msg_conv;
6598 msg_conv.inner = (void*)(msg & (~1));
6599 msg_conv.is_owned = false;
6600 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6603 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6604 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6605 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6606 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6607 LDKPublicKey their_node_id_ref;
6608 CHECK(*((uint32_t*)their_node_id) == 33);
6609 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6610 LDKCommitmentSigned msg_conv;
6611 msg_conv.inner = (void*)(msg & (~1));
6612 msg_conv.is_owned = false;
6613 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6616 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6617 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6618 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6619 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6620 LDKPublicKey their_node_id_ref;
6621 CHECK(*((uint32_t*)their_node_id) == 33);
6622 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6623 LDKRevokeAndACK msg_conv;
6624 msg_conv.inner = (void*)(msg & (~1));
6625 msg_conv.is_owned = false;
6626 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6629 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6630 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6631 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6632 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6633 LDKPublicKey their_node_id_ref;
6634 CHECK(*((uint32_t*)their_node_id) == 33);
6635 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6636 LDKUpdateFee msg_conv;
6637 msg_conv.inner = (void*)(msg & (~1));
6638 msg_conv.is_owned = false;
6639 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6642 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6643 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6644 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6645 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6646 LDKPublicKey their_node_id_ref;
6647 CHECK(*((uint32_t*)their_node_id) == 33);
6648 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6649 LDKAnnouncementSignatures msg_conv;
6650 msg_conv.inner = (void*)(msg & (~1));
6651 msg_conv.is_owned = false;
6652 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6655 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
6656 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6657 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6658 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6659 LDKPublicKey their_node_id_ref;
6660 CHECK(*((uint32_t*)their_node_id) == 33);
6661 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6662 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
6665 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6666 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6667 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6668 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6669 LDKPublicKey their_node_id_ref;
6670 CHECK(*((uint32_t*)their_node_id) == 33);
6671 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6673 msg_conv.inner = (void*)(msg & (~1));
6674 msg_conv.is_owned = false;
6675 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6678 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6679 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6680 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6681 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6682 LDKPublicKey their_node_id_ref;
6683 CHECK(*((uint32_t*)their_node_id) == 33);
6684 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6685 LDKChannelReestablish msg_conv;
6686 msg_conv.inner = (void*)(msg & (~1));
6687 msg_conv.is_owned = false;
6688 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6691 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6692 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6693 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6694 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6695 LDKPublicKey their_node_id_ref;
6696 CHECK(*((uint32_t*)their_node_id) == 33);
6697 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6698 LDKChannelUpdate msg_conv;
6699 msg_conv.inner = (void*)(msg & (~1));
6700 msg_conv.is_owned = false;
6701 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6704 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6705 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6706 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6707 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6708 LDKPublicKey their_node_id_ref;
6709 CHECK(*((uint32_t*)their_node_id) == 33);
6710 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6711 LDKErrorMessage msg_conv;
6712 msg_conv.inner = (void*)(msg & (~1));
6713 msg_conv.is_owned = false;
6714 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6717 typedef struct LDKRoutingMessageHandler_JCalls {
6718 atomic_size_t refcnt;
6719 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6720 uint32_t handle_node_announcement_meth;
6721 uint32_t handle_channel_announcement_meth;
6722 uint32_t handle_channel_update_meth;
6723 uint32_t get_next_channel_announcements_meth;
6724 uint32_t get_next_node_announcements_meth;
6725 uint32_t sync_routing_table_meth;
6726 uint32_t handle_reply_channel_range_meth;
6727 uint32_t handle_reply_short_channel_ids_end_meth;
6728 uint32_t handle_query_channel_range_meth;
6729 uint32_t handle_query_short_channel_ids_meth;
6730 } LDKRoutingMessageHandler_JCalls;
6731 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
6732 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6733 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6734 js_free(j_calls->handle_node_announcement_meth);
6735 js_free(j_calls->handle_channel_announcement_meth);
6736 js_free(j_calls->handle_channel_update_meth);
6737 js_free(j_calls->get_next_channel_announcements_meth);
6738 js_free(j_calls->get_next_node_announcements_meth);
6739 js_free(j_calls->sync_routing_table_meth);
6740 js_free(j_calls->handle_reply_channel_range_meth);
6741 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
6742 js_free(j_calls->handle_query_channel_range_meth);
6743 js_free(j_calls->handle_query_short_channel_ids_meth);
6747 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
6748 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6749 LDKNodeAnnouncement msg_var = *msg;
6750 msg_var = NodeAnnouncement_clone(msg);
6751 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6752 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6753 uint64_t msg_ref = (uint64_t)msg_var.inner;
6754 if (msg_var.is_owned) {
6757 uint32_t ret = js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
6758 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6759 CHECK_ACCESS(ret_ptr);
6760 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
6761 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6764 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
6765 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6766 LDKChannelAnnouncement msg_var = *msg;
6767 msg_var = ChannelAnnouncement_clone(msg);
6768 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6769 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6770 uint64_t msg_ref = (uint64_t)msg_var.inner;
6771 if (msg_var.is_owned) {
6774 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
6775 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6776 CHECK_ACCESS(ret_ptr);
6777 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
6778 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6781 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
6782 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6783 LDKChannelUpdate msg_var = *msg;
6784 msg_var = ChannelUpdate_clone(msg);
6785 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6786 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6787 uint64_t msg_ref = (uint64_t)msg_var.inner;
6788 if (msg_var.is_owned) {
6791 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
6792 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6793 CHECK_ACCESS(ret_ptr);
6794 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
6795 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6798 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
6799 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6800 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
6801 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
6802 ret_constr.datalen = *((uint32_t*)ret);
6803 if (ret_constr.datalen > 0)
6804 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6806 ret_constr.data = NULL;
6807 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6808 for (size_t h = 0; h < ret_constr.datalen; h++) {
6809 uint32_t ret_conv_59 = ret_vals[h];
6810 void* ret_conv_59_ptr = (void*)(((uint64_t)ret_conv_59) & ~1);
6811 CHECK_ACCESS(ret_conv_59_ptr);
6812 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
6813 ret_conv_59_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_59) & ~1));
6814 ret_constr.data[h] = ret_conv_59_conv;
6818 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
6819 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6820 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6821 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
6822 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
6823 LDKCVec_NodeAnnouncementZ ret_constr;
6824 ret_constr.datalen = *((uint32_t*)ret);
6825 if (ret_constr.datalen > 0)
6826 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6828 ret_constr.data = NULL;
6829 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6830 for (size_t s = 0; s < ret_constr.datalen; s++) {
6831 uint32_t ret_conv_18 = ret_vals[s];
6832 LDKNodeAnnouncement ret_conv_18_conv;
6833 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
6834 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
6835 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
6836 ret_constr.data[s] = ret_conv_18_conv;
6840 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
6841 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6842 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6843 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6844 LDKInit init_var = *init;
6845 init_var = Init_clone(init);
6846 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6847 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6848 uint64_t init_ref = (uint64_t)init_var.inner;
6849 if (init_var.is_owned) {
6852 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
6854 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
6855 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6856 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6857 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6858 LDKReplyChannelRange msg_var = msg;
6859 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6860 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6861 uint64_t msg_ref = (uint64_t)msg_var.inner;
6862 if (msg_var.is_owned) {
6865 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
6866 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6867 CHECK_ACCESS(ret_ptr);
6868 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6869 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6872 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
6873 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6874 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6875 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6876 LDKReplyShortChannelIdsEnd msg_var = msg;
6877 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6878 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6879 uint64_t msg_ref = (uint64_t)msg_var.inner;
6880 if (msg_var.is_owned) {
6883 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
6884 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6885 CHECK_ACCESS(ret_ptr);
6886 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6887 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6890 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
6891 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6892 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6893 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6894 LDKQueryChannelRange msg_var = msg;
6895 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6896 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6897 uint64_t msg_ref = (uint64_t)msg_var.inner;
6898 if (msg_var.is_owned) {
6901 uint32_t ret = js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
6902 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6903 CHECK_ACCESS(ret_ptr);
6904 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6905 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6908 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
6909 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6910 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6911 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6912 LDKQueryShortChannelIds msg_var = msg;
6913 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6914 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6915 uint64_t msg_ref = (uint64_t)msg_var.inner;
6916 if (msg_var.is_owned) {
6919 uint32_t ret = js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
6920 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6921 CHECK_ACCESS(ret_ptr);
6922 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6923 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6926 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
6927 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
6928 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6929 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6931 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6932 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
6933 atomic_init(&calls->refcnt, 1);
6934 //TODO: Assign calls->o from o
6936 LDKRoutingMessageHandler ret = {
6937 .this_arg = (void*) calls,
6938 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
6939 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
6940 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
6941 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
6942 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
6943 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
6944 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
6945 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
6946 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
6947 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
6948 .free = LDKRoutingMessageHandler_JCalls_free,
6949 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6951 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6954 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6955 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
6956 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
6957 return (long)res_ptr;
6959 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
6960 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6961 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6962 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6963 LDKNodeAnnouncement msg_conv;
6964 msg_conv.inner = (void*)(msg & (~1));
6965 msg_conv.is_owned = false;
6966 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6967 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
6968 return (uint64_t)ret_conv;
6971 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
6972 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6973 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6974 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6975 LDKChannelAnnouncement msg_conv;
6976 msg_conv.inner = (void*)(msg & (~1));
6977 msg_conv.is_owned = false;
6978 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6979 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
6980 return (uint64_t)ret_conv;
6983 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
6984 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6985 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6986 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6987 LDKChannelUpdate msg_conv;
6988 msg_conv.inner = (void*)(msg & (~1));
6989 msg_conv.is_owned = false;
6990 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6991 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
6992 return (uint64_t)ret_conv;
6995 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
6996 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6997 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6998 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6999 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
7000 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7001 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7002 for (size_t h = 0; h < ret_var.datalen; h++) {
7003 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
7004 *ret_conv_59_conv = ret_var.data[h];
7005 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
7011 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
7012 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7013 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7014 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7015 LDKPublicKey starting_point_ref;
7016 CHECK(*((uint32_t*)starting_point) == 33);
7017 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
7018 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
7019 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7020 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7021 for (size_t s = 0; s < ret_var.datalen; s++) {
7022 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
7023 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7024 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7025 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
7026 if (ret_conv_18_var.is_owned) {
7027 ret_conv_18_ref |= 1;
7029 ret_arr_ptr[s] = ret_conv_18_ref;
7035 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
7036 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7037 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7038 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7039 LDKPublicKey their_node_id_ref;
7040 CHECK(*((uint32_t*)their_node_id) == 33);
7041 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7043 init_conv.inner = (void*)(init & (~1));
7044 init_conv.is_owned = false;
7045 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
7048 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7049 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7050 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7051 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7052 LDKPublicKey their_node_id_ref;
7053 CHECK(*((uint32_t*)their_node_id) == 33);
7054 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7055 LDKReplyChannelRange msg_conv;
7056 msg_conv.inner = (void*)(msg & (~1));
7057 msg_conv.is_owned = (msg & 1) || (msg == 0);
7058 msg_conv = ReplyChannelRange_clone(&msg_conv);
7059 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7060 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7061 return (uint64_t)ret_conv;
7064 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) {
7065 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7066 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7067 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7068 LDKPublicKey their_node_id_ref;
7069 CHECK(*((uint32_t*)their_node_id) == 33);
7070 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7071 LDKReplyShortChannelIdsEnd msg_conv;
7072 msg_conv.inner = (void*)(msg & (~1));
7073 msg_conv.is_owned = (msg & 1) || (msg == 0);
7074 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
7075 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7076 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7077 return (uint64_t)ret_conv;
7080 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7081 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7082 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7083 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7084 LDKPublicKey their_node_id_ref;
7085 CHECK(*((uint32_t*)their_node_id) == 33);
7086 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7087 LDKQueryChannelRange msg_conv;
7088 msg_conv.inner = (void*)(msg & (~1));
7089 msg_conv.is_owned = (msg & 1) || (msg == 0);
7090 msg_conv = QueryChannelRange_clone(&msg_conv);
7091 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7092 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7093 return (uint64_t)ret_conv;
7096 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7097 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7098 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7099 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7100 LDKPublicKey their_node_id_ref;
7101 CHECK(*((uint32_t*)their_node_id) == 33);
7102 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7103 LDKQueryShortChannelIds msg_conv;
7104 msg_conv.inner = (void*)(msg & (~1));
7105 msg_conv.is_owned = (msg & 1) || (msg == 0);
7106 msg_conv = QueryShortChannelIds_clone(&msg_conv);
7107 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7108 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7109 return (uint64_t)ret_conv;
7112 typedef struct LDKCustomMessageReader_JCalls {
7113 atomic_size_t refcnt;
7115 } LDKCustomMessageReader_JCalls;
7116 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
7117 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
7118 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7119 js_free(j_calls->read_meth);
7123 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
7124 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
7125 LDKu8slice buffer_var = buffer;
7126 int8_tArray buffer_arr = init_arr(buffer_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7127 memcpy((uint8_t*)(buffer_arr + 4), buffer_var.data, buffer_var.datalen);
7128 uint32_t ret = js_invoke_function_2(j_calls->read_meth, message_type, buffer_arr);
7129 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7130 CHECK_ACCESS(ret_ptr);
7131 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
7132 ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
7135 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
7136 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
7137 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7139 static inline LDKCustomMessageReader LDKCustomMessageReader_init (/*TODO: JS Object Reference */void* o) {
7140 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
7141 atomic_init(&calls->refcnt, 1);
7142 //TODO: Assign calls->o from o
7144 LDKCustomMessageReader ret = {
7145 .this_arg = (void*) calls,
7146 .read = read_LDKCustomMessageReader_jcall,
7147 .free = LDKCustomMessageReader_JCalls_free,
7151 long __attribute__((visibility("default"))) TS_LDKCustomMessageReader_new(/*TODO: JS Object Reference */void* o) {
7152 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
7153 *res_ptr = LDKCustomMessageReader_init(o);
7154 return (long)res_ptr;
7156 uint32_t __attribute__((visibility("default"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
7157 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7158 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7159 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
7160 LDKu8slice buffer_ref;
7161 buffer_ref.datalen = *((uint32_t*)buffer);
7162 buffer_ref.data = (int8_t*)(buffer + 4);
7163 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
7164 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
7165 return (uint64_t)ret_conv;
7168 typedef struct LDKCustomMessageHandler_JCalls {
7169 atomic_size_t refcnt;
7170 LDKCustomMessageReader_JCalls* CustomMessageReader;
7171 uint32_t handle_custom_message_meth;
7172 uint32_t get_and_clear_pending_msg_meth;
7173 } LDKCustomMessageHandler_JCalls;
7174 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
7175 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7176 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7177 js_free(j_calls->handle_custom_message_meth);
7178 js_free(j_calls->get_and_clear_pending_msg_meth);
7182 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
7183 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7184 LDKType* msg_ret =MALLOC(sizeof(LDKType), "LDKType");
7186 int8_tArray sender_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7187 memcpy((uint8_t*)(sender_node_id_arr + 4), sender_node_id.compressed_form, 33);
7188 uint32_t ret = js_invoke_function_2(j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
7189 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7190 CHECK_ACCESS(ret_ptr);
7191 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7192 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
7195 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
7196 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7197 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_meth);
7198 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
7199 ret_constr.datalen = *((uint32_t*)ret);
7200 if (ret_constr.datalen > 0)
7201 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
7203 ret_constr.data = NULL;
7204 uint32_t* ret_vals = (uint32_t*)(ret + 4);
7205 for (size_t z = 0; z < ret_constr.datalen; z++) {
7206 uint32_t ret_conv_25 = ret_vals[z];
7207 void* ret_conv_25_ptr = (void*)(((uint64_t)ret_conv_25) & ~1);
7208 CHECK_ACCESS(ret_conv_25_ptr);
7209 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
7210 ret_conv_25_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_25) & ~1));
7211 ret_constr.data[z] = ret_conv_25_conv;
7215 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
7216 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
7217 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7218 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
7220 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* CustomMessageReader) {
7221 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
7222 atomic_init(&calls->refcnt, 1);
7223 //TODO: Assign calls->o from o
7225 LDKCustomMessageHandler ret = {
7226 .this_arg = (void*) calls,
7227 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
7228 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
7229 .free = LDKCustomMessageHandler_JCalls_free,
7230 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
7232 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
7235 long __attribute__((visibility("default"))) TS_LDKCustomMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* CustomMessageReader) {
7236 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
7237 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
7238 return (long)res_ptr;
7240 uint32_t __attribute__((visibility("default"))) TS_CustomMessageHandler_handle_custom_message(uint32_t this_arg, uint32_t msg, int8_tArray sender_node_id) {
7241 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7242 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7243 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
7244 void* msg_ptr = (void*)(((uint64_t)msg) & ~1);
7245 CHECK_ACCESS(msg_ptr);
7246 LDKType msg_conv = *(LDKType*)(msg_ptr);
7247 LDKPublicKey sender_node_id_ref;
7248 CHECK(*((uint32_t*)sender_node_id) == 33);
7249 memcpy(sender_node_id_ref.compressed_form, (uint8_t*)(sender_node_id + 4), 33);
7250 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7251 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
7252 return (uint64_t)ret_conv;
7255 uint32_tArray __attribute__((visibility("default"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
7256 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7257 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7258 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
7259 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
7260 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7261 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7262 for (size_t z = 0; z < ret_var.datalen; z++) {
7263 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
7264 *ret_conv_25_conv = ret_var.data[z];
7265 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
7271 typedef struct LDKSocketDescriptor_JCalls {
7272 atomic_size_t refcnt;
7273 uint32_t send_data_meth;
7274 uint32_t disconnect_socket_meth;
7277 } LDKSocketDescriptor_JCalls;
7278 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
7279 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7280 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7281 js_free(j_calls->send_data_meth);
7282 js_free(j_calls->disconnect_socket_meth);
7283 js_free(j_calls->eq_meth);
7284 js_free(j_calls->hash_meth);
7288 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
7289 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7290 LDKu8slice data_var = data;
7291 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7292 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
7293 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
7295 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
7296 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7297 js_invoke_function_0(j_calls->disconnect_socket_meth);
7299 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
7300 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7301 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
7302 *other_arg_clone = SocketDescriptor_clone(other_arg);
7303 return js_invoke_function_1(j_calls->eq_meth, (uint64_t)other_arg_clone);
7305 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
7306 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7307 return js_invoke_function_0(j_calls->hash_meth);
7309 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
7310 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
7311 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7313 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
7314 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
7315 atomic_init(&calls->refcnt, 1);
7316 //TODO: Assign calls->o from o
7318 LDKSocketDescriptor ret = {
7319 .this_arg = (void*) calls,
7320 .send_data = send_data_LDKSocketDescriptor_jcall,
7321 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
7322 .eq = eq_LDKSocketDescriptor_jcall,
7323 .hash = hash_LDKSocketDescriptor_jcall,
7324 .cloned = LDKSocketDescriptor_JCalls_cloned,
7325 .free = LDKSocketDescriptor_JCalls_free,
7329 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
7330 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
7331 *res_ptr = LDKSocketDescriptor_init(o);
7332 return (long)res_ptr;
7334 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
7335 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7336 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7337 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7338 LDKu8slice data_ref;
7339 data_ref.datalen = *((uint32_t*)data);
7340 data_ref.data = (int8_t*)(data + 4);
7341 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
7345 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
7346 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7347 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7348 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7349 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
7352 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
7353 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7354 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7355 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7356 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
7360 typedef struct LDKScore_JCalls {
7361 atomic_size_t refcnt;
7362 uint32_t channel_penalty_msat_meth;
7364 static void LDKScore_JCalls_free(void* this_arg) {
7365 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7366 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7367 js_free(j_calls->channel_penalty_msat_meth);
7371 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id) {
7372 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7373 return js_invoke_function_1(j_calls->channel_penalty_msat_meth, short_channel_id);
7375 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
7376 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
7377 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7379 static inline LDKScore LDKScore_init (/*TODO: JS Object Reference */void* o) {
7380 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
7381 atomic_init(&calls->refcnt, 1);
7382 //TODO: Assign calls->o from o
7385 .this_arg = (void*) calls,
7386 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
7387 .free = LDKScore_JCalls_free,
7391 long __attribute__((visibility("default"))) TS_LDKScore_new(/*TODO: JS Object Reference */void* o) {
7392 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
7393 *res_ptr = LDKScore_init(o);
7394 return (long)res_ptr;
7396 int64_t __attribute__((visibility("default"))) TS_Score_channel_penalty_msat(uint32_t this_arg, int64_t short_channel_id) {
7397 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7398 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7399 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7400 int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id);
7404 typedef struct LDKChannelManagerPersister_JCalls {
7405 atomic_size_t refcnt;
7406 uint32_t persist_manager_meth;
7407 } LDKChannelManagerPersister_JCalls;
7408 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
7409 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
7410 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7411 js_free(j_calls->persist_manager_meth);
7415 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
7416 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
7417 LDKChannelManager channel_manager_var = *channel_manager;
7418 // Warning: we may need a move here but no clone is available for LDKChannelManager
7419 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7420 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7421 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
7422 if (channel_manager_var.is_owned) {
7423 channel_manager_ref |= 1;
7425 uint32_t ret = js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
7426 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7427 CHECK_ACCESS(ret_ptr);
7428 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
7429 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
7432 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
7433 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
7434 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7436 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (/*TODO: JS Object Reference */void* o) {
7437 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
7438 atomic_init(&calls->refcnt, 1);
7439 //TODO: Assign calls->o from o
7441 LDKChannelManagerPersister ret = {
7442 .this_arg = (void*) calls,
7443 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
7444 .free = LDKChannelManagerPersister_JCalls_free,
7448 long __attribute__((visibility("default"))) TS_LDKChannelManagerPersister_new(/*TODO: JS Object Reference */void* o) {
7449 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
7450 *res_ptr = LDKChannelManagerPersister_init(o);
7451 return (long)res_ptr;
7453 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerPersister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
7454 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7455 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7456 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)this_arg_ptr;
7457 LDKChannelManager channel_manager_conv;
7458 channel_manager_conv.inner = (void*)(channel_manager & (~1));
7459 channel_manager_conv.is_owned = false;
7460 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7461 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
7462 return (uint64_t)ret_conv;
7465 uint32_t __attribute__((visibility("default"))) TS_LDKFallback_ref_from_ptr(uint32_t ptr) {
7466 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
7468 case LDKFallback_SegWitProgram: {
7469 uint8_t version_val = obj->seg_wit_program.version._0;
7470 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
7471 int8_tArray program_arr = init_arr(program_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7472 memcpy((uint8_t*)(program_arr + 4), program_var.data, program_var.datalen);
7473 return 0 /* LDKFallback - SegWitProgram */; (void) version_val; (void) program_arr;
7475 case LDKFallback_PubKeyHash: {
7476 int8_tArray pub_key_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7477 memcpy((uint8_t*)(pub_key_hash_arr + 4), obj->pub_key_hash.data, 20);
7478 return 0 /* LDKFallback - PubKeyHash */; (void) pub_key_hash_arr;
7480 case LDKFallback_ScriptHash: {
7481 int8_tArray script_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7482 memcpy((uint8_t*)(script_hash_arr + 4), obj->script_hash.data, 20);
7483 return 0 /* LDKFallback - ScriptHash */; (void) script_hash_arr;
7488 jstring __attribute__((visibility("default"))) TS__ldk_get_compiled_version() {
7489 LDKStr ret_str = _ldk_get_compiled_version();
7490 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7495 jstring __attribute__((visibility("default"))) TS__ldk_c_bindings_get_compiled_version() {
7496 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
7497 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7502 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
7503 LDKTransaction _res_ref;
7504 _res_ref.datalen = *((uint32_t*)_res);
7505 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
7506 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
7507 _res_ref.data_is_owned = true;
7508 Transaction_free(_res_ref);
7511 uint32_t __attribute__((visibility("default"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
7512 LDKCVec_u8Z script_pubkey_ref;
7513 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
7514 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
7515 memcpy(script_pubkey_ref.data, (uint8_t*)(script_pubkey + 4), script_pubkey_ref.datalen);
7516 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7517 *ret_ref = TxOut_new(script_pubkey_ref, value);
7518 return (uint64_t)ret_ref;
7521 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
7522 if ((_res & 1) != 0) return;
7523 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7524 CHECK_ACCESS(_res_ptr);
7525 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
7527 TxOut_free(_res_conv);
7530 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
7531 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
7532 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7533 *ret_ref = TxOut_clone(orig_conv);
7534 return (uint64_t)ret_ref;
7537 void __attribute__((visibility("default"))) TS_Str_free(jstring _res) {
7538 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
7542 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
7544 CHECK(*((uint32_t*)o) == 32);
7545 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
7546 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
7547 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
7548 return (uint64_t)ret_conv;
7551 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
7552 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7553 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
7554 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
7555 return (uint64_t)ret_conv;
7558 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
7559 if ((_res & 1) != 0) return;
7560 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7561 CHECK_ACCESS(_res_ptr);
7562 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
7564 CResult_SecretKeyErrorZ_free(_res_conv);
7567 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
7569 CHECK(*((uint32_t*)o) == 33);
7570 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
7571 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7572 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
7573 return (uint64_t)ret_conv;
7576 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
7577 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7578 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7579 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
7580 return (uint64_t)ret_conv;
7583 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
7584 if ((_res & 1) != 0) return;
7585 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7586 CHECK_ACCESS(_res_ptr);
7587 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
7589 CResult_PublicKeyErrorZ_free(_res_conv);
7592 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
7593 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
7594 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7595 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
7596 return (uint64_t)ret_conv;
7599 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
7600 LDKTxCreationKeys o_conv;
7601 o_conv.inner = (void*)(o & (~1));
7602 o_conv.is_owned = (o & 1) || (o == 0);
7603 o_conv = TxCreationKeys_clone(&o_conv);
7604 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7605 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
7606 return (uint64_t)ret_conv;
7609 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
7610 LDKDecodeError e_conv;
7611 e_conv.inner = (void*)(e & (~1));
7612 e_conv.is_owned = (e & 1) || (e == 0);
7613 e_conv = DecodeError_clone(&e_conv);
7614 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7615 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
7616 return (uint64_t)ret_conv;
7619 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
7620 if ((_res & 1) != 0) return;
7621 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7622 CHECK_ACCESS(_res_ptr);
7623 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
7625 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
7628 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
7629 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
7630 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7631 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
7632 return (uint64_t)ret_conv;
7635 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
7636 LDKChannelPublicKeys o_conv;
7637 o_conv.inner = (void*)(o & (~1));
7638 o_conv.is_owned = (o & 1) || (o == 0);
7639 o_conv = ChannelPublicKeys_clone(&o_conv);
7640 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7641 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
7642 return (uint64_t)ret_conv;
7645 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
7646 LDKDecodeError e_conv;
7647 e_conv.inner = (void*)(e & (~1));
7648 e_conv.is_owned = (e & 1) || (e == 0);
7649 e_conv = DecodeError_clone(&e_conv);
7650 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7651 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
7652 return (uint64_t)ret_conv;
7655 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
7656 if ((_res & 1) != 0) return;
7657 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7658 CHECK_ACCESS(_res_ptr);
7659 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
7661 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
7664 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
7665 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
7666 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7667 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
7668 return (uint64_t)ret_conv;
7671 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
7672 LDKTxCreationKeys o_conv;
7673 o_conv.inner = (void*)(o & (~1));
7674 o_conv.is_owned = (o & 1) || (o == 0);
7675 o_conv = TxCreationKeys_clone(&o_conv);
7676 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7677 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
7678 return (uint64_t)ret_conv;
7681 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
7682 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7683 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7684 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
7685 return (uint64_t)ret_conv;
7688 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
7689 if ((_res & 1) != 0) return;
7690 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7691 CHECK_ACCESS(_res_ptr);
7692 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
7694 CResult_TxCreationKeysErrorZ_free(_res_conv);
7697 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
7698 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
7699 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7700 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
7701 return (uint64_t)ret_conv;
7704 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
7705 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7706 *ret_copy = COption_u32Z_some(o);
7707 uint64_t ret_ref = (uint64_t)ret_copy;
7711 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
7712 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7713 *ret_copy = COption_u32Z_none();
7714 uint64_t ret_ref = (uint64_t)ret_copy;
7718 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
7719 if ((_res & 1) != 0) return;
7720 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7721 CHECK_ACCESS(_res_ptr);
7722 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
7724 COption_u32Z_free(_res_conv);
7727 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
7728 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
7729 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7730 *ret_copy = COption_u32Z_clone(orig_conv);
7731 uint64_t ret_ref = (uint64_t)ret_copy;
7735 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
7736 LDKHTLCOutputInCommitment o_conv;
7737 o_conv.inner = (void*)(o & (~1));
7738 o_conv.is_owned = (o & 1) || (o == 0);
7739 o_conv = HTLCOutputInCommitment_clone(&o_conv);
7740 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7741 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
7742 return (uint64_t)ret_conv;
7745 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
7746 LDKDecodeError e_conv;
7747 e_conv.inner = (void*)(e & (~1));
7748 e_conv.is_owned = (e & 1) || (e == 0);
7749 e_conv = DecodeError_clone(&e_conv);
7750 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7751 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
7752 return (uint64_t)ret_conv;
7755 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
7756 if ((_res & 1) != 0) return;
7757 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7758 CHECK_ACCESS(_res_ptr);
7759 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
7761 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
7764 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
7765 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
7766 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7767 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
7768 return (uint64_t)ret_conv;
7771 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
7772 LDKCounterpartyChannelTransactionParameters o_conv;
7773 o_conv.inner = (void*)(o & (~1));
7774 o_conv.is_owned = (o & 1) || (o == 0);
7775 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
7776 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7777 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
7778 return (uint64_t)ret_conv;
7781 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
7782 LDKDecodeError e_conv;
7783 e_conv.inner = (void*)(e & (~1));
7784 e_conv.is_owned = (e & 1) || (e == 0);
7785 e_conv = DecodeError_clone(&e_conv);
7786 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7787 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
7788 return (uint64_t)ret_conv;
7791 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
7792 if ((_res & 1) != 0) return;
7793 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7794 CHECK_ACCESS(_res_ptr);
7795 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
7797 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
7800 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
7801 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
7802 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7803 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
7804 return (uint64_t)ret_conv;
7807 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
7808 LDKChannelTransactionParameters o_conv;
7809 o_conv.inner = (void*)(o & (~1));
7810 o_conv.is_owned = (o & 1) || (o == 0);
7811 o_conv = ChannelTransactionParameters_clone(&o_conv);
7812 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7813 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
7814 return (uint64_t)ret_conv;
7817 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
7818 LDKDecodeError e_conv;
7819 e_conv.inner = (void*)(e & (~1));
7820 e_conv.is_owned = (e & 1) || (e == 0);
7821 e_conv = DecodeError_clone(&e_conv);
7822 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7823 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
7824 return (uint64_t)ret_conv;
7827 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
7828 if ((_res & 1) != 0) return;
7829 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7830 CHECK_ACCESS(_res_ptr);
7831 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
7833 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
7836 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
7837 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
7838 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7839 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
7840 return (uint64_t)ret_conv;
7843 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
7844 LDKCVec_SignatureZ _res_constr;
7845 _res_constr.datalen = *((uint32_t*)_res);
7846 if (_res_constr.datalen > 0)
7847 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7849 _res_constr.data = NULL;
7850 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7851 for (size_t m = 0; m < _res_constr.datalen; m++) {
7852 int8_tArray _res_conv_12 = _res_vals[m];
7853 LDKSignature _res_conv_12_ref;
7854 CHECK(*((uint32_t*)_res_conv_12) == 64);
7855 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
7856 _res_constr.data[m] = _res_conv_12_ref;
7858 CVec_SignatureZ_free(_res_constr);
7861 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7862 LDKHolderCommitmentTransaction o_conv;
7863 o_conv.inner = (void*)(o & (~1));
7864 o_conv.is_owned = (o & 1) || (o == 0);
7865 o_conv = HolderCommitmentTransaction_clone(&o_conv);
7866 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7867 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
7868 return (uint64_t)ret_conv;
7871 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7872 LDKDecodeError e_conv;
7873 e_conv.inner = (void*)(e & (~1));
7874 e_conv.is_owned = (e & 1) || (e == 0);
7875 e_conv = DecodeError_clone(&e_conv);
7876 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7877 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
7878 return (uint64_t)ret_conv;
7881 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7882 if ((_res & 1) != 0) return;
7883 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7884 CHECK_ACCESS(_res_ptr);
7885 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
7887 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
7890 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7891 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
7892 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7893 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
7894 return (uint64_t)ret_conv;
7897 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7898 LDKBuiltCommitmentTransaction o_conv;
7899 o_conv.inner = (void*)(o & (~1));
7900 o_conv.is_owned = (o & 1) || (o == 0);
7901 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
7902 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7903 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
7904 return (uint64_t)ret_conv;
7907 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7908 LDKDecodeError e_conv;
7909 e_conv.inner = (void*)(e & (~1));
7910 e_conv.is_owned = (e & 1) || (e == 0);
7911 e_conv = DecodeError_clone(&e_conv);
7912 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7913 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
7914 return (uint64_t)ret_conv;
7917 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7918 if ((_res & 1) != 0) return;
7919 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7920 CHECK_ACCESS(_res_ptr);
7921 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
7923 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
7926 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7927 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
7928 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7929 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
7930 return (uint64_t)ret_conv;
7933 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
7934 LDKTrustedClosingTransaction o_conv;
7935 o_conv.inner = (void*)(o & (~1));
7936 o_conv.is_owned = (o & 1) || (o == 0);
7937 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
7938 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
7939 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
7940 return (uint64_t)ret_conv;
7943 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
7944 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
7945 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
7946 return (uint64_t)ret_conv;
7949 void __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
7950 if ((_res & 1) != 0) return;
7951 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7952 CHECK_ACCESS(_res_ptr);
7953 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
7955 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
7958 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7959 LDKCommitmentTransaction o_conv;
7960 o_conv.inner = (void*)(o & (~1));
7961 o_conv.is_owned = (o & 1) || (o == 0);
7962 o_conv = CommitmentTransaction_clone(&o_conv);
7963 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7964 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
7965 return (uint64_t)ret_conv;
7968 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7969 LDKDecodeError e_conv;
7970 e_conv.inner = (void*)(e & (~1));
7971 e_conv.is_owned = (e & 1) || (e == 0);
7972 e_conv = DecodeError_clone(&e_conv);
7973 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7974 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
7975 return (uint64_t)ret_conv;
7978 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7979 if ((_res & 1) != 0) return;
7980 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7981 CHECK_ACCESS(_res_ptr);
7982 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
7984 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
7987 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7988 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
7989 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7990 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
7991 return (uint64_t)ret_conv;
7994 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
7995 LDKTrustedCommitmentTransaction o_conv;
7996 o_conv.inner = (void*)(o & (~1));
7997 o_conv.is_owned = (o & 1) || (o == 0);
7998 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
7999 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
8000 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
8001 return (uint64_t)ret_conv;
8004 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
8005 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
8006 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
8007 return (uint64_t)ret_conv;
8010 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
8011 if ((_res & 1) != 0) return;
8012 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8013 CHECK_ACCESS(_res_ptr);
8014 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
8016 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
8019 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
8020 LDKCVec_SignatureZ o_constr;
8021 o_constr.datalen = *((uint32_t*)o);
8022 if (o_constr.datalen > 0)
8023 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8025 o_constr.data = NULL;
8026 int8_tArray* o_vals = (int8_tArray*)(o + 4);
8027 for (size_t m = 0; m < o_constr.datalen; m++) {
8028 int8_tArray o_conv_12 = o_vals[m];
8029 LDKSignature o_conv_12_ref;
8030 CHECK(*((uint32_t*)o_conv_12) == 64);
8031 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
8032 o_constr.data[m] = o_conv_12_ref;
8034 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8035 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
8036 return (uint64_t)ret_conv;
8039 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
8040 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8041 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
8042 return (uint64_t)ret_conv;
8045 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
8046 if ((_res & 1) != 0) return;
8047 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8048 CHECK_ACCESS(_res_ptr);
8049 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
8051 CResult_CVec_SignatureZNoneZ_free(_res_conv);
8054 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
8055 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
8056 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8057 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
8058 return (uint64_t)ret_conv;
8061 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
8062 LDKShutdownScript o_conv;
8063 o_conv.inner = (void*)(o & (~1));
8064 o_conv.is_owned = (o & 1) || (o == 0);
8065 o_conv = ShutdownScript_clone(&o_conv);
8066 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8067 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
8068 return (uint64_t)ret_conv;
8071 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
8072 LDKDecodeError e_conv;
8073 e_conv.inner = (void*)(e & (~1));
8074 e_conv.is_owned = (e & 1) || (e == 0);
8075 e_conv = DecodeError_clone(&e_conv);
8076 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8077 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
8078 return (uint64_t)ret_conv;
8081 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
8082 if ((_res & 1) != 0) return;
8083 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8084 CHECK_ACCESS(_res_ptr);
8085 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
8087 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
8090 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
8091 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
8092 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8093 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
8094 return (uint64_t)ret_conv;
8097 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
8098 LDKShutdownScript o_conv;
8099 o_conv.inner = (void*)(o & (~1));
8100 o_conv.is_owned = (o & 1) || (o == 0);
8101 o_conv = ShutdownScript_clone(&o_conv);
8102 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8103 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
8104 return (uint64_t)ret_conv;
8107 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
8108 LDKInvalidShutdownScript e_conv;
8109 e_conv.inner = (void*)(e & (~1));
8110 e_conv.is_owned = (e & 1) || (e == 0);
8111 e_conv = InvalidShutdownScript_clone(&e_conv);
8112 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8113 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
8114 return (uint64_t)ret_conv;
8117 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
8118 if ((_res & 1) != 0) return;
8119 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8120 CHECK_ACCESS(_res_ptr);
8121 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
8123 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
8126 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint32_t orig) {
8127 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
8128 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8129 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
8130 return (uint64_t)ret_conv;
8133 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
8134 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8135 *ret_conv = CResult_NoneErrorZ_ok();
8136 return (uint64_t)ret_conv;
8139 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
8140 LDKIOError e_conv = LDKIOError_from_js(e);
8141 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8142 *ret_conv = CResult_NoneErrorZ_err(e_conv);
8143 return (uint64_t)ret_conv;
8146 void __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
8147 if ((_res & 1) != 0) return;
8148 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8149 CHECK_ACCESS(_res_ptr);
8150 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
8152 CResult_NoneErrorZ_free(_res_conv);
8155 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
8156 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
8157 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8158 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
8159 return (uint64_t)ret_conv;
8162 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
8164 o_conv.inner = (void*)(o & (~1));
8165 o_conv.is_owned = (o & 1) || (o == 0);
8166 o_conv = RouteHop_clone(&o_conv);
8167 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8168 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
8169 return (uint64_t)ret_conv;
8172 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
8173 LDKDecodeError e_conv;
8174 e_conv.inner = (void*)(e & (~1));
8175 e_conv.is_owned = (e & 1) || (e == 0);
8176 e_conv = DecodeError_clone(&e_conv);
8177 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8178 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
8179 return (uint64_t)ret_conv;
8182 void __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
8183 if ((_res & 1) != 0) return;
8184 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8185 CHECK_ACCESS(_res_ptr);
8186 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
8188 CResult_RouteHopDecodeErrorZ_free(_res_conv);
8191 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
8192 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
8193 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8194 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
8195 return (uint64_t)ret_conv;
8198 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
8199 LDKCVec_RouteHopZ _res_constr;
8200 _res_constr.datalen = *((uint32_t*)_res);
8201 if (_res_constr.datalen > 0)
8202 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8204 _res_constr.data = NULL;
8205 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8206 for (size_t k = 0; k < _res_constr.datalen; k++) {
8207 uint32_t _res_conv_10 = _res_vals[k];
8208 LDKRouteHop _res_conv_10_conv;
8209 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
8210 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
8211 _res_constr.data[k] = _res_conv_10_conv;
8213 CVec_RouteHopZ_free(_res_constr);
8216 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
8217 LDKCVec_CVec_RouteHopZZ _res_constr;
8218 _res_constr.datalen = *((uint32_t*)_res);
8219 if (_res_constr.datalen > 0)
8220 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
8222 _res_constr.data = NULL;
8223 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
8224 for (size_t m = 0; m < _res_constr.datalen; m++) {
8225 uint32_tArray _res_conv_12 = _res_vals[m];
8226 LDKCVec_RouteHopZ _res_conv_12_constr;
8227 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
8228 if (_res_conv_12_constr.datalen > 0)
8229 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8231 _res_conv_12_constr.data = NULL;
8232 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
8233 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
8234 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
8235 LDKRouteHop _res_conv_12_conv_10_conv;
8236 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
8237 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
8238 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
8240 _res_constr.data[m] = _res_conv_12_constr;
8242 CVec_CVec_RouteHopZZ_free(_res_constr);
8245 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
8247 o_conv.inner = (void*)(o & (~1));
8248 o_conv.is_owned = (o & 1) || (o == 0);
8249 o_conv = Route_clone(&o_conv);
8250 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8251 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
8252 return (uint64_t)ret_conv;
8255 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
8256 LDKDecodeError e_conv;
8257 e_conv.inner = (void*)(e & (~1));
8258 e_conv.is_owned = (e & 1) || (e == 0);
8259 e_conv = DecodeError_clone(&e_conv);
8260 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8261 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
8262 return (uint64_t)ret_conv;
8265 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
8266 if ((_res & 1) != 0) return;
8267 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8268 CHECK_ACCESS(_res_ptr);
8269 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
8271 CResult_RouteDecodeErrorZ_free(_res_conv);
8274 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
8275 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
8276 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8277 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
8278 return (uint64_t)ret_conv;
8281 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
8282 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
8283 *ret_copy = COption_u64Z_some(o);
8284 uint64_t ret_ref = (uint64_t)ret_copy;
8288 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
8289 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
8290 *ret_copy = COption_u64Z_none();
8291 uint64_t ret_ref = (uint64_t)ret_copy;
8295 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
8296 if ((_res & 1) != 0) return;
8297 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8298 CHECK_ACCESS(_res_ptr);
8299 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
8301 COption_u64Z_free(_res_conv);
8304 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
8305 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
8306 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
8307 *ret_copy = COption_u64Z_clone(orig_conv);
8308 uint64_t ret_ref = (uint64_t)ret_copy;
8312 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
8313 LDKCVec_ChannelDetailsZ _res_constr;
8314 _res_constr.datalen = *((uint32_t*)_res);
8315 if (_res_constr.datalen > 0)
8316 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8318 _res_constr.data = NULL;
8319 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8320 for (size_t q = 0; q < _res_constr.datalen; q++) {
8321 uint32_t _res_conv_16 = _res_vals[q];
8322 LDKChannelDetails _res_conv_16_conv;
8323 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8324 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8325 _res_constr.data[q] = _res_conv_16_conv;
8327 CVec_ChannelDetailsZ_free(_res_constr);
8330 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
8331 LDKCVec_RouteHintZ _res_constr;
8332 _res_constr.datalen = *((uint32_t*)_res);
8333 if (_res_constr.datalen > 0)
8334 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
8336 _res_constr.data = NULL;
8337 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8338 for (size_t l = 0; l < _res_constr.datalen; l++) {
8339 uint32_t _res_conv_11 = _res_vals[l];
8340 LDKRouteHint _res_conv_11_conv;
8341 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
8342 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
8343 _res_constr.data[l] = _res_conv_11_conv;
8345 CVec_RouteHintZ_free(_res_constr);
8348 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
8350 o_conv.inner = (void*)(o & (~1));
8351 o_conv.is_owned = (o & 1) || (o == 0);
8352 o_conv = Route_clone(&o_conv);
8353 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8354 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
8355 return (uint64_t)ret_conv;
8358 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
8359 LDKLightningError e_conv;
8360 e_conv.inner = (void*)(e & (~1));
8361 e_conv.is_owned = (e & 1) || (e == 0);
8362 e_conv = LightningError_clone(&e_conv);
8363 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8364 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
8365 return (uint64_t)ret_conv;
8368 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
8369 if ((_res & 1) != 0) return;
8370 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8371 CHECK_ACCESS(_res_ptr);
8372 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
8374 CResult_RouteLightningErrorZ_free(_res_conv);
8377 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
8378 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
8379 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8380 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
8381 return (uint64_t)ret_conv;
8384 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
8385 void* o_ptr = (void*)(((uint64_t)o) & ~1);
8386 CHECK_ACCESS(o_ptr);
8387 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
8388 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
8389 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8390 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
8391 return (uint64_t)ret_conv;
8394 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
8395 LDKAccessError e_conv = LDKAccessError_from_js(e);
8396 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8397 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
8398 return (uint64_t)ret_conv;
8401 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
8402 if ((_res & 1) != 0) return;
8403 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8404 CHECK_ACCESS(_res_ptr);
8405 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
8407 CResult_TxOutAccessErrorZ_free(_res_conv);
8410 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
8411 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
8412 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8413 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
8414 return (uint64_t)ret_conv;
8417 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
8418 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
8419 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8420 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
8421 return ((uint64_t)ret_conv);
8424 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
8425 LDKTransaction b_ref;
8426 b_ref.datalen = *((uint32_t*)b);
8427 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
8428 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
8429 b_ref.data_is_owned = true;
8430 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8431 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
8432 return ((uint64_t)ret_conv);
8435 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
8436 if ((_res & 1) != 0) return;
8437 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8438 CHECK_ACCESS(_res_ptr);
8439 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
8441 C2Tuple_usizeTransactionZ_free(_res_conv);
8444 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
8445 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
8446 _res_constr.datalen = *((uint32_t*)_res);
8447 if (_res_constr.datalen > 0)
8448 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8450 _res_constr.data = NULL;
8451 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8452 for (size_t c = 0; c < _res_constr.datalen; c++) {
8453 uint32_t _res_conv_28 = _res_vals[c];
8454 void* _res_conv_28_ptr = (void*)(((uint64_t)_res_conv_28) & ~1);
8455 CHECK_ACCESS(_res_conv_28_ptr);
8456 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
8457 FREE((void*)_res_conv_28);
8458 _res_constr.data[c] = _res_conv_28_conv;
8460 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
8463 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
8464 LDKCVec_TxidZ _res_constr;
8465 _res_constr.datalen = *((uint32_t*)_res);
8466 if (_res_constr.datalen > 0)
8467 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8469 _res_constr.data = NULL;
8470 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
8471 for (size_t m = 0; m < _res_constr.datalen; m++) {
8472 int8_tArray _res_conv_12 = _res_vals[m];
8473 LDKThirtyTwoBytes _res_conv_12_ref;
8474 CHECK(*((uint32_t*)_res_conv_12) == 32);
8475 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), 32);
8476 _res_constr.data[m] = _res_conv_12_ref;
8478 CVec_TxidZ_free(_res_constr);
8481 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
8482 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8483 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
8484 return (uint64_t)ret_conv;
8487 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
8488 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
8489 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8490 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
8491 return (uint64_t)ret_conv;
8494 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
8495 if ((_res & 1) != 0) return;
8496 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8497 CHECK_ACCESS(_res_ptr);
8498 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
8500 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
8503 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
8504 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
8505 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8506 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
8507 return (uint64_t)ret_conv;
8510 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
8511 LDKCVec_MonitorEventZ _res_constr;
8512 _res_constr.datalen = *((uint32_t*)_res);
8513 if (_res_constr.datalen > 0)
8514 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
8516 _res_constr.data = NULL;
8517 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8518 for (size_t o = 0; o < _res_constr.datalen; o++) {
8519 uint32_t _res_conv_14 = _res_vals[o];
8520 void* _res_conv_14_ptr = (void*)(((uint64_t)_res_conv_14) & ~1);
8521 CHECK_ACCESS(_res_conv_14_ptr);
8522 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
8523 FREE((void*)_res_conv_14);
8524 _res_constr.data[o] = _res_conv_14_conv;
8526 CVec_MonitorEventZ_free(_res_constr);
8529 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
8530 void* o_ptr = (void*)(((uint64_t)o) & ~1);
8531 CHECK_ACCESS(o_ptr);
8532 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
8533 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
8534 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8535 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
8536 uint64_t ret_ref = (uint64_t)ret_copy;
8540 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
8541 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8542 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
8543 uint64_t ret_ref = (uint64_t)ret_copy;
8547 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
8548 if ((_res & 1) != 0) return;
8549 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8550 CHECK_ACCESS(_res_ptr);
8551 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
8553 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
8556 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
8557 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
8558 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8559 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
8560 uint64_t ret_ref = (uint64_t)ret_copy;
8564 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
8565 void* o_ptr = (void*)(((uint64_t)o) & ~1);
8566 CHECK_ACCESS(o_ptr);
8567 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
8568 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
8569 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8570 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
8571 uint64_t ret_ref = (uint64_t)ret_copy;
8575 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_none() {
8576 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8577 *ret_copy = COption_NetworkUpdateZ_none();
8578 uint64_t ret_ref = (uint64_t)ret_copy;
8582 void __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
8583 if ((_res & 1) != 0) return;
8584 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8585 CHECK_ACCESS(_res_ptr);
8586 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
8588 COption_NetworkUpdateZ_free(_res_conv);
8591 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
8592 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
8593 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8594 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
8595 uint64_t ret_ref = (uint64_t)ret_copy;
8599 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
8600 LDKCVec_SpendableOutputDescriptorZ _res_constr;
8601 _res_constr.datalen = *((uint32_t*)_res);
8602 if (_res_constr.datalen > 0)
8603 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
8605 _res_constr.data = NULL;
8606 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8607 for (size_t b = 0; b < _res_constr.datalen; b++) {
8608 uint32_t _res_conv_27 = _res_vals[b];
8609 void* _res_conv_27_ptr = (void*)(((uint64_t)_res_conv_27) & ~1);
8610 CHECK_ACCESS(_res_conv_27_ptr);
8611 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
8612 FREE((void*)_res_conv_27);
8613 _res_constr.data[b] = _res_conv_27_conv;
8615 CVec_SpendableOutputDescriptorZ_free(_res_constr);
8618 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
8619 LDKCVec_MessageSendEventZ _res_constr;
8620 _res_constr.datalen = *((uint32_t*)_res);
8621 if (_res_constr.datalen > 0)
8622 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
8624 _res_constr.data = NULL;
8625 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8626 for (size_t s = 0; s < _res_constr.datalen; s++) {
8627 uint32_t _res_conv_18 = _res_vals[s];
8628 void* _res_conv_18_ptr = (void*)(((uint64_t)_res_conv_18) & ~1);
8629 CHECK_ACCESS(_res_conv_18_ptr);
8630 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
8631 FREE((void*)_res_conv_18);
8632 _res_constr.data[s] = _res_conv_18_conv;
8634 CVec_MessageSendEventZ_free(_res_constr);
8637 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
8638 LDKInitFeatures o_conv;
8639 o_conv.inner = (void*)(o & (~1));
8640 o_conv.is_owned = (o & 1) || (o == 0);
8641 o_conv = InitFeatures_clone(&o_conv);
8642 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
8643 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
8644 return (uint64_t)ret_conv;
8647 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
8648 LDKDecodeError e_conv;
8649 e_conv.inner = (void*)(e & (~1));
8650 e_conv.is_owned = (e & 1) || (e == 0);
8651 e_conv = DecodeError_clone(&e_conv);
8652 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
8653 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
8654 return (uint64_t)ret_conv;
8657 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
8658 if ((_res & 1) != 0) return;
8659 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8660 CHECK_ACCESS(_res_ptr);
8661 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
8663 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
8666 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
8667 LDKNodeFeatures o_conv;
8668 o_conv.inner = (void*)(o & (~1));
8669 o_conv.is_owned = (o & 1) || (o == 0);
8670 o_conv = NodeFeatures_clone(&o_conv);
8671 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
8672 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
8673 return (uint64_t)ret_conv;
8676 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
8677 LDKDecodeError e_conv;
8678 e_conv.inner = (void*)(e & (~1));
8679 e_conv.is_owned = (e & 1) || (e == 0);
8680 e_conv = DecodeError_clone(&e_conv);
8681 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
8682 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
8683 return (uint64_t)ret_conv;
8686 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
8687 if ((_res & 1) != 0) return;
8688 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8689 CHECK_ACCESS(_res_ptr);
8690 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
8692 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
8695 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
8696 LDKChannelFeatures o_conv;
8697 o_conv.inner = (void*)(o & (~1));
8698 o_conv.is_owned = (o & 1) || (o == 0);
8699 o_conv = ChannelFeatures_clone(&o_conv);
8700 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
8701 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
8702 return (uint64_t)ret_conv;
8705 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
8706 LDKDecodeError e_conv;
8707 e_conv.inner = (void*)(e & (~1));
8708 e_conv.is_owned = (e & 1) || (e == 0);
8709 e_conv = DecodeError_clone(&e_conv);
8710 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
8711 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
8712 return (uint64_t)ret_conv;
8715 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
8716 if ((_res & 1) != 0) return;
8717 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8718 CHECK_ACCESS(_res_ptr);
8719 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
8721 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
8724 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
8725 LDKInvoiceFeatures o_conv;
8726 o_conv.inner = (void*)(o & (~1));
8727 o_conv.is_owned = (o & 1) || (o == 0);
8728 o_conv = InvoiceFeatures_clone(&o_conv);
8729 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
8730 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
8731 return (uint64_t)ret_conv;
8734 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
8735 LDKDecodeError e_conv;
8736 e_conv.inner = (void*)(e & (~1));
8737 e_conv.is_owned = (e & 1) || (e == 0);
8738 e_conv = DecodeError_clone(&e_conv);
8739 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
8740 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
8741 return (uint64_t)ret_conv;
8744 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
8745 if ((_res & 1) != 0) return;
8746 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8747 CHECK_ACCESS(_res_ptr);
8748 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
8750 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
8753 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8754 LDKDelayedPaymentOutputDescriptor o_conv;
8755 o_conv.inner = (void*)(o & (~1));
8756 o_conv.is_owned = (o & 1) || (o == 0);
8757 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
8758 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8759 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
8760 return (uint64_t)ret_conv;
8763 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8764 LDKDecodeError e_conv;
8765 e_conv.inner = (void*)(e & (~1));
8766 e_conv.is_owned = (e & 1) || (e == 0);
8767 e_conv = DecodeError_clone(&e_conv);
8768 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8769 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
8770 return (uint64_t)ret_conv;
8773 void __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8774 if ((_res & 1) != 0) return;
8775 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8776 CHECK_ACCESS(_res_ptr);
8777 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
8779 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
8782 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8783 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
8784 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8785 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
8786 return (uint64_t)ret_conv;
8789 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8790 LDKStaticPaymentOutputDescriptor o_conv;
8791 o_conv.inner = (void*)(o & (~1));
8792 o_conv.is_owned = (o & 1) || (o == 0);
8793 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
8794 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8795 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
8796 return (uint64_t)ret_conv;
8799 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8800 LDKDecodeError e_conv;
8801 e_conv.inner = (void*)(e & (~1));
8802 e_conv.is_owned = (e & 1) || (e == 0);
8803 e_conv = DecodeError_clone(&e_conv);
8804 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8805 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
8806 return (uint64_t)ret_conv;
8809 void __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8810 if ((_res & 1) != 0) return;
8811 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8812 CHECK_ACCESS(_res_ptr);
8813 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
8815 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
8818 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8819 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
8820 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8821 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
8822 return (uint64_t)ret_conv;
8825 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8826 void* o_ptr = (void*)(((uint64_t)o) & ~1);
8827 CHECK_ACCESS(o_ptr);
8828 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
8829 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
8830 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8831 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
8832 return (uint64_t)ret_conv;
8835 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8836 LDKDecodeError e_conv;
8837 e_conv.inner = (void*)(e & (~1));
8838 e_conv.is_owned = (e & 1) || (e == 0);
8839 e_conv = DecodeError_clone(&e_conv);
8840 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8841 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
8842 return (uint64_t)ret_conv;
8845 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8846 if ((_res & 1) != 0) return;
8847 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8848 CHECK_ACCESS(_res_ptr);
8849 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
8851 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
8854 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8855 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
8856 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8857 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
8858 return (uint64_t)ret_conv;
8861 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_ok() {
8862 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8863 *ret_conv = CResult_NoneNoneZ_ok();
8864 return (uint64_t)ret_conv;
8867 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_err() {
8868 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8869 *ret_conv = CResult_NoneNoneZ_err();
8870 return (uint64_t)ret_conv;
8873 void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
8874 if ((_res & 1) != 0) return;
8875 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8876 CHECK_ACCESS(_res_ptr);
8877 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
8879 CResult_NoneNoneZ_free(_res_conv);
8882 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
8883 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
8884 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8885 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
8886 return (uint64_t)ret_conv;
8889 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
8890 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
8891 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8892 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
8893 return ((uint64_t)ret_conv);
8896 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
8898 CHECK(*((uint32_t*)a) == 64);
8899 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
8900 LDKCVec_SignatureZ b_constr;
8901 b_constr.datalen = *((uint32_t*)b);
8902 if (b_constr.datalen > 0)
8903 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8905 b_constr.data = NULL;
8906 int8_tArray* b_vals = (int8_tArray*)(b + 4);
8907 for (size_t m = 0; m < b_constr.datalen; m++) {
8908 int8_tArray b_conv_12 = b_vals[m];
8909 LDKSignature b_conv_12_ref;
8910 CHECK(*((uint32_t*)b_conv_12) == 64);
8911 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
8912 b_constr.data[m] = b_conv_12_ref;
8914 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8915 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
8916 return ((uint64_t)ret_conv);
8919 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
8920 if ((_res & 1) != 0) return;
8921 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8922 CHECK_ACCESS(_res_ptr);
8923 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
8925 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
8928 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
8929 void* o_ptr = (void*)(((uint64_t)o) & ~1);
8930 CHECK_ACCESS(o_ptr);
8931 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
8932 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
8933 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8934 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
8935 return (uint64_t)ret_conv;
8938 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
8939 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8940 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
8941 return (uint64_t)ret_conv;
8944 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
8945 if ((_res & 1) != 0) return;
8946 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8947 CHECK_ACCESS(_res_ptr);
8948 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
8950 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
8953 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
8954 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
8955 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8956 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
8957 return (uint64_t)ret_conv;
8960 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
8962 CHECK(*((uint32_t*)o) == 64);
8963 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
8964 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8965 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
8966 return (uint64_t)ret_conv;
8969 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
8970 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8971 *ret_conv = CResult_SignatureNoneZ_err();
8972 return (uint64_t)ret_conv;
8975 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
8976 if ((_res & 1) != 0) return;
8977 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8978 CHECK_ACCESS(_res_ptr);
8979 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
8981 CResult_SignatureNoneZ_free(_res_conv);
8984 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
8985 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
8986 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8987 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
8988 return (uint64_t)ret_conv;
8991 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
8992 void* o_ptr = (void*)(((uint64_t)o) & ~1);
8993 CHECK_ACCESS(o_ptr);
8994 LDKSign o_conv = *(LDKSign*)(o_ptr);
8995 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8996 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
8997 return (uint64_t)ret_conv;
9000 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
9001 LDKDecodeError e_conv;
9002 e_conv.inner = (void*)(e & (~1));
9003 e_conv.is_owned = (e & 1) || (e == 0);
9004 e_conv = DecodeError_clone(&e_conv);
9005 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
9006 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
9007 return (uint64_t)ret_conv;
9010 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
9011 if ((_res & 1) != 0) return;
9012 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9013 CHECK_ACCESS(_res_ptr);
9014 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
9016 CResult_SignDecodeErrorZ_free(_res_conv);
9019 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
9020 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
9021 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
9022 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
9023 return (uint64_t)ret_conv;
9026 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
9027 LDKCVec_u8Z _res_ref;
9028 _res_ref.datalen = *((uint32_t*)_res);
9029 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
9030 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
9031 CVec_u8Z_free(_res_ref);
9034 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray arg) {
9035 LDKRecoverableSignature arg_ref;
9036 CHECK(*((uint32_t*)arg) == 68);
9037 memcpy(arg_ref.serialized_form, (uint8_t*)(arg + 4), 68);
9038 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9039 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
9040 return (uint64_t)ret_conv;
9043 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_err() {
9044 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9045 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
9046 return (uint64_t)ret_conv;
9049 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
9050 if ((_res & 1) != 0) return;
9051 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9052 CHECK_ACCESS(_res_ptr);
9053 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
9055 CResult_RecoverableSignatureNoneZ_free(_res_conv);
9058 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
9059 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
9060 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9061 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
9062 return (uint64_t)ret_conv;
9065 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
9066 LDKCVec_CVec_u8ZZ _res_constr;
9067 _res_constr.datalen = *((uint32_t*)_res);
9068 if (_res_constr.datalen > 0)
9069 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
9071 _res_constr.data = NULL;
9072 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
9073 for (size_t m = 0; m < _res_constr.datalen; m++) {
9074 int8_tArray _res_conv_12 = _res_vals[m];
9075 LDKCVec_u8Z _res_conv_12_ref;
9076 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
9077 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
9078 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
9079 _res_constr.data[m] = _res_conv_12_ref;
9081 CVec_CVec_u8ZZ_free(_res_constr);
9084 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
9085 LDKCVec_CVec_u8ZZ o_constr;
9086 o_constr.datalen = *((uint32_t*)o);
9087 if (o_constr.datalen > 0)
9088 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
9090 o_constr.data = NULL;
9091 int8_tArray* o_vals = (int8_tArray*)(o + 4);
9092 for (size_t m = 0; m < o_constr.datalen; m++) {
9093 int8_tArray o_conv_12 = o_vals[m];
9094 LDKCVec_u8Z o_conv_12_ref;
9095 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
9096 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
9097 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
9098 o_constr.data[m] = o_conv_12_ref;
9100 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9101 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
9102 return (uint64_t)ret_conv;
9105 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
9106 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9107 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
9108 return (uint64_t)ret_conv;
9111 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
9112 if ((_res & 1) != 0) return;
9113 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9114 CHECK_ACCESS(_res_ptr);
9115 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
9117 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
9120 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
9121 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
9122 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9123 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
9124 return (uint64_t)ret_conv;
9127 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
9128 LDKInMemorySigner o_conv;
9129 o_conv.inner = (void*)(o & (~1));
9130 o_conv.is_owned = (o & 1) || (o == 0);
9131 o_conv = InMemorySigner_clone(&o_conv);
9132 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9133 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
9134 return (uint64_t)ret_conv;
9137 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
9138 LDKDecodeError e_conv;
9139 e_conv.inner = (void*)(e & (~1));
9140 e_conv.is_owned = (e & 1) || (e == 0);
9141 e_conv = DecodeError_clone(&e_conv);
9142 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9143 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
9144 return (uint64_t)ret_conv;
9147 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
9148 if ((_res & 1) != 0) return;
9149 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9150 CHECK_ACCESS(_res_ptr);
9151 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
9153 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
9156 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
9157 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
9158 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9159 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
9160 return (uint64_t)ret_conv;
9163 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
9164 LDKCVec_TxOutZ _res_constr;
9165 _res_constr.datalen = *((uint32_t*)_res);
9166 if (_res_constr.datalen > 0)
9167 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
9169 _res_constr.data = NULL;
9170 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9171 for (size_t h = 0; h < _res_constr.datalen; h++) {
9172 uint32_t _res_conv_7 = _res_vals[h];
9173 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
9174 CHECK_ACCESS(_res_conv_7_ptr);
9175 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
9176 FREE((void*)_res_conv_7);
9177 _res_constr.data[h] = _res_conv_7_conv;
9179 CVec_TxOutZ_free(_res_constr);
9182 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
9183 LDKTransaction o_ref;
9184 o_ref.datalen = *((uint32_t*)o);
9185 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
9186 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
9187 o_ref.data_is_owned = true;
9188 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
9189 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
9190 return (uint64_t)ret_conv;
9193 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
9194 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
9195 *ret_conv = CResult_TransactionNoneZ_err();
9196 return (uint64_t)ret_conv;
9199 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
9200 if ((_res & 1) != 0) return;
9201 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9202 CHECK_ACCESS(_res_ptr);
9203 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
9205 CResult_TransactionNoneZ_free(_res_conv);
9208 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
9209 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
9210 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
9211 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
9212 return (uint64_t)ret_conv;
9215 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
9216 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
9217 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
9218 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
9219 return ((uint64_t)ret_conv);
9222 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
9223 LDKThirtyTwoBytes a_ref;
9224 CHECK(*((uint32_t*)a) == 32);
9225 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9226 LDKChannelMonitor b_conv;
9227 b_conv.inner = (void*)(b & (~1));
9228 b_conv.is_owned = (b & 1) || (b == 0);
9229 b_conv = ChannelMonitor_clone(&b_conv);
9230 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
9231 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
9232 return ((uint64_t)ret_conv);
9235 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
9236 if ((_res & 1) != 0) return;
9237 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9238 CHECK_ACCESS(_res_ptr);
9239 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
9241 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
9244 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_BlockHashChannelMonitorZZ_free(uint32_tArray _res) {
9245 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
9246 _res_constr.datalen = *((uint32_t*)_res);
9247 if (_res_constr.datalen > 0)
9248 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
9250 _res_constr.data = NULL;
9251 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9252 for (size_t j = 0; j < _res_constr.datalen; j++) {
9253 uint32_t _res_conv_35 = _res_vals[j];
9254 void* _res_conv_35_ptr = (void*)(((uint64_t)_res_conv_35) & ~1);
9255 CHECK_ACCESS(_res_conv_35_ptr);
9256 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
9257 FREE((void*)_res_conv_35);
9258 _res_constr.data[j] = _res_conv_35_conv;
9260 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
9263 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(uint32_tArray o) {
9264 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
9265 o_constr.datalen = *((uint32_t*)o);
9266 if (o_constr.datalen > 0)
9267 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
9269 o_constr.data = NULL;
9270 uint32_t* o_vals = (uint32_t*)(o + 4);
9271 for (size_t j = 0; j < o_constr.datalen; j++) {
9272 uint32_t o_conv_35 = o_vals[j];
9273 void* o_conv_35_ptr = (void*)(((uint64_t)o_conv_35) & ~1);
9274 CHECK_ACCESS(o_conv_35_ptr);
9275 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
9276 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1));
9277 o_constr.data[j] = o_conv_35_conv;
9279 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
9280 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
9281 return (uint64_t)ret_conv;
9284 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(uint32_t e) {
9285 LDKIOError e_conv = LDKIOError_from_js(e);
9286 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
9287 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
9288 return (uint64_t)ret_conv;
9291 void __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(uint32_t _res) {
9292 if ((_res & 1) != 0) return;
9293 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9294 CHECK_ACCESS(_res_ptr);
9295 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
9297 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
9300 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(uint32_t orig) {
9301 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
9302 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
9303 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
9304 return (uint64_t)ret_conv;
9307 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_ok(uint32_t o) {
9308 LDKPaymentId o_conv;
9309 o_conv.inner = (void*)(o & (~1));
9310 o_conv.is_owned = (o & 1) || (o == 0);
9311 o_conv = PaymentId_clone(&o_conv);
9312 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
9313 *ret_conv = CResult_PaymentIdDecodeErrorZ_ok(o_conv);
9314 return (uint64_t)ret_conv;
9317 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_err(uint32_t e) {
9318 LDKDecodeError e_conv;
9319 e_conv.inner = (void*)(e & (~1));
9320 e_conv.is_owned = (e & 1) || (e == 0);
9321 e_conv = DecodeError_clone(&e_conv);
9322 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
9323 *ret_conv = CResult_PaymentIdDecodeErrorZ_err(e_conv);
9324 return (uint64_t)ret_conv;
9327 void __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_free(uint32_t _res) {
9328 if ((_res & 1) != 0) return;
9329 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9330 CHECK_ACCESS(_res_ptr);
9331 LDKCResult_PaymentIdDecodeErrorZ _res_conv = *(LDKCResult_PaymentIdDecodeErrorZ*)(_res_ptr);
9333 CResult_PaymentIdDecodeErrorZ_free(_res_conv);
9336 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_clone(uint32_t orig) {
9337 LDKCResult_PaymentIdDecodeErrorZ* orig_conv = (LDKCResult_PaymentIdDecodeErrorZ*)(orig & ~1);
9338 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
9339 *ret_conv = CResult_PaymentIdDecodeErrorZ_clone(orig_conv);
9340 return (uint64_t)ret_conv;
9343 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) {
9344 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
9345 *ret_copy = COption_u16Z_some(o);
9346 uint64_t ret_ref = (uint64_t)ret_copy;
9350 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_none() {
9351 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
9352 *ret_copy = COption_u16Z_none();
9353 uint64_t ret_ref = (uint64_t)ret_copy;
9357 void __attribute__((visibility("default"))) TS_COption_u16Z_free(uint32_t _res) {
9358 if ((_res & 1) != 0) return;
9359 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9360 CHECK_ACCESS(_res_ptr);
9361 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
9363 COption_u16Z_free(_res_conv);
9366 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_clone(uint32_t orig) {
9367 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
9368 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
9369 *ret_copy = COption_u16Z_clone(orig_conv);
9370 uint64_t ret_ref = (uint64_t)ret_copy;
9374 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
9375 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9376 *ret_conv = CResult_NoneAPIErrorZ_ok();
9377 return (uint64_t)ret_conv;
9380 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
9381 void* e_ptr = (void*)(((uint64_t)e) & ~1);
9382 CHECK_ACCESS(e_ptr);
9383 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
9384 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
9385 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9386 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
9387 return (uint64_t)ret_conv;
9390 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
9391 if ((_res & 1) != 0) return;
9392 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9393 CHECK_ACCESS(_res_ptr);
9394 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
9396 CResult_NoneAPIErrorZ_free(_res_conv);
9399 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
9400 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
9401 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9402 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
9403 return (uint64_t)ret_conv;
9406 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
9407 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
9408 _res_constr.datalen = *((uint32_t*)_res);
9409 if (_res_constr.datalen > 0)
9410 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
9412 _res_constr.data = NULL;
9413 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9414 for (size_t w = 0; w < _res_constr.datalen; w++) {
9415 uint32_t _res_conv_22 = _res_vals[w];
9416 void* _res_conv_22_ptr = (void*)(((uint64_t)_res_conv_22) & ~1);
9417 CHECK_ACCESS(_res_conv_22_ptr);
9418 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
9419 FREE((void*)_res_conv_22);
9420 _res_constr.data[w] = _res_conv_22_conv;
9422 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
9425 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
9426 LDKCVec_APIErrorZ _res_constr;
9427 _res_constr.datalen = *((uint32_t*)_res);
9428 if (_res_constr.datalen > 0)
9429 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
9431 _res_constr.data = NULL;
9432 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9433 for (size_t k = 0; k < _res_constr.datalen; k++) {
9434 uint32_t _res_conv_10 = _res_vals[k];
9435 void* _res_conv_10_ptr = (void*)(((uint64_t)_res_conv_10) & ~1);
9436 CHECK_ACCESS(_res_conv_10_ptr);
9437 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
9438 FREE((void*)_res_conv_10);
9439 _res_constr.data[k] = _res_conv_10_conv;
9441 CVec_APIErrorZ_free(_res_constr);
9444 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
9445 LDKThirtyTwoBytes o_ref;
9446 CHECK(*((uint32_t*)o) == 32);
9447 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
9448 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
9449 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
9450 return (uint64_t)ret_conv;
9453 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
9454 void* e_ptr = (void*)(((uint64_t)e) & ~1);
9455 CHECK_ACCESS(e_ptr);
9456 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
9457 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
9458 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
9459 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
9460 return (uint64_t)ret_conv;
9463 void __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) {
9464 if ((_res & 1) != 0) return;
9465 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9466 CHECK_ACCESS(_res_ptr);
9467 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
9469 CResult__u832APIErrorZ_free(_res_conv);
9472 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
9473 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
9474 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
9475 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
9476 return (uint64_t)ret_conv;
9479 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(uint32_t o) {
9480 LDKPaymentId o_conv;
9481 o_conv.inner = (void*)(o & (~1));
9482 o_conv.is_owned = (o & 1) || (o == 0);
9483 o_conv = PaymentId_clone(&o_conv);
9484 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
9485 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_conv);
9486 return (uint64_t)ret_conv;
9489 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
9490 void* e_ptr = (void*)(((uint64_t)e) & ~1);
9491 CHECK_ACCESS(e_ptr);
9492 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
9493 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
9494 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
9495 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
9496 return (uint64_t)ret_conv;
9499 void __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
9500 if ((_res & 1) != 0) return;
9501 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9502 CHECK_ACCESS(_res_ptr);
9503 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
9505 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
9508 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
9509 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
9510 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
9511 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
9512 return (uint64_t)ret_conv;
9515 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
9516 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9517 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
9518 return (uint64_t)ret_conv;
9521 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
9522 void* e_ptr = (void*)(((uint64_t)e) & ~1);
9523 CHECK_ACCESS(e_ptr);
9524 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
9525 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
9526 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9527 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
9528 return (uint64_t)ret_conv;
9531 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
9532 if ((_res & 1) != 0) return;
9533 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9534 CHECK_ACCESS(_res_ptr);
9535 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
9537 CResult_NonePaymentSendFailureZ_free(_res_conv);
9540 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
9541 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
9542 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9543 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
9544 return (uint64_t)ret_conv;
9547 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
9548 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
9549 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
9550 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
9551 return ((uint64_t)ret_conv);
9554 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, uint32_t b) {
9555 LDKThirtyTwoBytes a_ref;
9556 CHECK(*((uint32_t*)a) == 32);
9557 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9558 LDKPaymentId b_conv;
9559 b_conv.inner = (void*)(b & (~1));
9560 b_conv.is_owned = (b & 1) || (b == 0);
9561 b_conv = PaymentId_clone(&b_conv);
9562 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
9563 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_conv);
9564 return ((uint64_t)ret_conv);
9567 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
9568 if ((_res & 1) != 0) return;
9569 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9570 CHECK_ACCESS(_res_ptr);
9571 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
9573 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
9576 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
9577 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9578 CHECK_ACCESS(o_ptr);
9579 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
9580 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1));
9581 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
9582 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
9583 return (uint64_t)ret_conv;
9586 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
9587 void* e_ptr = (void*)(((uint64_t)e) & ~1);
9588 CHECK_ACCESS(e_ptr);
9589 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
9590 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
9591 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
9592 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
9593 return (uint64_t)ret_conv;
9596 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
9597 if ((_res & 1) != 0) return;
9598 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9599 CHECK_ACCESS(_res_ptr);
9600 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
9602 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
9605 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
9606 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
9607 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
9608 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
9609 return (uint64_t)ret_conv;
9612 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
9613 LDKCVec_NetAddressZ _res_constr;
9614 _res_constr.datalen = *((uint32_t*)_res);
9615 if (_res_constr.datalen > 0)
9616 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9618 _res_constr.data = NULL;
9619 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9620 for (size_t m = 0; m < _res_constr.datalen; m++) {
9621 uint32_t _res_conv_12 = _res_vals[m];
9622 void* _res_conv_12_ptr = (void*)(((uint64_t)_res_conv_12) & ~1);
9623 CHECK_ACCESS(_res_conv_12_ptr);
9624 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
9625 FREE((void*)_res_conv_12);
9626 _res_constr.data[m] = _res_conv_12_conv;
9628 CVec_NetAddressZ_free(_res_constr);
9631 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
9632 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
9633 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
9634 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
9635 return ((uint64_t)ret_conv);
9638 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
9639 LDKThirtyTwoBytes a_ref;
9640 CHECK(*((uint32_t*)a) == 32);
9641 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9642 LDKThirtyTwoBytes b_ref;
9643 CHECK(*((uint32_t*)b) == 32);
9644 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
9645 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
9646 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
9647 return ((uint64_t)ret_conv);
9650 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
9651 if ((_res & 1) != 0) return;
9652 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9653 CHECK_ACCESS(_res_ptr);
9654 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
9656 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
9659 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
9660 LDKThirtyTwoBytes o_ref;
9661 CHECK(*((uint32_t*)o) == 32);
9662 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
9663 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
9664 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
9665 return (uint64_t)ret_conv;
9668 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
9669 void* e_ptr = (void*)(((uint64_t)e) & ~1);
9670 CHECK_ACCESS(e_ptr);
9671 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
9672 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
9673 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
9674 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
9675 return (uint64_t)ret_conv;
9678 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
9679 if ((_res & 1) != 0) return;
9680 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9681 CHECK_ACCESS(_res_ptr);
9682 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
9684 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
9687 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
9688 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
9689 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
9690 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
9691 return (uint64_t)ret_conv;
9694 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
9695 LDKCVec_ChannelMonitorZ _res_constr;
9696 _res_constr.datalen = *((uint32_t*)_res);
9697 if (_res_constr.datalen > 0)
9698 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
9700 _res_constr.data = NULL;
9701 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9702 for (size_t q = 0; q < _res_constr.datalen; q++) {
9703 uint32_t _res_conv_16 = _res_vals[q];
9704 LDKChannelMonitor _res_conv_16_conv;
9705 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9706 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9707 _res_constr.data[q] = _res_conv_16_conv;
9709 CVec_ChannelMonitorZ_free(_res_constr);
9712 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
9713 LDKThirtyTwoBytes a_ref;
9714 CHECK(*((uint32_t*)a) == 32);
9715 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9716 LDKChannelManager b_conv;
9717 b_conv.inner = (void*)(b & (~1));
9718 b_conv.is_owned = (b & 1) || (b == 0);
9719 // Warning: we need a move here but no clone is available for LDKChannelManager
9720 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
9721 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
9722 return ((uint64_t)ret_conv);
9725 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
9726 if ((_res & 1) != 0) return;
9727 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9728 CHECK_ACCESS(_res_ptr);
9729 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
9731 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
9734 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
9735 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9736 CHECK_ACCESS(o_ptr);
9737 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
9738 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
9739 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9740 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
9741 return (uint64_t)ret_conv;
9744 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
9745 LDKDecodeError e_conv;
9746 e_conv.inner = (void*)(e & (~1));
9747 e_conv.is_owned = (e & 1) || (e == 0);
9748 e_conv = DecodeError_clone(&e_conv);
9749 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9750 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
9751 return (uint64_t)ret_conv;
9754 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
9755 if ((_res & 1) != 0) return;
9756 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9757 CHECK_ACCESS(_res_ptr);
9758 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
9760 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
9763 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
9764 LDKChannelConfig o_conv;
9765 o_conv.inner = (void*)(o & (~1));
9766 o_conv.is_owned = (o & 1) || (o == 0);
9767 o_conv = ChannelConfig_clone(&o_conv);
9768 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9769 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
9770 return (uint64_t)ret_conv;
9773 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
9774 LDKDecodeError e_conv;
9775 e_conv.inner = (void*)(e & (~1));
9776 e_conv.is_owned = (e & 1) || (e == 0);
9777 e_conv = DecodeError_clone(&e_conv);
9778 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9779 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
9780 return (uint64_t)ret_conv;
9783 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
9784 if ((_res & 1) != 0) return;
9785 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9786 CHECK_ACCESS(_res_ptr);
9787 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
9789 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
9792 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
9793 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
9794 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9795 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
9796 return (uint64_t)ret_conv;
9799 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
9801 o_conv.inner = (void*)(o & (~1));
9802 o_conv.is_owned = (o & 1) || (o == 0);
9803 o_conv = OutPoint_clone(&o_conv);
9804 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9805 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
9806 return (uint64_t)ret_conv;
9809 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
9810 LDKDecodeError e_conv;
9811 e_conv.inner = (void*)(e & (~1));
9812 e_conv.is_owned = (e & 1) || (e == 0);
9813 e_conv = DecodeError_clone(&e_conv);
9814 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9815 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
9816 return (uint64_t)ret_conv;
9819 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
9820 if ((_res & 1) != 0) return;
9821 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9822 CHECK_ACCESS(_res_ptr);
9823 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
9825 CResult_OutPointDecodeErrorZ_free(_res_conv);
9828 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
9829 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
9830 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9831 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
9832 return (uint64_t)ret_conv;
9835 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_some(uint32_t o) {
9836 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9837 CHECK_ACCESS(o_ptr);
9838 LDKType o_conv = *(LDKType*)(o_ptr);
9839 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9840 *ret_copy = COption_TypeZ_some(o_conv);
9841 uint64_t ret_ref = (uint64_t)ret_copy;
9845 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_none() {
9846 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9847 *ret_copy = COption_TypeZ_none();
9848 uint64_t ret_ref = (uint64_t)ret_copy;
9852 void __attribute__((visibility("default"))) TS_COption_TypeZ_free(uint32_t _res) {
9853 if ((_res & 1) != 0) return;
9854 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9855 CHECK_ACCESS(_res_ptr);
9856 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
9858 COption_TypeZ_free(_res_conv);
9861 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone(uint32_t orig) {
9862 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
9863 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9864 *ret_copy = COption_TypeZ_clone(orig_conv);
9865 uint64_t ret_ref = (uint64_t)ret_copy;
9869 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
9870 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9871 CHECK_ACCESS(o_ptr);
9872 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
9873 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
9874 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9875 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
9876 return (uint64_t)ret_conv;
9879 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
9880 LDKDecodeError e_conv;
9881 e_conv.inner = (void*)(e & (~1));
9882 e_conv.is_owned = (e & 1) || (e == 0);
9883 e_conv = DecodeError_clone(&e_conv);
9884 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9885 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
9886 return (uint64_t)ret_conv;
9889 void __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
9890 if ((_res & 1) != 0) return;
9891 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9892 CHECK_ACCESS(_res_ptr);
9893 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
9895 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
9898 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
9899 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
9900 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9901 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
9902 return (uint64_t)ret_conv;
9905 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
9906 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
9907 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9908 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
9909 return (uint64_t)ret_conv;
9912 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_err() {
9913 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9914 *ret_conv = CResult_SiPrefixNoneZ_err();
9915 return (uint64_t)ret_conv;
9918 void __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_free(uint32_t _res) {
9919 if ((_res & 1) != 0) return;
9920 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9921 CHECK_ACCESS(_res_ptr);
9922 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(_res_ptr);
9924 CResult_SiPrefixNoneZ_free(_res_conv);
9927 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_clone(uint32_t orig) {
9928 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
9929 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9930 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
9931 return (uint64_t)ret_conv;
9934 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_ok(uint32_t o) {
9936 o_conv.inner = (void*)(o & (~1));
9937 o_conv.is_owned = (o & 1) || (o == 0);
9938 o_conv = Invoice_clone(&o_conv);
9939 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9940 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
9941 return (uint64_t)ret_conv;
9944 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_err() {
9945 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9946 *ret_conv = CResult_InvoiceNoneZ_err();
9947 return (uint64_t)ret_conv;
9950 void __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_free(uint32_t _res) {
9951 if ((_res & 1) != 0) return;
9952 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9953 CHECK_ACCESS(_res_ptr);
9954 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(_res_ptr);
9956 CResult_InvoiceNoneZ_free(_res_conv);
9959 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_clone(uint32_t orig) {
9960 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
9961 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9962 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
9963 return (uint64_t)ret_conv;
9966 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_ok(uint32_t o) {
9967 LDKSignedRawInvoice o_conv;
9968 o_conv.inner = (void*)(o & (~1));
9969 o_conv.is_owned = (o & 1) || (o == 0);
9970 o_conv = SignedRawInvoice_clone(&o_conv);
9971 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9972 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
9973 return (uint64_t)ret_conv;
9976 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_err() {
9977 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9978 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
9979 return (uint64_t)ret_conv;
9982 void __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_free(uint32_t _res) {
9983 if ((_res & 1) != 0) return;
9984 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9985 CHECK_ACCESS(_res_ptr);
9986 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(_res_ptr);
9988 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
9991 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_clone(uint32_t orig) {
9992 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
9993 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9994 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
9995 return (uint64_t)ret_conv;
9998 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
9999 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
10000 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
10001 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
10002 return ((uint64_t)ret_conv);
10005 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
10006 LDKRawInvoice a_conv;
10007 a_conv.inner = (void*)(a & (~1));
10008 a_conv.is_owned = (a & 1) || (a == 0);
10009 a_conv = RawInvoice_clone(&a_conv);
10010 LDKThirtyTwoBytes b_ref;
10011 CHECK(*((uint32_t*)b) == 32);
10012 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
10013 LDKInvoiceSignature c_conv;
10014 c_conv.inner = (void*)(c & (~1));
10015 c_conv.is_owned = (c & 1) || (c == 0);
10016 c_conv = InvoiceSignature_clone(&c_conv);
10017 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
10018 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
10019 return ((uint64_t)ret_conv);
10022 void __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
10023 if ((_res & 1) != 0) return;
10024 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10025 CHECK_ACCESS(_res_ptr);
10026 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
10028 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
10031 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
10032 LDKPayeePubKey o_conv;
10033 o_conv.inner = (void*)(o & (~1));
10034 o_conv.is_owned = (o & 1) || (o == 0);
10035 o_conv = PayeePubKey_clone(&o_conv);
10036 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10037 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
10038 return (uint64_t)ret_conv;
10041 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
10042 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10043 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10044 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
10045 return (uint64_t)ret_conv;
10048 void __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
10049 if ((_res & 1) != 0) return;
10050 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10051 CHECK_ACCESS(_res_ptr);
10052 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
10054 CResult_PayeePubKeyErrorZ_free(_res_conv);
10057 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
10058 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
10059 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10060 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
10061 return (uint64_t)ret_conv;
10064 void __attribute__((visibility("default"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
10065 LDKCVec_PrivateRouteZ _res_constr;
10066 _res_constr.datalen = *((uint32_t*)_res);
10067 if (_res_constr.datalen > 0)
10068 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
10070 _res_constr.data = NULL;
10071 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10072 for (size_t o = 0; o < _res_constr.datalen; o++) {
10073 uint32_t _res_conv_14 = _res_vals[o];
10074 LDKPrivateRoute _res_conv_14_conv;
10075 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
10076 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
10077 _res_constr.data[o] = _res_conv_14_conv;
10079 CVec_PrivateRouteZ_free(_res_constr);
10082 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
10083 LDKPositiveTimestamp o_conv;
10084 o_conv.inner = (void*)(o & (~1));
10085 o_conv.is_owned = (o & 1) || (o == 0);
10086 o_conv = PositiveTimestamp_clone(&o_conv);
10087 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10088 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
10089 return (uint64_t)ret_conv;
10092 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
10093 LDKCreationError e_conv = LDKCreationError_from_js(e);
10094 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10095 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
10096 return (uint64_t)ret_conv;
10099 void __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
10100 if ((_res & 1) != 0) return;
10101 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10102 CHECK_ACCESS(_res_ptr);
10103 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
10105 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
10108 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
10109 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
10110 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10111 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
10112 return (uint64_t)ret_conv;
10115 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_ok() {
10116 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10117 *ret_conv = CResult_NoneSemanticErrorZ_ok();
10118 return (uint64_t)ret_conv;
10121 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
10122 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
10123 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10124 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
10125 return (uint64_t)ret_conv;
10128 void __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
10129 if ((_res & 1) != 0) return;
10130 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10131 CHECK_ACCESS(_res_ptr);
10132 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
10134 CResult_NoneSemanticErrorZ_free(_res_conv);
10137 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
10138 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
10139 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10140 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
10141 return (uint64_t)ret_conv;
10144 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
10146 o_conv.inner = (void*)(o & (~1));
10147 o_conv.is_owned = (o & 1) || (o == 0);
10148 o_conv = Invoice_clone(&o_conv);
10149 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10150 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
10151 return (uint64_t)ret_conv;
10154 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
10155 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
10156 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10157 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
10158 return (uint64_t)ret_conv;
10161 void __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
10162 if ((_res & 1) != 0) return;
10163 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10164 CHECK_ACCESS(_res_ptr);
10165 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
10167 CResult_InvoiceSemanticErrorZ_free(_res_conv);
10170 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
10171 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
10172 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10173 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
10174 return (uint64_t)ret_conv;
10177 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
10178 LDKDescription o_conv;
10179 o_conv.inner = (void*)(o & (~1));
10180 o_conv.is_owned = (o & 1) || (o == 0);
10181 o_conv = Description_clone(&o_conv);
10182 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10183 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
10184 return (uint64_t)ret_conv;
10187 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
10188 LDKCreationError e_conv = LDKCreationError_from_js(e);
10189 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10190 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
10191 return (uint64_t)ret_conv;
10194 void __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
10195 if ((_res & 1) != 0) return;
10196 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10197 CHECK_ACCESS(_res_ptr);
10198 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
10200 CResult_DescriptionCreationErrorZ_free(_res_conv);
10203 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
10204 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
10205 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10206 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
10207 return (uint64_t)ret_conv;
10210 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_ok(uint32_t o) {
10211 LDKExpiryTime o_conv;
10212 o_conv.inner = (void*)(o & (~1));
10213 o_conv.is_owned = (o & 1) || (o == 0);
10214 o_conv = ExpiryTime_clone(&o_conv);
10215 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10216 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
10217 return (uint64_t)ret_conv;
10220 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_err(uint32_t e) {
10221 LDKCreationError e_conv = LDKCreationError_from_js(e);
10222 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10223 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
10224 return (uint64_t)ret_conv;
10227 void __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_free(uint32_t _res) {
10228 if ((_res & 1) != 0) return;
10229 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10230 CHECK_ACCESS(_res_ptr);
10231 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(_res_ptr);
10233 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
10236 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_clone(uint32_t orig) {
10237 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
10238 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10239 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
10240 return (uint64_t)ret_conv;
10243 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
10244 LDKPrivateRoute o_conv;
10245 o_conv.inner = (void*)(o & (~1));
10246 o_conv.is_owned = (o & 1) || (o == 0);
10247 o_conv = PrivateRoute_clone(&o_conv);
10248 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
10249 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
10250 return (uint64_t)ret_conv;
10253 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
10254 LDKCreationError e_conv = LDKCreationError_from_js(e);
10255 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
10256 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
10257 return (uint64_t)ret_conv;
10260 void __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
10261 if ((_res & 1) != 0) return;
10262 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10263 CHECK_ACCESS(_res_ptr);
10264 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
10266 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
10269 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
10270 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
10271 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
10272 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
10273 return (uint64_t)ret_conv;
10276 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_ok(jstring o) {
10277 LDKStr o_conv = str_ref_to_owned_c(o);
10278 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10279 *ret_conv = CResult_StringErrorZ_ok(o_conv);
10280 return (uint64_t)ret_conv;
10283 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_err(uint32_t e) {
10284 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10285 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10286 *ret_conv = CResult_StringErrorZ_err(e_conv);
10287 return (uint64_t)ret_conv;
10290 void __attribute__((visibility("default"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
10291 if ((_res & 1) != 0) return;
10292 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10293 CHECK_ACCESS(_res_ptr);
10294 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
10296 CResult_StringErrorZ_free(_res_conv);
10299 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
10300 LDKChannelMonitorUpdate o_conv;
10301 o_conv.inner = (void*)(o & (~1));
10302 o_conv.is_owned = (o & 1) || (o == 0);
10303 o_conv = ChannelMonitorUpdate_clone(&o_conv);
10304 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10305 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
10306 return (uint64_t)ret_conv;
10309 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
10310 LDKDecodeError e_conv;
10311 e_conv.inner = (void*)(e & (~1));
10312 e_conv.is_owned = (e & 1) || (e == 0);
10313 e_conv = DecodeError_clone(&e_conv);
10314 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10315 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
10316 return (uint64_t)ret_conv;
10319 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
10320 if ((_res & 1) != 0) return;
10321 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10322 CHECK_ACCESS(_res_ptr);
10323 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
10325 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
10328 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
10329 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
10330 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10331 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
10332 return (uint64_t)ret_conv;
10335 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
10336 LDKHTLCUpdate o_conv;
10337 o_conv.inner = (void*)(o & (~1));
10338 o_conv.is_owned = (o & 1) || (o == 0);
10339 o_conv = HTLCUpdate_clone(&o_conv);
10340 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10341 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
10342 return (uint64_t)ret_conv;
10345 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
10346 LDKDecodeError e_conv;
10347 e_conv.inner = (void*)(e & (~1));
10348 e_conv.is_owned = (e & 1) || (e == 0);
10349 e_conv = DecodeError_clone(&e_conv);
10350 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10351 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
10352 return (uint64_t)ret_conv;
10355 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
10356 if ((_res & 1) != 0) return;
10357 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10358 CHECK_ACCESS(_res_ptr);
10359 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
10361 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
10364 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
10365 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
10366 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10367 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
10368 return (uint64_t)ret_conv;
10371 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
10372 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10373 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
10374 return (uint64_t)ret_conv;
10377 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
10378 LDKMonitorUpdateError e_conv;
10379 e_conv.inner = (void*)(e & (~1));
10380 e_conv.is_owned = (e & 1) || (e == 0);
10381 e_conv = MonitorUpdateError_clone(&e_conv);
10382 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10383 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
10384 return (uint64_t)ret_conv;
10387 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
10388 if ((_res & 1) != 0) return;
10389 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10390 CHECK_ACCESS(_res_ptr);
10391 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(_res_ptr);
10393 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
10396 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
10397 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
10398 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10399 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
10400 return (uint64_t)ret_conv;
10403 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
10404 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
10405 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10406 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
10407 return ((uint64_t)ret_conv);
10410 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
10411 LDKOutPoint a_conv;
10412 a_conv.inner = (void*)(a & (~1));
10413 a_conv.is_owned = (a & 1) || (a == 0);
10414 a_conv = OutPoint_clone(&a_conv);
10416 b_ref.datalen = *((uint32_t*)b);
10417 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10418 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
10419 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10420 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
10421 return ((uint64_t)ret_conv);
10424 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
10425 if ((_res & 1) != 0) return;
10426 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10427 CHECK_ACCESS(_res_ptr);
10428 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
10430 C2Tuple_OutPointScriptZ_free(_res_conv);
10433 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
10434 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
10435 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10436 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
10437 return ((uint64_t)ret_conv);
10440 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
10442 b_ref.datalen = *((uint32_t*)b);
10443 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10444 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
10445 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10446 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
10447 return ((uint64_t)ret_conv);
10450 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
10451 if ((_res & 1) != 0) return;
10452 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10453 CHECK_ACCESS(_res_ptr);
10454 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
10456 C2Tuple_u32ScriptZ_free(_res_conv);
10459 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
10460 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
10461 _res_constr.datalen = *((uint32_t*)_res);
10462 if (_res_constr.datalen > 0)
10463 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10465 _res_constr.data = NULL;
10466 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10467 for (size_t v = 0; v < _res_constr.datalen; v++) {
10468 uint32_t _res_conv_21 = _res_vals[v];
10469 void* _res_conv_21_ptr = (void*)(((uint64_t)_res_conv_21) & ~1);
10470 CHECK_ACCESS(_res_conv_21_ptr);
10471 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
10472 FREE((void*)_res_conv_21);
10473 _res_constr.data[v] = _res_conv_21_conv;
10475 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
10478 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
10479 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
10480 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10481 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
10482 return ((uint64_t)ret_conv);
10485 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
10486 LDKThirtyTwoBytes a_ref;
10487 CHECK(*((uint32_t*)a) == 32);
10488 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
10489 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
10490 b_constr.datalen = *((uint32_t*)b);
10491 if (b_constr.datalen > 0)
10492 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10494 b_constr.data = NULL;
10495 uint32_t* b_vals = (uint32_t*)(b + 4);
10496 for (size_t v = 0; v < b_constr.datalen; v++) {
10497 uint32_t b_conv_21 = b_vals[v];
10498 void* b_conv_21_ptr = (void*)(((uint64_t)b_conv_21) & ~1);
10499 CHECK_ACCESS(b_conv_21_ptr);
10500 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
10501 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
10502 b_constr.data[v] = b_conv_21_conv;
10504 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10505 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
10506 return ((uint64_t)ret_conv);
10509 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
10510 if ((_res & 1) != 0) return;
10511 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10512 CHECK_ACCESS(_res_ptr);
10513 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
10515 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
10518 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
10519 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
10520 _res_constr.datalen = *((uint32_t*)_res);
10521 if (_res_constr.datalen > 0)
10522 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
10524 _res_constr.data = NULL;
10525 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10526 for (size_t o = 0; o < _res_constr.datalen; o++) {
10527 uint32_t _res_conv_40 = _res_vals[o];
10528 void* _res_conv_40_ptr = (void*)(((uint64_t)_res_conv_40) & ~1);
10529 CHECK_ACCESS(_res_conv_40_ptr);
10530 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
10531 FREE((void*)_res_conv_40);
10532 _res_constr.data[o] = _res_conv_40_conv;
10534 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
10537 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
10538 LDKCVec_EventZ _res_constr;
10539 _res_constr.datalen = *((uint32_t*)_res);
10540 if (_res_constr.datalen > 0)
10541 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
10543 _res_constr.data = NULL;
10544 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10545 for (size_t h = 0; h < _res_constr.datalen; h++) {
10546 uint32_t _res_conv_7 = _res_vals[h];
10547 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
10548 CHECK_ACCESS(_res_conv_7_ptr);
10549 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
10550 FREE((void*)_res_conv_7);
10551 _res_constr.data[h] = _res_conv_7_conv;
10553 CVec_EventZ_free(_res_constr);
10556 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
10557 LDKCVec_TransactionZ _res_constr;
10558 _res_constr.datalen = *((uint32_t*)_res);
10559 if (_res_constr.datalen > 0)
10560 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
10562 _res_constr.data = NULL;
10563 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
10564 for (size_t m = 0; m < _res_constr.datalen; m++) {
10565 int8_tArray _res_conv_12 = _res_vals[m];
10566 LDKTransaction _res_conv_12_ref;
10567 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
10568 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
10569 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
10570 _res_conv_12_ref.data_is_owned = true;
10571 _res_constr.data[m] = _res_conv_12_ref;
10573 CVec_TransactionZ_free(_res_constr);
10576 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
10577 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
10578 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10579 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
10580 return ((uint64_t)ret_conv);
10583 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
10584 void* b_ptr = (void*)(((uint64_t)b) & ~1);
10585 CHECK_ACCESS(b_ptr);
10586 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
10587 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
10588 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10589 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
10590 return ((uint64_t)ret_conv);
10593 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
10594 if ((_res & 1) != 0) return;
10595 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10596 CHECK_ACCESS(_res_ptr);
10597 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
10599 C2Tuple_u32TxOutZ_free(_res_conv);
10602 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
10603 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
10604 _res_constr.datalen = *((uint32_t*)_res);
10605 if (_res_constr.datalen > 0)
10606 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
10608 _res_constr.data = NULL;
10609 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10610 for (size_t u = 0; u < _res_constr.datalen; u++) {
10611 uint32_t _res_conv_20 = _res_vals[u];
10612 void* _res_conv_20_ptr = (void*)(((uint64_t)_res_conv_20) & ~1);
10613 CHECK_ACCESS(_res_conv_20_ptr);
10614 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
10615 FREE((void*)_res_conv_20);
10616 _res_constr.data[u] = _res_conv_20_conv;
10618 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
10621 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
10622 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
10623 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10624 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
10625 return ((uint64_t)ret_conv);
10628 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
10629 LDKThirtyTwoBytes a_ref;
10630 CHECK(*((uint32_t*)a) == 32);
10631 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
10632 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
10633 b_constr.datalen = *((uint32_t*)b);
10634 if (b_constr.datalen > 0)
10635 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
10637 b_constr.data = NULL;
10638 uint32_t* b_vals = (uint32_t*)(b + 4);
10639 for (size_t u = 0; u < b_constr.datalen; u++) {
10640 uint32_t b_conv_20 = b_vals[u];
10641 void* b_conv_20_ptr = (void*)(((uint64_t)b_conv_20) & ~1);
10642 CHECK_ACCESS(b_conv_20_ptr);
10643 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
10644 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
10645 b_constr.data[u] = b_conv_20_conv;
10647 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10648 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
10649 return ((uint64_t)ret_conv);
10652 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
10653 if ((_res & 1) != 0) return;
10654 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10655 CHECK_ACCESS(_res_ptr);
10656 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
10658 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
10661 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
10662 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
10663 _res_constr.datalen = *((uint32_t*)_res);
10664 if (_res_constr.datalen > 0)
10665 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
10667 _res_constr.data = NULL;
10668 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10669 for (size_t n = 0; n < _res_constr.datalen; n++) {
10670 uint32_t _res_conv_39 = _res_vals[n];
10671 void* _res_conv_39_ptr = (void*)(((uint64_t)_res_conv_39) & ~1);
10672 CHECK_ACCESS(_res_conv_39_ptr);
10673 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
10674 FREE((void*)_res_conv_39);
10675 _res_constr.data[n] = _res_conv_39_conv;
10677 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
10680 void __attribute__((visibility("default"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
10681 LDKCVec_BalanceZ _res_constr;
10682 _res_constr.datalen = *((uint32_t*)_res);
10683 if (_res_constr.datalen > 0)
10684 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
10686 _res_constr.data = NULL;
10687 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10688 for (size_t j = 0; j < _res_constr.datalen; j++) {
10689 uint32_t _res_conv_9 = _res_vals[j];
10690 void* _res_conv_9_ptr = (void*)(((uint64_t)_res_conv_9) & ~1);
10691 CHECK_ACCESS(_res_conv_9_ptr);
10692 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
10693 FREE((void*)_res_conv_9);
10694 _res_constr.data[j] = _res_conv_9_conv;
10696 CVec_BalanceZ_free(_res_constr);
10699 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
10700 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10701 CHECK_ACCESS(o_ptr);
10702 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
10703 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
10704 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10705 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
10706 return (uint64_t)ret_conv;
10709 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
10710 LDKDecodeError e_conv;
10711 e_conv.inner = (void*)(e & (~1));
10712 e_conv.is_owned = (e & 1) || (e == 0);
10713 e_conv = DecodeError_clone(&e_conv);
10714 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10715 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
10716 return (uint64_t)ret_conv;
10719 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
10720 if ((_res & 1) != 0) return;
10721 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10722 CHECK_ACCESS(_res_ptr);
10723 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
10725 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
10728 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
10729 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
10730 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10731 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
10732 return (uint64_t)ret_conv;
10735 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
10736 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10737 *ret_conv = CResult_NoneLightningErrorZ_ok();
10738 return (uint64_t)ret_conv;
10741 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
10742 LDKLightningError e_conv;
10743 e_conv.inner = (void*)(e & (~1));
10744 e_conv.is_owned = (e & 1) || (e == 0);
10745 e_conv = LightningError_clone(&e_conv);
10746 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10747 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
10748 return (uint64_t)ret_conv;
10751 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
10752 if ((_res & 1) != 0) return;
10753 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10754 CHECK_ACCESS(_res_ptr);
10755 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
10757 CResult_NoneLightningErrorZ_free(_res_conv);
10760 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
10761 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
10762 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10763 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
10764 return (uint64_t)ret_conv;
10767 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
10768 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
10769 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10770 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
10771 return ((uint64_t)ret_conv);
10774 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
10775 LDKPublicKey a_ref;
10776 CHECK(*((uint32_t*)a) == 33);
10777 memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
10778 void* b_ptr = (void*)(((uint64_t)b) & ~1);
10779 CHECK_ACCESS(b_ptr);
10780 LDKType b_conv = *(LDKType*)(b_ptr);
10781 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10782 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
10783 return ((uint64_t)ret_conv);
10786 void __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
10787 if ((_res & 1) != 0) return;
10788 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10789 CHECK_ACCESS(_res_ptr);
10790 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
10792 C2Tuple_PublicKeyTypeZ_free(_res_conv);
10795 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
10796 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
10797 _res_constr.datalen = *((uint32_t*)_res);
10798 if (_res_constr.datalen > 0)
10799 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
10801 _res_constr.data = NULL;
10802 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10803 for (size_t z = 0; z < _res_constr.datalen; z++) {
10804 uint32_t _res_conv_25 = _res_vals[z];
10805 void* _res_conv_25_ptr = (void*)(((uint64_t)_res_conv_25) & ~1);
10806 CHECK_ACCESS(_res_conv_25_ptr);
10807 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
10808 FREE((void*)_res_conv_25);
10809 _res_constr.data[z] = _res_conv_25_conv;
10811 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
10814 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
10815 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10816 *ret_conv = CResult_boolLightningErrorZ_ok(o);
10817 return (uint64_t)ret_conv;
10820 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
10821 LDKLightningError e_conv;
10822 e_conv.inner = (void*)(e & (~1));
10823 e_conv.is_owned = (e & 1) || (e == 0);
10824 e_conv = LightningError_clone(&e_conv);
10825 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10826 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
10827 return (uint64_t)ret_conv;
10830 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
10831 if ((_res & 1) != 0) return;
10832 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10833 CHECK_ACCESS(_res_ptr);
10834 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
10836 CResult_boolLightningErrorZ_free(_res_conv);
10839 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
10840 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
10841 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10842 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
10843 return (uint64_t)ret_conv;
10846 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
10847 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
10848 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
10849 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
10850 return ((uint64_t)ret_conv);
10853 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
10854 LDKChannelAnnouncement a_conv;
10855 a_conv.inner = (void*)(a & (~1));
10856 a_conv.is_owned = (a & 1) || (a == 0);
10857 a_conv = ChannelAnnouncement_clone(&a_conv);
10858 LDKChannelUpdate b_conv;
10859 b_conv.inner = (void*)(b & (~1));
10860 b_conv.is_owned = (b & 1) || (b == 0);
10861 b_conv = ChannelUpdate_clone(&b_conv);
10862 LDKChannelUpdate c_conv;
10863 c_conv.inner = (void*)(c & (~1));
10864 c_conv.is_owned = (c & 1) || (c == 0);
10865 c_conv = ChannelUpdate_clone(&c_conv);
10866 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
10867 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
10868 return ((uint64_t)ret_conv);
10871 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
10872 if ((_res & 1) != 0) return;
10873 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10874 CHECK_ACCESS(_res_ptr);
10875 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
10877 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
10880 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
10881 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
10882 _res_constr.datalen = *((uint32_t*)_res);
10883 if (_res_constr.datalen > 0)
10884 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
10886 _res_constr.data = NULL;
10887 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10888 for (size_t h = 0; h < _res_constr.datalen; h++) {
10889 uint32_t _res_conv_59 = _res_vals[h];
10890 void* _res_conv_59_ptr = (void*)(((uint64_t)_res_conv_59) & ~1);
10891 CHECK_ACCESS(_res_conv_59_ptr);
10892 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
10893 FREE((void*)_res_conv_59);
10894 _res_constr.data[h] = _res_conv_59_conv;
10896 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
10899 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
10900 LDKCVec_NodeAnnouncementZ _res_constr;
10901 _res_constr.datalen = *((uint32_t*)_res);
10902 if (_res_constr.datalen > 0)
10903 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
10905 _res_constr.data = NULL;
10906 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10907 for (size_t s = 0; s < _res_constr.datalen; s++) {
10908 uint32_t _res_conv_18 = _res_vals[s];
10909 LDKNodeAnnouncement _res_conv_18_conv;
10910 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
10911 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
10912 _res_constr.data[s] = _res_conv_18_conv;
10914 CVec_NodeAnnouncementZ_free(_res_constr);
10917 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
10918 LDKCVec_PublicKeyZ _res_constr;
10919 _res_constr.datalen = *((uint32_t*)_res);
10920 if (_res_constr.datalen > 0)
10921 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
10923 _res_constr.data = NULL;
10924 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
10925 for (size_t m = 0; m < _res_constr.datalen; m++) {
10926 int8_tArray _res_conv_12 = _res_vals[m];
10927 LDKPublicKey _res_conv_12_ref;
10928 CHECK(*((uint32_t*)_res_conv_12) == 33);
10929 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
10930 _res_constr.data[m] = _res_conv_12_ref;
10932 CVec_PublicKeyZ_free(_res_constr);
10935 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
10937 o_ref.datalen = *((uint32_t*)o);
10938 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
10939 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
10940 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10941 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
10942 return (uint64_t)ret_conv;
10945 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
10946 LDKPeerHandleError e_conv;
10947 e_conv.inner = (void*)(e & (~1));
10948 e_conv.is_owned = (e & 1) || (e == 0);
10949 e_conv = PeerHandleError_clone(&e_conv);
10950 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10951 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
10952 return (uint64_t)ret_conv;
10955 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
10956 if ((_res & 1) != 0) return;
10957 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10958 CHECK_ACCESS(_res_ptr);
10959 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
10961 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
10964 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
10965 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
10966 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10967 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
10968 return (uint64_t)ret_conv;
10971 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
10972 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10973 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
10974 return (uint64_t)ret_conv;
10977 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
10978 LDKPeerHandleError e_conv;
10979 e_conv.inner = (void*)(e & (~1));
10980 e_conv.is_owned = (e & 1) || (e == 0);
10981 e_conv = PeerHandleError_clone(&e_conv);
10982 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10983 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
10984 return (uint64_t)ret_conv;
10987 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
10988 if ((_res & 1) != 0) return;
10989 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10990 CHECK_ACCESS(_res_ptr);
10991 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
10993 CResult_NonePeerHandleErrorZ_free(_res_conv);
10996 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
10997 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
10998 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10999 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
11000 return (uint64_t)ret_conv;
11003 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
11004 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11005 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
11006 return (uint64_t)ret_conv;
11009 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
11010 LDKPeerHandleError e_conv;
11011 e_conv.inner = (void*)(e & (~1));
11012 e_conv.is_owned = (e & 1) || (e == 0);
11013 e_conv = PeerHandleError_clone(&e_conv);
11014 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11015 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
11016 return (uint64_t)ret_conv;
11019 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
11020 if ((_res & 1) != 0) return;
11021 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11022 CHECK_ACCESS(_res_ptr);
11023 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
11025 CResult_boolPeerHandleErrorZ_free(_res_conv);
11028 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
11029 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
11030 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11031 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
11032 return (uint64_t)ret_conv;
11035 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
11037 o_conv.inner = (void*)(o & (~1));
11038 o_conv.is_owned = (o & 1) || (o == 0);
11039 o_conv = NodeId_clone(&o_conv);
11040 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
11041 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
11042 return (uint64_t)ret_conv;
11045 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) {
11046 LDKDecodeError e_conv;
11047 e_conv.inner = (void*)(e & (~1));
11048 e_conv.is_owned = (e & 1) || (e == 0);
11049 e_conv = DecodeError_clone(&e_conv);
11050 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
11051 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
11052 return (uint64_t)ret_conv;
11055 void __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
11056 if ((_res & 1) != 0) return;
11057 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11058 CHECK_ACCESS(_res_ptr);
11059 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
11061 CResult_NodeIdDecodeErrorZ_free(_res_conv);
11064 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
11065 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
11066 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
11067 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
11068 return (uint64_t)ret_conv;
11071 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_some(uint32_t o) {
11072 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11073 CHECK_ACCESS(o_ptr);
11074 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
11075 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
11076 *ret_copy = COption_AccessZ_some(o_conv);
11077 uint64_t ret_ref = (uint64_t)ret_copy;
11081 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_none() {
11082 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
11083 *ret_copy = COption_AccessZ_none();
11084 uint64_t ret_ref = (uint64_t)ret_copy;
11088 void __attribute__((visibility("default"))) TS_COption_AccessZ_free(uint32_t _res) {
11089 if ((_res & 1) != 0) return;
11090 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11091 CHECK_ACCESS(_res_ptr);
11092 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
11094 COption_AccessZ_free(_res_conv);
11097 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
11098 LDKDirectionalChannelInfo o_conv;
11099 o_conv.inner = (void*)(o & (~1));
11100 o_conv.is_owned = (o & 1) || (o == 0);
11101 o_conv = DirectionalChannelInfo_clone(&o_conv);
11102 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11103 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
11104 return (uint64_t)ret_conv;
11107 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
11108 LDKDecodeError e_conv;
11109 e_conv.inner = (void*)(e & (~1));
11110 e_conv.is_owned = (e & 1) || (e == 0);
11111 e_conv = DecodeError_clone(&e_conv);
11112 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11113 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
11114 return (uint64_t)ret_conv;
11117 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
11118 if ((_res & 1) != 0) return;
11119 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11120 CHECK_ACCESS(_res_ptr);
11121 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(_res_ptr);
11123 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
11126 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
11127 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
11128 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11129 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
11130 return (uint64_t)ret_conv;
11133 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
11134 LDKChannelInfo o_conv;
11135 o_conv.inner = (void*)(o & (~1));
11136 o_conv.is_owned = (o & 1) || (o == 0);
11137 o_conv = ChannelInfo_clone(&o_conv);
11138 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11139 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
11140 return (uint64_t)ret_conv;
11143 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
11144 LDKDecodeError e_conv;
11145 e_conv.inner = (void*)(e & (~1));
11146 e_conv.is_owned = (e & 1) || (e == 0);
11147 e_conv = DecodeError_clone(&e_conv);
11148 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11149 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
11150 return (uint64_t)ret_conv;
11153 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
11154 if ((_res & 1) != 0) return;
11155 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11156 CHECK_ACCESS(_res_ptr);
11157 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
11159 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
11162 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
11163 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
11164 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11165 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
11166 return (uint64_t)ret_conv;
11169 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
11170 LDKRoutingFees o_conv;
11171 o_conv.inner = (void*)(o & (~1));
11172 o_conv.is_owned = (o & 1) || (o == 0);
11173 o_conv = RoutingFees_clone(&o_conv);
11174 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11175 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
11176 return (uint64_t)ret_conv;
11179 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
11180 LDKDecodeError e_conv;
11181 e_conv.inner = (void*)(e & (~1));
11182 e_conv.is_owned = (e & 1) || (e == 0);
11183 e_conv = DecodeError_clone(&e_conv);
11184 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11185 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
11186 return (uint64_t)ret_conv;
11189 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
11190 if ((_res & 1) != 0) return;
11191 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11192 CHECK_ACCESS(_res_ptr);
11193 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
11195 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
11198 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
11199 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
11200 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11201 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
11202 return (uint64_t)ret_conv;
11205 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
11206 LDKNodeAnnouncementInfo o_conv;
11207 o_conv.inner = (void*)(o & (~1));
11208 o_conv.is_owned = (o & 1) || (o == 0);
11209 o_conv = NodeAnnouncementInfo_clone(&o_conv);
11210 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11211 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
11212 return (uint64_t)ret_conv;
11215 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
11216 LDKDecodeError e_conv;
11217 e_conv.inner = (void*)(e & (~1));
11218 e_conv.is_owned = (e & 1) || (e == 0);
11219 e_conv = DecodeError_clone(&e_conv);
11220 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11221 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
11222 return (uint64_t)ret_conv;
11225 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
11226 if ((_res & 1) != 0) return;
11227 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11228 CHECK_ACCESS(_res_ptr);
11229 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
11231 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
11234 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
11235 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
11236 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11237 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
11238 return (uint64_t)ret_conv;
11241 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
11242 LDKCVec_u64Z _res_constr;
11243 _res_constr.datalen = *((uint32_t*)_res);
11244 if (_res_constr.datalen > 0)
11245 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11247 _res_constr.data = NULL;
11248 int64_t* _res_vals = (int64_t*)(_res + 4);
11249 for (size_t i = 0; i < _res_constr.datalen; i++) {
11250 int64_t _res_conv_8 = _res_vals[i];
11251 _res_constr.data[i] = _res_conv_8;
11253 CVec_u64Z_free(_res_constr);
11256 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
11257 LDKNodeInfo o_conv;
11258 o_conv.inner = (void*)(o & (~1));
11259 o_conv.is_owned = (o & 1) || (o == 0);
11260 o_conv = NodeInfo_clone(&o_conv);
11261 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11262 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
11263 return (uint64_t)ret_conv;
11266 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
11267 LDKDecodeError e_conv;
11268 e_conv.inner = (void*)(e & (~1));
11269 e_conv.is_owned = (e & 1) || (e == 0);
11270 e_conv = DecodeError_clone(&e_conv);
11271 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11272 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
11273 return (uint64_t)ret_conv;
11276 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
11277 if ((_res & 1) != 0) return;
11278 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11279 CHECK_ACCESS(_res_ptr);
11280 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
11282 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
11285 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
11286 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
11287 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11288 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
11289 return (uint64_t)ret_conv;
11292 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
11293 LDKNetworkGraph o_conv;
11294 o_conv.inner = (void*)(o & (~1));
11295 o_conv.is_owned = (o & 1) || (o == 0);
11296 o_conv = NetworkGraph_clone(&o_conv);
11297 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11298 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
11299 return (uint64_t)ret_conv;
11302 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
11303 LDKDecodeError e_conv;
11304 e_conv.inner = (void*)(e & (~1));
11305 e_conv.is_owned = (e & 1) || (e == 0);
11306 e_conv = DecodeError_clone(&e_conv);
11307 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11308 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
11309 return (uint64_t)ret_conv;
11312 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
11313 if ((_res & 1) != 0) return;
11314 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11315 CHECK_ACCESS(_res_ptr);
11316 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
11318 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
11321 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
11322 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
11323 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11324 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
11325 return (uint64_t)ret_conv;
11328 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
11329 LDKCVec_NetAddressZ o_constr;
11330 o_constr.datalen = *((uint32_t*)o);
11331 if (o_constr.datalen > 0)
11332 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11334 o_constr.data = NULL;
11335 uint32_t* o_vals = (uint32_t*)(o + 4);
11336 for (size_t m = 0; m < o_constr.datalen; m++) {
11337 uint32_t o_conv_12 = o_vals[m];
11338 void* o_conv_12_ptr = (void*)(((uint64_t)o_conv_12) & ~1);
11339 CHECK_ACCESS(o_conv_12_ptr);
11340 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
11341 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1));
11342 o_constr.data[m] = o_conv_12_conv;
11344 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
11345 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
11346 uint64_t ret_ref = (uint64_t)ret_copy;
11350 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_none() {
11351 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
11352 *ret_copy = COption_CVec_NetAddressZZ_none();
11353 uint64_t ret_ref = (uint64_t)ret_copy;
11357 void __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
11358 if ((_res & 1) != 0) return;
11359 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11360 CHECK_ACCESS(_res_ptr);
11361 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
11363 COption_CVec_NetAddressZZ_free(_res_conv);
11366 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
11367 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
11368 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
11369 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
11370 uint64_t ret_ref = (uint64_t)ret_copy;
11374 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
11375 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11376 CHECK_ACCESS(o_ptr);
11377 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
11378 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
11379 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11380 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
11381 return (uint64_t)ret_conv;
11384 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_err(int8_t e) {
11385 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11386 *ret_conv = CResult_NetAddressu8Z_err(e);
11387 return (uint64_t)ret_conv;
11390 void __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_free(uint32_t _res) {
11391 if ((_res & 1) != 0) return;
11392 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11393 CHECK_ACCESS(_res_ptr);
11394 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(_res_ptr);
11396 CResult_NetAddressu8Z_free(_res_conv);
11399 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_clone(uint32_t orig) {
11400 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
11401 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11402 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
11403 return (uint64_t)ret_conv;
11406 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
11407 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11408 CHECK_ACCESS(o_ptr);
11409 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(o_ptr);
11410 o_conv = CResult_NetAddressu8Z_clone((LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1));
11411 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11412 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
11413 return (uint64_t)ret_conv;
11416 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_err(uint32_t e) {
11417 LDKDecodeError e_conv;
11418 e_conv.inner = (void*)(e & (~1));
11419 e_conv.is_owned = (e & 1) || (e == 0);
11420 e_conv = DecodeError_clone(&e_conv);
11421 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11422 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
11423 return (uint64_t)ret_conv;
11426 void __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_free(uint32_t _res) {
11427 if ((_res & 1) != 0) return;
11428 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11429 CHECK_ACCESS(_res_ptr);
11430 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(_res_ptr);
11432 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
11435 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(uint32_t orig) {
11436 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
11437 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11438 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
11439 return (uint64_t)ret_conv;
11442 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
11443 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11444 CHECK_ACCESS(o_ptr);
11445 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
11446 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
11447 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11448 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
11449 return (uint64_t)ret_conv;
11452 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
11453 LDKDecodeError e_conv;
11454 e_conv.inner = (void*)(e & (~1));
11455 e_conv.is_owned = (e & 1) || (e == 0);
11456 e_conv = DecodeError_clone(&e_conv);
11457 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11458 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
11459 return (uint64_t)ret_conv;
11462 void __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
11463 if ((_res & 1) != 0) return;
11464 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11465 CHECK_ACCESS(_res_ptr);
11466 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
11468 CResult_NetAddressDecodeErrorZ_free(_res_conv);
11471 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
11472 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
11473 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11474 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
11475 return (uint64_t)ret_conv;
11478 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
11479 LDKCVec_UpdateAddHTLCZ _res_constr;
11480 _res_constr.datalen = *((uint32_t*)_res);
11481 if (_res_constr.datalen > 0)
11482 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11484 _res_constr.data = NULL;
11485 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11486 for (size_t p = 0; p < _res_constr.datalen; p++) {
11487 uint32_t _res_conv_15 = _res_vals[p];
11488 LDKUpdateAddHTLC _res_conv_15_conv;
11489 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
11490 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
11491 _res_constr.data[p] = _res_conv_15_conv;
11493 CVec_UpdateAddHTLCZ_free(_res_constr);
11496 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
11497 LDKCVec_UpdateFulfillHTLCZ _res_constr;
11498 _res_constr.datalen = *((uint32_t*)_res);
11499 if (_res_constr.datalen > 0)
11500 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11502 _res_constr.data = NULL;
11503 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11504 for (size_t t = 0; t < _res_constr.datalen; t++) {
11505 uint32_t _res_conv_19 = _res_vals[t];
11506 LDKUpdateFulfillHTLC _res_conv_19_conv;
11507 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
11508 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
11509 _res_constr.data[t] = _res_conv_19_conv;
11511 CVec_UpdateFulfillHTLCZ_free(_res_constr);
11514 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
11515 LDKCVec_UpdateFailHTLCZ _res_constr;
11516 _res_constr.datalen = *((uint32_t*)_res);
11517 if (_res_constr.datalen > 0)
11518 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11520 _res_constr.data = NULL;
11521 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11522 for (size_t q = 0; q < _res_constr.datalen; q++) {
11523 uint32_t _res_conv_16 = _res_vals[q];
11524 LDKUpdateFailHTLC _res_conv_16_conv;
11525 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11526 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11527 _res_constr.data[q] = _res_conv_16_conv;
11529 CVec_UpdateFailHTLCZ_free(_res_constr);
11532 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
11533 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
11534 _res_constr.datalen = *((uint32_t*)_res);
11535 if (_res_constr.datalen > 0)
11536 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11538 _res_constr.data = NULL;
11539 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11540 for (size_t z = 0; z < _res_constr.datalen; z++) {
11541 uint32_t _res_conv_25 = _res_vals[z];
11542 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
11543 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
11544 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
11545 _res_constr.data[z] = _res_conv_25_conv;
11547 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
11550 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
11551 LDKAcceptChannel o_conv;
11552 o_conv.inner = (void*)(o & (~1));
11553 o_conv.is_owned = (o & 1) || (o == 0);
11554 o_conv = AcceptChannel_clone(&o_conv);
11555 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11556 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
11557 return (uint64_t)ret_conv;
11560 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
11561 LDKDecodeError e_conv;
11562 e_conv.inner = (void*)(e & (~1));
11563 e_conv.is_owned = (e & 1) || (e == 0);
11564 e_conv = DecodeError_clone(&e_conv);
11565 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11566 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
11567 return (uint64_t)ret_conv;
11570 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
11571 if ((_res & 1) != 0) return;
11572 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11573 CHECK_ACCESS(_res_ptr);
11574 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
11576 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
11579 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
11580 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
11581 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11582 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
11583 return (uint64_t)ret_conv;
11586 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
11587 LDKAnnouncementSignatures o_conv;
11588 o_conv.inner = (void*)(o & (~1));
11589 o_conv.is_owned = (o & 1) || (o == 0);
11590 o_conv = AnnouncementSignatures_clone(&o_conv);
11591 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11592 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
11593 return (uint64_t)ret_conv;
11596 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
11597 LDKDecodeError e_conv;
11598 e_conv.inner = (void*)(e & (~1));
11599 e_conv.is_owned = (e & 1) || (e == 0);
11600 e_conv = DecodeError_clone(&e_conv);
11601 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11602 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
11603 return (uint64_t)ret_conv;
11606 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
11607 if ((_res & 1) != 0) return;
11608 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11609 CHECK_ACCESS(_res_ptr);
11610 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
11612 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
11615 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
11616 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
11617 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11618 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
11619 return (uint64_t)ret_conv;
11622 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
11623 LDKChannelReestablish o_conv;
11624 o_conv.inner = (void*)(o & (~1));
11625 o_conv.is_owned = (o & 1) || (o == 0);
11626 o_conv = ChannelReestablish_clone(&o_conv);
11627 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11628 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
11629 return (uint64_t)ret_conv;
11632 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
11633 LDKDecodeError e_conv;
11634 e_conv.inner = (void*)(e & (~1));
11635 e_conv.is_owned = (e & 1) || (e == 0);
11636 e_conv = DecodeError_clone(&e_conv);
11637 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11638 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
11639 return (uint64_t)ret_conv;
11642 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
11643 if ((_res & 1) != 0) return;
11644 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11645 CHECK_ACCESS(_res_ptr);
11646 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
11648 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
11651 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
11652 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
11653 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11654 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
11655 return (uint64_t)ret_conv;
11658 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
11659 LDKClosingSigned o_conv;
11660 o_conv.inner = (void*)(o & (~1));
11661 o_conv.is_owned = (o & 1) || (o == 0);
11662 o_conv = ClosingSigned_clone(&o_conv);
11663 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11664 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
11665 return (uint64_t)ret_conv;
11668 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
11669 LDKDecodeError e_conv;
11670 e_conv.inner = (void*)(e & (~1));
11671 e_conv.is_owned = (e & 1) || (e == 0);
11672 e_conv = DecodeError_clone(&e_conv);
11673 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11674 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
11675 return (uint64_t)ret_conv;
11678 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
11679 if ((_res & 1) != 0) return;
11680 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11681 CHECK_ACCESS(_res_ptr);
11682 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
11684 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
11687 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
11688 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
11689 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11690 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
11691 return (uint64_t)ret_conv;
11694 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
11695 LDKClosingSignedFeeRange o_conv;
11696 o_conv.inner = (void*)(o & (~1));
11697 o_conv.is_owned = (o & 1) || (o == 0);
11698 o_conv = ClosingSignedFeeRange_clone(&o_conv);
11699 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
11700 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
11701 return (uint64_t)ret_conv;
11704 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
11705 LDKDecodeError e_conv;
11706 e_conv.inner = (void*)(e & (~1));
11707 e_conv.is_owned = (e & 1) || (e == 0);
11708 e_conv = DecodeError_clone(&e_conv);
11709 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
11710 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
11711 return (uint64_t)ret_conv;
11714 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
11715 if ((_res & 1) != 0) return;
11716 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11717 CHECK_ACCESS(_res_ptr);
11718 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
11720 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
11723 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
11724 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
11725 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
11726 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
11727 return (uint64_t)ret_conv;
11730 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
11731 LDKCommitmentSigned o_conv;
11732 o_conv.inner = (void*)(o & (~1));
11733 o_conv.is_owned = (o & 1) || (o == 0);
11734 o_conv = CommitmentSigned_clone(&o_conv);
11735 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11736 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
11737 return (uint64_t)ret_conv;
11740 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
11741 LDKDecodeError e_conv;
11742 e_conv.inner = (void*)(e & (~1));
11743 e_conv.is_owned = (e & 1) || (e == 0);
11744 e_conv = DecodeError_clone(&e_conv);
11745 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11746 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
11747 return (uint64_t)ret_conv;
11750 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
11751 if ((_res & 1) != 0) return;
11752 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11753 CHECK_ACCESS(_res_ptr);
11754 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
11756 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
11759 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
11760 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
11761 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11762 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
11763 return (uint64_t)ret_conv;
11766 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
11767 LDKFundingCreated o_conv;
11768 o_conv.inner = (void*)(o & (~1));
11769 o_conv.is_owned = (o & 1) || (o == 0);
11770 o_conv = FundingCreated_clone(&o_conv);
11771 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11772 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
11773 return (uint64_t)ret_conv;
11776 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
11777 LDKDecodeError e_conv;
11778 e_conv.inner = (void*)(e & (~1));
11779 e_conv.is_owned = (e & 1) || (e == 0);
11780 e_conv = DecodeError_clone(&e_conv);
11781 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11782 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
11783 return (uint64_t)ret_conv;
11786 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
11787 if ((_res & 1) != 0) return;
11788 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11789 CHECK_ACCESS(_res_ptr);
11790 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
11792 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
11795 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
11796 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
11797 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11798 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
11799 return (uint64_t)ret_conv;
11802 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
11803 LDKFundingSigned o_conv;
11804 o_conv.inner = (void*)(o & (~1));
11805 o_conv.is_owned = (o & 1) || (o == 0);
11806 o_conv = FundingSigned_clone(&o_conv);
11807 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
11808 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
11809 return (uint64_t)ret_conv;
11812 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
11813 LDKDecodeError e_conv;
11814 e_conv.inner = (void*)(e & (~1));
11815 e_conv.is_owned = (e & 1) || (e == 0);
11816 e_conv = DecodeError_clone(&e_conv);
11817 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
11818 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
11819 return (uint64_t)ret_conv;
11822 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
11823 if ((_res & 1) != 0) return;
11824 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11825 CHECK_ACCESS(_res_ptr);
11826 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
11828 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
11831 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
11832 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
11833 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
11834 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
11835 return (uint64_t)ret_conv;
11838 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
11839 LDKFundingLocked o_conv;
11840 o_conv.inner = (void*)(o & (~1));
11841 o_conv.is_owned = (o & 1) || (o == 0);
11842 o_conv = FundingLocked_clone(&o_conv);
11843 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
11844 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
11845 return (uint64_t)ret_conv;
11848 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
11849 LDKDecodeError e_conv;
11850 e_conv.inner = (void*)(e & (~1));
11851 e_conv.is_owned = (e & 1) || (e == 0);
11852 e_conv = DecodeError_clone(&e_conv);
11853 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
11854 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
11855 return (uint64_t)ret_conv;
11858 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
11859 if ((_res & 1) != 0) return;
11860 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11861 CHECK_ACCESS(_res_ptr);
11862 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
11864 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
11867 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
11868 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
11869 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
11870 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
11871 return (uint64_t)ret_conv;
11874 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
11876 o_conv.inner = (void*)(o & (~1));
11877 o_conv.is_owned = (o & 1) || (o == 0);
11878 o_conv = Init_clone(&o_conv);
11879 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
11880 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
11881 return (uint64_t)ret_conv;
11884 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
11885 LDKDecodeError e_conv;
11886 e_conv.inner = (void*)(e & (~1));
11887 e_conv.is_owned = (e & 1) || (e == 0);
11888 e_conv = DecodeError_clone(&e_conv);
11889 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
11890 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
11891 return (uint64_t)ret_conv;
11894 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
11895 if ((_res & 1) != 0) return;
11896 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11897 CHECK_ACCESS(_res_ptr);
11898 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
11900 CResult_InitDecodeErrorZ_free(_res_conv);
11903 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
11904 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
11905 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
11906 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
11907 return (uint64_t)ret_conv;
11910 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
11911 LDKOpenChannel o_conv;
11912 o_conv.inner = (void*)(o & (~1));
11913 o_conv.is_owned = (o & 1) || (o == 0);
11914 o_conv = OpenChannel_clone(&o_conv);
11915 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
11916 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
11917 return (uint64_t)ret_conv;
11920 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
11921 LDKDecodeError e_conv;
11922 e_conv.inner = (void*)(e & (~1));
11923 e_conv.is_owned = (e & 1) || (e == 0);
11924 e_conv = DecodeError_clone(&e_conv);
11925 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
11926 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
11927 return (uint64_t)ret_conv;
11930 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
11931 if ((_res & 1) != 0) return;
11932 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11933 CHECK_ACCESS(_res_ptr);
11934 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
11936 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
11939 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
11940 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
11941 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
11942 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
11943 return (uint64_t)ret_conv;
11946 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
11947 LDKRevokeAndACK o_conv;
11948 o_conv.inner = (void*)(o & (~1));
11949 o_conv.is_owned = (o & 1) || (o == 0);
11950 o_conv = RevokeAndACK_clone(&o_conv);
11951 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
11952 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
11953 return (uint64_t)ret_conv;
11956 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
11957 LDKDecodeError e_conv;
11958 e_conv.inner = (void*)(e & (~1));
11959 e_conv.is_owned = (e & 1) || (e == 0);
11960 e_conv = DecodeError_clone(&e_conv);
11961 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
11962 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
11963 return (uint64_t)ret_conv;
11966 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
11967 if ((_res & 1) != 0) return;
11968 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11969 CHECK_ACCESS(_res_ptr);
11970 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
11972 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
11975 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
11976 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
11977 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
11978 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
11979 return (uint64_t)ret_conv;
11982 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
11983 LDKShutdown o_conv;
11984 o_conv.inner = (void*)(o & (~1));
11985 o_conv.is_owned = (o & 1) || (o == 0);
11986 o_conv = Shutdown_clone(&o_conv);
11987 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
11988 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
11989 return (uint64_t)ret_conv;
11992 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
11993 LDKDecodeError e_conv;
11994 e_conv.inner = (void*)(e & (~1));
11995 e_conv.is_owned = (e & 1) || (e == 0);
11996 e_conv = DecodeError_clone(&e_conv);
11997 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
11998 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
11999 return (uint64_t)ret_conv;
12002 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
12003 if ((_res & 1) != 0) return;
12004 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12005 CHECK_ACCESS(_res_ptr);
12006 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
12008 CResult_ShutdownDecodeErrorZ_free(_res_conv);
12011 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
12012 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
12013 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12014 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
12015 return (uint64_t)ret_conv;
12018 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
12019 LDKUpdateFailHTLC o_conv;
12020 o_conv.inner = (void*)(o & (~1));
12021 o_conv.is_owned = (o & 1) || (o == 0);
12022 o_conv = UpdateFailHTLC_clone(&o_conv);
12023 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12024 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
12025 return (uint64_t)ret_conv;
12028 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
12029 LDKDecodeError e_conv;
12030 e_conv.inner = (void*)(e & (~1));
12031 e_conv.is_owned = (e & 1) || (e == 0);
12032 e_conv = DecodeError_clone(&e_conv);
12033 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12034 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
12035 return (uint64_t)ret_conv;
12038 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
12039 if ((_res & 1) != 0) return;
12040 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12041 CHECK_ACCESS(_res_ptr);
12042 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
12044 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
12047 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
12048 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
12049 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12050 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
12051 return (uint64_t)ret_conv;
12054 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
12055 LDKUpdateFailMalformedHTLC o_conv;
12056 o_conv.inner = (void*)(o & (~1));
12057 o_conv.is_owned = (o & 1) || (o == 0);
12058 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
12059 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12060 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
12061 return (uint64_t)ret_conv;
12064 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
12065 LDKDecodeError e_conv;
12066 e_conv.inner = (void*)(e & (~1));
12067 e_conv.is_owned = (e & 1) || (e == 0);
12068 e_conv = DecodeError_clone(&e_conv);
12069 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12070 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
12071 return (uint64_t)ret_conv;
12074 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
12075 if ((_res & 1) != 0) return;
12076 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12077 CHECK_ACCESS(_res_ptr);
12078 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
12080 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
12083 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
12084 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
12085 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12086 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
12087 return (uint64_t)ret_conv;
12090 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
12091 LDKUpdateFee o_conv;
12092 o_conv.inner = (void*)(o & (~1));
12093 o_conv.is_owned = (o & 1) || (o == 0);
12094 o_conv = UpdateFee_clone(&o_conv);
12095 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12096 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
12097 return (uint64_t)ret_conv;
12100 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
12101 LDKDecodeError e_conv;
12102 e_conv.inner = (void*)(e & (~1));
12103 e_conv.is_owned = (e & 1) || (e == 0);
12104 e_conv = DecodeError_clone(&e_conv);
12105 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12106 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
12107 return (uint64_t)ret_conv;
12110 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
12111 if ((_res & 1) != 0) return;
12112 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12113 CHECK_ACCESS(_res_ptr);
12114 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
12116 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
12119 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
12120 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
12121 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12122 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
12123 return (uint64_t)ret_conv;
12126 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
12127 LDKUpdateFulfillHTLC o_conv;
12128 o_conv.inner = (void*)(o & (~1));
12129 o_conv.is_owned = (o & 1) || (o == 0);
12130 o_conv = UpdateFulfillHTLC_clone(&o_conv);
12131 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12132 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
12133 return (uint64_t)ret_conv;
12136 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
12137 LDKDecodeError e_conv;
12138 e_conv.inner = (void*)(e & (~1));
12139 e_conv.is_owned = (e & 1) || (e == 0);
12140 e_conv = DecodeError_clone(&e_conv);
12141 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12142 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
12143 return (uint64_t)ret_conv;
12146 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
12147 if ((_res & 1) != 0) return;
12148 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12149 CHECK_ACCESS(_res_ptr);
12150 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
12152 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
12155 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
12156 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
12157 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12158 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
12159 return (uint64_t)ret_conv;
12162 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
12163 LDKUpdateAddHTLC o_conv;
12164 o_conv.inner = (void*)(o & (~1));
12165 o_conv.is_owned = (o & 1) || (o == 0);
12166 o_conv = UpdateAddHTLC_clone(&o_conv);
12167 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12168 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
12169 return (uint64_t)ret_conv;
12172 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
12173 LDKDecodeError e_conv;
12174 e_conv.inner = (void*)(e & (~1));
12175 e_conv.is_owned = (e & 1) || (e == 0);
12176 e_conv = DecodeError_clone(&e_conv);
12177 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12178 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
12179 return (uint64_t)ret_conv;
12182 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
12183 if ((_res & 1) != 0) return;
12184 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12185 CHECK_ACCESS(_res_ptr);
12186 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
12188 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
12191 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
12192 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
12193 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12194 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
12195 return (uint64_t)ret_conv;
12198 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
12200 o_conv.inner = (void*)(o & (~1));
12201 o_conv.is_owned = (o & 1) || (o == 0);
12202 o_conv = Ping_clone(&o_conv);
12203 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12204 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
12205 return (uint64_t)ret_conv;
12208 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
12209 LDKDecodeError e_conv;
12210 e_conv.inner = (void*)(e & (~1));
12211 e_conv.is_owned = (e & 1) || (e == 0);
12212 e_conv = DecodeError_clone(&e_conv);
12213 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12214 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
12215 return (uint64_t)ret_conv;
12218 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
12219 if ((_res & 1) != 0) return;
12220 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12221 CHECK_ACCESS(_res_ptr);
12222 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
12224 CResult_PingDecodeErrorZ_free(_res_conv);
12227 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
12228 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
12229 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12230 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
12231 return (uint64_t)ret_conv;
12234 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
12236 o_conv.inner = (void*)(o & (~1));
12237 o_conv.is_owned = (o & 1) || (o == 0);
12238 o_conv = Pong_clone(&o_conv);
12239 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12240 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
12241 return (uint64_t)ret_conv;
12244 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
12245 LDKDecodeError e_conv;
12246 e_conv.inner = (void*)(e & (~1));
12247 e_conv.is_owned = (e & 1) || (e == 0);
12248 e_conv = DecodeError_clone(&e_conv);
12249 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12250 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
12251 return (uint64_t)ret_conv;
12254 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
12255 if ((_res & 1) != 0) return;
12256 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12257 CHECK_ACCESS(_res_ptr);
12258 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
12260 CResult_PongDecodeErrorZ_free(_res_conv);
12263 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
12264 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
12265 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12266 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
12267 return (uint64_t)ret_conv;
12270 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
12271 LDKUnsignedChannelAnnouncement o_conv;
12272 o_conv.inner = (void*)(o & (~1));
12273 o_conv.is_owned = (o & 1) || (o == 0);
12274 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
12275 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12276 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
12277 return (uint64_t)ret_conv;
12280 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
12281 LDKDecodeError e_conv;
12282 e_conv.inner = (void*)(e & (~1));
12283 e_conv.is_owned = (e & 1) || (e == 0);
12284 e_conv = DecodeError_clone(&e_conv);
12285 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12286 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
12287 return (uint64_t)ret_conv;
12290 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
12291 if ((_res & 1) != 0) return;
12292 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12293 CHECK_ACCESS(_res_ptr);
12294 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
12296 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
12299 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
12300 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
12301 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12302 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
12303 return (uint64_t)ret_conv;
12306 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
12307 LDKChannelAnnouncement o_conv;
12308 o_conv.inner = (void*)(o & (~1));
12309 o_conv.is_owned = (o & 1) || (o == 0);
12310 o_conv = ChannelAnnouncement_clone(&o_conv);
12311 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12312 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
12313 return (uint64_t)ret_conv;
12316 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
12317 LDKDecodeError e_conv;
12318 e_conv.inner = (void*)(e & (~1));
12319 e_conv.is_owned = (e & 1) || (e == 0);
12320 e_conv = DecodeError_clone(&e_conv);
12321 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12322 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
12323 return (uint64_t)ret_conv;
12326 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
12327 if ((_res & 1) != 0) return;
12328 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12329 CHECK_ACCESS(_res_ptr);
12330 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
12332 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
12335 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
12336 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
12337 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12338 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
12339 return (uint64_t)ret_conv;
12342 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
12343 LDKUnsignedChannelUpdate o_conv;
12344 o_conv.inner = (void*)(o & (~1));
12345 o_conv.is_owned = (o & 1) || (o == 0);
12346 o_conv = UnsignedChannelUpdate_clone(&o_conv);
12347 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12348 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
12349 return (uint64_t)ret_conv;
12352 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
12353 LDKDecodeError e_conv;
12354 e_conv.inner = (void*)(e & (~1));
12355 e_conv.is_owned = (e & 1) || (e == 0);
12356 e_conv = DecodeError_clone(&e_conv);
12357 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12358 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
12359 return (uint64_t)ret_conv;
12362 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
12363 if ((_res & 1) != 0) return;
12364 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12365 CHECK_ACCESS(_res_ptr);
12366 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
12368 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
12371 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
12372 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
12373 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12374 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
12375 return (uint64_t)ret_conv;
12378 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
12379 LDKChannelUpdate o_conv;
12380 o_conv.inner = (void*)(o & (~1));
12381 o_conv.is_owned = (o & 1) || (o == 0);
12382 o_conv = ChannelUpdate_clone(&o_conv);
12383 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12384 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
12385 return (uint64_t)ret_conv;
12388 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
12389 LDKDecodeError e_conv;
12390 e_conv.inner = (void*)(e & (~1));
12391 e_conv.is_owned = (e & 1) || (e == 0);
12392 e_conv = DecodeError_clone(&e_conv);
12393 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12394 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
12395 return (uint64_t)ret_conv;
12398 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
12399 if ((_res & 1) != 0) return;
12400 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12401 CHECK_ACCESS(_res_ptr);
12402 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
12404 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
12407 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
12408 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
12409 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12410 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
12411 return (uint64_t)ret_conv;
12414 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
12415 LDKErrorMessage o_conv;
12416 o_conv.inner = (void*)(o & (~1));
12417 o_conv.is_owned = (o & 1) || (o == 0);
12418 o_conv = ErrorMessage_clone(&o_conv);
12419 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12420 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
12421 return (uint64_t)ret_conv;
12424 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
12425 LDKDecodeError e_conv;
12426 e_conv.inner = (void*)(e & (~1));
12427 e_conv.is_owned = (e & 1) || (e == 0);
12428 e_conv = DecodeError_clone(&e_conv);
12429 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12430 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
12431 return (uint64_t)ret_conv;
12434 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
12435 if ((_res & 1) != 0) return;
12436 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12437 CHECK_ACCESS(_res_ptr);
12438 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
12440 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
12443 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
12444 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
12445 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12446 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
12447 return (uint64_t)ret_conv;
12450 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
12451 LDKUnsignedNodeAnnouncement o_conv;
12452 o_conv.inner = (void*)(o & (~1));
12453 o_conv.is_owned = (o & 1) || (o == 0);
12454 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
12455 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12456 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
12457 return (uint64_t)ret_conv;
12460 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
12461 LDKDecodeError e_conv;
12462 e_conv.inner = (void*)(e & (~1));
12463 e_conv.is_owned = (e & 1) || (e == 0);
12464 e_conv = DecodeError_clone(&e_conv);
12465 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12466 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
12467 return (uint64_t)ret_conv;
12470 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
12471 if ((_res & 1) != 0) return;
12472 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12473 CHECK_ACCESS(_res_ptr);
12474 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
12476 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
12479 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
12480 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
12481 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12482 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
12483 return (uint64_t)ret_conv;
12486 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
12487 LDKNodeAnnouncement o_conv;
12488 o_conv.inner = (void*)(o & (~1));
12489 o_conv.is_owned = (o & 1) || (o == 0);
12490 o_conv = NodeAnnouncement_clone(&o_conv);
12491 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12492 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
12493 return (uint64_t)ret_conv;
12496 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
12497 LDKDecodeError e_conv;
12498 e_conv.inner = (void*)(e & (~1));
12499 e_conv.is_owned = (e & 1) || (e == 0);
12500 e_conv = DecodeError_clone(&e_conv);
12501 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12502 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
12503 return (uint64_t)ret_conv;
12506 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
12507 if ((_res & 1) != 0) return;
12508 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12509 CHECK_ACCESS(_res_ptr);
12510 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
12512 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
12515 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
12516 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
12517 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12518 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
12519 return (uint64_t)ret_conv;
12522 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
12523 LDKQueryShortChannelIds o_conv;
12524 o_conv.inner = (void*)(o & (~1));
12525 o_conv.is_owned = (o & 1) || (o == 0);
12526 o_conv = QueryShortChannelIds_clone(&o_conv);
12527 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12528 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
12529 return (uint64_t)ret_conv;
12532 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
12533 LDKDecodeError e_conv;
12534 e_conv.inner = (void*)(e & (~1));
12535 e_conv.is_owned = (e & 1) || (e == 0);
12536 e_conv = DecodeError_clone(&e_conv);
12537 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12538 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
12539 return (uint64_t)ret_conv;
12542 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
12543 if ((_res & 1) != 0) return;
12544 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12545 CHECK_ACCESS(_res_ptr);
12546 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
12548 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
12551 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
12552 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
12553 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12554 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
12555 return (uint64_t)ret_conv;
12558 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
12559 LDKReplyShortChannelIdsEnd o_conv;
12560 o_conv.inner = (void*)(o & (~1));
12561 o_conv.is_owned = (o & 1) || (o == 0);
12562 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
12563 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12564 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
12565 return (uint64_t)ret_conv;
12568 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
12569 LDKDecodeError e_conv;
12570 e_conv.inner = (void*)(e & (~1));
12571 e_conv.is_owned = (e & 1) || (e == 0);
12572 e_conv = DecodeError_clone(&e_conv);
12573 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12574 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
12575 return (uint64_t)ret_conv;
12578 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
12579 if ((_res & 1) != 0) return;
12580 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12581 CHECK_ACCESS(_res_ptr);
12582 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
12584 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
12587 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
12588 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
12589 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12590 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
12591 return (uint64_t)ret_conv;
12594 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
12595 LDKQueryChannelRange o_conv;
12596 o_conv.inner = (void*)(o & (~1));
12597 o_conv.is_owned = (o & 1) || (o == 0);
12598 o_conv = QueryChannelRange_clone(&o_conv);
12599 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12600 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
12601 return (uint64_t)ret_conv;
12604 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
12605 LDKDecodeError e_conv;
12606 e_conv.inner = (void*)(e & (~1));
12607 e_conv.is_owned = (e & 1) || (e == 0);
12608 e_conv = DecodeError_clone(&e_conv);
12609 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12610 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
12611 return (uint64_t)ret_conv;
12614 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
12615 if ((_res & 1) != 0) return;
12616 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12617 CHECK_ACCESS(_res_ptr);
12618 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
12620 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
12623 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
12624 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
12625 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12626 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
12627 return (uint64_t)ret_conv;
12630 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
12631 LDKReplyChannelRange o_conv;
12632 o_conv.inner = (void*)(o & (~1));
12633 o_conv.is_owned = (o & 1) || (o == 0);
12634 o_conv = ReplyChannelRange_clone(&o_conv);
12635 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12636 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
12637 return (uint64_t)ret_conv;
12640 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
12641 LDKDecodeError e_conv;
12642 e_conv.inner = (void*)(e & (~1));
12643 e_conv.is_owned = (e & 1) || (e == 0);
12644 e_conv = DecodeError_clone(&e_conv);
12645 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12646 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
12647 return (uint64_t)ret_conv;
12650 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
12651 if ((_res & 1) != 0) return;
12652 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12653 CHECK_ACCESS(_res_ptr);
12654 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
12656 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
12659 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
12660 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
12661 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12662 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
12663 return (uint64_t)ret_conv;
12666 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
12667 LDKGossipTimestampFilter o_conv;
12668 o_conv.inner = (void*)(o & (~1));
12669 o_conv.is_owned = (o & 1) || (o == 0);
12670 o_conv = GossipTimestampFilter_clone(&o_conv);
12671 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12672 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
12673 return (uint64_t)ret_conv;
12676 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
12677 LDKDecodeError e_conv;
12678 e_conv.inner = (void*)(e & (~1));
12679 e_conv.is_owned = (e & 1) || (e == 0);
12680 e_conv = DecodeError_clone(&e_conv);
12681 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12682 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
12683 return (uint64_t)ret_conv;
12686 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
12687 if ((_res & 1) != 0) return;
12688 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12689 CHECK_ACCESS(_res_ptr);
12690 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
12692 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
12695 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
12696 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
12697 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12698 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
12699 return (uint64_t)ret_conv;
12702 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
12704 o_conv.inner = (void*)(o & (~1));
12705 o_conv.is_owned = (o & 1) || (o == 0);
12706 o_conv = Invoice_clone(&o_conv);
12707 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12708 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
12709 return (uint64_t)ret_conv;
12712 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
12713 void* e_ptr = (void*)(((uint64_t)e) & ~1);
12714 CHECK_ACCESS(e_ptr);
12715 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
12716 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
12717 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12718 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
12719 return (uint64_t)ret_conv;
12722 void __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
12723 if ((_res & 1) != 0) return;
12724 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12725 CHECK_ACCESS(_res_ptr);
12726 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
12728 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
12731 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
12732 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
12733 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12734 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
12735 return (uint64_t)ret_conv;
12738 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_some(uint32_t o) {
12739 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12740 CHECK_ACCESS(o_ptr);
12741 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
12742 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
12743 *ret_copy = COption_FilterZ_some(o_conv);
12744 uint64_t ret_ref = (uint64_t)ret_copy;
12748 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_none() {
12749 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
12750 *ret_copy = COption_FilterZ_none();
12751 uint64_t ret_ref = (uint64_t)ret_copy;
12755 void __attribute__((visibility("default"))) TS_COption_FilterZ_free(uint32_t _res) {
12756 if ((_res & 1) != 0) return;
12757 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12758 CHECK_ACCESS(_res_ptr);
12759 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
12761 COption_FilterZ_free(_res_conv);
12764 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
12765 LDKLockedChannelMonitor o_conv;
12766 o_conv.inner = (void*)(o & (~1));
12767 o_conv.is_owned = (o & 1) || (o == 0);
12768 // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor
12769 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
12770 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
12771 return (uint64_t)ret_conv;
12774 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
12775 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
12776 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
12777 return (uint64_t)ret_conv;
12780 void __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
12781 if ((_res & 1) != 0) return;
12782 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12783 CHECK_ACCESS(_res_ptr);
12784 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
12786 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
12789 void __attribute__((visibility("default"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
12790 LDKCVec_OutPointZ _res_constr;
12791 _res_constr.datalen = *((uint32_t*)_res);
12792 if (_res_constr.datalen > 0)
12793 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
12795 _res_constr.data = NULL;
12796 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12797 for (size_t k = 0; k < _res_constr.datalen; k++) {
12798 uint32_t _res_conv_10 = _res_vals[k];
12799 LDKOutPoint _res_conv_10_conv;
12800 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
12801 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
12802 _res_constr.data[k] = _res_conv_10_conv;
12804 CVec_OutPointZ_free(_res_constr);
12807 void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
12808 if ((this_ptr & 1) != 0) return;
12809 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
12810 CHECK_ACCESS(this_ptr_ptr);
12811 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
12812 FREE((void*)this_ptr);
12813 PaymentPurpose_free(this_ptr_conv);
12816 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) {
12817 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
12818 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
12819 *ret_copy = PaymentPurpose_clone(orig_conv);
12820 uint64_t ret_ref = (uint64_t)ret_copy;
12824 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
12825 LDKThirtyTwoBytes payment_preimage_ref;
12826 CHECK(*((uint32_t*)payment_preimage) == 32);
12827 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
12828 LDKThirtyTwoBytes payment_secret_ref;
12829 CHECK(*((uint32_t*)payment_secret) == 32);
12830 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
12831 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
12832 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
12833 uint64_t ret_ref = (uint64_t)ret_copy;
12837 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
12838 LDKThirtyTwoBytes a_ref;
12839 CHECK(*((uint32_t*)a) == 32);
12840 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
12841 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
12842 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
12843 uint64_t ret_ref = (uint64_t)ret_copy;
12847 void __attribute__((visibility("default"))) TS_ClosureReason_free(uint32_t this_ptr) {
12848 if ((this_ptr & 1) != 0) return;
12849 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
12850 CHECK_ACCESS(this_ptr_ptr);
12851 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
12852 FREE((void*)this_ptr);
12853 ClosureReason_free(this_ptr_conv);
12856 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_clone(uint32_t orig) {
12857 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
12858 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12859 *ret_copy = ClosureReason_clone(orig_conv);
12860 uint64_t ret_ref = (uint64_t)ret_copy;
12864 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
12865 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
12866 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12867 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
12868 uint64_t ret_ref = (uint64_t)ret_copy;
12872 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_holder_force_closed() {
12873 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12874 *ret_copy = ClosureReason_holder_force_closed();
12875 uint64_t ret_ref = (uint64_t)ret_copy;
12879 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_cooperative_closure() {
12880 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12881 *ret_copy = ClosureReason_cooperative_closure();
12882 uint64_t ret_ref = (uint64_t)ret_copy;
12886 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_commitment_tx_confirmed() {
12887 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12888 *ret_copy = ClosureReason_commitment_tx_confirmed();
12889 uint64_t ret_ref = (uint64_t)ret_copy;
12893 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_processing_error(jstring err) {
12894 LDKStr err_conv = str_ref_to_owned_c(err);
12895 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12896 *ret_copy = ClosureReason_processing_error(err_conv);
12897 uint64_t ret_ref = (uint64_t)ret_copy;
12901 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_disconnected_peer() {
12902 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12903 *ret_copy = ClosureReason_disconnected_peer();
12904 uint64_t ret_ref = (uint64_t)ret_copy;
12908 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_outdated_channel_manager() {
12909 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12910 *ret_copy = ClosureReason_outdated_channel_manager();
12911 uint64_t ret_ref = (uint64_t)ret_copy;
12915 int8_tArray __attribute__((visibility("default"))) TS_ClosureReason_write(uint32_t obj) {
12916 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
12917 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
12918 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12919 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12920 CVec_u8Z_free(ret_var);
12924 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
12925 if ((this_ptr & 1) != 0) return;
12926 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
12927 CHECK_ACCESS(this_ptr_ptr);
12928 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
12929 FREE((void*)this_ptr);
12930 Event_free(this_ptr_conv);
12933 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
12934 LDKEvent* orig_conv = (LDKEvent*)orig;
12935 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12936 *ret_copy = Event_clone(orig_conv);
12937 uint64_t ret_ref = (uint64_t)ret_copy;
12941 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) {
12942 LDKThirtyTwoBytes temporary_channel_id_ref;
12943 CHECK(*((uint32_t*)temporary_channel_id) == 32);
12944 memcpy(temporary_channel_id_ref.data, (uint8_t*)(temporary_channel_id + 4), 32);
12945 LDKCVec_u8Z output_script_ref;
12946 output_script_ref.datalen = *((uint32_t*)output_script);
12947 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
12948 memcpy(output_script_ref.data, (uint8_t*)(output_script + 4), output_script_ref.datalen);
12949 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12950 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
12951 uint64_t ret_ref = (uint64_t)ret_copy;
12955 uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
12956 LDKThirtyTwoBytes payment_hash_ref;
12957 CHECK(*((uint32_t*)payment_hash) == 32);
12958 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
12959 void* purpose_ptr = (void*)(((uint64_t)purpose) & ~1);
12960 CHECK_ACCESS(purpose_ptr);
12961 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
12962 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
12963 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12964 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
12965 uint64_t ret_ref = (uint64_t)ret_copy;
12969 uint32_t __attribute__((visibility("default"))) TS_Event_payment_sent(int8_tArray payment_preimage, int8_tArray payment_hash) {
12970 LDKThirtyTwoBytes payment_preimage_ref;
12971 CHECK(*((uint32_t*)payment_preimage) == 32);
12972 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
12973 LDKThirtyTwoBytes payment_hash_ref;
12974 CHECK(*((uint32_t*)payment_hash) == 32);
12975 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
12976 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12977 *ret_copy = Event_payment_sent(payment_preimage_ref, payment_hash_ref);
12978 uint64_t ret_ref = (uint64_t)ret_copy;
12982 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) {
12983 LDKThirtyTwoBytes payment_hash_ref;
12984 CHECK(*((uint32_t*)payment_hash) == 32);
12985 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
12986 void* network_update_ptr = (void*)(((uint64_t)network_update) & ~1);
12987 CHECK_ACCESS(network_update_ptr);
12988 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
12989 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
12990 LDKCVec_RouteHopZ path_constr;
12991 path_constr.datalen = *((uint32_t*)path);
12992 if (path_constr.datalen > 0)
12993 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12995 path_constr.data = NULL;
12996 uint32_t* path_vals = (uint32_t*)(path + 4);
12997 for (size_t k = 0; k < path_constr.datalen; k++) {
12998 uint32_t path_conv_10 = path_vals[k];
12999 LDKRouteHop path_conv_10_conv;
13000 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
13001 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
13002 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
13003 path_constr.data[k] = path_conv_10_conv;
13005 void* short_channel_id_ptr = (void*)(((uint64_t)short_channel_id) & ~1);
13006 CHECK_ACCESS(short_channel_id_ptr);
13007 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
13008 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1));
13009 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13010 *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv);
13011 uint64_t ret_ref = (uint64_t)ret_copy;
13015 uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
13016 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13017 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
13018 uint64_t ret_ref = (uint64_t)ret_copy;
13022 uint32_t __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
13023 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
13024 outputs_constr.datalen = *((uint32_t*)outputs);
13025 if (outputs_constr.datalen > 0)
13026 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13028 outputs_constr.data = NULL;
13029 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
13030 for (size_t b = 0; b < outputs_constr.datalen; b++) {
13031 uint32_t outputs_conv_27 = outputs_vals[b];
13032 void* outputs_conv_27_ptr = (void*)(((uint64_t)outputs_conv_27) & ~1);
13033 CHECK_ACCESS(outputs_conv_27_ptr);
13034 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
13035 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
13036 outputs_constr.data[b] = outputs_conv_27_conv;
13038 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13039 *ret_copy = Event_spendable_outputs(outputs_constr);
13040 uint64_t ret_ref = (uint64_t)ret_copy;
13044 uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
13045 void* fee_earned_msat_ptr = (void*)(((uint64_t)fee_earned_msat) & ~1);
13046 CHECK_ACCESS(fee_earned_msat_ptr);
13047 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
13048 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
13049 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13050 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
13051 uint64_t ret_ref = (uint64_t)ret_copy;
13055 uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, int64_t user_channel_id, uint32_t reason) {
13056 LDKThirtyTwoBytes channel_id_ref;
13057 CHECK(*((uint32_t*)channel_id) == 32);
13058 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
13059 void* reason_ptr = (void*)(((uint64_t)reason) & ~1);
13060 CHECK_ACCESS(reason_ptr);
13061 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
13062 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
13063 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13064 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
13065 uint64_t ret_ref = (uint64_t)ret_copy;
13069 uint32_t __attribute__((visibility("default"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
13070 LDKThirtyTwoBytes channel_id_ref;
13071 CHECK(*((uint32_t*)channel_id) == 32);
13072 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
13073 LDKTransaction transaction_ref;
13074 transaction_ref.datalen = *((uint32_t*)transaction);
13075 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
13076 memcpy(transaction_ref.data, (uint8_t*)(transaction + 4), transaction_ref.datalen);
13077 transaction_ref.data_is_owned = true;
13078 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13079 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
13080 uint64_t ret_ref = (uint64_t)ret_copy;
13084 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
13085 LDKEvent* obj_conv = (LDKEvent*)obj;
13086 LDKCVec_u8Z ret_var = Event_write(obj_conv);
13087 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13088 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13089 CVec_u8Z_free(ret_var);
13093 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
13094 if ((this_ptr & 1) != 0) return;
13095 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
13096 CHECK_ACCESS(this_ptr_ptr);
13097 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
13098 FREE((void*)this_ptr);
13099 MessageSendEvent_free(this_ptr_conv);
13102 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
13103 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
13104 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13105 *ret_copy = MessageSendEvent_clone(orig_conv);
13106 uint64_t ret_ref = (uint64_t)ret_copy;
13110 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
13111 LDKPublicKey node_id_ref;
13112 CHECK(*((uint32_t*)node_id) == 33);
13113 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13114 LDKAcceptChannel msg_conv;
13115 msg_conv.inner = (void*)(msg & (~1));
13116 msg_conv.is_owned = (msg & 1) || (msg == 0);
13117 msg_conv = AcceptChannel_clone(&msg_conv);
13118 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13119 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
13120 uint64_t ret_ref = (uint64_t)ret_copy;
13124 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
13125 LDKPublicKey node_id_ref;
13126 CHECK(*((uint32_t*)node_id) == 33);
13127 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13128 LDKOpenChannel msg_conv;
13129 msg_conv.inner = (void*)(msg & (~1));
13130 msg_conv.is_owned = (msg & 1) || (msg == 0);
13131 msg_conv = OpenChannel_clone(&msg_conv);
13132 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13133 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
13134 uint64_t ret_ref = (uint64_t)ret_copy;
13138 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
13139 LDKPublicKey node_id_ref;
13140 CHECK(*((uint32_t*)node_id) == 33);
13141 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13142 LDKFundingCreated msg_conv;
13143 msg_conv.inner = (void*)(msg & (~1));
13144 msg_conv.is_owned = (msg & 1) || (msg == 0);
13145 msg_conv = FundingCreated_clone(&msg_conv);
13146 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13147 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
13148 uint64_t ret_ref = (uint64_t)ret_copy;
13152 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
13153 LDKPublicKey node_id_ref;
13154 CHECK(*((uint32_t*)node_id) == 33);
13155 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13156 LDKFundingSigned msg_conv;
13157 msg_conv.inner = (void*)(msg & (~1));
13158 msg_conv.is_owned = (msg & 1) || (msg == 0);
13159 msg_conv = FundingSigned_clone(&msg_conv);
13160 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13161 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
13162 uint64_t ret_ref = (uint64_t)ret_copy;
13166 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
13167 LDKPublicKey node_id_ref;
13168 CHECK(*((uint32_t*)node_id) == 33);
13169 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13170 LDKFundingLocked msg_conv;
13171 msg_conv.inner = (void*)(msg & (~1));
13172 msg_conv.is_owned = (msg & 1) || (msg == 0);
13173 msg_conv = FundingLocked_clone(&msg_conv);
13174 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13175 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
13176 uint64_t ret_ref = (uint64_t)ret_copy;
13180 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
13181 LDKPublicKey node_id_ref;
13182 CHECK(*((uint32_t*)node_id) == 33);
13183 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13184 LDKAnnouncementSignatures msg_conv;
13185 msg_conv.inner = (void*)(msg & (~1));
13186 msg_conv.is_owned = (msg & 1) || (msg == 0);
13187 msg_conv = AnnouncementSignatures_clone(&msg_conv);
13188 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13189 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
13190 uint64_t ret_ref = (uint64_t)ret_copy;
13194 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
13195 LDKPublicKey node_id_ref;
13196 CHECK(*((uint32_t*)node_id) == 33);
13197 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13198 LDKCommitmentUpdate updates_conv;
13199 updates_conv.inner = (void*)(updates & (~1));
13200 updates_conv.is_owned = (updates & 1) || (updates == 0);
13201 updates_conv = CommitmentUpdate_clone(&updates_conv);
13202 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13203 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
13204 uint64_t ret_ref = (uint64_t)ret_copy;
13208 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
13209 LDKPublicKey node_id_ref;
13210 CHECK(*((uint32_t*)node_id) == 33);
13211 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13212 LDKRevokeAndACK msg_conv;
13213 msg_conv.inner = (void*)(msg & (~1));
13214 msg_conv.is_owned = (msg & 1) || (msg == 0);
13215 msg_conv = RevokeAndACK_clone(&msg_conv);
13216 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13217 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
13218 uint64_t ret_ref = (uint64_t)ret_copy;
13222 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
13223 LDKPublicKey node_id_ref;
13224 CHECK(*((uint32_t*)node_id) == 33);
13225 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13226 LDKClosingSigned msg_conv;
13227 msg_conv.inner = (void*)(msg & (~1));
13228 msg_conv.is_owned = (msg & 1) || (msg == 0);
13229 msg_conv = ClosingSigned_clone(&msg_conv);
13230 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13231 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
13232 uint64_t ret_ref = (uint64_t)ret_copy;
13236 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
13237 LDKPublicKey node_id_ref;
13238 CHECK(*((uint32_t*)node_id) == 33);
13239 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13240 LDKShutdown msg_conv;
13241 msg_conv.inner = (void*)(msg & (~1));
13242 msg_conv.is_owned = (msg & 1) || (msg == 0);
13243 msg_conv = Shutdown_clone(&msg_conv);
13244 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13245 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
13246 uint64_t ret_ref = (uint64_t)ret_copy;
13250 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
13251 LDKPublicKey node_id_ref;
13252 CHECK(*((uint32_t*)node_id) == 33);
13253 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13254 LDKChannelReestablish msg_conv;
13255 msg_conv.inner = (void*)(msg & (~1));
13256 msg_conv.is_owned = (msg & 1) || (msg == 0);
13257 msg_conv = ChannelReestablish_clone(&msg_conv);
13258 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13259 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
13260 uint64_t ret_ref = (uint64_t)ret_copy;
13264 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
13265 LDKChannelAnnouncement msg_conv;
13266 msg_conv.inner = (void*)(msg & (~1));
13267 msg_conv.is_owned = (msg & 1) || (msg == 0);
13268 msg_conv = ChannelAnnouncement_clone(&msg_conv);
13269 LDKChannelUpdate update_msg_conv;
13270 update_msg_conv.inner = (void*)(update_msg & (~1));
13271 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
13272 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
13273 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13274 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
13275 uint64_t ret_ref = (uint64_t)ret_copy;
13279 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
13280 LDKNodeAnnouncement msg_conv;
13281 msg_conv.inner = (void*)(msg & (~1));
13282 msg_conv.is_owned = (msg & 1) || (msg == 0);
13283 msg_conv = NodeAnnouncement_clone(&msg_conv);
13284 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13285 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
13286 uint64_t ret_ref = (uint64_t)ret_copy;
13290 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
13291 LDKChannelUpdate msg_conv;
13292 msg_conv.inner = (void*)(msg & (~1));
13293 msg_conv.is_owned = (msg & 1) || (msg == 0);
13294 msg_conv = ChannelUpdate_clone(&msg_conv);
13295 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13296 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
13297 uint64_t ret_ref = (uint64_t)ret_copy;
13301 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
13302 LDKPublicKey node_id_ref;
13303 CHECK(*((uint32_t*)node_id) == 33);
13304 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13305 LDKChannelUpdate msg_conv;
13306 msg_conv.inner = (void*)(msg & (~1));
13307 msg_conv.is_owned = (msg & 1) || (msg == 0);
13308 msg_conv = ChannelUpdate_clone(&msg_conv);
13309 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13310 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
13311 uint64_t ret_ref = (uint64_t)ret_copy;
13315 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
13316 LDKPublicKey node_id_ref;
13317 CHECK(*((uint32_t*)node_id) == 33);
13318 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13319 void* action_ptr = (void*)(((uint64_t)action) & ~1);
13320 CHECK_ACCESS(action_ptr);
13321 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
13322 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
13323 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13324 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
13325 uint64_t ret_ref = (uint64_t)ret_copy;
13329 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
13330 LDKPublicKey node_id_ref;
13331 CHECK(*((uint32_t*)node_id) == 33);
13332 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13333 LDKQueryChannelRange msg_conv;
13334 msg_conv.inner = (void*)(msg & (~1));
13335 msg_conv.is_owned = (msg & 1) || (msg == 0);
13336 msg_conv = QueryChannelRange_clone(&msg_conv);
13337 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13338 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
13339 uint64_t ret_ref = (uint64_t)ret_copy;
13343 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
13344 LDKPublicKey node_id_ref;
13345 CHECK(*((uint32_t*)node_id) == 33);
13346 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13347 LDKQueryShortChannelIds msg_conv;
13348 msg_conv.inner = (void*)(msg & (~1));
13349 msg_conv.is_owned = (msg & 1) || (msg == 0);
13350 msg_conv = QueryShortChannelIds_clone(&msg_conv);
13351 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13352 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
13353 uint64_t ret_ref = (uint64_t)ret_copy;
13357 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
13358 LDKPublicKey node_id_ref;
13359 CHECK(*((uint32_t*)node_id) == 33);
13360 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
13361 LDKReplyChannelRange msg_conv;
13362 msg_conv.inner = (void*)(msg & (~1));
13363 msg_conv.is_owned = (msg & 1) || (msg == 0);
13364 msg_conv = ReplyChannelRange_clone(&msg_conv);
13365 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13366 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
13367 uint64_t ret_ref = (uint64_t)ret_copy;
13371 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
13372 if ((this_ptr & 1) != 0) return;
13373 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
13374 CHECK_ACCESS(this_ptr_ptr);
13375 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
13376 FREE((void*)this_ptr);
13377 MessageSendEventsProvider_free(this_ptr_conv);
13380 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
13381 if ((this_ptr & 1) != 0) return;
13382 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
13383 CHECK_ACCESS(this_ptr_ptr);
13384 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
13385 FREE((void*)this_ptr);
13386 EventsProvider_free(this_ptr_conv);
13389 void __attribute__((visibility("default"))) TS_EventHandler_free(uint32_t this_ptr) {
13390 if ((this_ptr & 1) != 0) return;
13391 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
13392 CHECK_ACCESS(this_ptr_ptr);
13393 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
13394 FREE((void*)this_ptr);
13395 EventHandler_free(this_ptr_conv);
13398 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
13399 if ((this_ptr & 1) != 0) return;
13400 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
13401 CHECK_ACCESS(this_ptr_ptr);
13402 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
13403 FREE((void*)this_ptr);
13404 APIError_free(this_ptr_conv);
13407 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
13408 LDKAPIError* orig_conv = (LDKAPIError*)orig;
13409 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13410 *ret_copy = APIError_clone(orig_conv);
13411 uint64_t ret_ref = (uint64_t)ret_copy;
13415 uint32_t __attribute__((visibility("default"))) TS_APIError_apimisuse_error(jstring err) {
13416 LDKStr err_conv = str_ref_to_owned_c(err);
13417 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13418 *ret_copy = APIError_apimisuse_error(err_conv);
13419 uint64_t ret_ref = (uint64_t)ret_copy;
13423 uint32_t __attribute__((visibility("default"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
13424 LDKStr err_conv = str_ref_to_owned_c(err);
13425 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13426 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
13427 uint64_t ret_ref = (uint64_t)ret_copy;
13431 uint32_t __attribute__((visibility("default"))) TS_APIError_route_error(jstring err) {
13432 LDKStr err_conv = str_ref_to_owned_c(err);
13433 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13434 *ret_copy = APIError_route_error(err_conv);
13435 uint64_t ret_ref = (uint64_t)ret_copy;
13439 uint32_t __attribute__((visibility("default"))) TS_APIError_channel_unavailable(jstring err) {
13440 LDKStr err_conv = str_ref_to_owned_c(err);
13441 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13442 *ret_copy = APIError_channel_unavailable(err_conv);
13443 uint64_t ret_ref = (uint64_t)ret_copy;
13447 uint32_t __attribute__((visibility("default"))) TS_APIError_monitor_update_failed() {
13448 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13449 *ret_copy = APIError_monitor_update_failed();
13450 uint64_t ret_ref = (uint64_t)ret_copy;
13454 uint32_t __attribute__((visibility("default"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
13455 LDKShutdownScript script_conv;
13456 script_conv.inner = (void*)(script & (~1));
13457 script_conv.is_owned = (script & 1) || (script == 0);
13458 script_conv = ShutdownScript_clone(&script_conv);
13459 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13460 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
13461 uint64_t ret_ref = (uint64_t)ret_copy;
13465 uint32_t __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
13466 LDKu8slice msg_ref;
13467 msg_ref.datalen = *((uint32_t*)msg);
13468 msg_ref.data = (int8_t*)(msg + 4);
13469 unsigned char sk_arr[32];
13470 CHECK(*((uint32_t*)sk) == 32);
13471 memcpy(sk_arr, (uint8_t*)(sk + 4), 32);
13472 unsigned char (*sk_ref)[32] = &sk_arr;
13473 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
13474 *ret_conv = sign(msg_ref, sk_ref);
13475 return (uint64_t)ret_conv;
13478 uint32_t __attribute__((visibility("default"))) TS_recover_pk(int8_tArray msg, jstring sig) {
13479 LDKu8slice msg_ref;
13480 msg_ref.datalen = *((uint32_t*)msg);
13481 msg_ref.data = (int8_t*)(msg + 4);
13482 LDKStr sig_conv = str_ref_to_owned_c(sig);
13483 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13484 *ret_conv = recover_pk(msg_ref, sig_conv);
13485 return (uint64_t)ret_conv;
13488 jboolean __attribute__((visibility("default"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
13489 LDKu8slice msg_ref;
13490 msg_ref.datalen = *((uint32_t*)msg);
13491 msg_ref.data = (int8_t*)(msg + 4);
13492 LDKStr sig_conv = str_ref_to_owned_c(sig);
13493 LDKPublicKey pk_ref;
13494 CHECK(*((uint32_t*)pk) == 33);
13495 memcpy(pk_ref.compressed_form, (uint8_t*)(pk + 4), 33);
13496 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
13500 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
13501 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
13502 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
13506 uint32_t __attribute__((visibility("default"))) TS_Level_trace() {
13507 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
13511 uint32_t __attribute__((visibility("default"))) TS_Level_debug() {
13512 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
13516 uint32_t __attribute__((visibility("default"))) TS_Level_info() {
13517 uint32_t ret_conv = LDKLevel_to_js(Level_info());
13521 uint32_t __attribute__((visibility("default"))) TS_Level_warn() {
13522 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
13526 uint32_t __attribute__((visibility("default"))) TS_Level_error() {
13527 uint32_t ret_conv = LDKLevel_to_js(Level_error());
13531 jboolean __attribute__((visibility("default"))) TS_Level_eq(uint32_t a, uint32_t b) {
13532 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
13533 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
13534 jboolean ret_val = Level_eq(a_conv, b_conv);
13538 int64_t __attribute__((visibility("default"))) TS_Level_hash(uint32_t o) {
13539 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
13540 int64_t ret_val = Level_hash(o_conv);
13544 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
13545 uint32_t ret_conv = LDKLevel_to_js(Level_max());
13549 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
13550 if ((this_ptr & 1) != 0) return;
13551 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
13552 CHECK_ACCESS(this_ptr_ptr);
13553 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
13554 FREE((void*)this_ptr);
13555 Logger_free(this_ptr_conv);
13558 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
13559 LDKChannelHandshakeConfig this_obj_conv;
13560 this_obj_conv.inner = (void*)(this_obj & (~1));
13561 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13562 ChannelHandshakeConfig_free(this_obj_conv);
13565 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
13566 LDKChannelHandshakeConfig this_ptr_conv;
13567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13568 this_ptr_conv.is_owned = false;
13569 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
13573 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
13574 LDKChannelHandshakeConfig this_ptr_conv;
13575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13576 this_ptr_conv.is_owned = false;
13577 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
13580 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
13581 LDKChannelHandshakeConfig this_ptr_conv;
13582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13583 this_ptr_conv.is_owned = false;
13584 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
13588 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
13589 LDKChannelHandshakeConfig this_ptr_conv;
13590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13591 this_ptr_conv.is_owned = false;
13592 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
13595 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
13596 LDKChannelHandshakeConfig this_ptr_conv;
13597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13598 this_ptr_conv.is_owned = false;
13599 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
13603 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
13604 LDKChannelHandshakeConfig this_ptr_conv;
13605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13606 this_ptr_conv.is_owned = false;
13607 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
13610 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) {
13611 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
13612 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13613 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13614 uint64_t ret_ref = (uint64_t)ret_var.inner;
13615 if (ret_var.is_owned) {
13621 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
13622 LDKChannelHandshakeConfig orig_conv;
13623 orig_conv.inner = (void*)(orig & (~1));
13624 orig_conv.is_owned = false;
13625 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
13626 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13627 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13628 uint64_t ret_ref = (uint64_t)ret_var.inner;
13629 if (ret_var.is_owned) {
13635 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
13636 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
13637 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13638 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13639 uint64_t ret_ref = (uint64_t)ret_var.inner;
13640 if (ret_var.is_owned) {
13646 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
13647 LDKChannelHandshakeLimits this_obj_conv;
13648 this_obj_conv.inner = (void*)(this_obj & (~1));
13649 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13650 ChannelHandshakeLimits_free(this_obj_conv);
13653 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
13654 LDKChannelHandshakeLimits this_ptr_conv;
13655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13656 this_ptr_conv.is_owned = false;
13657 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
13661 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
13662 LDKChannelHandshakeLimits this_ptr_conv;
13663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13664 this_ptr_conv.is_owned = false;
13665 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
13668 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
13669 LDKChannelHandshakeLimits this_ptr_conv;
13670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13671 this_ptr_conv.is_owned = false;
13672 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
13676 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
13677 LDKChannelHandshakeLimits this_ptr_conv;
13678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13679 this_ptr_conv.is_owned = false;
13680 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
13683 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
13684 LDKChannelHandshakeLimits this_ptr_conv;
13685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13686 this_ptr_conv.is_owned = false;
13687 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
13691 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
13692 LDKChannelHandshakeLimits this_ptr_conv;
13693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13694 this_ptr_conv.is_owned = false;
13695 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
13698 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
13699 LDKChannelHandshakeLimits this_ptr_conv;
13700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13701 this_ptr_conv.is_owned = false;
13702 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
13706 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
13707 LDKChannelHandshakeLimits this_ptr_conv;
13708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13709 this_ptr_conv.is_owned = false;
13710 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
13713 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
13714 LDKChannelHandshakeLimits this_ptr_conv;
13715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13716 this_ptr_conv.is_owned = false;
13717 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
13721 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
13722 LDKChannelHandshakeLimits this_ptr_conv;
13723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13724 this_ptr_conv.is_owned = false;
13725 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
13728 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
13729 LDKChannelHandshakeLimits this_ptr_conv;
13730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13731 this_ptr_conv.is_owned = false;
13732 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
13736 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
13737 LDKChannelHandshakeLimits this_ptr_conv;
13738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13739 this_ptr_conv.is_owned = false;
13740 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
13743 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
13744 LDKChannelHandshakeLimits this_ptr_conv;
13745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13746 this_ptr_conv.is_owned = false;
13747 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
13751 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
13752 LDKChannelHandshakeLimits this_ptr_conv;
13753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13754 this_ptr_conv.is_owned = false;
13755 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
13758 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
13759 LDKChannelHandshakeLimits this_ptr_conv;
13760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13761 this_ptr_conv.is_owned = false;
13762 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
13766 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
13767 LDKChannelHandshakeLimits this_ptr_conv;
13768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13769 this_ptr_conv.is_owned = false;
13770 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
13773 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) {
13774 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);
13775 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13776 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13777 uint64_t ret_ref = (uint64_t)ret_var.inner;
13778 if (ret_var.is_owned) {
13784 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
13785 LDKChannelHandshakeLimits orig_conv;
13786 orig_conv.inner = (void*)(orig & (~1));
13787 orig_conv.is_owned = false;
13788 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
13789 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13790 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13791 uint64_t ret_ref = (uint64_t)ret_var.inner;
13792 if (ret_var.is_owned) {
13798 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
13799 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
13800 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13801 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13802 uint64_t ret_ref = (uint64_t)ret_var.inner;
13803 if (ret_var.is_owned) {
13809 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
13810 LDKChannelConfig this_obj_conv;
13811 this_obj_conv.inner = (void*)(this_obj & (~1));
13812 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13813 ChannelConfig_free(this_obj_conv);
13816 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
13817 LDKChannelConfig this_ptr_conv;
13818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13819 this_ptr_conv.is_owned = false;
13820 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
13824 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
13825 LDKChannelConfig this_ptr_conv;
13826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13827 this_ptr_conv.is_owned = false;
13828 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
13831 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
13832 LDKChannelConfig this_ptr_conv;
13833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13834 this_ptr_conv.is_owned = false;
13835 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
13839 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
13840 LDKChannelConfig this_ptr_conv;
13841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13842 this_ptr_conv.is_owned = false;
13843 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
13846 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
13847 LDKChannelConfig this_ptr_conv;
13848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13849 this_ptr_conv.is_owned = false;
13850 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
13854 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
13855 LDKChannelConfig this_ptr_conv;
13856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13857 this_ptr_conv.is_owned = false;
13858 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
13861 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
13862 LDKChannelConfig this_ptr_conv;
13863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13864 this_ptr_conv.is_owned = false;
13865 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
13869 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
13870 LDKChannelConfig this_ptr_conv;
13871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13872 this_ptr_conv.is_owned = false;
13873 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
13876 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
13877 LDKChannelConfig this_ptr_conv;
13878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13879 this_ptr_conv.is_owned = false;
13880 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
13884 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
13885 LDKChannelConfig this_ptr_conv;
13886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13887 this_ptr_conv.is_owned = false;
13888 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
13891 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
13892 LDKChannelConfig this_ptr_conv;
13893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13894 this_ptr_conv.is_owned = false;
13895 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
13899 void __attribute__((visibility("default"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
13900 LDKChannelConfig this_ptr_conv;
13901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13902 this_ptr_conv.is_owned = false;
13903 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
13906 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
13907 LDKChannelConfig this_ptr_conv;
13908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13909 this_ptr_conv.is_owned = false;
13910 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
13914 void __attribute__((visibility("default"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
13915 LDKChannelConfig this_ptr_conv;
13916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13917 this_ptr_conv.is_owned = false;
13918 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
13921 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) {
13922 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);
13923 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13924 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13925 uint64_t ret_ref = (uint64_t)ret_var.inner;
13926 if (ret_var.is_owned) {
13932 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
13933 LDKChannelConfig orig_conv;
13934 orig_conv.inner = (void*)(orig & (~1));
13935 orig_conv.is_owned = false;
13936 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
13937 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13938 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13939 uint64_t ret_ref = (uint64_t)ret_var.inner;
13940 if (ret_var.is_owned) {
13946 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
13947 LDKChannelConfig ret_var = ChannelConfig_default();
13948 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13949 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13950 uint64_t ret_ref = (uint64_t)ret_var.inner;
13951 if (ret_var.is_owned) {
13957 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
13958 LDKChannelConfig obj_conv;
13959 obj_conv.inner = (void*)(obj & (~1));
13960 obj_conv.is_owned = false;
13961 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
13962 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13963 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13964 CVec_u8Z_free(ret_var);
13968 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
13969 LDKu8slice ser_ref;
13970 ser_ref.datalen = *((uint32_t*)ser);
13971 ser_ref.data = (int8_t*)(ser + 4);
13972 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
13973 *ret_conv = ChannelConfig_read(ser_ref);
13974 return (uint64_t)ret_conv;
13977 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
13978 LDKUserConfig this_obj_conv;
13979 this_obj_conv.inner = (void*)(this_obj & (~1));
13980 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13981 UserConfig_free(this_obj_conv);
13984 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
13985 LDKUserConfig this_ptr_conv;
13986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13987 this_ptr_conv.is_owned = false;
13988 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
13989 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13990 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13991 uint64_t ret_ref = (uint64_t)ret_var.inner;
13992 if (ret_var.is_owned) {
13998 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
13999 LDKUserConfig this_ptr_conv;
14000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14001 this_ptr_conv.is_owned = false;
14002 LDKChannelHandshakeConfig val_conv;
14003 val_conv.inner = (void*)(val & (~1));
14004 val_conv.is_owned = (val & 1) || (val == 0);
14005 val_conv = ChannelHandshakeConfig_clone(&val_conv);
14006 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
14009 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
14010 LDKUserConfig this_ptr_conv;
14011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14012 this_ptr_conv.is_owned = false;
14013 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
14014 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14015 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14016 uint64_t ret_ref = (uint64_t)ret_var.inner;
14017 if (ret_var.is_owned) {
14023 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
14024 LDKUserConfig this_ptr_conv;
14025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14026 this_ptr_conv.is_owned = false;
14027 LDKChannelHandshakeLimits val_conv;
14028 val_conv.inner = (void*)(val & (~1));
14029 val_conv.is_owned = (val & 1) || (val == 0);
14030 val_conv = ChannelHandshakeLimits_clone(&val_conv);
14031 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
14034 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
14035 LDKUserConfig this_ptr_conv;
14036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14037 this_ptr_conv.is_owned = false;
14038 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
14039 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14040 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14041 uint64_t ret_ref = (uint64_t)ret_var.inner;
14042 if (ret_var.is_owned) {
14048 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
14049 LDKUserConfig this_ptr_conv;
14050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14051 this_ptr_conv.is_owned = false;
14052 LDKChannelConfig val_conv;
14053 val_conv.inner = (void*)(val & (~1));
14054 val_conv.is_owned = (val & 1) || (val == 0);
14055 val_conv = ChannelConfig_clone(&val_conv);
14056 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
14059 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
14060 LDKUserConfig this_ptr_conv;
14061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14062 this_ptr_conv.is_owned = false;
14063 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
14067 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
14068 LDKUserConfig this_ptr_conv;
14069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14070 this_ptr_conv.is_owned = false;
14071 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
14074 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) {
14075 LDKChannelHandshakeConfig own_channel_config_arg_conv;
14076 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
14077 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
14078 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
14079 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
14080 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
14081 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
14082 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
14083 LDKChannelConfig channel_options_arg_conv;
14084 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
14085 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
14086 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
14087 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);
14088 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14089 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14090 uint64_t ret_ref = (uint64_t)ret_var.inner;
14091 if (ret_var.is_owned) {
14097 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
14098 LDKUserConfig orig_conv;
14099 orig_conv.inner = (void*)(orig & (~1));
14100 orig_conv.is_owned = false;
14101 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
14102 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14103 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14104 uint64_t ret_ref = (uint64_t)ret_var.inner;
14105 if (ret_var.is_owned) {
14111 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
14112 LDKUserConfig ret_var = UserConfig_default();
14113 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14114 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14115 uint64_t ret_ref = (uint64_t)ret_var.inner;
14116 if (ret_var.is_owned) {
14122 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
14123 LDKBestBlock this_obj_conv;
14124 this_obj_conv.inner = (void*)(this_obj & (~1));
14125 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14126 BestBlock_free(this_obj_conv);
14129 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
14130 LDKBestBlock orig_conv;
14131 orig_conv.inner = (void*)(orig & (~1));
14132 orig_conv.is_owned = false;
14133 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
14134 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14135 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14136 uint64_t ret_ref = (uint64_t)ret_var.inner;
14137 if (ret_var.is_owned) {
14143 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
14144 LDKNetwork network_conv = LDKNetwork_from_js(network);
14145 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
14146 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14147 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14148 uint64_t ret_ref = (uint64_t)ret_var.inner;
14149 if (ret_var.is_owned) {
14155 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
14156 LDKThirtyTwoBytes block_hash_ref;
14157 CHECK(*((uint32_t*)block_hash) == 32);
14158 memcpy(block_hash_ref.data, (uint8_t*)(block_hash + 4), 32);
14159 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
14160 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14161 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14162 uint64_t ret_ref = (uint64_t)ret_var.inner;
14163 if (ret_var.is_owned) {
14169 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
14170 LDKBestBlock this_arg_conv;
14171 this_arg_conv.inner = (void*)(this_arg & (~1));
14172 this_arg_conv.is_owned = false;
14173 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14174 memcpy((uint8_t*)(ret_arr + 4), BestBlock_block_hash(&this_arg_conv).data, 32);
14178 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
14179 LDKBestBlock this_arg_conv;
14180 this_arg_conv.inner = (void*)(this_arg & (~1));
14181 this_arg_conv.is_owned = false;
14182 int32_t ret_val = BestBlock_height(&this_arg_conv);
14186 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
14187 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
14188 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
14192 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_chain() {
14193 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
14197 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_tx() {
14198 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
14202 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
14203 if ((this_ptr & 1) != 0) return;
14204 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14205 CHECK_ACCESS(this_ptr_ptr);
14206 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
14207 FREE((void*)this_ptr);
14208 Access_free(this_ptr_conv);
14211 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
14212 if ((this_ptr & 1) != 0) return;
14213 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14214 CHECK_ACCESS(this_ptr_ptr);
14215 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
14216 FREE((void*)this_ptr);
14217 Listen_free(this_ptr_conv);
14220 void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) {
14221 if ((this_ptr & 1) != 0) return;
14222 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14223 CHECK_ACCESS(this_ptr_ptr);
14224 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
14225 FREE((void*)this_ptr);
14226 Confirm_free(this_ptr_conv);
14229 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
14230 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
14231 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
14235 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
14236 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
14240 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
14241 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
14245 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
14246 if ((this_ptr & 1) != 0) return;
14247 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14248 CHECK_ACCESS(this_ptr_ptr);
14249 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
14250 FREE((void*)this_ptr);
14251 Watch_free(this_ptr_conv);
14254 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
14255 if ((this_ptr & 1) != 0) return;
14256 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14257 CHECK_ACCESS(this_ptr_ptr);
14258 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
14259 FREE((void*)this_ptr);
14260 Filter_free(this_ptr_conv);
14263 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
14264 LDKWatchedOutput this_obj_conv;
14265 this_obj_conv.inner = (void*)(this_obj & (~1));
14266 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14267 WatchedOutput_free(this_obj_conv);
14270 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
14271 LDKWatchedOutput this_ptr_conv;
14272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14273 this_ptr_conv.is_owned = false;
14274 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14275 memcpy((uint8_t*)(ret_arr + 4), WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
14279 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
14280 LDKWatchedOutput this_ptr_conv;
14281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14282 this_ptr_conv.is_owned = false;
14283 LDKThirtyTwoBytes val_ref;
14284 CHECK(*((uint32_t*)val) == 32);
14285 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14286 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
14289 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
14290 LDKWatchedOutput this_ptr_conv;
14291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14292 this_ptr_conv.is_owned = false;
14293 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
14294 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14295 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14296 uint64_t ret_ref = (uint64_t)ret_var.inner;
14297 if (ret_var.is_owned) {
14303 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
14304 LDKWatchedOutput this_ptr_conv;
14305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14306 this_ptr_conv.is_owned = false;
14307 LDKOutPoint val_conv;
14308 val_conv.inner = (void*)(val & (~1));
14309 val_conv.is_owned = (val & 1) || (val == 0);
14310 val_conv = OutPoint_clone(&val_conv);
14311 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
14314 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
14315 LDKWatchedOutput this_ptr_conv;
14316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14317 this_ptr_conv.is_owned = false;
14318 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
14319 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14320 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14324 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
14325 LDKWatchedOutput this_ptr_conv;
14326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14327 this_ptr_conv.is_owned = false;
14328 LDKCVec_u8Z val_ref;
14329 val_ref.datalen = *((uint32_t*)val);
14330 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
14331 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
14332 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
14335 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
14336 LDKThirtyTwoBytes block_hash_arg_ref;
14337 CHECK(*((uint32_t*)block_hash_arg) == 32);
14338 memcpy(block_hash_arg_ref.data, (uint8_t*)(block_hash_arg + 4), 32);
14339 LDKOutPoint outpoint_arg_conv;
14340 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14341 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14342 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14343 LDKCVec_u8Z script_pubkey_arg_ref;
14344 script_pubkey_arg_ref.datalen = *((uint32_t*)script_pubkey_arg);
14345 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
14346 memcpy(script_pubkey_arg_ref.data, (uint8_t*)(script_pubkey_arg + 4), script_pubkey_arg_ref.datalen);
14347 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
14348 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14349 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14350 uint64_t ret_ref = (uint64_t)ret_var.inner;
14351 if (ret_var.is_owned) {
14357 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_clone(uint32_t orig) {
14358 LDKWatchedOutput orig_conv;
14359 orig_conv.inner = (void*)(orig & (~1));
14360 orig_conv.is_owned = false;
14361 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
14362 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14363 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14364 uint64_t ret_ref = (uint64_t)ret_var.inner;
14365 if (ret_var.is_owned) {
14371 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_hash(uint32_t o) {
14372 LDKWatchedOutput o_conv;
14373 o_conv.inner = (void*)(o & (~1));
14374 o_conv.is_owned = false;
14375 int64_t ret_val = WatchedOutput_hash(&o_conv);
14379 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
14380 if ((this_ptr & 1) != 0) return;
14381 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14382 CHECK_ACCESS(this_ptr_ptr);
14383 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
14384 FREE((void*)this_ptr);
14385 BroadcasterInterface_free(this_ptr_conv);
14388 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
14389 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
14390 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
14394 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_background() {
14395 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
14399 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_normal() {
14400 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
14404 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_high_priority() {
14405 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
14409 jboolean __attribute__((visibility("default"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
14410 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
14411 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
14412 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
14416 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
14417 if ((this_ptr & 1) != 0) return;
14418 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14419 CHECK_ACCESS(this_ptr_ptr);
14420 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
14421 FREE((void*)this_ptr);
14422 FeeEstimator_free(this_ptr_conv);
14425 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
14426 if ((this_ptr & 1) != 0) return;
14427 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14428 CHECK_ACCESS(this_ptr_ptr);
14429 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
14430 FREE((void*)this_ptr);
14431 Persist_free(this_ptr_conv);
14434 void __attribute__((visibility("default"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
14435 LDKLockedChannelMonitor this_obj_conv;
14436 this_obj_conv.inner = (void*)(this_obj & (~1));
14437 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14438 LockedChannelMonitor_free(this_obj_conv);
14441 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
14442 LDKChainMonitor this_obj_conv;
14443 this_obj_conv.inner = (void*)(this_obj & (~1));
14444 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14445 ChainMonitor_free(this_obj_conv);
14448 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
14449 void* chain_source_ptr = (void*)(((uint64_t)chain_source) & ~1);
14450 CHECK_ACCESS(chain_source_ptr);
14451 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
14452 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
14453 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
14454 // Manually implement clone for Java trait instances
14456 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
14457 CHECK_ACCESS(broadcaster_ptr);
14458 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
14459 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
14460 CHECK_ACCESS(logger_ptr);
14461 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
14462 void* feeest_ptr = (void*)(((uint64_t)feeest) & ~1);
14463 CHECK_ACCESS(feeest_ptr);
14464 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
14465 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
14466 CHECK_ACCESS(persister_ptr);
14467 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
14468 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
14469 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14470 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14471 uint64_t ret_ref = (uint64_t)ret_var.inner;
14472 if (ret_var.is_owned) {
14478 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
14479 LDKChainMonitor this_arg_conv;
14480 this_arg_conv.inner = (void*)(this_arg & (~1));
14481 this_arg_conv.is_owned = false;
14482 LDKCVec_ChannelDetailsZ ignored_channels_constr;
14483 ignored_channels_constr.datalen = *((uint32_t*)ignored_channels);
14484 if (ignored_channels_constr.datalen > 0)
14485 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
14487 ignored_channels_constr.data = NULL;
14488 uint32_t* ignored_channels_vals = (uint32_t*)(ignored_channels + 4);
14489 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
14490 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
14491 LDKChannelDetails ignored_channels_conv_16_conv;
14492 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
14493 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
14494 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
14495 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
14497 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
14498 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14499 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14500 for (size_t j = 0; j < ret_var.datalen; j++) {
14501 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14502 *ret_conv_9_copy = ret_var.data[j];
14503 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
14504 ret_arr_ptr[j] = ret_conv_9_ref;
14506 FREE(ret_var.data);
14510 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
14511 LDKChainMonitor this_arg_conv;
14512 this_arg_conv.inner = (void*)(this_arg & (~1));
14513 this_arg_conv.is_owned = false;
14514 LDKOutPoint funding_txo_conv;
14515 funding_txo_conv.inner = (void*)(funding_txo & (~1));
14516 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
14517 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
14518 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
14519 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
14520 return (uint64_t)ret_conv;
14523 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
14524 LDKChainMonitor this_arg_conv;
14525 this_arg_conv.inner = (void*)(this_arg & (~1));
14526 this_arg_conv.is_owned = false;
14527 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
14528 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14529 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14530 for (size_t k = 0; k < ret_var.datalen; k++) {
14531 LDKOutPoint ret_conv_10_var = ret_var.data[k];
14532 CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14533 CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14534 uint64_t ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner;
14535 if (ret_conv_10_var.is_owned) {
14536 ret_conv_10_ref |= 1;
14538 ret_arr_ptr[k] = ret_conv_10_ref;
14540 FREE(ret_var.data);
14544 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
14545 LDKChainMonitor this_arg_conv;
14546 this_arg_conv.inner = (void*)(this_arg & (~1));
14547 this_arg_conv.is_owned = false;
14548 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
14549 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
14550 return (uint64_t)ret_ret;
14553 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
14554 LDKChainMonitor this_arg_conv;
14555 this_arg_conv.inner = (void*)(this_arg & (~1));
14556 this_arg_conv.is_owned = false;
14557 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
14558 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
14559 return (uint64_t)ret_ret;
14562 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
14563 LDKChainMonitor this_arg_conv;
14564 this_arg_conv.inner = (void*)(this_arg & (~1));
14565 this_arg_conv.is_owned = false;
14566 LDKWatch* ret_ret =MALLOC(sizeof(LDKWatch), "LDKWatch");
14567 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
14568 return (uint64_t)ret_ret;
14571 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
14572 LDKChainMonitor this_arg_conv;
14573 this_arg_conv.inner = (void*)(this_arg & (~1));
14574 this_arg_conv.is_owned = false;
14575 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
14576 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
14577 return (uint64_t)ret_ret;
14580 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
14581 LDKChannelMonitorUpdate this_obj_conv;
14582 this_obj_conv.inner = (void*)(this_obj & (~1));
14583 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14584 ChannelMonitorUpdate_free(this_obj_conv);
14587 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
14588 LDKChannelMonitorUpdate this_ptr_conv;
14589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14590 this_ptr_conv.is_owned = false;
14591 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
14595 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
14596 LDKChannelMonitorUpdate this_ptr_conv;
14597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14598 this_ptr_conv.is_owned = false;
14599 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
14602 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
14603 LDKChannelMonitorUpdate orig_conv;
14604 orig_conv.inner = (void*)(orig & (~1));
14605 orig_conv.is_owned = false;
14606 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
14607 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14608 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14609 uint64_t ret_ref = (uint64_t)ret_var.inner;
14610 if (ret_var.is_owned) {
14616 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
14617 LDKChannelMonitorUpdate obj_conv;
14618 obj_conv.inner = (void*)(obj & (~1));
14619 obj_conv.is_owned = false;
14620 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
14621 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14622 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14623 CVec_u8Z_free(ret_var);
14627 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
14628 LDKu8slice ser_ref;
14629 ser_ref.datalen = *((uint32_t*)ser);
14630 ser_ref.data = (int8_t*)(ser + 4);
14631 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
14632 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
14633 return (uint64_t)ret_conv;
14636 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) {
14637 LDKMonitorUpdateError this_obj_conv;
14638 this_obj_conv.inner = (void*)(this_obj & (~1));
14639 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14640 MonitorUpdateError_free(this_obj_conv);
14643 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
14644 LDKMonitorUpdateError orig_conv;
14645 orig_conv.inner = (void*)(orig & (~1));
14646 orig_conv.is_owned = false;
14647 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
14648 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14649 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14650 uint64_t ret_ref = (uint64_t)ret_var.inner;
14651 if (ret_var.is_owned) {
14657 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
14658 if ((this_ptr & 1) != 0) return;
14659 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14660 CHECK_ACCESS(this_ptr_ptr);
14661 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
14662 FREE((void*)this_ptr);
14663 MonitorEvent_free(this_ptr_conv);
14666 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
14667 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
14668 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14669 *ret_copy = MonitorEvent_clone(orig_conv);
14670 uint64_t ret_ref = (uint64_t)ret_copy;
14674 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_htlcevent(uint32_t a) {
14675 LDKHTLCUpdate a_conv;
14676 a_conv.inner = (void*)(a & (~1));
14677 a_conv.is_owned = (a & 1) || (a == 0);
14678 a_conv = HTLCUpdate_clone(&a_conv);
14679 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14680 *ret_copy = MonitorEvent_htlcevent(a_conv);
14681 uint64_t ret_ref = (uint64_t)ret_copy;
14685 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
14686 LDKOutPoint a_conv;
14687 a_conv.inner = (void*)(a & (~1));
14688 a_conv.is_owned = (a & 1) || (a == 0);
14689 a_conv = OutPoint_clone(&a_conv);
14690 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14691 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
14692 uint64_t ret_ref = (uint64_t)ret_copy;
14696 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
14697 LDKHTLCUpdate this_obj_conv;
14698 this_obj_conv.inner = (void*)(this_obj & (~1));
14699 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14700 HTLCUpdate_free(this_obj_conv);
14703 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
14704 LDKHTLCUpdate orig_conv;
14705 orig_conv.inner = (void*)(orig & (~1));
14706 orig_conv.is_owned = false;
14707 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
14708 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14709 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14710 uint64_t ret_ref = (uint64_t)ret_var.inner;
14711 if (ret_var.is_owned) {
14717 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
14718 LDKHTLCUpdate obj_conv;
14719 obj_conv.inner = (void*)(obj & (~1));
14720 obj_conv.is_owned = false;
14721 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
14722 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14723 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14724 CVec_u8Z_free(ret_var);
14728 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
14729 LDKu8slice ser_ref;
14730 ser_ref.datalen = *((uint32_t*)ser);
14731 ser_ref.data = (int8_t*)(ser + 4);
14732 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
14733 *ret_conv = HTLCUpdate_read(ser_ref);
14734 return (uint64_t)ret_conv;
14737 void __attribute__((visibility("default"))) TS_Balance_free(uint32_t this_ptr) {
14738 if ((this_ptr & 1) != 0) return;
14739 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14740 CHECK_ACCESS(this_ptr_ptr);
14741 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
14742 FREE((void*)this_ptr);
14743 Balance_free(this_ptr_conv);
14746 uint32_t __attribute__((visibility("default"))) TS_Balance_clone(uint32_t orig) {
14747 LDKBalance* orig_conv = (LDKBalance*)orig;
14748 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14749 *ret_copy = Balance_clone(orig_conv);
14750 uint64_t ret_ref = (uint64_t)ret_copy;
14754 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
14755 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14756 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
14757 uint64_t ret_ref = (uint64_t)ret_copy;
14761 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
14762 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14763 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
14764 uint64_t ret_ref = (uint64_t)ret_copy;
14768 uint32_t __attribute__((visibility("default"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
14769 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14770 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
14771 uint64_t ret_ref = (uint64_t)ret_copy;
14775 uint32_t __attribute__((visibility("default"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
14776 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14777 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
14778 uint64_t ret_ref = (uint64_t)ret_copy;
14782 jboolean __attribute__((visibility("default"))) TS_Balance_eq(uint32_t a, uint32_t b) {
14783 LDKBalance* a_conv = (LDKBalance*)a;
14784 LDKBalance* b_conv = (LDKBalance*)b;
14785 jboolean ret_val = Balance_eq(a_conv, b_conv);
14789 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
14790 LDKChannelMonitor this_obj_conv;
14791 this_obj_conv.inner = (void*)(this_obj & (~1));
14792 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14793 ChannelMonitor_free(this_obj_conv);
14796 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
14797 LDKChannelMonitor orig_conv;
14798 orig_conv.inner = (void*)(orig & (~1));
14799 orig_conv.is_owned = false;
14800 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
14801 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14802 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14803 uint64_t ret_ref = (uint64_t)ret_var.inner;
14804 if (ret_var.is_owned) {
14810 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
14811 LDKChannelMonitor obj_conv;
14812 obj_conv.inner = (void*)(obj & (~1));
14813 obj_conv.is_owned = false;
14814 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
14815 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14816 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14817 CVec_u8Z_free(ret_var);
14821 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) {
14822 LDKChannelMonitor this_arg_conv;
14823 this_arg_conv.inner = (void*)(this_arg & (~1));
14824 this_arg_conv.is_owned = false;
14825 LDKChannelMonitorUpdate updates_conv;
14826 updates_conv.inner = (void*)(updates & (~1));
14827 updates_conv.is_owned = false;
14828 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
14829 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
14830 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
14831 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
14832 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
14833 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
14834 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
14835 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
14836 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
14837 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
14838 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
14839 return (uint64_t)ret_conv;
14842 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
14843 LDKChannelMonitor this_arg_conv;
14844 this_arg_conv.inner = (void*)(this_arg & (~1));
14845 this_arg_conv.is_owned = false;
14846 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
14850 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
14851 LDKChannelMonitor this_arg_conv;
14852 this_arg_conv.inner = (void*)(this_arg & (~1));
14853 this_arg_conv.is_owned = false;
14854 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
14855 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
14856 return ((uint64_t)ret_conv);
14859 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
14860 LDKChannelMonitor this_arg_conv;
14861 this_arg_conv.inner = (void*)(this_arg & (~1));
14862 this_arg_conv.is_owned = false;
14863 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
14864 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14865 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14866 for (size_t o = 0; o < ret_var.datalen; o++) {
14867 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
14868 *ret_conv_40_conv = ret_var.data[o];
14869 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
14871 FREE(ret_var.data);
14875 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
14876 LDKChannelMonitor this_arg_conv;
14877 this_arg_conv.inner = (void*)(this_arg & (~1));
14878 this_arg_conv.is_owned = false;
14879 void* filter_ptr = (void*)(((uint64_t)filter) & ~1);
14880 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
14881 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
14882 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
14885 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
14886 LDKChannelMonitor this_arg_conv;
14887 this_arg_conv.inner = (void*)(this_arg & (~1));
14888 this_arg_conv.is_owned = false;
14889 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
14890 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14891 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14892 for (size_t o = 0; o < ret_var.datalen; o++) {
14893 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14894 *ret_conv_14_copy = ret_var.data[o];
14895 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
14896 ret_arr_ptr[o] = ret_conv_14_ref;
14898 FREE(ret_var.data);
14902 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
14903 LDKChannelMonitor this_arg_conv;
14904 this_arg_conv.inner = (void*)(this_arg & (~1));
14905 this_arg_conv.is_owned = false;
14906 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
14907 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14908 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14909 for (size_t h = 0; h < ret_var.datalen; h++) {
14910 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14911 *ret_conv_7_copy = ret_var.data[h];
14912 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
14913 ret_arr_ptr[h] = ret_conv_7_ref;
14915 FREE(ret_var.data);
14919 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
14920 LDKChannelMonitor this_arg_conv;
14921 this_arg_conv.inner = (void*)(this_arg & (~1));
14922 this_arg_conv.is_owned = false;
14923 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
14924 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
14925 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
14926 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
14927 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
14928 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
14929 for (size_t m = 0; m < ret_var.datalen; m++) {
14930 LDKTransaction ret_conv_12_var = ret_var.data[m];
14931 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14932 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
14933 Transaction_free(ret_conv_12_var);
14934 ret_arr_ptr[m] = ret_conv_12_arr;
14936 FREE(ret_var.data);
14940 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) {
14941 LDKChannelMonitor this_arg_conv;
14942 this_arg_conv.inner = (void*)(this_arg & (~1));
14943 this_arg_conv.is_owned = false;
14944 unsigned char header_arr[80];
14945 CHECK(*((uint32_t*)header) == 80);
14946 memcpy(header_arr, (uint8_t*)(header + 4), 80);
14947 unsigned char (*header_ref)[80] = &header_arr;
14948 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14949 txdata_constr.datalen = *((uint32_t*)txdata);
14950 if (txdata_constr.datalen > 0)
14951 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14953 txdata_constr.data = NULL;
14954 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
14955 for (size_t c = 0; c < txdata_constr.datalen; c++) {
14956 uint32_t txdata_conv_28 = txdata_vals[c];
14957 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
14958 CHECK_ACCESS(txdata_conv_28_ptr);
14959 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
14960 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
14961 txdata_constr.data[c] = txdata_conv_28_conv;
14963 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
14964 CHECK_ACCESS(broadcaster_ptr);
14965 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
14966 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
14967 CHECK_ACCESS(fee_estimator_ptr);
14968 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
14969 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
14970 CHECK_ACCESS(logger_ptr);
14971 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
14972 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);
14973 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14974 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14975 for (size_t n = 0; n < ret_var.datalen; n++) {
14976 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14977 *ret_conv_39_conv = ret_var.data[n];
14978 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
14980 FREE(ret_var.data);
14984 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) {
14985 LDKChannelMonitor this_arg_conv;
14986 this_arg_conv.inner = (void*)(this_arg & (~1));
14987 this_arg_conv.is_owned = false;
14988 unsigned char header_arr[80];
14989 CHECK(*((uint32_t*)header) == 80);
14990 memcpy(header_arr, (uint8_t*)(header + 4), 80);
14991 unsigned char (*header_ref)[80] = &header_arr;
14992 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
14993 CHECK_ACCESS(broadcaster_ptr);
14994 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
14995 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
14996 CHECK_ACCESS(fee_estimator_ptr);
14997 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
14998 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
14999 CHECK_ACCESS(logger_ptr);
15000 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
15001 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
15004 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) {
15005 LDKChannelMonitor this_arg_conv;
15006 this_arg_conv.inner = (void*)(this_arg & (~1));
15007 this_arg_conv.is_owned = false;
15008 unsigned char header_arr[80];
15009 CHECK(*((uint32_t*)header) == 80);
15010 memcpy(header_arr, (uint8_t*)(header + 4), 80);
15011 unsigned char (*header_ref)[80] = &header_arr;
15012 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
15013 txdata_constr.datalen = *((uint32_t*)txdata);
15014 if (txdata_constr.datalen > 0)
15015 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15017 txdata_constr.data = NULL;
15018 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
15019 for (size_t c = 0; c < txdata_constr.datalen; c++) {
15020 uint32_t txdata_conv_28 = txdata_vals[c];
15021 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
15022 CHECK_ACCESS(txdata_conv_28_ptr);
15023 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
15024 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
15025 txdata_constr.data[c] = txdata_conv_28_conv;
15027 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
15028 CHECK_ACCESS(broadcaster_ptr);
15029 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
15030 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
15031 CHECK_ACCESS(fee_estimator_ptr);
15032 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
15033 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
15034 CHECK_ACCESS(logger_ptr);
15035 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
15036 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);
15037 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
15038 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
15039 for (size_t n = 0; n < ret_var.datalen; n++) {
15040 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
15041 *ret_conv_39_conv = ret_var.data[n];
15042 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
15044 FREE(ret_var.data);
15048 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) {
15049 LDKChannelMonitor this_arg_conv;
15050 this_arg_conv.inner = (void*)(this_arg & (~1));
15051 this_arg_conv.is_owned = false;
15052 unsigned char txid_arr[32];
15053 CHECK(*((uint32_t*)txid) == 32);
15054 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
15055 unsigned char (*txid_ref)[32] = &txid_arr;
15056 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
15057 CHECK_ACCESS(broadcaster_ptr);
15058 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
15059 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
15060 CHECK_ACCESS(fee_estimator_ptr);
15061 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
15062 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
15063 CHECK_ACCESS(logger_ptr);
15064 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
15065 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
15068 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) {
15069 LDKChannelMonitor this_arg_conv;
15070 this_arg_conv.inner = (void*)(this_arg & (~1));
15071 this_arg_conv.is_owned = false;
15072 unsigned char header_arr[80];
15073 CHECK(*((uint32_t*)header) == 80);
15074 memcpy(header_arr, (uint8_t*)(header + 4), 80);
15075 unsigned char (*header_ref)[80] = &header_arr;
15076 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
15077 CHECK_ACCESS(broadcaster_ptr);
15078 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
15079 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
15080 CHECK_ACCESS(fee_estimator_ptr);
15081 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
15082 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
15083 CHECK_ACCESS(logger_ptr);
15084 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
15085 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
15086 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
15087 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
15088 for (size_t n = 0; n < ret_var.datalen; n++) {
15089 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
15090 *ret_conv_39_conv = ret_var.data[n];
15091 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
15093 FREE(ret_var.data);
15097 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
15098 LDKChannelMonitor this_arg_conv;
15099 this_arg_conv.inner = (void*)(this_arg & (~1));
15100 this_arg_conv.is_owned = false;
15101 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
15102 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
15103 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
15104 for (size_t m = 0; m < ret_var.datalen; m++) {
15105 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15106 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
15107 ret_arr_ptr[m] = ret_conv_12_arr;
15109 FREE(ret_var.data);
15113 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
15114 LDKChannelMonitor this_arg_conv;
15115 this_arg_conv.inner = (void*)(this_arg & (~1));
15116 this_arg_conv.is_owned = false;
15117 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
15118 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15119 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15120 uint64_t ret_ref = (uint64_t)ret_var.inner;
15121 if (ret_var.is_owned) {
15127 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
15128 LDKChannelMonitor this_arg_conv;
15129 this_arg_conv.inner = (void*)(this_arg & (~1));
15130 this_arg_conv.is_owned = false;
15131 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
15132 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
15133 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
15134 for (size_t j = 0; j < ret_var.datalen; j++) {
15135 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
15136 *ret_conv_9_copy = ret_var.data[j];
15137 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
15138 ret_arr_ptr[j] = ret_conv_9_ref;
15140 FREE(ret_var.data);
15144 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
15145 LDKu8slice ser_ref;
15146 ser_ref.datalen = *((uint32_t*)ser);
15147 ser_ref.data = (int8_t*)(ser + 4);
15148 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
15149 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
15150 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
15151 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
15152 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
15153 return (uint64_t)ret_conv;
15156 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
15157 LDKOutPoint this_obj_conv;
15158 this_obj_conv.inner = (void*)(this_obj & (~1));
15159 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15160 OutPoint_free(this_obj_conv);
15163 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
15164 LDKOutPoint this_ptr_conv;
15165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15166 this_ptr_conv.is_owned = false;
15167 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15168 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
15172 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
15173 LDKOutPoint this_ptr_conv;
15174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15175 this_ptr_conv.is_owned = false;
15176 LDKThirtyTwoBytes val_ref;
15177 CHECK(*((uint32_t*)val) == 32);
15178 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15179 OutPoint_set_txid(&this_ptr_conv, val_ref);
15182 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
15183 LDKOutPoint this_ptr_conv;
15184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15185 this_ptr_conv.is_owned = false;
15186 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
15190 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
15191 LDKOutPoint this_ptr_conv;
15192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15193 this_ptr_conv.is_owned = false;
15194 OutPoint_set_index(&this_ptr_conv, val);
15197 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
15198 LDKThirtyTwoBytes txid_arg_ref;
15199 CHECK(*((uint32_t*)txid_arg) == 32);
15200 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
15201 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
15202 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15203 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15204 uint64_t ret_ref = (uint64_t)ret_var.inner;
15205 if (ret_var.is_owned) {
15211 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
15212 LDKOutPoint orig_conv;
15213 orig_conv.inner = (void*)(orig & (~1));
15214 orig_conv.is_owned = false;
15215 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
15216 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15217 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15218 uint64_t ret_ref = (uint64_t)ret_var.inner;
15219 if (ret_var.is_owned) {
15225 jboolean __attribute__((visibility("default"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
15226 LDKOutPoint a_conv;
15227 a_conv.inner = (void*)(a & (~1));
15228 a_conv.is_owned = false;
15229 LDKOutPoint b_conv;
15230 b_conv.inner = (void*)(b & (~1));
15231 b_conv.is_owned = false;
15232 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
15236 int64_t __attribute__((visibility("default"))) TS_OutPoint_hash(uint32_t o) {
15237 LDKOutPoint o_conv;
15238 o_conv.inner = (void*)(o & (~1));
15239 o_conv.is_owned = false;
15240 int64_t ret_val = OutPoint_hash(&o_conv);
15244 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
15245 LDKOutPoint this_arg_conv;
15246 this_arg_conv.inner = (void*)(this_arg & (~1));
15247 this_arg_conv.is_owned = false;
15248 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15249 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
15253 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
15254 LDKOutPoint obj_conv;
15255 obj_conv.inner = (void*)(obj & (~1));
15256 obj_conv.is_owned = false;
15257 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
15258 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15259 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15260 CVec_u8Z_free(ret_var);
15264 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
15265 LDKu8slice ser_ref;
15266 ser_ref.datalen = *((uint32_t*)ser);
15267 ser_ref.data = (int8_t*)(ser + 4);
15268 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15269 *ret_conv = OutPoint_read(ser_ref);
15270 return (uint64_t)ret_conv;
15273 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
15274 LDKDelayedPaymentOutputDescriptor this_obj_conv;
15275 this_obj_conv.inner = (void*)(this_obj & (~1));
15276 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15277 DelayedPaymentOutputDescriptor_free(this_obj_conv);
15280 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
15281 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15283 this_ptr_conv.is_owned = false;
15284 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
15285 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15286 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15287 uint64_t ret_ref = (uint64_t)ret_var.inner;
15288 if (ret_var.is_owned) {
15294 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
15295 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15297 this_ptr_conv.is_owned = false;
15298 LDKOutPoint val_conv;
15299 val_conv.inner = (void*)(val & (~1));
15300 val_conv.is_owned = (val & 1) || (val == 0);
15301 val_conv = OutPoint_clone(&val_conv);
15302 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
15305 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
15306 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15308 this_ptr_conv.is_owned = false;
15309 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15310 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
15314 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
15315 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15317 this_ptr_conv.is_owned = false;
15318 LDKPublicKey val_ref;
15319 CHECK(*((uint32_t*)val) == 33);
15320 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15321 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
15324 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
15325 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15327 this_ptr_conv.is_owned = false;
15328 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
15332 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
15333 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15335 this_ptr_conv.is_owned = false;
15336 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
15339 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
15340 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15342 this_ptr_conv.is_owned = false;
15343 void* val_ptr = (void*)(((uint64_t)val) & ~1);
15344 CHECK_ACCESS(val_ptr);
15345 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
15346 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
15347 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
15350 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
15351 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15353 this_ptr_conv.is_owned = false;
15354 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15355 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
15359 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
15360 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15362 this_ptr_conv.is_owned = false;
15363 LDKPublicKey val_ref;
15364 CHECK(*((uint32_t*)val) == 33);
15365 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15366 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
15369 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
15370 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15372 this_ptr_conv.is_owned = false;
15373 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15374 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
15378 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
15379 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15381 this_ptr_conv.is_owned = false;
15382 LDKThirtyTwoBytes val_ref;
15383 CHECK(*((uint32_t*)val) == 32);
15384 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15385 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
15388 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
15389 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15391 this_ptr_conv.is_owned = false;
15392 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
15396 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
15397 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15399 this_ptr_conv.is_owned = false;
15400 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
15403 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) {
15404 LDKOutPoint outpoint_arg_conv;
15405 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
15406 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
15407 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
15408 LDKPublicKey per_commitment_point_arg_ref;
15409 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
15410 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
15411 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
15412 CHECK_ACCESS(output_arg_ptr);
15413 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
15414 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
15415 LDKPublicKey revocation_pubkey_arg_ref;
15416 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
15417 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
15418 LDKThirtyTwoBytes channel_keys_id_arg_ref;
15419 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
15420 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
15421 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);
15422 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15423 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15424 uint64_t ret_ref = (uint64_t)ret_var.inner;
15425 if (ret_var.is_owned) {
15431 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
15432 LDKDelayedPaymentOutputDescriptor orig_conv;
15433 orig_conv.inner = (void*)(orig & (~1));
15434 orig_conv.is_owned = false;
15435 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
15436 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15437 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15438 uint64_t ret_ref = (uint64_t)ret_var.inner;
15439 if (ret_var.is_owned) {
15445 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
15446 LDKDelayedPaymentOutputDescriptor obj_conv;
15447 obj_conv.inner = (void*)(obj & (~1));
15448 obj_conv.is_owned = false;
15449 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
15450 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15451 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15452 CVec_u8Z_free(ret_var);
15456 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
15457 LDKu8slice ser_ref;
15458 ser_ref.datalen = *((uint32_t*)ser);
15459 ser_ref.data = (int8_t*)(ser + 4);
15460 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15461 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
15462 return (uint64_t)ret_conv;
15465 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
15466 LDKStaticPaymentOutputDescriptor this_obj_conv;
15467 this_obj_conv.inner = (void*)(this_obj & (~1));
15468 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15469 StaticPaymentOutputDescriptor_free(this_obj_conv);
15472 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
15473 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15475 this_ptr_conv.is_owned = false;
15476 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
15477 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15478 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15479 uint64_t ret_ref = (uint64_t)ret_var.inner;
15480 if (ret_var.is_owned) {
15486 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
15487 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15489 this_ptr_conv.is_owned = false;
15490 LDKOutPoint val_conv;
15491 val_conv.inner = (void*)(val & (~1));
15492 val_conv.is_owned = (val & 1) || (val == 0);
15493 val_conv = OutPoint_clone(&val_conv);
15494 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
15497 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
15498 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15500 this_ptr_conv.is_owned = false;
15501 void* val_ptr = (void*)(((uint64_t)val) & ~1);
15502 CHECK_ACCESS(val_ptr);
15503 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
15504 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
15505 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
15508 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
15509 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15511 this_ptr_conv.is_owned = false;
15512 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15513 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
15517 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
15518 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15520 this_ptr_conv.is_owned = false;
15521 LDKThirtyTwoBytes val_ref;
15522 CHECK(*((uint32_t*)val) == 32);
15523 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15524 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
15527 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
15528 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15530 this_ptr_conv.is_owned = false;
15531 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
15535 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
15536 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15538 this_ptr_conv.is_owned = false;
15539 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
15542 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) {
15543 LDKOutPoint outpoint_arg_conv;
15544 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
15545 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
15546 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
15547 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
15548 CHECK_ACCESS(output_arg_ptr);
15549 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
15550 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
15551 LDKThirtyTwoBytes channel_keys_id_arg_ref;
15552 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
15553 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
15554 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
15555 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15556 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15557 uint64_t ret_ref = (uint64_t)ret_var.inner;
15558 if (ret_var.is_owned) {
15564 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
15565 LDKStaticPaymentOutputDescriptor orig_conv;
15566 orig_conv.inner = (void*)(orig & (~1));
15567 orig_conv.is_owned = false;
15568 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
15569 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15570 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15571 uint64_t ret_ref = (uint64_t)ret_var.inner;
15572 if (ret_var.is_owned) {
15578 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
15579 LDKStaticPaymentOutputDescriptor obj_conv;
15580 obj_conv.inner = (void*)(obj & (~1));
15581 obj_conv.is_owned = false;
15582 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
15583 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15584 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15585 CVec_u8Z_free(ret_var);
15589 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
15590 LDKu8slice ser_ref;
15591 ser_ref.datalen = *((uint32_t*)ser);
15592 ser_ref.data = (int8_t*)(ser + 4);
15593 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15594 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
15595 return (uint64_t)ret_conv;
15598 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
15599 if ((this_ptr & 1) != 0) return;
15600 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15601 CHECK_ACCESS(this_ptr_ptr);
15602 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
15603 FREE((void*)this_ptr);
15604 SpendableOutputDescriptor_free(this_ptr_conv);
15607 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
15608 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
15609 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
15610 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
15611 uint64_t ret_ref = (uint64_t)ret_copy;
15615 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
15616 LDKOutPoint outpoint_conv;
15617 outpoint_conv.inner = (void*)(outpoint & (~1));
15618 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
15619 outpoint_conv = OutPoint_clone(&outpoint_conv);
15620 void* output_ptr = (void*)(((uint64_t)output) & ~1);
15621 CHECK_ACCESS(output_ptr);
15622 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
15623 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
15624 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
15625 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
15626 uint64_t ret_ref = (uint64_t)ret_copy;
15630 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
15631 LDKDelayedPaymentOutputDescriptor a_conv;
15632 a_conv.inner = (void*)(a & (~1));
15633 a_conv.is_owned = (a & 1) || (a == 0);
15634 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
15635 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
15636 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
15637 uint64_t ret_ref = (uint64_t)ret_copy;
15641 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
15642 LDKStaticPaymentOutputDescriptor a_conv;
15643 a_conv.inner = (void*)(a & (~1));
15644 a_conv.is_owned = (a & 1) || (a == 0);
15645 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
15646 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
15647 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
15648 uint64_t ret_ref = (uint64_t)ret_copy;
15652 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
15653 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
15654 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
15655 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15656 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15657 CVec_u8Z_free(ret_var);
15661 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
15662 LDKu8slice ser_ref;
15663 ser_ref.datalen = *((uint32_t*)ser);
15664 ser_ref.data = (int8_t*)(ser + 4);
15665 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15666 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
15667 return (uint64_t)ret_conv;
15670 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
15671 if ((this_ptr & 1) != 0) return;
15672 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15673 CHECK_ACCESS(this_ptr_ptr);
15674 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
15675 FREE((void*)this_ptr);
15676 BaseSign_free(this_ptr_conv);
15679 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
15680 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
15681 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
15682 LDKSign* orig_conv = (LDKSign*)orig_ptr;
15683 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
15684 *ret_ret = Sign_clone(orig_conv);
15685 return (uint64_t)ret_ret;
15688 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
15689 if ((this_ptr & 1) != 0) return;
15690 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15691 CHECK_ACCESS(this_ptr_ptr);
15692 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
15693 FREE((void*)this_ptr);
15694 Sign_free(this_ptr_conv);
15697 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
15698 if ((this_ptr & 1) != 0) return;
15699 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15700 CHECK_ACCESS(this_ptr_ptr);
15701 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
15702 FREE((void*)this_ptr);
15703 KeysInterface_free(this_ptr_conv);
15706 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
15707 LDKInMemorySigner this_obj_conv;
15708 this_obj_conv.inner = (void*)(this_obj & (~1));
15709 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15710 InMemorySigner_free(this_obj_conv);
15713 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
15714 LDKInMemorySigner this_ptr_conv;
15715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15716 this_ptr_conv.is_owned = false;
15717 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15718 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
15722 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
15723 LDKInMemorySigner this_ptr_conv;
15724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15725 this_ptr_conv.is_owned = false;
15726 LDKSecretKey val_ref;
15727 CHECK(*((uint32_t*)val) == 32);
15728 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
15729 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
15732 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
15733 LDKInMemorySigner this_ptr_conv;
15734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15735 this_ptr_conv.is_owned = false;
15736 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15737 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
15741 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
15742 LDKInMemorySigner this_ptr_conv;
15743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15744 this_ptr_conv.is_owned = false;
15745 LDKSecretKey val_ref;
15746 CHECK(*((uint32_t*)val) == 32);
15747 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
15748 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
15751 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
15752 LDKInMemorySigner this_ptr_conv;
15753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15754 this_ptr_conv.is_owned = false;
15755 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15756 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
15760 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
15761 LDKInMemorySigner this_ptr_conv;
15762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15763 this_ptr_conv.is_owned = false;
15764 LDKSecretKey val_ref;
15765 CHECK(*((uint32_t*)val) == 32);
15766 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
15767 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
15770 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
15771 LDKInMemorySigner this_ptr_conv;
15772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15773 this_ptr_conv.is_owned = false;
15774 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15775 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
15779 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
15780 LDKInMemorySigner this_ptr_conv;
15781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15782 this_ptr_conv.is_owned = false;
15783 LDKSecretKey val_ref;
15784 CHECK(*((uint32_t*)val) == 32);
15785 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
15786 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
15789 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
15790 LDKInMemorySigner this_ptr_conv;
15791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15792 this_ptr_conv.is_owned = false;
15793 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15794 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
15798 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
15799 LDKInMemorySigner this_ptr_conv;
15800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15801 this_ptr_conv.is_owned = false;
15802 LDKSecretKey val_ref;
15803 CHECK(*((uint32_t*)val) == 32);
15804 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
15805 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
15808 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
15809 LDKInMemorySigner this_ptr_conv;
15810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15811 this_ptr_conv.is_owned = false;
15812 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15813 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
15817 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
15818 LDKInMemorySigner this_ptr_conv;
15819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15820 this_ptr_conv.is_owned = false;
15821 LDKThirtyTwoBytes val_ref;
15822 CHECK(*((uint32_t*)val) == 32);
15823 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15824 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
15827 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
15828 LDKInMemorySigner orig_conv;
15829 orig_conv.inner = (void*)(orig & (~1));
15830 orig_conv.is_owned = false;
15831 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
15832 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15833 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15834 uint64_t ret_ref = (uint64_t)ret_var.inner;
15835 if (ret_var.is_owned) {
15841 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) {
15842 LDKSecretKey funding_key_ref;
15843 CHECK(*((uint32_t*)funding_key) == 32);
15844 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
15845 LDKSecretKey revocation_base_key_ref;
15846 CHECK(*((uint32_t*)revocation_base_key) == 32);
15847 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
15848 LDKSecretKey payment_key_ref;
15849 CHECK(*((uint32_t*)payment_key) == 32);
15850 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
15851 LDKSecretKey delayed_payment_base_key_ref;
15852 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
15853 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
15854 LDKSecretKey htlc_base_key_ref;
15855 CHECK(*((uint32_t*)htlc_base_key) == 32);
15856 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
15857 LDKThirtyTwoBytes commitment_seed_ref;
15858 CHECK(*((uint32_t*)commitment_seed) == 32);
15859 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
15860 LDKThirtyTwoBytes channel_keys_id_ref;
15861 CHECK(*((uint32_t*)channel_keys_id) == 32);
15862 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
15863 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);
15864 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15865 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15866 uint64_t ret_ref = (uint64_t)ret_var.inner;
15867 if (ret_var.is_owned) {
15873 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
15874 LDKInMemorySigner this_arg_conv;
15875 this_arg_conv.inner = (void*)(this_arg & (~1));
15876 this_arg_conv.is_owned = false;
15877 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
15878 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15879 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15880 uint64_t ret_ref = (uint64_t)ret_var.inner;
15881 if (ret_var.is_owned) {
15887 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
15888 LDKInMemorySigner this_arg_conv;
15889 this_arg_conv.inner = (void*)(this_arg & (~1));
15890 this_arg_conv.is_owned = false;
15891 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
15895 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
15896 LDKInMemorySigner this_arg_conv;
15897 this_arg_conv.inner = (void*)(this_arg & (~1));
15898 this_arg_conv.is_owned = false;
15899 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
15903 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
15904 LDKInMemorySigner this_arg_conv;
15905 this_arg_conv.inner = (void*)(this_arg & (~1));
15906 this_arg_conv.is_owned = false;
15907 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
15911 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
15912 LDKInMemorySigner this_arg_conv;
15913 this_arg_conv.inner = (void*)(this_arg & (~1));
15914 this_arg_conv.is_owned = false;
15915 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
15916 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15917 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15918 uint64_t ret_ref = (uint64_t)ret_var.inner;
15919 if (ret_var.is_owned) {
15925 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
15926 LDKInMemorySigner this_arg_conv;
15927 this_arg_conv.inner = (void*)(this_arg & (~1));
15928 this_arg_conv.is_owned = false;
15929 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
15930 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15931 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15932 uint64_t ret_ref = (uint64_t)ret_var.inner;
15933 if (ret_var.is_owned) {
15939 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) {
15940 LDKInMemorySigner this_arg_conv;
15941 this_arg_conv.inner = (void*)(this_arg & (~1));
15942 this_arg_conv.is_owned = false;
15943 LDKTransaction spend_tx_ref;
15944 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
15945 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15946 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
15947 spend_tx_ref.data_is_owned = true;
15948 LDKStaticPaymentOutputDescriptor descriptor_conv;
15949 descriptor_conv.inner = (void*)(descriptor & (~1));
15950 descriptor_conv.is_owned = false;
15951 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15952 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15953 return (uint64_t)ret_conv;
15956 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) {
15957 LDKInMemorySigner this_arg_conv;
15958 this_arg_conv.inner = (void*)(this_arg & (~1));
15959 this_arg_conv.is_owned = false;
15960 LDKTransaction spend_tx_ref;
15961 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
15962 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15963 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
15964 spend_tx_ref.data_is_owned = true;
15965 LDKDelayedPaymentOutputDescriptor descriptor_conv;
15966 descriptor_conv.inner = (void*)(descriptor & (~1));
15967 descriptor_conv.is_owned = false;
15968 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15969 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15970 return (uint64_t)ret_conv;
15973 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
15974 LDKInMemorySigner this_arg_conv;
15975 this_arg_conv.inner = (void*)(this_arg & (~1));
15976 this_arg_conv.is_owned = false;
15977 LDKBaseSign* ret_ret =MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
15978 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
15979 return (uint64_t)ret_ret;
15982 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
15983 LDKInMemorySigner this_arg_conv;
15984 this_arg_conv.inner = (void*)(this_arg & (~1));
15985 this_arg_conv.is_owned = false;
15986 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
15987 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
15988 return (uint64_t)ret_ret;
15991 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
15992 LDKInMemorySigner obj_conv;
15993 obj_conv.inner = (void*)(obj & (~1));
15994 obj_conv.is_owned = false;
15995 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
15996 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15997 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15998 CVec_u8Z_free(ret_var);
16002 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
16003 LDKu8slice ser_ref;
16004 ser_ref.datalen = *((uint32_t*)ser);
16005 ser_ref.data = (int8_t*)(ser + 4);
16006 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16007 *ret_conv = InMemorySigner_read(ser_ref);
16008 return (uint64_t)ret_conv;
16011 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
16012 LDKKeysManager this_obj_conv;
16013 this_obj_conv.inner = (void*)(this_obj & (~1));
16014 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16015 KeysManager_free(this_obj_conv);
16018 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
16019 unsigned char seed_arr[32];
16020 CHECK(*((uint32_t*)seed) == 32);
16021 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
16022 unsigned char (*seed_ref)[32] = &seed_arr;
16023 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
16024 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16025 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16026 uint64_t ret_ref = (uint64_t)ret_var.inner;
16027 if (ret_var.is_owned) {
16033 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
16034 LDKKeysManager this_arg_conv;
16035 this_arg_conv.inner = (void*)(this_arg & (~1));
16036 this_arg_conv.is_owned = false;
16037 unsigned char params_arr[32];
16038 CHECK(*((uint32_t*)params) == 32);
16039 memcpy(params_arr, (uint8_t*)(params + 4), 32);
16040 unsigned char (*params_ref)[32] = ¶ms_arr;
16041 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
16042 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16043 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16044 uint64_t ret_ref = (uint64_t)ret_var.inner;
16045 if (ret_var.is_owned) {
16051 uint32_t __attribute__((visibility("default"))) TS_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) {
16052 LDKKeysManager this_arg_conv;
16053 this_arg_conv.inner = (void*)(this_arg & (~1));
16054 this_arg_conv.is_owned = false;
16055 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
16056 descriptors_constr.datalen = *((uint32_t*)descriptors);
16057 if (descriptors_constr.datalen > 0)
16058 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16060 descriptors_constr.data = NULL;
16061 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
16062 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
16063 uint32_t descriptors_conv_27 = descriptors_vals[b];
16064 void* descriptors_conv_27_ptr = (void*)(((uint64_t)descriptors_conv_27) & ~1);
16065 CHECK_ACCESS(descriptors_conv_27_ptr);
16066 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
16067 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
16068 descriptors_constr.data[b] = descriptors_conv_27_conv;
16070 LDKCVec_TxOutZ outputs_constr;
16071 outputs_constr.datalen = *((uint32_t*)outputs);
16072 if (outputs_constr.datalen > 0)
16073 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16075 outputs_constr.data = NULL;
16076 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
16077 for (size_t h = 0; h < outputs_constr.datalen; h++) {
16078 uint32_t outputs_conv_7 = outputs_vals[h];
16079 void* outputs_conv_7_ptr = (void*)(((uint64_t)outputs_conv_7) & ~1);
16080 CHECK_ACCESS(outputs_conv_7_ptr);
16081 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
16082 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
16083 outputs_constr.data[h] = outputs_conv_7_conv;
16085 LDKCVec_u8Z change_destination_script_ref;
16086 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
16087 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
16088 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
16089 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16090 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
16091 return (uint64_t)ret_conv;
16094 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
16095 LDKKeysManager this_arg_conv;
16096 this_arg_conv.inner = (void*)(this_arg & (~1));
16097 this_arg_conv.is_owned = false;
16098 LDKKeysInterface* ret_ret =MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
16099 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
16100 return (uint64_t)ret_ret;
16103 void __attribute__((visibility("default"))) TS_PaymentId_free(uint32_t this_obj) {
16104 LDKPaymentId this_obj_conv;
16105 this_obj_conv.inner = (void*)(this_obj & (~1));
16106 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16107 PaymentId_free(this_obj_conv);
16110 int64_t __attribute__((visibility("default"))) TS_PaymentId_hash(uint32_t o) {
16111 LDKPaymentId o_conv;
16112 o_conv.inner = (void*)(o & (~1));
16113 o_conv.is_owned = false;
16114 int64_t ret_val = PaymentId_hash(&o_conv);
16118 uint32_t __attribute__((visibility("default"))) TS_PaymentId_clone(uint32_t orig) {
16119 LDKPaymentId orig_conv;
16120 orig_conv.inner = (void*)(orig & (~1));
16121 orig_conv.is_owned = false;
16122 LDKPaymentId ret_var = PaymentId_clone(&orig_conv);
16123 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16124 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16125 uint64_t ret_ref = (uint64_t)ret_var.inner;
16126 if (ret_var.is_owned) {
16132 jboolean __attribute__((visibility("default"))) TS_PaymentId_eq(uint32_t a, uint32_t b) {
16133 LDKPaymentId a_conv;
16134 a_conv.inner = (void*)(a & (~1));
16135 a_conv.is_owned = false;
16136 LDKPaymentId b_conv;
16137 b_conv.inner = (void*)(b & (~1));
16138 b_conv.is_owned = false;
16139 jboolean ret_val = PaymentId_eq(&a_conv, &b_conv);
16143 int8_tArray __attribute__((visibility("default"))) TS_PaymentId_write(uint32_t obj) {
16144 LDKPaymentId obj_conv;
16145 obj_conv.inner = (void*)(obj & (~1));
16146 obj_conv.is_owned = false;
16147 LDKCVec_u8Z ret_var = PaymentId_write(&obj_conv);
16148 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16149 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16150 CVec_u8Z_free(ret_var);
16154 uint32_t __attribute__((visibility("default"))) TS_PaymentId_read(int8_tArray ser) {
16155 LDKu8slice ser_ref;
16156 ser_ref.datalen = *((uint32_t*)ser);
16157 ser_ref.data = (int8_t*)(ser + 4);
16158 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
16159 *ret_conv = PaymentId_read(ser_ref);
16160 return (uint64_t)ret_conv;
16163 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
16164 LDKChannelManager this_obj_conv;
16165 this_obj_conv.inner = (void*)(this_obj & (~1));
16166 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16167 ChannelManager_free(this_obj_conv);
16170 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
16171 LDKChainParameters this_obj_conv;
16172 this_obj_conv.inner = (void*)(this_obj & (~1));
16173 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16174 ChainParameters_free(this_obj_conv);
16177 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
16178 LDKChainParameters this_ptr_conv;
16179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16180 this_ptr_conv.is_owned = false;
16181 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
16185 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
16186 LDKChainParameters this_ptr_conv;
16187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16188 this_ptr_conv.is_owned = false;
16189 LDKNetwork val_conv = LDKNetwork_from_js(val);
16190 ChainParameters_set_network(&this_ptr_conv, val_conv);
16193 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
16194 LDKChainParameters this_ptr_conv;
16195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16196 this_ptr_conv.is_owned = false;
16197 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
16198 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16199 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16200 uint64_t ret_ref = (uint64_t)ret_var.inner;
16201 if (ret_var.is_owned) {
16207 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
16208 LDKChainParameters this_ptr_conv;
16209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16210 this_ptr_conv.is_owned = false;
16211 LDKBestBlock val_conv;
16212 val_conv.inner = (void*)(val & (~1));
16213 val_conv.is_owned = (val & 1) || (val == 0);
16214 val_conv = BestBlock_clone(&val_conv);
16215 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
16218 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
16219 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
16220 LDKBestBlock best_block_arg_conv;
16221 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
16222 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
16223 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
16224 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
16225 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16226 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16227 uint64_t ret_ref = (uint64_t)ret_var.inner;
16228 if (ret_var.is_owned) {
16234 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_clone(uint32_t orig) {
16235 LDKChainParameters orig_conv;
16236 orig_conv.inner = (void*)(orig & (~1));
16237 orig_conv.is_owned = false;
16238 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
16239 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16240 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16241 uint64_t ret_ref = (uint64_t)ret_var.inner;
16242 if (ret_var.is_owned) {
16248 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
16249 LDKCounterpartyForwardingInfo this_obj_conv;
16250 this_obj_conv.inner = (void*)(this_obj & (~1));
16251 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16252 CounterpartyForwardingInfo_free(this_obj_conv);
16255 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
16256 LDKCounterpartyForwardingInfo this_ptr_conv;
16257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16258 this_ptr_conv.is_owned = false;
16259 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
16263 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
16264 LDKCounterpartyForwardingInfo this_ptr_conv;
16265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16266 this_ptr_conv.is_owned = false;
16267 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
16270 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
16271 LDKCounterpartyForwardingInfo this_ptr_conv;
16272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16273 this_ptr_conv.is_owned = false;
16274 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
16278 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
16279 LDKCounterpartyForwardingInfo this_ptr_conv;
16280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16281 this_ptr_conv.is_owned = false;
16282 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
16285 int16_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
16286 LDKCounterpartyForwardingInfo this_ptr_conv;
16287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16288 this_ptr_conv.is_owned = false;
16289 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
16293 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
16294 LDKCounterpartyForwardingInfo this_ptr_conv;
16295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16296 this_ptr_conv.is_owned = false;
16297 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
16300 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) {
16301 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
16302 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16303 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16304 uint64_t ret_ref = (uint64_t)ret_var.inner;
16305 if (ret_var.is_owned) {
16311 uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
16312 LDKCounterpartyForwardingInfo orig_conv;
16313 orig_conv.inner = (void*)(orig & (~1));
16314 orig_conv.is_owned = false;
16315 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
16316 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16317 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16318 uint64_t ret_ref = (uint64_t)ret_var.inner;
16319 if (ret_var.is_owned) {
16325 void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
16326 LDKChannelCounterparty this_obj_conv;
16327 this_obj_conv.inner = (void*)(this_obj & (~1));
16328 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16329 ChannelCounterparty_free(this_obj_conv);
16332 int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
16333 LDKChannelCounterparty this_ptr_conv;
16334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16335 this_ptr_conv.is_owned = false;
16336 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16337 memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
16341 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
16342 LDKChannelCounterparty this_ptr_conv;
16343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16344 this_ptr_conv.is_owned = false;
16345 LDKPublicKey val_ref;
16346 CHECK(*((uint32_t*)val) == 33);
16347 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16348 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
16351 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
16352 LDKChannelCounterparty this_ptr_conv;
16353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16354 this_ptr_conv.is_owned = false;
16355 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
16356 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16357 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16358 uint64_t ret_ref = (uint64_t)ret_var.inner;
16359 if (ret_var.is_owned) {
16365 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
16366 LDKChannelCounterparty this_ptr_conv;
16367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16368 this_ptr_conv.is_owned = false;
16369 LDKInitFeatures val_conv;
16370 val_conv.inner = (void*)(val & (~1));
16371 val_conv.is_owned = (val & 1) || (val == 0);
16372 val_conv = InitFeatures_clone(&val_conv);
16373 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
16376 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
16377 LDKChannelCounterparty this_ptr_conv;
16378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16379 this_ptr_conv.is_owned = false;
16380 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
16384 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
16385 LDKChannelCounterparty this_ptr_conv;
16386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16387 this_ptr_conv.is_owned = false;
16388 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
16391 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
16392 LDKChannelCounterparty this_ptr_conv;
16393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16394 this_ptr_conv.is_owned = false;
16395 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
16396 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16397 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16398 uint64_t ret_ref = (uint64_t)ret_var.inner;
16399 if (ret_var.is_owned) {
16405 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
16406 LDKChannelCounterparty this_ptr_conv;
16407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16408 this_ptr_conv.is_owned = false;
16409 LDKCounterpartyForwardingInfo val_conv;
16410 val_conv.inner = (void*)(val & (~1));
16411 val_conv.is_owned = (val & 1) || (val == 0);
16412 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
16413 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
16416 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) {
16417 LDKPublicKey node_id_arg_ref;
16418 CHECK(*((uint32_t*)node_id_arg) == 33);
16419 memcpy(node_id_arg_ref.compressed_form, (uint8_t*)(node_id_arg + 4), 33);
16420 LDKInitFeatures features_arg_conv;
16421 features_arg_conv.inner = (void*)(features_arg & (~1));
16422 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16423 features_arg_conv = InitFeatures_clone(&features_arg_conv);
16424 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
16425 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
16426 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
16427 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
16428 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
16429 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16430 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16431 uint64_t ret_ref = (uint64_t)ret_var.inner;
16432 if (ret_var.is_owned) {
16438 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
16439 LDKChannelCounterparty orig_conv;
16440 orig_conv.inner = (void*)(orig & (~1));
16441 orig_conv.is_owned = false;
16442 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
16443 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16444 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16445 uint64_t ret_ref = (uint64_t)ret_var.inner;
16446 if (ret_var.is_owned) {
16452 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
16453 LDKChannelDetails this_obj_conv;
16454 this_obj_conv.inner = (void*)(this_obj & (~1));
16455 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16456 ChannelDetails_free(this_obj_conv);
16459 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
16460 LDKChannelDetails this_ptr_conv;
16461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16462 this_ptr_conv.is_owned = false;
16463 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16464 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
16468 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16469 LDKChannelDetails this_ptr_conv;
16470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16471 this_ptr_conv.is_owned = false;
16472 LDKThirtyTwoBytes val_ref;
16473 CHECK(*((uint32_t*)val) == 32);
16474 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16475 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
16478 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
16479 LDKChannelDetails this_ptr_conv;
16480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16481 this_ptr_conv.is_owned = false;
16482 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
16483 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16484 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16485 uint64_t ret_ref = (uint64_t)ret_var.inner;
16486 if (ret_var.is_owned) {
16492 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
16493 LDKChannelDetails this_ptr_conv;
16494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16495 this_ptr_conv.is_owned = false;
16496 LDKChannelCounterparty val_conv;
16497 val_conv.inner = (void*)(val & (~1));
16498 val_conv.is_owned = (val & 1) || (val == 0);
16499 val_conv = ChannelCounterparty_clone(&val_conv);
16500 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
16503 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
16504 LDKChannelDetails this_ptr_conv;
16505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16506 this_ptr_conv.is_owned = false;
16507 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
16508 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16509 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16510 uint64_t ret_ref = (uint64_t)ret_var.inner;
16511 if (ret_var.is_owned) {
16517 void __attribute__((visibility("default"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
16518 LDKChannelDetails this_ptr_conv;
16519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16520 this_ptr_conv.is_owned = false;
16521 LDKOutPoint val_conv;
16522 val_conv.inner = (void*)(val & (~1));
16523 val_conv.is_owned = (val & 1) || (val == 0);
16524 val_conv = OutPoint_clone(&val_conv);
16525 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
16528 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
16529 LDKChannelDetails this_ptr_conv;
16530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16531 this_ptr_conv.is_owned = false;
16532 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16533 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
16534 uint64_t ret_ref = (uint64_t)ret_copy;
16538 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
16539 LDKChannelDetails this_ptr_conv;
16540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16541 this_ptr_conv.is_owned = false;
16542 void* val_ptr = (void*)(((uint64_t)val) & ~1);
16543 CHECK_ACCESS(val_ptr);
16544 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
16545 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
16546 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
16549 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
16550 LDKChannelDetails this_ptr_conv;
16551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16552 this_ptr_conv.is_owned = false;
16553 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
16557 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
16558 LDKChannelDetails this_ptr_conv;
16559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16560 this_ptr_conv.is_owned = false;
16561 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
16564 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
16565 LDKChannelDetails this_ptr_conv;
16566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16567 this_ptr_conv.is_owned = false;
16568 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16569 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
16570 uint64_t ret_ref = (uint64_t)ret_copy;
16574 void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
16575 LDKChannelDetails this_ptr_conv;
16576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16577 this_ptr_conv.is_owned = false;
16578 void* val_ptr = (void*)(((uint64_t)val) & ~1);
16579 CHECK_ACCESS(val_ptr);
16580 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
16581 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
16582 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
16585 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) {
16586 LDKChannelDetails this_ptr_conv;
16587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16588 this_ptr_conv.is_owned = false;
16589 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
16593 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
16594 LDKChannelDetails this_ptr_conv;
16595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16596 this_ptr_conv.is_owned = false;
16597 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
16600 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
16601 LDKChannelDetails this_ptr_conv;
16602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16603 this_ptr_conv.is_owned = false;
16604 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
16608 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
16609 LDKChannelDetails this_ptr_conv;
16610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16611 this_ptr_conv.is_owned = false;
16612 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
16615 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
16616 LDKChannelDetails this_ptr_conv;
16617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16618 this_ptr_conv.is_owned = false;
16619 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
16623 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
16624 LDKChannelDetails this_ptr_conv;
16625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16626 this_ptr_conv.is_owned = false;
16627 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
16630 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
16631 LDKChannelDetails this_ptr_conv;
16632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16633 this_ptr_conv.is_owned = false;
16634 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16635 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
16636 uint64_t ret_ref = (uint64_t)ret_copy;
16640 void __attribute__((visibility("default"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
16641 LDKChannelDetails this_ptr_conv;
16642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16643 this_ptr_conv.is_owned = false;
16644 void* val_ptr = (void*)(((uint64_t)val) & ~1);
16645 CHECK_ACCESS(val_ptr);
16646 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
16647 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
16648 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
16651 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
16652 LDKChannelDetails this_ptr_conv;
16653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16654 this_ptr_conv.is_owned = false;
16655 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16656 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
16657 uint64_t ret_ref = (uint64_t)ret_copy;
16661 void __attribute__((visibility("default"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
16662 LDKChannelDetails this_ptr_conv;
16663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16664 this_ptr_conv.is_owned = false;
16665 void* val_ptr = (void*)(((uint64_t)val) & ~1);
16666 CHECK_ACCESS(val_ptr);
16667 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
16668 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
16669 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
16672 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
16673 LDKChannelDetails this_ptr_conv;
16674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16675 this_ptr_conv.is_owned = false;
16676 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
16680 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
16681 LDKChannelDetails this_ptr_conv;
16682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16683 this_ptr_conv.is_owned = false;
16684 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
16687 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
16688 LDKChannelDetails this_ptr_conv;
16689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16690 this_ptr_conv.is_owned = false;
16691 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
16695 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
16696 LDKChannelDetails this_ptr_conv;
16697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16698 this_ptr_conv.is_owned = false;
16699 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
16702 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
16703 LDKChannelDetails this_ptr_conv;
16704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16705 this_ptr_conv.is_owned = false;
16706 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
16710 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
16711 LDKChannelDetails this_ptr_conv;
16712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16713 this_ptr_conv.is_owned = false;
16714 ChannelDetails_set_is_usable(&this_ptr_conv, val);
16717 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
16718 LDKChannelDetails this_ptr_conv;
16719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16720 this_ptr_conv.is_owned = false;
16721 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
16725 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
16726 LDKChannelDetails this_ptr_conv;
16727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16728 this_ptr_conv.is_owned = false;
16729 ChannelDetails_set_is_public(&this_ptr_conv, val);
16732 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) {
16733 LDKThirtyTwoBytes channel_id_arg_ref;
16734 CHECK(*((uint32_t*)channel_id_arg) == 32);
16735 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16736 LDKChannelCounterparty counterparty_arg_conv;
16737 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
16738 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
16739 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
16740 LDKOutPoint funding_txo_arg_conv;
16741 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
16742 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
16743 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
16744 void* short_channel_id_arg_ptr = (void*)(((uint64_t)short_channel_id_arg) & ~1);
16745 CHECK_ACCESS(short_channel_id_arg_ptr);
16746 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
16747 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
16748 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
16749 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
16750 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
16751 void* confirmations_required_arg_ptr = (void*)(((uint64_t)confirmations_required_arg) & ~1);
16752 CHECK_ACCESS(confirmations_required_arg_ptr);
16753 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
16754 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
16755 void* force_close_spend_delay_arg_ptr = (void*)(((uint64_t)force_close_spend_delay_arg) & ~1);
16756 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
16757 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
16758 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
16759 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);
16760 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16761 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16762 uint64_t ret_ref = (uint64_t)ret_var.inner;
16763 if (ret_var.is_owned) {
16769 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
16770 LDKChannelDetails orig_conv;
16771 orig_conv.inner = (void*)(orig & (~1));
16772 orig_conv.is_owned = false;
16773 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
16774 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16775 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16776 uint64_t ret_ref = (uint64_t)ret_var.inner;
16777 if (ret_var.is_owned) {
16783 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
16784 if ((this_ptr & 1) != 0) return;
16785 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16786 CHECK_ACCESS(this_ptr_ptr);
16787 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
16788 FREE((void*)this_ptr);
16789 PaymentSendFailure_free(this_ptr_conv);
16792 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
16793 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
16794 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
16795 *ret_copy = PaymentSendFailure_clone(orig_conv);
16796 uint64_t ret_ref = (uint64_t)ret_copy;
16800 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
16801 void* a_ptr = (void*)(((uint64_t)a) & ~1);
16802 CHECK_ACCESS(a_ptr);
16803 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
16804 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
16805 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
16806 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
16807 uint64_t ret_ref = (uint64_t)ret_copy;
16811 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
16812 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
16813 a_constr.datalen = *((uint32_t*)a);
16814 if (a_constr.datalen > 0)
16815 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
16817 a_constr.data = NULL;
16818 uint32_t* a_vals = (uint32_t*)(a + 4);
16819 for (size_t w = 0; w < a_constr.datalen; w++) {
16820 uint32_t a_conv_22 = a_vals[w];
16821 void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1);
16822 CHECK_ACCESS(a_conv_22_ptr);
16823 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
16824 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
16825 a_constr.data[w] = a_conv_22_conv;
16827 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
16828 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
16829 uint64_t ret_ref = (uint64_t)ret_copy;
16833 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
16834 LDKCVec_APIErrorZ a_constr;
16835 a_constr.datalen = *((uint32_t*)a);
16836 if (a_constr.datalen > 0)
16837 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
16839 a_constr.data = NULL;
16840 uint32_t* a_vals = (uint32_t*)(a + 4);
16841 for (size_t k = 0; k < a_constr.datalen; k++) {
16842 uint32_t a_conv_10 = a_vals[k];
16843 void* a_conv_10_ptr = (void*)(((uint64_t)a_conv_10) & ~1);
16844 CHECK_ACCESS(a_conv_10_ptr);
16845 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
16846 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
16847 a_constr.data[k] = a_conv_10_conv;
16849 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
16850 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
16851 uint64_t ret_ref = (uint64_t)ret_copy;
16855 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_partial_failure(uint32_tArray a) {
16856 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
16857 a_constr.datalen = *((uint32_t*)a);
16858 if (a_constr.datalen > 0)
16859 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
16861 a_constr.data = NULL;
16862 uint32_t* a_vals = (uint32_t*)(a + 4);
16863 for (size_t w = 0; w < a_constr.datalen; w++) {
16864 uint32_t a_conv_22 = a_vals[w];
16865 void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1);
16866 CHECK_ACCESS(a_conv_22_ptr);
16867 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
16868 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
16869 a_constr.data[w] = a_conv_22_conv;
16871 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
16872 *ret_copy = PaymentSendFailure_partial_failure(a_constr);
16873 uint64_t ret_ref = (uint64_t)ret_copy;
16877 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) {
16878 void* fee_est_ptr = (void*)(((uint64_t)fee_est) & ~1);
16879 CHECK_ACCESS(fee_est_ptr);
16880 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
16881 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
16882 CHECK_ACCESS(chain_monitor_ptr);
16883 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
16884 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
16885 CHECK_ACCESS(tx_broadcaster_ptr);
16886 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
16887 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
16888 CHECK_ACCESS(logger_ptr);
16889 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
16890 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
16891 CHECK_ACCESS(keys_manager_ptr);
16892 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
16893 LDKUserConfig config_conv;
16894 config_conv.inner = (void*)(config & (~1));
16895 config_conv.is_owned = (config & 1) || (config == 0);
16896 config_conv = UserConfig_clone(&config_conv);
16897 LDKChainParameters params_conv;
16898 params_conv.inner = (void*)(params & (~1));
16899 params_conv.is_owned = (params & 1) || (params == 0);
16900 params_conv = ChainParameters_clone(¶ms_conv);
16901 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
16902 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16903 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16904 uint64_t ret_ref = (uint64_t)ret_var.inner;
16905 if (ret_var.is_owned) {
16911 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
16912 LDKChannelManager this_arg_conv;
16913 this_arg_conv.inner = (void*)(this_arg & (~1));
16914 this_arg_conv.is_owned = false;
16915 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
16916 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16917 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16918 uint64_t ret_ref = (uint64_t)ret_var.inner;
16919 if (ret_var.is_owned) {
16925 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) {
16926 LDKChannelManager this_arg_conv;
16927 this_arg_conv.inner = (void*)(this_arg & (~1));
16928 this_arg_conv.is_owned = false;
16929 LDKPublicKey their_network_key_ref;
16930 CHECK(*((uint32_t*)their_network_key) == 33);
16931 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
16932 LDKUserConfig override_config_conv;
16933 override_config_conv.inner = (void*)(override_config & (~1));
16934 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
16935 override_config_conv = UserConfig_clone(&override_config_conv);
16936 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16937 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
16938 return (uint64_t)ret_conv;
16941 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
16942 LDKChannelManager this_arg_conv;
16943 this_arg_conv.inner = (void*)(this_arg & (~1));
16944 this_arg_conv.is_owned = false;
16945 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
16946 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
16947 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
16948 for (size_t q = 0; q < ret_var.datalen; q++) {
16949 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
16950 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16951 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16952 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
16953 if (ret_conv_16_var.is_owned) {
16954 ret_conv_16_ref |= 1;
16956 ret_arr_ptr[q] = ret_conv_16_ref;
16958 FREE(ret_var.data);
16962 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
16963 LDKChannelManager this_arg_conv;
16964 this_arg_conv.inner = (void*)(this_arg & (~1));
16965 this_arg_conv.is_owned = false;
16966 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
16967 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
16968 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
16969 for (size_t q = 0; q < ret_var.datalen; q++) {
16970 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
16971 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16972 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16973 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
16974 if (ret_conv_16_var.is_owned) {
16975 ret_conv_16_ref |= 1;
16977 ret_arr_ptr[q] = ret_conv_16_ref;
16979 FREE(ret_var.data);
16983 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
16984 LDKChannelManager this_arg_conv;
16985 this_arg_conv.inner = (void*)(this_arg & (~1));
16986 this_arg_conv.is_owned = false;
16987 unsigned char channel_id_arr[32];
16988 CHECK(*((uint32_t*)channel_id) == 32);
16989 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
16990 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
16991 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16992 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
16993 return (uint64_t)ret_conv;
16996 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) {
16997 LDKChannelManager this_arg_conv;
16998 this_arg_conv.inner = (void*)(this_arg & (~1));
16999 this_arg_conv.is_owned = false;
17000 unsigned char channel_id_arr[32];
17001 CHECK(*((uint32_t*)channel_id) == 32);
17002 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
17003 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
17004 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17005 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
17006 return (uint64_t)ret_conv;
17009 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
17010 LDKChannelManager this_arg_conv;
17011 this_arg_conv.inner = (void*)(this_arg & (~1));
17012 this_arg_conv.is_owned = false;
17013 unsigned char channel_id_arr[32];
17014 CHECK(*((uint32_t*)channel_id) == 32);
17015 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
17016 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
17017 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17018 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
17019 return (uint64_t)ret_conv;
17022 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
17023 LDKChannelManager this_arg_conv;
17024 this_arg_conv.inner = (void*)(this_arg & (~1));
17025 this_arg_conv.is_owned = false;
17026 ChannelManager_force_close_all_channels(&this_arg_conv);
17029 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
17030 LDKChannelManager this_arg_conv;
17031 this_arg_conv.inner = (void*)(this_arg & (~1));
17032 this_arg_conv.is_owned = false;
17033 LDKRoute route_conv;
17034 route_conv.inner = (void*)(route & (~1));
17035 route_conv.is_owned = false;
17036 LDKThirtyTwoBytes payment_hash_ref;
17037 CHECK(*((uint32_t*)payment_hash) == 32);
17038 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
17039 LDKThirtyTwoBytes payment_secret_ref;
17040 CHECK(*((uint32_t*)payment_secret) == 32);
17041 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
17042 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17043 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
17044 return (uint64_t)ret_conv;
17047 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, uint32_t payment_id) {
17048 LDKChannelManager this_arg_conv;
17049 this_arg_conv.inner = (void*)(this_arg & (~1));
17050 this_arg_conv.is_owned = false;
17051 LDKRoute route_conv;
17052 route_conv.inner = (void*)(route & (~1));
17053 route_conv.is_owned = false;
17054 LDKPaymentId payment_id_conv;
17055 payment_id_conv.inner = (void*)(payment_id & (~1));
17056 payment_id_conv.is_owned = (payment_id & 1) || (payment_id == 0);
17057 payment_id_conv = PaymentId_clone(&payment_id_conv);
17058 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17059 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_conv);
17060 return (uint64_t)ret_conv;
17063 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
17064 LDKChannelManager this_arg_conv;
17065 this_arg_conv.inner = (void*)(this_arg & (~1));
17066 this_arg_conv.is_owned = false;
17067 LDKRoute route_conv;
17068 route_conv.inner = (void*)(route & (~1));
17069 route_conv.is_owned = false;
17070 LDKThirtyTwoBytes payment_preimage_ref;
17071 CHECK(*((uint32_t*)payment_preimage) == 32);
17072 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
17073 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17074 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
17075 return (uint64_t)ret_conv;
17078 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
17079 LDKChannelManager this_arg_conv;
17080 this_arg_conv.inner = (void*)(this_arg & (~1));
17081 this_arg_conv.is_owned = false;
17082 unsigned char temporary_channel_id_arr[32];
17083 CHECK(*((uint32_t*)temporary_channel_id) == 32);
17084 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
17085 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
17086 LDKTransaction funding_transaction_ref;
17087 funding_transaction_ref.datalen = *((uint32_t*)funding_transaction);
17088 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
17089 memcpy(funding_transaction_ref.data, (uint8_t*)(funding_transaction + 4), funding_transaction_ref.datalen);
17090 funding_transaction_ref.data_is_owned = true;
17091 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17092 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
17093 return (uint64_t)ret_conv;
17096 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
17097 LDKChannelManager this_arg_conv;
17098 this_arg_conv.inner = (void*)(this_arg & (~1));
17099 this_arg_conv.is_owned = false;
17100 LDKThreeBytes rgb_ref;
17101 CHECK(*((uint32_t*)rgb) == 3);
17102 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
17103 LDKThirtyTwoBytes alias_ref;
17104 CHECK(*((uint32_t*)alias) == 32);
17105 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
17106 LDKCVec_NetAddressZ addresses_constr;
17107 addresses_constr.datalen = *((uint32_t*)addresses);
17108 if (addresses_constr.datalen > 0)
17109 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17111 addresses_constr.data = NULL;
17112 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
17113 for (size_t m = 0; m < addresses_constr.datalen; m++) {
17114 uint32_t addresses_conv_12 = addresses_vals[m];
17115 void* addresses_conv_12_ptr = (void*)(((uint64_t)addresses_conv_12) & ~1);
17116 CHECK_ACCESS(addresses_conv_12_ptr);
17117 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
17118 addresses_constr.data[m] = addresses_conv_12_conv;
17120 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
17123 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
17124 LDKChannelManager this_arg_conv;
17125 this_arg_conv.inner = (void*)(this_arg & (~1));
17126 this_arg_conv.is_owned = false;
17127 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
17130 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
17131 LDKChannelManager this_arg_conv;
17132 this_arg_conv.inner = (void*)(this_arg & (~1));
17133 this_arg_conv.is_owned = false;
17134 ChannelManager_timer_tick_occurred(&this_arg_conv);
17137 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
17138 LDKChannelManager this_arg_conv;
17139 this_arg_conv.inner = (void*)(this_arg & (~1));
17140 this_arg_conv.is_owned = false;
17141 unsigned char payment_hash_arr[32];
17142 CHECK(*((uint32_t*)payment_hash) == 32);
17143 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
17144 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
17145 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
17149 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
17150 LDKChannelManager this_arg_conv;
17151 this_arg_conv.inner = (void*)(this_arg & (~1));
17152 this_arg_conv.is_owned = false;
17153 LDKThirtyTwoBytes payment_preimage_ref;
17154 CHECK(*((uint32_t*)payment_preimage) == 32);
17155 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
17156 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
17160 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
17161 LDKChannelManager this_arg_conv;
17162 this_arg_conv.inner = (void*)(this_arg & (~1));
17163 this_arg_conv.is_owned = false;
17164 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17165 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
17169 void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
17170 LDKChannelManager this_arg_conv;
17171 this_arg_conv.inner = (void*)(this_arg & (~1));
17172 this_arg_conv.is_owned = false;
17173 LDKOutPoint funding_txo_conv;
17174 funding_txo_conv.inner = (void*)(funding_txo & (~1));
17175 funding_txo_conv.is_owned = false;
17176 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
17179 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) {
17180 LDKChannelManager this_arg_conv;
17181 this_arg_conv.inner = (void*)(this_arg & (~1));
17182 this_arg_conv.is_owned = false;
17183 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
17184 CHECK_ACCESS(min_value_msat_ptr);
17185 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
17186 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
17187 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17188 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
17189 return ((uint64_t)ret_conv);
17192 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) {
17193 LDKChannelManager this_arg_conv;
17194 this_arg_conv.inner = (void*)(this_arg & (~1));
17195 this_arg_conv.is_owned = false;
17196 LDKThirtyTwoBytes payment_hash_ref;
17197 CHECK(*((uint32_t*)payment_hash) == 32);
17198 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
17199 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
17200 CHECK_ACCESS(min_value_msat_ptr);
17201 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
17202 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
17203 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17204 *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);
17205 return (uint64_t)ret_conv;
17208 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
17209 LDKChannelManager this_arg_conv;
17210 this_arg_conv.inner = (void*)(this_arg & (~1));
17211 this_arg_conv.is_owned = false;
17212 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
17213 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
17214 return (uint64_t)ret_ret;
17217 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
17218 LDKChannelManager this_arg_conv;
17219 this_arg_conv.inner = (void*)(this_arg & (~1));
17220 this_arg_conv.is_owned = false;
17221 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
17222 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
17223 return (uint64_t)ret_ret;
17226 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
17227 LDKChannelManager this_arg_conv;
17228 this_arg_conv.inner = (void*)(this_arg & (~1));
17229 this_arg_conv.is_owned = false;
17230 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
17231 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
17232 return (uint64_t)ret_ret;
17235 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
17236 LDKChannelManager this_arg_conv;
17237 this_arg_conv.inner = (void*)(this_arg & (~1));
17238 this_arg_conv.is_owned = false;
17239 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
17240 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
17241 return (uint64_t)ret_ret;
17244 jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
17245 LDKChannelManager this_arg_conv;
17246 this_arg_conv.inner = (void*)(this_arg & (~1));
17247 this_arg_conv.is_owned = false;
17248 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
17252 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
17253 LDKChannelManager this_arg_conv;
17254 this_arg_conv.inner = (void*)(this_arg & (~1));
17255 this_arg_conv.is_owned = false;
17256 ChannelManager_await_persistable_update(&this_arg_conv);
17259 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
17260 LDKChannelManager this_arg_conv;
17261 this_arg_conv.inner = (void*)(this_arg & (~1));
17262 this_arg_conv.is_owned = false;
17263 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
17264 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17265 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17266 uint64_t ret_ref = (uint64_t)ret_var.inner;
17267 if (ret_var.is_owned) {
17273 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
17274 LDKChannelManager this_arg_conv;
17275 this_arg_conv.inner = (void*)(this_arg & (~1));
17276 this_arg_conv.is_owned = false;
17277 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
17278 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
17279 return (uint64_t)ret_ret;
17282 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
17283 LDKChannelManager obj_conv;
17284 obj_conv.inner = (void*)(obj & (~1));
17285 obj_conv.is_owned = false;
17286 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
17287 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17288 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17289 CVec_u8Z_free(ret_var);
17293 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
17294 LDKChannelManagerReadArgs this_obj_conv;
17295 this_obj_conv.inner = (void*)(this_obj & (~1));
17296 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17297 ChannelManagerReadArgs_free(this_obj_conv);
17300 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
17301 LDKChannelManagerReadArgs this_ptr_conv;
17302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17303 this_ptr_conv.is_owned = false;
17304 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
17308 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
17309 LDKChannelManagerReadArgs this_ptr_conv;
17310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17311 this_ptr_conv.is_owned = false;
17312 void* val_ptr = (void*)(((uint64_t)val) & ~1);
17313 CHECK_ACCESS(val_ptr);
17314 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
17315 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
17318 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
17319 LDKChannelManagerReadArgs this_ptr_conv;
17320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17321 this_ptr_conv.is_owned = false;
17322 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
17326 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
17327 LDKChannelManagerReadArgs this_ptr_conv;
17328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17329 this_ptr_conv.is_owned = false;
17330 void* val_ptr = (void*)(((uint64_t)val) & ~1);
17331 CHECK_ACCESS(val_ptr);
17332 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
17333 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
17336 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
17337 LDKChannelManagerReadArgs this_ptr_conv;
17338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17339 this_ptr_conv.is_owned = false;
17340 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
17344 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
17345 LDKChannelManagerReadArgs this_ptr_conv;
17346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17347 this_ptr_conv.is_owned = false;
17348 void* val_ptr = (void*)(((uint64_t)val) & ~1);
17349 CHECK_ACCESS(val_ptr);
17350 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
17351 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
17354 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
17355 LDKChannelManagerReadArgs this_ptr_conv;
17356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17357 this_ptr_conv.is_owned = false;
17358 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
17362 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
17363 LDKChannelManagerReadArgs this_ptr_conv;
17364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17365 this_ptr_conv.is_owned = false;
17366 void* val_ptr = (void*)(((uint64_t)val) & ~1);
17367 CHECK_ACCESS(val_ptr);
17368 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
17369 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
17372 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
17373 LDKChannelManagerReadArgs this_ptr_conv;
17374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17375 this_ptr_conv.is_owned = false;
17376 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
17380 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
17381 LDKChannelManagerReadArgs this_ptr_conv;
17382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17383 this_ptr_conv.is_owned = false;
17384 void* val_ptr = (void*)(((uint64_t)val) & ~1);
17385 CHECK_ACCESS(val_ptr);
17386 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
17387 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
17390 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
17391 LDKChannelManagerReadArgs this_ptr_conv;
17392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17393 this_ptr_conv.is_owned = false;
17394 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
17395 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17396 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17397 uint64_t ret_ref = (uint64_t)ret_var.inner;
17398 if (ret_var.is_owned) {
17404 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
17405 LDKChannelManagerReadArgs this_ptr_conv;
17406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17407 this_ptr_conv.is_owned = false;
17408 LDKUserConfig val_conv;
17409 val_conv.inner = (void*)(val & (~1));
17410 val_conv.is_owned = (val & 1) || (val == 0);
17411 val_conv = UserConfig_clone(&val_conv);
17412 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
17415 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) {
17416 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
17417 CHECK_ACCESS(keys_manager_ptr);
17418 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
17419 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
17420 CHECK_ACCESS(fee_estimator_ptr);
17421 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
17422 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
17423 CHECK_ACCESS(chain_monitor_ptr);
17424 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
17425 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
17426 CHECK_ACCESS(tx_broadcaster_ptr);
17427 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
17428 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
17429 CHECK_ACCESS(logger_ptr);
17430 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
17431 LDKUserConfig default_config_conv;
17432 default_config_conv.inner = (void*)(default_config & (~1));
17433 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
17434 default_config_conv = UserConfig_clone(&default_config_conv);
17435 LDKCVec_ChannelMonitorZ channel_monitors_constr;
17436 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
17437 if (channel_monitors_constr.datalen > 0)
17438 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
17440 channel_monitors_constr.data = NULL;
17441 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
17442 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
17443 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
17444 LDKChannelMonitor channel_monitors_conv_16_conv;
17445 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
17446 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
17447 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
17449 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);
17450 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17451 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17452 uint64_t ret_ref = (uint64_t)ret_var.inner;
17453 if (ret_var.is_owned) {
17459 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
17460 LDKu8slice ser_ref;
17461 ser_ref.datalen = *((uint32_t*)ser);
17462 ser_ref.data = (int8_t*)(ser + 4);
17463 LDKChannelManagerReadArgs arg_conv;
17464 arg_conv.inner = (void*)(arg & (~1));
17465 arg_conv.is_owned = (arg & 1) || (arg == 0);
17466 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
17467 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17468 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
17469 return (uint64_t)ret_conv;
17472 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
17473 LDKDecodeError this_obj_conv;
17474 this_obj_conv.inner = (void*)(this_obj & (~1));
17475 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17476 DecodeError_free(this_obj_conv);
17479 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
17480 LDKDecodeError orig_conv;
17481 orig_conv.inner = (void*)(orig & (~1));
17482 orig_conv.is_owned = false;
17483 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
17484 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17485 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17486 uint64_t ret_ref = (uint64_t)ret_var.inner;
17487 if (ret_var.is_owned) {
17493 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
17494 LDKInit this_obj_conv;
17495 this_obj_conv.inner = (void*)(this_obj & (~1));
17496 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17497 Init_free(this_obj_conv);
17500 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
17501 LDKInit this_ptr_conv;
17502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17503 this_ptr_conv.is_owned = false;
17504 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
17505 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17506 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17507 uint64_t ret_ref = (uint64_t)ret_var.inner;
17508 if (ret_var.is_owned) {
17514 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
17515 LDKInit this_ptr_conv;
17516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17517 this_ptr_conv.is_owned = false;
17518 LDKInitFeatures val_conv;
17519 val_conv.inner = (void*)(val & (~1));
17520 val_conv.is_owned = (val & 1) || (val == 0);
17521 val_conv = InitFeatures_clone(&val_conv);
17522 Init_set_features(&this_ptr_conv, val_conv);
17525 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
17526 LDKInitFeatures features_arg_conv;
17527 features_arg_conv.inner = (void*)(features_arg & (~1));
17528 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
17529 features_arg_conv = InitFeatures_clone(&features_arg_conv);
17530 LDKInit ret_var = Init_new(features_arg_conv);
17531 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17532 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17533 uint64_t ret_ref = (uint64_t)ret_var.inner;
17534 if (ret_var.is_owned) {
17540 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
17542 orig_conv.inner = (void*)(orig & (~1));
17543 orig_conv.is_owned = false;
17544 LDKInit ret_var = Init_clone(&orig_conv);
17545 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17546 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17547 uint64_t ret_ref = (uint64_t)ret_var.inner;
17548 if (ret_var.is_owned) {
17554 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
17555 LDKErrorMessage this_obj_conv;
17556 this_obj_conv.inner = (void*)(this_obj & (~1));
17557 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17558 ErrorMessage_free(this_obj_conv);
17561 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
17562 LDKErrorMessage this_ptr_conv;
17563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17564 this_ptr_conv.is_owned = false;
17565 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17566 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
17570 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17571 LDKErrorMessage this_ptr_conv;
17572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17573 this_ptr_conv.is_owned = false;
17574 LDKThirtyTwoBytes val_ref;
17575 CHECK(*((uint32_t*)val) == 32);
17576 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17577 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
17580 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
17581 LDKErrorMessage this_ptr_conv;
17582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17583 this_ptr_conv.is_owned = false;
17584 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
17585 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17590 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
17591 LDKErrorMessage this_ptr_conv;
17592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17593 this_ptr_conv.is_owned = false;
17594 LDKStr val_conv = str_ref_to_owned_c(val);
17595 ErrorMessage_set_data(&this_ptr_conv, val_conv);
17598 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
17599 LDKThirtyTwoBytes channel_id_arg_ref;
17600 CHECK(*((uint32_t*)channel_id_arg) == 32);
17601 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17602 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
17603 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
17604 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17605 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17606 uint64_t ret_ref = (uint64_t)ret_var.inner;
17607 if (ret_var.is_owned) {
17613 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
17614 LDKErrorMessage orig_conv;
17615 orig_conv.inner = (void*)(orig & (~1));
17616 orig_conv.is_owned = false;
17617 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
17618 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17619 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17620 uint64_t ret_ref = (uint64_t)ret_var.inner;
17621 if (ret_var.is_owned) {
17627 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
17628 LDKPing this_obj_conv;
17629 this_obj_conv.inner = (void*)(this_obj & (~1));
17630 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17631 Ping_free(this_obj_conv);
17634 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
17635 LDKPing this_ptr_conv;
17636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17637 this_ptr_conv.is_owned = false;
17638 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
17642 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
17643 LDKPing this_ptr_conv;
17644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17645 this_ptr_conv.is_owned = false;
17646 Ping_set_ponglen(&this_ptr_conv, val);
17649 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
17650 LDKPing this_ptr_conv;
17651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17652 this_ptr_conv.is_owned = false;
17653 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
17657 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
17658 LDKPing this_ptr_conv;
17659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17660 this_ptr_conv.is_owned = false;
17661 Ping_set_byteslen(&this_ptr_conv, val);
17664 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
17665 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
17666 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17667 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17668 uint64_t ret_ref = (uint64_t)ret_var.inner;
17669 if (ret_var.is_owned) {
17675 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
17677 orig_conv.inner = (void*)(orig & (~1));
17678 orig_conv.is_owned = false;
17679 LDKPing ret_var = Ping_clone(&orig_conv);
17680 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17681 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17682 uint64_t ret_ref = (uint64_t)ret_var.inner;
17683 if (ret_var.is_owned) {
17689 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
17690 LDKPong this_obj_conv;
17691 this_obj_conv.inner = (void*)(this_obj & (~1));
17692 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17693 Pong_free(this_obj_conv);
17696 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
17697 LDKPong this_ptr_conv;
17698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17699 this_ptr_conv.is_owned = false;
17700 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
17704 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
17705 LDKPong this_ptr_conv;
17706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17707 this_ptr_conv.is_owned = false;
17708 Pong_set_byteslen(&this_ptr_conv, val);
17711 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
17712 LDKPong ret_var = Pong_new(byteslen_arg);
17713 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17714 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17715 uint64_t ret_ref = (uint64_t)ret_var.inner;
17716 if (ret_var.is_owned) {
17722 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
17724 orig_conv.inner = (void*)(orig & (~1));
17725 orig_conv.is_owned = false;
17726 LDKPong ret_var = Pong_clone(&orig_conv);
17727 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17728 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17729 uint64_t ret_ref = (uint64_t)ret_var.inner;
17730 if (ret_var.is_owned) {
17736 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
17737 LDKOpenChannel this_obj_conv;
17738 this_obj_conv.inner = (void*)(this_obj & (~1));
17739 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17740 OpenChannel_free(this_obj_conv);
17743 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
17744 LDKOpenChannel this_ptr_conv;
17745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17746 this_ptr_conv.is_owned = false;
17747 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17748 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
17752 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17753 LDKOpenChannel this_ptr_conv;
17754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17755 this_ptr_conv.is_owned = false;
17756 LDKThirtyTwoBytes val_ref;
17757 CHECK(*((uint32_t*)val) == 32);
17758 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17759 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
17762 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
17763 LDKOpenChannel this_ptr_conv;
17764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17765 this_ptr_conv.is_owned = false;
17766 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17767 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
17771 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
17772 LDKOpenChannel this_ptr_conv;
17773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17774 this_ptr_conv.is_owned = false;
17775 LDKThirtyTwoBytes val_ref;
17776 CHECK(*((uint32_t*)val) == 32);
17777 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17778 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
17781 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
17782 LDKOpenChannel this_ptr_conv;
17783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17784 this_ptr_conv.is_owned = false;
17785 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
17789 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
17790 LDKOpenChannel this_ptr_conv;
17791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17792 this_ptr_conv.is_owned = false;
17793 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
17796 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
17797 LDKOpenChannel this_ptr_conv;
17798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17799 this_ptr_conv.is_owned = false;
17800 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
17804 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
17805 LDKOpenChannel this_ptr_conv;
17806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17807 this_ptr_conv.is_owned = false;
17808 OpenChannel_set_push_msat(&this_ptr_conv, val);
17811 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
17812 LDKOpenChannel this_ptr_conv;
17813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17814 this_ptr_conv.is_owned = false;
17815 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
17819 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
17820 LDKOpenChannel this_ptr_conv;
17821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17822 this_ptr_conv.is_owned = false;
17823 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
17826 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
17827 LDKOpenChannel this_ptr_conv;
17828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17829 this_ptr_conv.is_owned = false;
17830 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
17834 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
17835 LDKOpenChannel this_ptr_conv;
17836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17837 this_ptr_conv.is_owned = false;
17838 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
17841 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
17842 LDKOpenChannel this_ptr_conv;
17843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17844 this_ptr_conv.is_owned = false;
17845 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
17849 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
17850 LDKOpenChannel this_ptr_conv;
17851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17852 this_ptr_conv.is_owned = false;
17853 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
17856 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
17857 LDKOpenChannel this_ptr_conv;
17858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17859 this_ptr_conv.is_owned = false;
17860 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
17864 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17865 LDKOpenChannel this_ptr_conv;
17866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17867 this_ptr_conv.is_owned = false;
17868 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
17871 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
17872 LDKOpenChannel this_ptr_conv;
17873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17874 this_ptr_conv.is_owned = false;
17875 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
17879 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
17880 LDKOpenChannel this_ptr_conv;
17881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17882 this_ptr_conv.is_owned = false;
17883 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
17886 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
17887 LDKOpenChannel this_ptr_conv;
17888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17889 this_ptr_conv.is_owned = false;
17890 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
17894 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
17895 LDKOpenChannel this_ptr_conv;
17896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17897 this_ptr_conv.is_owned = false;
17898 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
17901 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
17902 LDKOpenChannel this_ptr_conv;
17903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17904 this_ptr_conv.is_owned = false;
17905 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
17909 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
17910 LDKOpenChannel this_ptr_conv;
17911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17912 this_ptr_conv.is_owned = false;
17913 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
17916 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
17917 LDKOpenChannel this_ptr_conv;
17918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17919 this_ptr_conv.is_owned = false;
17920 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17921 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
17925 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
17926 LDKOpenChannel this_ptr_conv;
17927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17928 this_ptr_conv.is_owned = false;
17929 LDKPublicKey val_ref;
17930 CHECK(*((uint32_t*)val) == 33);
17931 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17932 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
17935 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
17936 LDKOpenChannel this_ptr_conv;
17937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17938 this_ptr_conv.is_owned = false;
17939 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17940 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
17944 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
17945 LDKOpenChannel this_ptr_conv;
17946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17947 this_ptr_conv.is_owned = false;
17948 LDKPublicKey val_ref;
17949 CHECK(*((uint32_t*)val) == 33);
17950 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17951 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
17954 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
17955 LDKOpenChannel this_ptr_conv;
17956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17957 this_ptr_conv.is_owned = false;
17958 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17959 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
17963 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
17964 LDKOpenChannel this_ptr_conv;
17965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17966 this_ptr_conv.is_owned = false;
17967 LDKPublicKey val_ref;
17968 CHECK(*((uint32_t*)val) == 33);
17969 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17970 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
17973 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
17974 LDKOpenChannel this_ptr_conv;
17975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17976 this_ptr_conv.is_owned = false;
17977 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17978 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
17982 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
17983 LDKOpenChannel this_ptr_conv;
17984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17985 this_ptr_conv.is_owned = false;
17986 LDKPublicKey val_ref;
17987 CHECK(*((uint32_t*)val) == 33);
17988 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17989 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
17992 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
17993 LDKOpenChannel this_ptr_conv;
17994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17995 this_ptr_conv.is_owned = false;
17996 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17997 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
18001 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
18002 LDKOpenChannel this_ptr_conv;
18003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18004 this_ptr_conv.is_owned = false;
18005 LDKPublicKey val_ref;
18006 CHECK(*((uint32_t*)val) == 33);
18007 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18008 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
18011 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
18012 LDKOpenChannel this_ptr_conv;
18013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18014 this_ptr_conv.is_owned = false;
18015 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18016 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
18020 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
18021 LDKOpenChannel this_ptr_conv;
18022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18023 this_ptr_conv.is_owned = false;
18024 LDKPublicKey val_ref;
18025 CHECK(*((uint32_t*)val) == 33);
18026 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18027 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
18030 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
18031 LDKOpenChannel this_ptr_conv;
18032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18033 this_ptr_conv.is_owned = false;
18034 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
18038 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
18039 LDKOpenChannel this_ptr_conv;
18040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18041 this_ptr_conv.is_owned = false;
18042 OpenChannel_set_channel_flags(&this_ptr_conv, val);
18045 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
18046 LDKOpenChannel orig_conv;
18047 orig_conv.inner = (void*)(orig & (~1));
18048 orig_conv.is_owned = false;
18049 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
18050 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18051 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18052 uint64_t ret_ref = (uint64_t)ret_var.inner;
18053 if (ret_var.is_owned) {
18059 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
18060 LDKAcceptChannel this_obj_conv;
18061 this_obj_conv.inner = (void*)(this_obj & (~1));
18062 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18063 AcceptChannel_free(this_obj_conv);
18066 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
18067 LDKAcceptChannel this_ptr_conv;
18068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18069 this_ptr_conv.is_owned = false;
18070 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18071 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
18075 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
18076 LDKAcceptChannel this_ptr_conv;
18077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18078 this_ptr_conv.is_owned = false;
18079 LDKThirtyTwoBytes val_ref;
18080 CHECK(*((uint32_t*)val) == 32);
18081 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18082 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
18085 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
18086 LDKAcceptChannel this_ptr_conv;
18087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18088 this_ptr_conv.is_owned = false;
18089 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
18093 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
18094 LDKAcceptChannel this_ptr_conv;
18095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18096 this_ptr_conv.is_owned = false;
18097 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
18100 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
18101 LDKAcceptChannel this_ptr_conv;
18102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18103 this_ptr_conv.is_owned = false;
18104 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
18108 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
18109 LDKAcceptChannel this_ptr_conv;
18110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18111 this_ptr_conv.is_owned = false;
18112 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
18115 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
18116 LDKAcceptChannel this_ptr_conv;
18117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18118 this_ptr_conv.is_owned = false;
18119 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
18123 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
18124 LDKAcceptChannel this_ptr_conv;
18125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18126 this_ptr_conv.is_owned = false;
18127 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
18130 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
18131 LDKAcceptChannel this_ptr_conv;
18132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18133 this_ptr_conv.is_owned = false;
18134 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
18138 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
18139 LDKAcceptChannel this_ptr_conv;
18140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18141 this_ptr_conv.is_owned = false;
18142 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
18145 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
18146 LDKAcceptChannel this_ptr_conv;
18147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18148 this_ptr_conv.is_owned = false;
18149 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
18153 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
18154 LDKAcceptChannel this_ptr_conv;
18155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18156 this_ptr_conv.is_owned = false;
18157 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
18160 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
18161 LDKAcceptChannel this_ptr_conv;
18162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18163 this_ptr_conv.is_owned = false;
18164 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
18168 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
18169 LDKAcceptChannel this_ptr_conv;
18170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18171 this_ptr_conv.is_owned = false;
18172 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
18175 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
18176 LDKAcceptChannel this_ptr_conv;
18177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18178 this_ptr_conv.is_owned = false;
18179 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
18183 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
18184 LDKAcceptChannel this_ptr_conv;
18185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18186 this_ptr_conv.is_owned = false;
18187 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
18190 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
18191 LDKAcceptChannel this_ptr_conv;
18192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18193 this_ptr_conv.is_owned = false;
18194 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18195 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
18199 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
18200 LDKAcceptChannel this_ptr_conv;
18201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18202 this_ptr_conv.is_owned = false;
18203 LDKPublicKey val_ref;
18204 CHECK(*((uint32_t*)val) == 33);
18205 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18206 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
18209 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
18210 LDKAcceptChannel this_ptr_conv;
18211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18212 this_ptr_conv.is_owned = false;
18213 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18214 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
18218 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
18219 LDKAcceptChannel this_ptr_conv;
18220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18221 this_ptr_conv.is_owned = false;
18222 LDKPublicKey val_ref;
18223 CHECK(*((uint32_t*)val) == 33);
18224 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18225 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
18228 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
18229 LDKAcceptChannel this_ptr_conv;
18230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18231 this_ptr_conv.is_owned = false;
18232 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18233 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
18237 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
18238 LDKAcceptChannel this_ptr_conv;
18239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18240 this_ptr_conv.is_owned = false;
18241 LDKPublicKey val_ref;
18242 CHECK(*((uint32_t*)val) == 33);
18243 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18244 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
18247 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
18248 LDKAcceptChannel this_ptr_conv;
18249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18250 this_ptr_conv.is_owned = false;
18251 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18252 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
18256 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
18257 LDKAcceptChannel this_ptr_conv;
18258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18259 this_ptr_conv.is_owned = false;
18260 LDKPublicKey val_ref;
18261 CHECK(*((uint32_t*)val) == 33);
18262 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18263 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
18266 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
18267 LDKAcceptChannel this_ptr_conv;
18268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18269 this_ptr_conv.is_owned = false;
18270 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18271 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
18275 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
18276 LDKAcceptChannel this_ptr_conv;
18277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18278 this_ptr_conv.is_owned = false;
18279 LDKPublicKey val_ref;
18280 CHECK(*((uint32_t*)val) == 33);
18281 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18282 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
18285 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
18286 LDKAcceptChannel this_ptr_conv;
18287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18288 this_ptr_conv.is_owned = false;
18289 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18290 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
18294 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
18295 LDKAcceptChannel this_ptr_conv;
18296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18297 this_ptr_conv.is_owned = false;
18298 LDKPublicKey val_ref;
18299 CHECK(*((uint32_t*)val) == 33);
18300 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18301 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
18304 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
18305 LDKAcceptChannel orig_conv;
18306 orig_conv.inner = (void*)(orig & (~1));
18307 orig_conv.is_owned = false;
18308 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
18309 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18310 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18311 uint64_t ret_ref = (uint64_t)ret_var.inner;
18312 if (ret_var.is_owned) {
18318 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
18319 LDKFundingCreated this_obj_conv;
18320 this_obj_conv.inner = (void*)(this_obj & (~1));
18321 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18322 FundingCreated_free(this_obj_conv);
18325 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
18326 LDKFundingCreated this_ptr_conv;
18327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18328 this_ptr_conv.is_owned = false;
18329 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18330 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
18334 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
18335 LDKFundingCreated this_ptr_conv;
18336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18337 this_ptr_conv.is_owned = false;
18338 LDKThirtyTwoBytes val_ref;
18339 CHECK(*((uint32_t*)val) == 32);
18340 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18341 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
18344 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
18345 LDKFundingCreated this_ptr_conv;
18346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18347 this_ptr_conv.is_owned = false;
18348 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18349 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
18353 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
18354 LDKFundingCreated this_ptr_conv;
18355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18356 this_ptr_conv.is_owned = false;
18357 LDKThirtyTwoBytes val_ref;
18358 CHECK(*((uint32_t*)val) == 32);
18359 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18360 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
18363 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
18364 LDKFundingCreated this_ptr_conv;
18365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18366 this_ptr_conv.is_owned = false;
18367 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
18371 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
18372 LDKFundingCreated this_ptr_conv;
18373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18374 this_ptr_conv.is_owned = false;
18375 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
18378 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
18379 LDKFundingCreated this_ptr_conv;
18380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18381 this_ptr_conv.is_owned = false;
18382 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18383 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
18387 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
18388 LDKFundingCreated this_ptr_conv;
18389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18390 this_ptr_conv.is_owned = false;
18391 LDKSignature val_ref;
18392 CHECK(*((uint32_t*)val) == 64);
18393 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18394 FundingCreated_set_signature(&this_ptr_conv, val_ref);
18397 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) {
18398 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
18399 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
18400 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
18401 LDKThirtyTwoBytes funding_txid_arg_ref;
18402 CHECK(*((uint32_t*)funding_txid_arg) == 32);
18403 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
18404 LDKSignature signature_arg_ref;
18405 CHECK(*((uint32_t*)signature_arg) == 64);
18406 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
18407 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
18408 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18409 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18410 uint64_t ret_ref = (uint64_t)ret_var.inner;
18411 if (ret_var.is_owned) {
18417 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
18418 LDKFundingCreated orig_conv;
18419 orig_conv.inner = (void*)(orig & (~1));
18420 orig_conv.is_owned = false;
18421 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
18422 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18423 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18424 uint64_t ret_ref = (uint64_t)ret_var.inner;
18425 if (ret_var.is_owned) {
18431 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
18432 LDKFundingSigned this_obj_conv;
18433 this_obj_conv.inner = (void*)(this_obj & (~1));
18434 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18435 FundingSigned_free(this_obj_conv);
18438 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
18439 LDKFundingSigned this_ptr_conv;
18440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18441 this_ptr_conv.is_owned = false;
18442 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18443 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
18447 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18448 LDKFundingSigned this_ptr_conv;
18449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18450 this_ptr_conv.is_owned = false;
18451 LDKThirtyTwoBytes val_ref;
18452 CHECK(*((uint32_t*)val) == 32);
18453 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18454 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
18457 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
18458 LDKFundingSigned this_ptr_conv;
18459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18460 this_ptr_conv.is_owned = false;
18461 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18462 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
18466 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
18467 LDKFundingSigned this_ptr_conv;
18468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18469 this_ptr_conv.is_owned = false;
18470 LDKSignature val_ref;
18471 CHECK(*((uint32_t*)val) == 64);
18472 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18473 FundingSigned_set_signature(&this_ptr_conv, val_ref);
18476 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
18477 LDKThirtyTwoBytes channel_id_arg_ref;
18478 CHECK(*((uint32_t*)channel_id_arg) == 32);
18479 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18480 LDKSignature signature_arg_ref;
18481 CHECK(*((uint32_t*)signature_arg) == 64);
18482 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
18483 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
18484 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18485 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18486 uint64_t ret_ref = (uint64_t)ret_var.inner;
18487 if (ret_var.is_owned) {
18493 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
18494 LDKFundingSigned orig_conv;
18495 orig_conv.inner = (void*)(orig & (~1));
18496 orig_conv.is_owned = false;
18497 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
18498 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18499 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18500 uint64_t ret_ref = (uint64_t)ret_var.inner;
18501 if (ret_var.is_owned) {
18507 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
18508 LDKFundingLocked this_obj_conv;
18509 this_obj_conv.inner = (void*)(this_obj & (~1));
18510 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18511 FundingLocked_free(this_obj_conv);
18514 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
18515 LDKFundingLocked this_ptr_conv;
18516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18517 this_ptr_conv.is_owned = false;
18518 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18519 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
18523 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18524 LDKFundingLocked this_ptr_conv;
18525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18526 this_ptr_conv.is_owned = false;
18527 LDKThirtyTwoBytes val_ref;
18528 CHECK(*((uint32_t*)val) == 32);
18529 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18530 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
18533 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
18534 LDKFundingLocked this_ptr_conv;
18535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18536 this_ptr_conv.is_owned = false;
18537 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18538 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
18542 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
18543 LDKFundingLocked this_ptr_conv;
18544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18545 this_ptr_conv.is_owned = false;
18546 LDKPublicKey val_ref;
18547 CHECK(*((uint32_t*)val) == 33);
18548 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18549 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
18552 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
18553 LDKThirtyTwoBytes channel_id_arg_ref;
18554 CHECK(*((uint32_t*)channel_id_arg) == 32);
18555 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18556 LDKPublicKey next_per_commitment_point_arg_ref;
18557 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
18558 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
18559 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
18560 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18561 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18562 uint64_t ret_ref = (uint64_t)ret_var.inner;
18563 if (ret_var.is_owned) {
18569 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
18570 LDKFundingLocked orig_conv;
18571 orig_conv.inner = (void*)(orig & (~1));
18572 orig_conv.is_owned = false;
18573 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
18574 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18575 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18576 uint64_t ret_ref = (uint64_t)ret_var.inner;
18577 if (ret_var.is_owned) {
18583 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
18584 LDKShutdown this_obj_conv;
18585 this_obj_conv.inner = (void*)(this_obj & (~1));
18586 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18587 Shutdown_free(this_obj_conv);
18590 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
18591 LDKShutdown this_ptr_conv;
18592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18593 this_ptr_conv.is_owned = false;
18594 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18595 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
18599 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18600 LDKShutdown this_ptr_conv;
18601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18602 this_ptr_conv.is_owned = false;
18603 LDKThirtyTwoBytes val_ref;
18604 CHECK(*((uint32_t*)val) == 32);
18605 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18606 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
18609 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
18610 LDKShutdown this_ptr_conv;
18611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18612 this_ptr_conv.is_owned = false;
18613 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
18614 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18615 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18619 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
18620 LDKShutdown this_ptr_conv;
18621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18622 this_ptr_conv.is_owned = false;
18623 LDKCVec_u8Z val_ref;
18624 val_ref.datalen = *((uint32_t*)val);
18625 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
18626 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
18627 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
18630 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
18631 LDKThirtyTwoBytes channel_id_arg_ref;
18632 CHECK(*((uint32_t*)channel_id_arg) == 32);
18633 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18634 LDKCVec_u8Z scriptpubkey_arg_ref;
18635 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
18636 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
18637 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
18638 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
18639 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18640 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18641 uint64_t ret_ref = (uint64_t)ret_var.inner;
18642 if (ret_var.is_owned) {
18648 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
18649 LDKShutdown orig_conv;
18650 orig_conv.inner = (void*)(orig & (~1));
18651 orig_conv.is_owned = false;
18652 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
18653 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18654 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18655 uint64_t ret_ref = (uint64_t)ret_var.inner;
18656 if (ret_var.is_owned) {
18662 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
18663 LDKClosingSignedFeeRange this_obj_conv;
18664 this_obj_conv.inner = (void*)(this_obj & (~1));
18665 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18666 ClosingSignedFeeRange_free(this_obj_conv);
18669 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
18670 LDKClosingSignedFeeRange this_ptr_conv;
18671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18672 this_ptr_conv.is_owned = false;
18673 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
18677 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
18678 LDKClosingSignedFeeRange this_ptr_conv;
18679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18680 this_ptr_conv.is_owned = false;
18681 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
18684 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
18685 LDKClosingSignedFeeRange this_ptr_conv;
18686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18687 this_ptr_conv.is_owned = false;
18688 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
18692 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
18693 LDKClosingSignedFeeRange this_ptr_conv;
18694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18695 this_ptr_conv.is_owned = false;
18696 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
18699 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
18700 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
18701 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18702 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18703 uint64_t ret_ref = (uint64_t)ret_var.inner;
18704 if (ret_var.is_owned) {
18710 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
18711 LDKClosingSignedFeeRange orig_conv;
18712 orig_conv.inner = (void*)(orig & (~1));
18713 orig_conv.is_owned = false;
18714 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
18715 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18716 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18717 uint64_t ret_ref = (uint64_t)ret_var.inner;
18718 if (ret_var.is_owned) {
18724 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
18725 LDKClosingSigned this_obj_conv;
18726 this_obj_conv.inner = (void*)(this_obj & (~1));
18727 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18728 ClosingSigned_free(this_obj_conv);
18731 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
18732 LDKClosingSigned this_ptr_conv;
18733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18734 this_ptr_conv.is_owned = false;
18735 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18736 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
18740 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18741 LDKClosingSigned this_ptr_conv;
18742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18743 this_ptr_conv.is_owned = false;
18744 LDKThirtyTwoBytes val_ref;
18745 CHECK(*((uint32_t*)val) == 32);
18746 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18747 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
18750 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
18751 LDKClosingSigned this_ptr_conv;
18752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18753 this_ptr_conv.is_owned = false;
18754 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
18758 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
18759 LDKClosingSigned this_ptr_conv;
18760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18761 this_ptr_conv.is_owned = false;
18762 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
18765 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
18766 LDKClosingSigned this_ptr_conv;
18767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18768 this_ptr_conv.is_owned = false;
18769 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18770 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
18774 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
18775 LDKClosingSigned this_ptr_conv;
18776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18777 this_ptr_conv.is_owned = false;
18778 LDKSignature val_ref;
18779 CHECK(*((uint32_t*)val) == 64);
18780 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18781 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
18784 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
18785 LDKClosingSigned this_ptr_conv;
18786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18787 this_ptr_conv.is_owned = false;
18788 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
18789 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18790 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18791 uint64_t ret_ref = (uint64_t)ret_var.inner;
18792 if (ret_var.is_owned) {
18798 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
18799 LDKClosingSigned this_ptr_conv;
18800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18801 this_ptr_conv.is_owned = false;
18802 LDKClosingSignedFeeRange val_conv;
18803 val_conv.inner = (void*)(val & (~1));
18804 val_conv.is_owned = (val & 1) || (val == 0);
18805 val_conv = ClosingSignedFeeRange_clone(&val_conv);
18806 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
18809 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) {
18810 LDKThirtyTwoBytes channel_id_arg_ref;
18811 CHECK(*((uint32_t*)channel_id_arg) == 32);
18812 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18813 LDKSignature signature_arg_ref;
18814 CHECK(*((uint32_t*)signature_arg) == 64);
18815 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
18816 LDKClosingSignedFeeRange fee_range_arg_conv;
18817 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
18818 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
18819 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
18820 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
18821 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18822 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18823 uint64_t ret_ref = (uint64_t)ret_var.inner;
18824 if (ret_var.is_owned) {
18830 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
18831 LDKClosingSigned orig_conv;
18832 orig_conv.inner = (void*)(orig & (~1));
18833 orig_conv.is_owned = false;
18834 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
18835 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18836 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18837 uint64_t ret_ref = (uint64_t)ret_var.inner;
18838 if (ret_var.is_owned) {
18844 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
18845 LDKUpdateAddHTLC this_obj_conv;
18846 this_obj_conv.inner = (void*)(this_obj & (~1));
18847 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18848 UpdateAddHTLC_free(this_obj_conv);
18851 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
18852 LDKUpdateAddHTLC this_ptr_conv;
18853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18854 this_ptr_conv.is_owned = false;
18855 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18856 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
18860 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18861 LDKUpdateAddHTLC this_ptr_conv;
18862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18863 this_ptr_conv.is_owned = false;
18864 LDKThirtyTwoBytes val_ref;
18865 CHECK(*((uint32_t*)val) == 32);
18866 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18867 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
18870 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
18871 LDKUpdateAddHTLC this_ptr_conv;
18872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18873 this_ptr_conv.is_owned = false;
18874 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
18878 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
18879 LDKUpdateAddHTLC this_ptr_conv;
18880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18881 this_ptr_conv.is_owned = false;
18882 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
18885 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
18886 LDKUpdateAddHTLC this_ptr_conv;
18887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18888 this_ptr_conv.is_owned = false;
18889 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
18893 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
18894 LDKUpdateAddHTLC this_ptr_conv;
18895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18896 this_ptr_conv.is_owned = false;
18897 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
18900 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
18901 LDKUpdateAddHTLC this_ptr_conv;
18902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18903 this_ptr_conv.is_owned = false;
18904 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18905 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
18909 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
18910 LDKUpdateAddHTLC this_ptr_conv;
18911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18912 this_ptr_conv.is_owned = false;
18913 LDKThirtyTwoBytes val_ref;
18914 CHECK(*((uint32_t*)val) == 32);
18915 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18916 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
18919 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
18920 LDKUpdateAddHTLC this_ptr_conv;
18921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18922 this_ptr_conv.is_owned = false;
18923 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
18927 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
18928 LDKUpdateAddHTLC this_ptr_conv;
18929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18930 this_ptr_conv.is_owned = false;
18931 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
18934 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
18935 LDKUpdateAddHTLC orig_conv;
18936 orig_conv.inner = (void*)(orig & (~1));
18937 orig_conv.is_owned = false;
18938 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
18939 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18940 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18941 uint64_t ret_ref = (uint64_t)ret_var.inner;
18942 if (ret_var.is_owned) {
18948 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
18949 LDKUpdateFulfillHTLC this_obj_conv;
18950 this_obj_conv.inner = (void*)(this_obj & (~1));
18951 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18952 UpdateFulfillHTLC_free(this_obj_conv);
18955 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
18956 LDKUpdateFulfillHTLC this_ptr_conv;
18957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18958 this_ptr_conv.is_owned = false;
18959 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18960 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
18964 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18965 LDKUpdateFulfillHTLC this_ptr_conv;
18966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18967 this_ptr_conv.is_owned = false;
18968 LDKThirtyTwoBytes val_ref;
18969 CHECK(*((uint32_t*)val) == 32);
18970 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18971 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
18974 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
18975 LDKUpdateFulfillHTLC this_ptr_conv;
18976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18977 this_ptr_conv.is_owned = false;
18978 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
18982 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
18983 LDKUpdateFulfillHTLC this_ptr_conv;
18984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18985 this_ptr_conv.is_owned = false;
18986 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
18989 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
18990 LDKUpdateFulfillHTLC this_ptr_conv;
18991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18992 this_ptr_conv.is_owned = false;
18993 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18994 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
18998 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
18999 LDKUpdateFulfillHTLC this_ptr_conv;
19000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19001 this_ptr_conv.is_owned = false;
19002 LDKThirtyTwoBytes val_ref;
19003 CHECK(*((uint32_t*)val) == 32);
19004 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19005 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
19008 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
19009 LDKThirtyTwoBytes channel_id_arg_ref;
19010 CHECK(*((uint32_t*)channel_id_arg) == 32);
19011 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
19012 LDKThirtyTwoBytes payment_preimage_arg_ref;
19013 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
19014 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
19015 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
19016 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19017 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19018 uint64_t ret_ref = (uint64_t)ret_var.inner;
19019 if (ret_var.is_owned) {
19025 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
19026 LDKUpdateFulfillHTLC orig_conv;
19027 orig_conv.inner = (void*)(orig & (~1));
19028 orig_conv.is_owned = false;
19029 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
19030 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19031 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19032 uint64_t ret_ref = (uint64_t)ret_var.inner;
19033 if (ret_var.is_owned) {
19039 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
19040 LDKUpdateFailHTLC this_obj_conv;
19041 this_obj_conv.inner = (void*)(this_obj & (~1));
19042 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19043 UpdateFailHTLC_free(this_obj_conv);
19046 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
19047 LDKUpdateFailHTLC this_ptr_conv;
19048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19049 this_ptr_conv.is_owned = false;
19050 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19051 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
19055 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19056 LDKUpdateFailHTLC this_ptr_conv;
19057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19058 this_ptr_conv.is_owned = false;
19059 LDKThirtyTwoBytes val_ref;
19060 CHECK(*((uint32_t*)val) == 32);
19061 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19062 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
19065 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
19066 LDKUpdateFailHTLC this_ptr_conv;
19067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19068 this_ptr_conv.is_owned = false;
19069 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
19073 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
19074 LDKUpdateFailHTLC this_ptr_conv;
19075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19076 this_ptr_conv.is_owned = false;
19077 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
19080 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
19081 LDKUpdateFailHTLC orig_conv;
19082 orig_conv.inner = (void*)(orig & (~1));
19083 orig_conv.is_owned = false;
19084 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
19085 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19086 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19087 uint64_t ret_ref = (uint64_t)ret_var.inner;
19088 if (ret_var.is_owned) {
19094 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
19095 LDKUpdateFailMalformedHTLC this_obj_conv;
19096 this_obj_conv.inner = (void*)(this_obj & (~1));
19097 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19098 UpdateFailMalformedHTLC_free(this_obj_conv);
19101 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
19102 LDKUpdateFailMalformedHTLC this_ptr_conv;
19103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19104 this_ptr_conv.is_owned = false;
19105 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19106 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
19110 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19111 LDKUpdateFailMalformedHTLC this_ptr_conv;
19112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19113 this_ptr_conv.is_owned = false;
19114 LDKThirtyTwoBytes val_ref;
19115 CHECK(*((uint32_t*)val) == 32);
19116 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19117 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
19120 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
19121 LDKUpdateFailMalformedHTLC this_ptr_conv;
19122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19123 this_ptr_conv.is_owned = false;
19124 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
19128 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
19129 LDKUpdateFailMalformedHTLC this_ptr_conv;
19130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19131 this_ptr_conv.is_owned = false;
19132 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
19135 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
19136 LDKUpdateFailMalformedHTLC this_ptr_conv;
19137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19138 this_ptr_conv.is_owned = false;
19139 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
19143 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
19144 LDKUpdateFailMalformedHTLC this_ptr_conv;
19145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19146 this_ptr_conv.is_owned = false;
19147 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
19150 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
19151 LDKUpdateFailMalformedHTLC orig_conv;
19152 orig_conv.inner = (void*)(orig & (~1));
19153 orig_conv.is_owned = false;
19154 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
19155 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19156 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19157 uint64_t ret_ref = (uint64_t)ret_var.inner;
19158 if (ret_var.is_owned) {
19164 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_obj) {
19165 LDKCommitmentSigned this_obj_conv;
19166 this_obj_conv.inner = (void*)(this_obj & (~1));
19167 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19168 CommitmentSigned_free(this_obj_conv);
19171 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
19172 LDKCommitmentSigned this_ptr_conv;
19173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19174 this_ptr_conv.is_owned = false;
19175 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19176 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
19180 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19181 LDKCommitmentSigned this_ptr_conv;
19182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19183 this_ptr_conv.is_owned = false;
19184 LDKThirtyTwoBytes val_ref;
19185 CHECK(*((uint32_t*)val) == 32);
19186 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19187 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
19190 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
19191 LDKCommitmentSigned this_ptr_conv;
19192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19193 this_ptr_conv.is_owned = false;
19194 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19195 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
19199 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
19200 LDKCommitmentSigned this_ptr_conv;
19201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19202 this_ptr_conv.is_owned = false;
19203 LDKSignature val_ref;
19204 CHECK(*((uint32_t*)val) == 64);
19205 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19206 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
19209 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
19210 LDKCommitmentSigned this_ptr_conv;
19211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19212 this_ptr_conv.is_owned = false;
19213 LDKCVec_SignatureZ val_constr;
19214 val_constr.datalen = *((uint32_t*)val);
19215 if (val_constr.datalen > 0)
19216 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
19218 val_constr.data = NULL;
19219 int8_tArray* val_vals = (int8_tArray*)(val + 4);
19220 for (size_t m = 0; m < val_constr.datalen; m++) {
19221 int8_tArray val_conv_12 = val_vals[m];
19222 LDKSignature val_conv_12_ref;
19223 CHECK(*((uint32_t*)val_conv_12) == 64);
19224 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
19225 val_constr.data[m] = val_conv_12_ref;
19227 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
19230 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
19231 LDKThirtyTwoBytes channel_id_arg_ref;
19232 CHECK(*((uint32_t*)channel_id_arg) == 32);
19233 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
19234 LDKSignature signature_arg_ref;
19235 CHECK(*((uint32_t*)signature_arg) == 64);
19236 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
19237 LDKCVec_SignatureZ htlc_signatures_arg_constr;
19238 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
19239 if (htlc_signatures_arg_constr.datalen > 0)
19240 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
19242 htlc_signatures_arg_constr.data = NULL;
19243 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
19244 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
19245 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
19246 LDKSignature htlc_signatures_arg_conv_12_ref;
19247 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
19248 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
19249 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
19251 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
19252 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19253 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19254 uint64_t ret_ref = (uint64_t)ret_var.inner;
19255 if (ret_var.is_owned) {
19261 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
19262 LDKCommitmentSigned orig_conv;
19263 orig_conv.inner = (void*)(orig & (~1));
19264 orig_conv.is_owned = false;
19265 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
19266 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19267 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19268 uint64_t ret_ref = (uint64_t)ret_var.inner;
19269 if (ret_var.is_owned) {
19275 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
19276 LDKRevokeAndACK this_obj_conv;
19277 this_obj_conv.inner = (void*)(this_obj & (~1));
19278 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19279 RevokeAndACK_free(this_obj_conv);
19282 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
19283 LDKRevokeAndACK this_ptr_conv;
19284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19285 this_ptr_conv.is_owned = false;
19286 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19287 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
19291 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19292 LDKRevokeAndACK this_ptr_conv;
19293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19294 this_ptr_conv.is_owned = false;
19295 LDKThirtyTwoBytes val_ref;
19296 CHECK(*((uint32_t*)val) == 32);
19297 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19298 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
19301 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
19302 LDKRevokeAndACK this_ptr_conv;
19303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19304 this_ptr_conv.is_owned = false;
19305 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19306 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
19310 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
19311 LDKRevokeAndACK this_ptr_conv;
19312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19313 this_ptr_conv.is_owned = false;
19314 LDKThirtyTwoBytes val_ref;
19315 CHECK(*((uint32_t*)val) == 32);
19316 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19317 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
19320 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
19321 LDKRevokeAndACK this_ptr_conv;
19322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19323 this_ptr_conv.is_owned = false;
19324 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19325 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19329 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19330 LDKRevokeAndACK this_ptr_conv;
19331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19332 this_ptr_conv.is_owned = false;
19333 LDKPublicKey val_ref;
19334 CHECK(*((uint32_t*)val) == 33);
19335 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19336 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
19339 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) {
19340 LDKThirtyTwoBytes channel_id_arg_ref;
19341 CHECK(*((uint32_t*)channel_id_arg) == 32);
19342 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
19343 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
19344 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
19345 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
19346 LDKPublicKey next_per_commitment_point_arg_ref;
19347 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
19348 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
19349 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
19350 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19351 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19352 uint64_t ret_ref = (uint64_t)ret_var.inner;
19353 if (ret_var.is_owned) {
19359 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
19360 LDKRevokeAndACK orig_conv;
19361 orig_conv.inner = (void*)(orig & (~1));
19362 orig_conv.is_owned = false;
19363 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
19364 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19365 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19366 uint64_t ret_ref = (uint64_t)ret_var.inner;
19367 if (ret_var.is_owned) {
19373 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
19374 LDKUpdateFee this_obj_conv;
19375 this_obj_conv.inner = (void*)(this_obj & (~1));
19376 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19377 UpdateFee_free(this_obj_conv);
19380 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
19381 LDKUpdateFee this_ptr_conv;
19382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19383 this_ptr_conv.is_owned = false;
19384 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19385 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
19389 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19390 LDKUpdateFee this_ptr_conv;
19391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19392 this_ptr_conv.is_owned = false;
19393 LDKThirtyTwoBytes val_ref;
19394 CHECK(*((uint32_t*)val) == 32);
19395 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19396 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
19399 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
19400 LDKUpdateFee this_ptr_conv;
19401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19402 this_ptr_conv.is_owned = false;
19403 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
19407 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
19408 LDKUpdateFee this_ptr_conv;
19409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19410 this_ptr_conv.is_owned = false;
19411 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
19414 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
19415 LDKThirtyTwoBytes channel_id_arg_ref;
19416 CHECK(*((uint32_t*)channel_id_arg) == 32);
19417 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
19418 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
19419 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19420 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19421 uint64_t ret_ref = (uint64_t)ret_var.inner;
19422 if (ret_var.is_owned) {
19428 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
19429 LDKUpdateFee orig_conv;
19430 orig_conv.inner = (void*)(orig & (~1));
19431 orig_conv.is_owned = false;
19432 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
19433 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19434 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19435 uint64_t ret_ref = (uint64_t)ret_var.inner;
19436 if (ret_var.is_owned) {
19442 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
19443 LDKDataLossProtect this_obj_conv;
19444 this_obj_conv.inner = (void*)(this_obj & (~1));
19445 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19446 DataLossProtect_free(this_obj_conv);
19449 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
19450 LDKDataLossProtect this_ptr_conv;
19451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19452 this_ptr_conv.is_owned = false;
19453 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19454 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
19458 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
19459 LDKDataLossProtect this_ptr_conv;
19460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19461 this_ptr_conv.is_owned = false;
19462 LDKThirtyTwoBytes val_ref;
19463 CHECK(*((uint32_t*)val) == 32);
19464 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19465 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
19468 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
19469 LDKDataLossProtect this_ptr_conv;
19470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19471 this_ptr_conv.is_owned = false;
19472 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19473 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19477 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19478 LDKDataLossProtect this_ptr_conv;
19479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19480 this_ptr_conv.is_owned = false;
19481 LDKPublicKey val_ref;
19482 CHECK(*((uint32_t*)val) == 33);
19483 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19484 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
19487 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
19488 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
19489 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
19490 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
19491 LDKPublicKey my_current_per_commitment_point_arg_ref;
19492 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
19493 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
19494 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
19495 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19496 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19497 uint64_t ret_ref = (uint64_t)ret_var.inner;
19498 if (ret_var.is_owned) {
19504 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
19505 LDKDataLossProtect orig_conv;
19506 orig_conv.inner = (void*)(orig & (~1));
19507 orig_conv.is_owned = false;
19508 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
19509 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19510 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19511 uint64_t ret_ref = (uint64_t)ret_var.inner;
19512 if (ret_var.is_owned) {
19518 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
19519 LDKChannelReestablish this_obj_conv;
19520 this_obj_conv.inner = (void*)(this_obj & (~1));
19521 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19522 ChannelReestablish_free(this_obj_conv);
19525 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
19526 LDKChannelReestablish this_ptr_conv;
19527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19528 this_ptr_conv.is_owned = false;
19529 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19530 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
19534 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19535 LDKChannelReestablish this_ptr_conv;
19536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19537 this_ptr_conv.is_owned = false;
19538 LDKThirtyTwoBytes val_ref;
19539 CHECK(*((uint32_t*)val) == 32);
19540 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19541 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
19544 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
19545 LDKChannelReestablish this_ptr_conv;
19546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19547 this_ptr_conv.is_owned = false;
19548 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
19552 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
19553 LDKChannelReestablish this_ptr_conv;
19554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19555 this_ptr_conv.is_owned = false;
19556 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
19559 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
19560 LDKChannelReestablish this_ptr_conv;
19561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19562 this_ptr_conv.is_owned = false;
19563 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
19567 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
19568 LDKChannelReestablish this_ptr_conv;
19569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19570 this_ptr_conv.is_owned = false;
19571 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
19574 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
19575 LDKChannelReestablish orig_conv;
19576 orig_conv.inner = (void*)(orig & (~1));
19577 orig_conv.is_owned = false;
19578 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
19579 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19580 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19581 uint64_t ret_ref = (uint64_t)ret_var.inner;
19582 if (ret_var.is_owned) {
19588 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
19589 LDKAnnouncementSignatures this_obj_conv;
19590 this_obj_conv.inner = (void*)(this_obj & (~1));
19591 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19592 AnnouncementSignatures_free(this_obj_conv);
19595 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
19596 LDKAnnouncementSignatures this_ptr_conv;
19597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19598 this_ptr_conv.is_owned = false;
19599 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19600 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
19604 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19605 LDKAnnouncementSignatures this_ptr_conv;
19606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19607 this_ptr_conv.is_owned = false;
19608 LDKThirtyTwoBytes val_ref;
19609 CHECK(*((uint32_t*)val) == 32);
19610 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19611 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
19614 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
19615 LDKAnnouncementSignatures this_ptr_conv;
19616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19617 this_ptr_conv.is_owned = false;
19618 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
19622 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
19623 LDKAnnouncementSignatures this_ptr_conv;
19624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19625 this_ptr_conv.is_owned = false;
19626 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
19629 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
19630 LDKAnnouncementSignatures this_ptr_conv;
19631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19632 this_ptr_conv.is_owned = false;
19633 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19634 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
19638 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
19639 LDKAnnouncementSignatures this_ptr_conv;
19640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19641 this_ptr_conv.is_owned = false;
19642 LDKSignature val_ref;
19643 CHECK(*((uint32_t*)val) == 64);
19644 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19645 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
19648 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
19649 LDKAnnouncementSignatures this_ptr_conv;
19650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19651 this_ptr_conv.is_owned = false;
19652 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19653 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
19657 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
19658 LDKAnnouncementSignatures this_ptr_conv;
19659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19660 this_ptr_conv.is_owned = false;
19661 LDKSignature val_ref;
19662 CHECK(*((uint32_t*)val) == 64);
19663 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19664 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
19667 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) {
19668 LDKThirtyTwoBytes channel_id_arg_ref;
19669 CHECK(*((uint32_t*)channel_id_arg) == 32);
19670 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
19671 LDKSignature node_signature_arg_ref;
19672 CHECK(*((uint32_t*)node_signature_arg) == 64);
19673 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
19674 LDKSignature bitcoin_signature_arg_ref;
19675 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
19676 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
19677 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
19678 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19679 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19680 uint64_t ret_ref = (uint64_t)ret_var.inner;
19681 if (ret_var.is_owned) {
19687 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
19688 LDKAnnouncementSignatures orig_conv;
19689 orig_conv.inner = (void*)(orig & (~1));
19690 orig_conv.is_owned = false;
19691 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
19692 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19693 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19694 uint64_t ret_ref = (uint64_t)ret_var.inner;
19695 if (ret_var.is_owned) {
19701 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
19702 if ((this_ptr & 1) != 0) return;
19703 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19704 CHECK_ACCESS(this_ptr_ptr);
19705 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
19706 FREE((void*)this_ptr);
19707 NetAddress_free(this_ptr_conv);
19710 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
19711 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
19712 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19713 *ret_copy = NetAddress_clone(orig_conv);
19714 uint64_t ret_ref = (uint64_t)ret_copy;
19718 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
19719 LDKFourBytes addr_ref;
19720 CHECK(*((uint32_t*)addr) == 4);
19721 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 4);
19722 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19723 *ret_copy = NetAddress_ipv4(addr_ref, port);
19724 uint64_t ret_ref = (uint64_t)ret_copy;
19728 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
19729 LDKSixteenBytes addr_ref;
19730 CHECK(*((uint32_t*)addr) == 16);
19731 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 16);
19732 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19733 *ret_copy = NetAddress_ipv6(addr_ref, port);
19734 uint64_t ret_ref = (uint64_t)ret_copy;
19738 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray addr, int16_t port) {
19739 LDKTenBytes addr_ref;
19740 CHECK(*((uint32_t*)addr) == 10);
19741 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 10);
19742 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19743 *ret_copy = NetAddress_onion_v2(addr_ref, port);
19744 uint64_t ret_ref = (uint64_t)ret_copy;
19748 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
19749 LDKThirtyTwoBytes ed25519_pubkey_ref;
19750 CHECK(*((uint32_t*)ed25519_pubkey) == 32);
19751 memcpy(ed25519_pubkey_ref.data, (uint8_t*)(ed25519_pubkey + 4), 32);
19752 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19753 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
19754 uint64_t ret_ref = (uint64_t)ret_copy;
19758 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
19759 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
19760 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
19761 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19762 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19763 CVec_u8Z_free(ret_var);
19767 uint32_t __attribute__((visibility("default"))) TS_Result_read(int8_tArray ser) {
19768 LDKu8slice ser_ref;
19769 ser_ref.datalen = *((uint32_t*)ser);
19770 ser_ref.data = (int8_t*)(ser + 4);
19771 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
19772 *ret_conv = Result_read(ser_ref);
19773 return (uint64_t)ret_conv;
19776 uint32_t __attribute__((visibility("default"))) TS_NetAddress_read(int8_tArray ser) {
19777 LDKu8slice ser_ref;
19778 ser_ref.datalen = *((uint32_t*)ser);
19779 ser_ref.data = (int8_t*)(ser + 4);
19780 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19781 *ret_conv = NetAddress_read(ser_ref);
19782 return (uint64_t)ret_conv;
19785 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
19786 LDKUnsignedNodeAnnouncement this_obj_conv;
19787 this_obj_conv.inner = (void*)(this_obj & (~1));
19788 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19789 UnsignedNodeAnnouncement_free(this_obj_conv);
19792 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
19793 LDKUnsignedNodeAnnouncement this_ptr_conv;
19794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19795 this_ptr_conv.is_owned = false;
19796 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
19797 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19798 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19799 uint64_t ret_ref = (uint64_t)ret_var.inner;
19800 if (ret_var.is_owned) {
19806 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
19807 LDKUnsignedNodeAnnouncement this_ptr_conv;
19808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19809 this_ptr_conv.is_owned = false;
19810 LDKNodeFeatures val_conv;
19811 val_conv.inner = (void*)(val & (~1));
19812 val_conv.is_owned = (val & 1) || (val == 0);
19813 val_conv = NodeFeatures_clone(&val_conv);
19814 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
19817 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
19818 LDKUnsignedNodeAnnouncement this_ptr_conv;
19819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19820 this_ptr_conv.is_owned = false;
19821 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
19825 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
19826 LDKUnsignedNodeAnnouncement this_ptr_conv;
19827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19828 this_ptr_conv.is_owned = false;
19829 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
19832 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
19833 LDKUnsignedNodeAnnouncement this_ptr_conv;
19834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19835 this_ptr_conv.is_owned = false;
19836 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19837 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
19841 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
19842 LDKUnsignedNodeAnnouncement this_ptr_conv;
19843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19844 this_ptr_conv.is_owned = false;
19845 LDKPublicKey val_ref;
19846 CHECK(*((uint32_t*)val) == 33);
19847 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19848 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
19851 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
19852 LDKUnsignedNodeAnnouncement this_ptr_conv;
19853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19854 this_ptr_conv.is_owned = false;
19855 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
19856 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
19860 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
19861 LDKUnsignedNodeAnnouncement this_ptr_conv;
19862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19863 this_ptr_conv.is_owned = false;
19864 LDKThreeBytes val_ref;
19865 CHECK(*((uint32_t*)val) == 3);
19866 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
19867 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
19870 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
19871 LDKUnsignedNodeAnnouncement this_ptr_conv;
19872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19873 this_ptr_conv.is_owned = false;
19874 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19875 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
19879 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
19880 LDKUnsignedNodeAnnouncement this_ptr_conv;
19881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19882 this_ptr_conv.is_owned = false;
19883 LDKThirtyTwoBytes val_ref;
19884 CHECK(*((uint32_t*)val) == 32);
19885 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19886 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
19889 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
19890 LDKUnsignedNodeAnnouncement this_ptr_conv;
19891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19892 this_ptr_conv.is_owned = false;
19893 LDKCVec_NetAddressZ val_constr;
19894 val_constr.datalen = *((uint32_t*)val);
19895 if (val_constr.datalen > 0)
19896 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19898 val_constr.data = NULL;
19899 uint32_t* val_vals = (uint32_t*)(val + 4);
19900 for (size_t m = 0; m < val_constr.datalen; m++) {
19901 uint32_t val_conv_12 = val_vals[m];
19902 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
19903 CHECK_ACCESS(val_conv_12_ptr);
19904 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
19905 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
19906 val_constr.data[m] = val_conv_12_conv;
19908 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
19911 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
19912 LDKUnsignedNodeAnnouncement orig_conv;
19913 orig_conv.inner = (void*)(orig & (~1));
19914 orig_conv.is_owned = false;
19915 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
19916 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19917 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19918 uint64_t ret_ref = (uint64_t)ret_var.inner;
19919 if (ret_var.is_owned) {
19925 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
19926 LDKNodeAnnouncement this_obj_conv;
19927 this_obj_conv.inner = (void*)(this_obj & (~1));
19928 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19929 NodeAnnouncement_free(this_obj_conv);
19932 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
19933 LDKNodeAnnouncement this_ptr_conv;
19934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19935 this_ptr_conv.is_owned = false;
19936 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19937 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
19941 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
19942 LDKNodeAnnouncement this_ptr_conv;
19943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19944 this_ptr_conv.is_owned = false;
19945 LDKSignature val_ref;
19946 CHECK(*((uint32_t*)val) == 64);
19947 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19948 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
19951 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
19952 LDKNodeAnnouncement this_ptr_conv;
19953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19954 this_ptr_conv.is_owned = false;
19955 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
19956 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19957 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19958 uint64_t ret_ref = (uint64_t)ret_var.inner;
19959 if (ret_var.is_owned) {
19965 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
19966 LDKNodeAnnouncement this_ptr_conv;
19967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19968 this_ptr_conv.is_owned = false;
19969 LDKUnsignedNodeAnnouncement val_conv;
19970 val_conv.inner = (void*)(val & (~1));
19971 val_conv.is_owned = (val & 1) || (val == 0);
19972 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
19973 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
19976 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
19977 LDKSignature signature_arg_ref;
19978 CHECK(*((uint32_t*)signature_arg) == 64);
19979 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
19980 LDKUnsignedNodeAnnouncement contents_arg_conv;
19981 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19982 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19983 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
19984 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
19985 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19986 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19987 uint64_t ret_ref = (uint64_t)ret_var.inner;
19988 if (ret_var.is_owned) {
19994 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
19995 LDKNodeAnnouncement orig_conv;
19996 orig_conv.inner = (void*)(orig & (~1));
19997 orig_conv.is_owned = false;
19998 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
19999 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20000 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20001 uint64_t ret_ref = (uint64_t)ret_var.inner;
20002 if (ret_var.is_owned) {
20008 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
20009 LDKUnsignedChannelAnnouncement this_obj_conv;
20010 this_obj_conv.inner = (void*)(this_obj & (~1));
20011 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20012 UnsignedChannelAnnouncement_free(this_obj_conv);
20015 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
20016 LDKUnsignedChannelAnnouncement this_ptr_conv;
20017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20018 this_ptr_conv.is_owned = false;
20019 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
20020 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20021 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20022 uint64_t ret_ref = (uint64_t)ret_var.inner;
20023 if (ret_var.is_owned) {
20029 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
20030 LDKUnsignedChannelAnnouncement this_ptr_conv;
20031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20032 this_ptr_conv.is_owned = false;
20033 LDKChannelFeatures val_conv;
20034 val_conv.inner = (void*)(val & (~1));
20035 val_conv.is_owned = (val & 1) || (val == 0);
20036 val_conv = ChannelFeatures_clone(&val_conv);
20037 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
20040 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
20041 LDKUnsignedChannelAnnouncement this_ptr_conv;
20042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20043 this_ptr_conv.is_owned = false;
20044 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20045 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
20049 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20050 LDKUnsignedChannelAnnouncement this_ptr_conv;
20051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20052 this_ptr_conv.is_owned = false;
20053 LDKThirtyTwoBytes val_ref;
20054 CHECK(*((uint32_t*)val) == 32);
20055 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20056 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
20059 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
20060 LDKUnsignedChannelAnnouncement this_ptr_conv;
20061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20062 this_ptr_conv.is_owned = false;
20063 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
20067 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
20068 LDKUnsignedChannelAnnouncement this_ptr_conv;
20069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20070 this_ptr_conv.is_owned = false;
20071 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
20074 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
20075 LDKUnsignedChannelAnnouncement this_ptr_conv;
20076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20077 this_ptr_conv.is_owned = false;
20078 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20079 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
20083 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
20084 LDKUnsignedChannelAnnouncement this_ptr_conv;
20085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20086 this_ptr_conv.is_owned = false;
20087 LDKPublicKey val_ref;
20088 CHECK(*((uint32_t*)val) == 33);
20089 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20090 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
20093 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
20094 LDKUnsignedChannelAnnouncement this_ptr_conv;
20095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20096 this_ptr_conv.is_owned = false;
20097 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20098 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
20102 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
20103 LDKUnsignedChannelAnnouncement this_ptr_conv;
20104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20105 this_ptr_conv.is_owned = false;
20106 LDKPublicKey val_ref;
20107 CHECK(*((uint32_t*)val) == 33);
20108 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20109 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
20112 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
20113 LDKUnsignedChannelAnnouncement this_ptr_conv;
20114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20115 this_ptr_conv.is_owned = false;
20116 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20117 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
20121 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
20122 LDKUnsignedChannelAnnouncement this_ptr_conv;
20123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20124 this_ptr_conv.is_owned = false;
20125 LDKPublicKey val_ref;
20126 CHECK(*((uint32_t*)val) == 33);
20127 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20128 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
20131 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
20132 LDKUnsignedChannelAnnouncement this_ptr_conv;
20133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20134 this_ptr_conv.is_owned = false;
20135 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20136 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
20140 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
20141 LDKUnsignedChannelAnnouncement this_ptr_conv;
20142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20143 this_ptr_conv.is_owned = false;
20144 LDKPublicKey val_ref;
20145 CHECK(*((uint32_t*)val) == 33);
20146 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20147 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
20150 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
20151 LDKUnsignedChannelAnnouncement orig_conv;
20152 orig_conv.inner = (void*)(orig & (~1));
20153 orig_conv.is_owned = false;
20154 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
20155 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20156 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20157 uint64_t ret_ref = (uint64_t)ret_var.inner;
20158 if (ret_var.is_owned) {
20164 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
20165 LDKChannelAnnouncement this_obj_conv;
20166 this_obj_conv.inner = (void*)(this_obj & (~1));
20167 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20168 ChannelAnnouncement_free(this_obj_conv);
20171 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
20172 LDKChannelAnnouncement this_ptr_conv;
20173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20174 this_ptr_conv.is_owned = false;
20175 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20176 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
20180 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
20181 LDKChannelAnnouncement this_ptr_conv;
20182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20183 this_ptr_conv.is_owned = false;
20184 LDKSignature val_ref;
20185 CHECK(*((uint32_t*)val) == 64);
20186 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
20187 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
20190 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
20191 LDKChannelAnnouncement this_ptr_conv;
20192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20193 this_ptr_conv.is_owned = false;
20194 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20195 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
20199 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
20200 LDKChannelAnnouncement this_ptr_conv;
20201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20202 this_ptr_conv.is_owned = false;
20203 LDKSignature val_ref;
20204 CHECK(*((uint32_t*)val) == 64);
20205 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
20206 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
20209 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
20210 LDKChannelAnnouncement this_ptr_conv;
20211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20212 this_ptr_conv.is_owned = false;
20213 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20214 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
20218 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
20219 LDKChannelAnnouncement this_ptr_conv;
20220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20221 this_ptr_conv.is_owned = false;
20222 LDKSignature val_ref;
20223 CHECK(*((uint32_t*)val) == 64);
20224 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
20225 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
20228 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
20229 LDKChannelAnnouncement this_ptr_conv;
20230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20231 this_ptr_conv.is_owned = false;
20232 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20233 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
20237 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
20238 LDKChannelAnnouncement this_ptr_conv;
20239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20240 this_ptr_conv.is_owned = false;
20241 LDKSignature val_ref;
20242 CHECK(*((uint32_t*)val) == 64);
20243 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
20244 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
20247 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
20248 LDKChannelAnnouncement this_ptr_conv;
20249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20250 this_ptr_conv.is_owned = false;
20251 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
20252 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20253 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20254 uint64_t ret_ref = (uint64_t)ret_var.inner;
20255 if (ret_var.is_owned) {
20261 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
20262 LDKChannelAnnouncement this_ptr_conv;
20263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20264 this_ptr_conv.is_owned = false;
20265 LDKUnsignedChannelAnnouncement val_conv;
20266 val_conv.inner = (void*)(val & (~1));
20267 val_conv.is_owned = (val & 1) || (val == 0);
20268 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
20269 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
20272 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) {
20273 LDKSignature node_signature_1_arg_ref;
20274 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
20275 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
20276 LDKSignature node_signature_2_arg_ref;
20277 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
20278 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
20279 LDKSignature bitcoin_signature_1_arg_ref;
20280 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
20281 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
20282 LDKSignature bitcoin_signature_2_arg_ref;
20283 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
20284 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
20285 LDKUnsignedChannelAnnouncement contents_arg_conv;
20286 contents_arg_conv.inner = (void*)(contents_arg & (~1));
20287 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
20288 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
20289 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);
20290 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20291 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20292 uint64_t ret_ref = (uint64_t)ret_var.inner;
20293 if (ret_var.is_owned) {
20299 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
20300 LDKChannelAnnouncement orig_conv;
20301 orig_conv.inner = (void*)(orig & (~1));
20302 orig_conv.is_owned = false;
20303 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
20304 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20305 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20306 uint64_t ret_ref = (uint64_t)ret_var.inner;
20307 if (ret_var.is_owned) {
20313 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
20314 LDKUnsignedChannelUpdate this_obj_conv;
20315 this_obj_conv.inner = (void*)(this_obj & (~1));
20316 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20317 UnsignedChannelUpdate_free(this_obj_conv);
20320 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
20321 LDKUnsignedChannelUpdate this_ptr_conv;
20322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20323 this_ptr_conv.is_owned = false;
20324 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20325 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
20329 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20330 LDKUnsignedChannelUpdate this_ptr_conv;
20331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20332 this_ptr_conv.is_owned = false;
20333 LDKThirtyTwoBytes val_ref;
20334 CHECK(*((uint32_t*)val) == 32);
20335 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20336 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
20339 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
20340 LDKUnsignedChannelUpdate this_ptr_conv;
20341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20342 this_ptr_conv.is_owned = false;
20343 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
20347 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
20348 LDKUnsignedChannelUpdate this_ptr_conv;
20349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20350 this_ptr_conv.is_owned = false;
20351 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
20354 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
20355 LDKUnsignedChannelUpdate this_ptr_conv;
20356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20357 this_ptr_conv.is_owned = false;
20358 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
20362 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
20363 LDKUnsignedChannelUpdate this_ptr_conv;
20364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20365 this_ptr_conv.is_owned = false;
20366 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
20369 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
20370 LDKUnsignedChannelUpdate this_ptr_conv;
20371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20372 this_ptr_conv.is_owned = false;
20373 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
20377 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
20378 LDKUnsignedChannelUpdate this_ptr_conv;
20379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20380 this_ptr_conv.is_owned = false;
20381 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
20384 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
20385 LDKUnsignedChannelUpdate this_ptr_conv;
20386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20387 this_ptr_conv.is_owned = false;
20388 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
20392 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
20393 LDKUnsignedChannelUpdate this_ptr_conv;
20394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20395 this_ptr_conv.is_owned = false;
20396 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
20399 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
20400 LDKUnsignedChannelUpdate this_ptr_conv;
20401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20402 this_ptr_conv.is_owned = false;
20403 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
20407 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
20408 LDKUnsignedChannelUpdate this_ptr_conv;
20409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20410 this_ptr_conv.is_owned = false;
20411 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
20414 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
20415 LDKUnsignedChannelUpdate this_ptr_conv;
20416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20417 this_ptr_conv.is_owned = false;
20418 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
20422 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
20423 LDKUnsignedChannelUpdate this_ptr_conv;
20424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20425 this_ptr_conv.is_owned = false;
20426 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
20429 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
20430 LDKUnsignedChannelUpdate this_ptr_conv;
20431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20432 this_ptr_conv.is_owned = false;
20433 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
20437 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
20438 LDKUnsignedChannelUpdate this_ptr_conv;
20439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20440 this_ptr_conv.is_owned = false;
20441 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
20444 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
20445 LDKUnsignedChannelUpdate orig_conv;
20446 orig_conv.inner = (void*)(orig & (~1));
20447 orig_conv.is_owned = false;
20448 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
20449 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20450 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20451 uint64_t ret_ref = (uint64_t)ret_var.inner;
20452 if (ret_var.is_owned) {
20458 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
20459 LDKChannelUpdate this_obj_conv;
20460 this_obj_conv.inner = (void*)(this_obj & (~1));
20461 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20462 ChannelUpdate_free(this_obj_conv);
20465 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
20466 LDKChannelUpdate this_ptr_conv;
20467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20468 this_ptr_conv.is_owned = false;
20469 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20470 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
20474 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
20475 LDKChannelUpdate this_ptr_conv;
20476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20477 this_ptr_conv.is_owned = false;
20478 LDKSignature val_ref;
20479 CHECK(*((uint32_t*)val) == 64);
20480 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
20481 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
20484 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
20485 LDKChannelUpdate this_ptr_conv;
20486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20487 this_ptr_conv.is_owned = false;
20488 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
20489 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20490 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20491 uint64_t ret_ref = (uint64_t)ret_var.inner;
20492 if (ret_var.is_owned) {
20498 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
20499 LDKChannelUpdate this_ptr_conv;
20500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20501 this_ptr_conv.is_owned = false;
20502 LDKUnsignedChannelUpdate val_conv;
20503 val_conv.inner = (void*)(val & (~1));
20504 val_conv.is_owned = (val & 1) || (val == 0);
20505 val_conv = UnsignedChannelUpdate_clone(&val_conv);
20506 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
20509 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
20510 LDKSignature signature_arg_ref;
20511 CHECK(*((uint32_t*)signature_arg) == 64);
20512 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
20513 LDKUnsignedChannelUpdate contents_arg_conv;
20514 contents_arg_conv.inner = (void*)(contents_arg & (~1));
20515 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
20516 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
20517 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
20518 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20519 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20520 uint64_t ret_ref = (uint64_t)ret_var.inner;
20521 if (ret_var.is_owned) {
20527 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
20528 LDKChannelUpdate orig_conv;
20529 orig_conv.inner = (void*)(orig & (~1));
20530 orig_conv.is_owned = false;
20531 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
20532 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20533 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20534 uint64_t ret_ref = (uint64_t)ret_var.inner;
20535 if (ret_var.is_owned) {
20541 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
20542 LDKQueryChannelRange this_obj_conv;
20543 this_obj_conv.inner = (void*)(this_obj & (~1));
20544 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20545 QueryChannelRange_free(this_obj_conv);
20548 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
20549 LDKQueryChannelRange this_ptr_conv;
20550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20551 this_ptr_conv.is_owned = false;
20552 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20553 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
20557 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20558 LDKQueryChannelRange this_ptr_conv;
20559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20560 this_ptr_conv.is_owned = false;
20561 LDKThirtyTwoBytes val_ref;
20562 CHECK(*((uint32_t*)val) == 32);
20563 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20564 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
20567 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
20568 LDKQueryChannelRange this_ptr_conv;
20569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20570 this_ptr_conv.is_owned = false;
20571 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
20575 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
20576 LDKQueryChannelRange this_ptr_conv;
20577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20578 this_ptr_conv.is_owned = false;
20579 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
20582 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
20583 LDKQueryChannelRange this_ptr_conv;
20584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20585 this_ptr_conv.is_owned = false;
20586 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
20590 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
20591 LDKQueryChannelRange this_ptr_conv;
20592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20593 this_ptr_conv.is_owned = false;
20594 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
20597 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
20598 LDKThirtyTwoBytes chain_hash_arg_ref;
20599 CHECK(*((uint32_t*)chain_hash_arg) == 32);
20600 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
20601 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
20602 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20603 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20604 uint64_t ret_ref = (uint64_t)ret_var.inner;
20605 if (ret_var.is_owned) {
20611 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
20612 LDKQueryChannelRange orig_conv;
20613 orig_conv.inner = (void*)(orig & (~1));
20614 orig_conv.is_owned = false;
20615 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
20616 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20617 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20618 uint64_t ret_ref = (uint64_t)ret_var.inner;
20619 if (ret_var.is_owned) {
20625 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
20626 LDKReplyChannelRange this_obj_conv;
20627 this_obj_conv.inner = (void*)(this_obj & (~1));
20628 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20629 ReplyChannelRange_free(this_obj_conv);
20632 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
20633 LDKReplyChannelRange this_ptr_conv;
20634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20635 this_ptr_conv.is_owned = false;
20636 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20637 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
20641 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20642 LDKReplyChannelRange this_ptr_conv;
20643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20644 this_ptr_conv.is_owned = false;
20645 LDKThirtyTwoBytes val_ref;
20646 CHECK(*((uint32_t*)val) == 32);
20647 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20648 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
20651 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
20652 LDKReplyChannelRange this_ptr_conv;
20653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20654 this_ptr_conv.is_owned = false;
20655 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
20659 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
20660 LDKReplyChannelRange this_ptr_conv;
20661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20662 this_ptr_conv.is_owned = false;
20663 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
20666 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
20667 LDKReplyChannelRange this_ptr_conv;
20668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20669 this_ptr_conv.is_owned = false;
20670 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
20674 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
20675 LDKReplyChannelRange this_ptr_conv;
20676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20677 this_ptr_conv.is_owned = false;
20678 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
20681 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
20682 LDKReplyChannelRange this_ptr_conv;
20683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20684 this_ptr_conv.is_owned = false;
20685 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
20689 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
20690 LDKReplyChannelRange this_ptr_conv;
20691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20692 this_ptr_conv.is_owned = false;
20693 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
20696 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
20697 LDKReplyChannelRange this_ptr_conv;
20698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20699 this_ptr_conv.is_owned = false;
20700 LDKCVec_u64Z val_constr;
20701 val_constr.datalen = *((uint32_t*)val);
20702 if (val_constr.datalen > 0)
20703 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20705 val_constr.data = NULL;
20706 int64_t* val_vals = (int64_t*)(val + 4);
20707 for (size_t i = 0; i < val_constr.datalen; i++) {
20708 int64_t val_conv_8 = val_vals[i];
20709 val_constr.data[i] = val_conv_8;
20711 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
20714 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) {
20715 LDKThirtyTwoBytes chain_hash_arg_ref;
20716 CHECK(*((uint32_t*)chain_hash_arg) == 32);
20717 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
20718 LDKCVec_u64Z short_channel_ids_arg_constr;
20719 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
20720 if (short_channel_ids_arg_constr.datalen > 0)
20721 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20723 short_channel_ids_arg_constr.data = NULL;
20724 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
20725 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
20726 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
20727 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
20729 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
20730 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20731 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20732 uint64_t ret_ref = (uint64_t)ret_var.inner;
20733 if (ret_var.is_owned) {
20739 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
20740 LDKReplyChannelRange orig_conv;
20741 orig_conv.inner = (void*)(orig & (~1));
20742 orig_conv.is_owned = false;
20743 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
20744 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20745 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20746 uint64_t ret_ref = (uint64_t)ret_var.inner;
20747 if (ret_var.is_owned) {
20753 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
20754 LDKQueryShortChannelIds this_obj_conv;
20755 this_obj_conv.inner = (void*)(this_obj & (~1));
20756 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20757 QueryShortChannelIds_free(this_obj_conv);
20760 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
20761 LDKQueryShortChannelIds this_ptr_conv;
20762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20763 this_ptr_conv.is_owned = false;
20764 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20765 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
20769 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20770 LDKQueryShortChannelIds this_ptr_conv;
20771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20772 this_ptr_conv.is_owned = false;
20773 LDKThirtyTwoBytes val_ref;
20774 CHECK(*((uint32_t*)val) == 32);
20775 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20776 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
20779 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
20780 LDKQueryShortChannelIds this_ptr_conv;
20781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20782 this_ptr_conv.is_owned = false;
20783 LDKCVec_u64Z val_constr;
20784 val_constr.datalen = *((uint32_t*)val);
20785 if (val_constr.datalen > 0)
20786 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20788 val_constr.data = NULL;
20789 int64_t* val_vals = (int64_t*)(val + 4);
20790 for (size_t i = 0; i < val_constr.datalen; i++) {
20791 int64_t val_conv_8 = val_vals[i];
20792 val_constr.data[i] = val_conv_8;
20794 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
20797 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
20798 LDKThirtyTwoBytes chain_hash_arg_ref;
20799 CHECK(*((uint32_t*)chain_hash_arg) == 32);
20800 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
20801 LDKCVec_u64Z short_channel_ids_arg_constr;
20802 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
20803 if (short_channel_ids_arg_constr.datalen > 0)
20804 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20806 short_channel_ids_arg_constr.data = NULL;
20807 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
20808 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
20809 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
20810 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
20812 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
20813 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20814 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20815 uint64_t ret_ref = (uint64_t)ret_var.inner;
20816 if (ret_var.is_owned) {
20822 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
20823 LDKQueryShortChannelIds orig_conv;
20824 orig_conv.inner = (void*)(orig & (~1));
20825 orig_conv.is_owned = false;
20826 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
20827 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20828 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20829 uint64_t ret_ref = (uint64_t)ret_var.inner;
20830 if (ret_var.is_owned) {
20836 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
20837 LDKReplyShortChannelIdsEnd this_obj_conv;
20838 this_obj_conv.inner = (void*)(this_obj & (~1));
20839 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20840 ReplyShortChannelIdsEnd_free(this_obj_conv);
20843 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
20844 LDKReplyShortChannelIdsEnd this_ptr_conv;
20845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20846 this_ptr_conv.is_owned = false;
20847 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20848 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
20852 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20853 LDKReplyShortChannelIdsEnd this_ptr_conv;
20854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20855 this_ptr_conv.is_owned = false;
20856 LDKThirtyTwoBytes val_ref;
20857 CHECK(*((uint32_t*)val) == 32);
20858 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20859 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
20862 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
20863 LDKReplyShortChannelIdsEnd this_ptr_conv;
20864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20865 this_ptr_conv.is_owned = false;
20866 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
20870 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
20871 LDKReplyShortChannelIdsEnd this_ptr_conv;
20872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20873 this_ptr_conv.is_owned = false;
20874 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
20877 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
20878 LDKThirtyTwoBytes chain_hash_arg_ref;
20879 CHECK(*((uint32_t*)chain_hash_arg) == 32);
20880 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
20881 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
20882 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20883 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20884 uint64_t ret_ref = (uint64_t)ret_var.inner;
20885 if (ret_var.is_owned) {
20891 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
20892 LDKReplyShortChannelIdsEnd orig_conv;
20893 orig_conv.inner = (void*)(orig & (~1));
20894 orig_conv.is_owned = false;
20895 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
20896 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20897 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20898 uint64_t ret_ref = (uint64_t)ret_var.inner;
20899 if (ret_var.is_owned) {
20905 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
20906 LDKGossipTimestampFilter this_obj_conv;
20907 this_obj_conv.inner = (void*)(this_obj & (~1));
20908 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20909 GossipTimestampFilter_free(this_obj_conv);
20912 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
20913 LDKGossipTimestampFilter this_ptr_conv;
20914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20915 this_ptr_conv.is_owned = false;
20916 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20917 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
20921 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20922 LDKGossipTimestampFilter this_ptr_conv;
20923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20924 this_ptr_conv.is_owned = false;
20925 LDKThirtyTwoBytes val_ref;
20926 CHECK(*((uint32_t*)val) == 32);
20927 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20928 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
20931 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
20932 LDKGossipTimestampFilter this_ptr_conv;
20933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20934 this_ptr_conv.is_owned = false;
20935 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
20939 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
20940 LDKGossipTimestampFilter this_ptr_conv;
20941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20942 this_ptr_conv.is_owned = false;
20943 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
20946 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
20947 LDKGossipTimestampFilter this_ptr_conv;
20948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20949 this_ptr_conv.is_owned = false;
20950 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
20954 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
20955 LDKGossipTimestampFilter this_ptr_conv;
20956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20957 this_ptr_conv.is_owned = false;
20958 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
20961 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
20962 LDKThirtyTwoBytes chain_hash_arg_ref;
20963 CHECK(*((uint32_t*)chain_hash_arg) == 32);
20964 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
20965 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
20966 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20967 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20968 uint64_t ret_ref = (uint64_t)ret_var.inner;
20969 if (ret_var.is_owned) {
20975 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
20976 LDKGossipTimestampFilter orig_conv;
20977 orig_conv.inner = (void*)(orig & (~1));
20978 orig_conv.is_owned = false;
20979 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
20980 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20981 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20982 uint64_t ret_ref = (uint64_t)ret_var.inner;
20983 if (ret_var.is_owned) {
20989 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
20990 if ((this_ptr & 1) != 0) return;
20991 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20992 CHECK_ACCESS(this_ptr_ptr);
20993 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
20994 FREE((void*)this_ptr);
20995 ErrorAction_free(this_ptr_conv);
20998 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
20999 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
21000 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21001 *ret_copy = ErrorAction_clone(orig_conv);
21002 uint64_t ret_ref = (uint64_t)ret_copy;
21006 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
21007 LDKErrorMessage msg_conv;
21008 msg_conv.inner = (void*)(msg & (~1));
21009 msg_conv.is_owned = (msg & 1) || (msg == 0);
21010 msg_conv = ErrorMessage_clone(&msg_conv);
21011 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21012 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
21013 uint64_t ret_ref = (uint64_t)ret_copy;
21017 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_error() {
21018 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21019 *ret_copy = ErrorAction_ignore_error();
21020 uint64_t ret_ref = (uint64_t)ret_copy;
21024 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
21025 LDKLevel a_conv = LDKLevel_from_js(a);
21026 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21027 *ret_copy = ErrorAction_ignore_and_log(a_conv);
21028 uint64_t ret_ref = (uint64_t)ret_copy;
21032 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) {
21033 LDKErrorMessage msg_conv;
21034 msg_conv.inner = (void*)(msg & (~1));
21035 msg_conv.is_owned = (msg & 1) || (msg == 0);
21036 msg_conv = ErrorMessage_clone(&msg_conv);
21037 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21038 *ret_copy = ErrorAction_send_error_message(msg_conv);
21039 uint64_t ret_ref = (uint64_t)ret_copy;
21043 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
21044 LDKLightningError this_obj_conv;
21045 this_obj_conv.inner = (void*)(this_obj & (~1));
21046 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21047 LightningError_free(this_obj_conv);
21050 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
21051 LDKLightningError this_ptr_conv;
21052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21053 this_ptr_conv.is_owned = false;
21054 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
21055 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
21060 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
21061 LDKLightningError this_ptr_conv;
21062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21063 this_ptr_conv.is_owned = false;
21064 LDKStr val_conv = str_ref_to_owned_c(val);
21065 LightningError_set_err(&this_ptr_conv, val_conv);
21068 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
21069 LDKLightningError this_ptr_conv;
21070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21071 this_ptr_conv.is_owned = false;
21072 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21073 *ret_copy = LightningError_get_action(&this_ptr_conv);
21074 uint64_t ret_ref = (uint64_t)ret_copy;
21078 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
21079 LDKLightningError this_ptr_conv;
21080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21081 this_ptr_conv.is_owned = false;
21082 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21083 CHECK_ACCESS(val_ptr);
21084 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
21085 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
21086 LightningError_set_action(&this_ptr_conv, val_conv);
21089 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
21090 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
21091 void* action_arg_ptr = (void*)(((uint64_t)action_arg) & ~1);
21092 CHECK_ACCESS(action_arg_ptr);
21093 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
21094 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
21095 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
21096 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21097 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21098 uint64_t ret_ref = (uint64_t)ret_var.inner;
21099 if (ret_var.is_owned) {
21105 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
21106 LDKLightningError orig_conv;
21107 orig_conv.inner = (void*)(orig & (~1));
21108 orig_conv.is_owned = false;
21109 LDKLightningError ret_var = LightningError_clone(&orig_conv);
21110 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21111 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21112 uint64_t ret_ref = (uint64_t)ret_var.inner;
21113 if (ret_var.is_owned) {
21119 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
21120 LDKCommitmentUpdate this_obj_conv;
21121 this_obj_conv.inner = (void*)(this_obj & (~1));
21122 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21123 CommitmentUpdate_free(this_obj_conv);
21126 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
21127 LDKCommitmentUpdate this_ptr_conv;
21128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21129 this_ptr_conv.is_owned = false;
21130 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
21131 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
21132 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21133 for (size_t p = 0; p < ret_var.datalen; p++) {
21134 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
21135 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21136 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21137 uint64_t ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
21138 if (ret_conv_15_var.is_owned) {
21139 ret_conv_15_ref |= 1;
21141 ret_arr_ptr[p] = ret_conv_15_ref;
21143 FREE(ret_var.data);
21147 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
21148 LDKCommitmentUpdate this_ptr_conv;
21149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21150 this_ptr_conv.is_owned = false;
21151 LDKCVec_UpdateAddHTLCZ val_constr;
21152 val_constr.datalen = *((uint32_t*)val);
21153 if (val_constr.datalen > 0)
21154 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
21156 val_constr.data = NULL;
21157 uint32_t* val_vals = (uint32_t*)(val + 4);
21158 for (size_t p = 0; p < val_constr.datalen; p++) {
21159 uint32_t val_conv_15 = val_vals[p];
21160 LDKUpdateAddHTLC val_conv_15_conv;
21161 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
21162 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
21163 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
21164 val_constr.data[p] = val_conv_15_conv;
21166 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
21169 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
21170 LDKCommitmentUpdate this_ptr_conv;
21171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21172 this_ptr_conv.is_owned = false;
21173 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
21174 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
21175 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21176 for (size_t t = 0; t < ret_var.datalen; t++) {
21177 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
21178 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21179 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21180 uint64_t ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
21181 if (ret_conv_19_var.is_owned) {
21182 ret_conv_19_ref |= 1;
21184 ret_arr_ptr[t] = ret_conv_19_ref;
21186 FREE(ret_var.data);
21190 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
21191 LDKCommitmentUpdate this_ptr_conv;
21192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21193 this_ptr_conv.is_owned = false;
21194 LDKCVec_UpdateFulfillHTLCZ val_constr;
21195 val_constr.datalen = *((uint32_t*)val);
21196 if (val_constr.datalen > 0)
21197 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
21199 val_constr.data = NULL;
21200 uint32_t* val_vals = (uint32_t*)(val + 4);
21201 for (size_t t = 0; t < val_constr.datalen; t++) {
21202 uint32_t val_conv_19 = val_vals[t];
21203 LDKUpdateFulfillHTLC val_conv_19_conv;
21204 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
21205 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
21206 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
21207 val_constr.data[t] = val_conv_19_conv;
21209 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
21212 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
21213 LDKCommitmentUpdate this_ptr_conv;
21214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21215 this_ptr_conv.is_owned = false;
21216 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
21217 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
21218 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21219 for (size_t q = 0; q < ret_var.datalen; q++) {
21220 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
21221 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21222 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21223 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21224 if (ret_conv_16_var.is_owned) {
21225 ret_conv_16_ref |= 1;
21227 ret_arr_ptr[q] = ret_conv_16_ref;
21229 FREE(ret_var.data);
21233 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
21234 LDKCommitmentUpdate this_ptr_conv;
21235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21236 this_ptr_conv.is_owned = false;
21237 LDKCVec_UpdateFailHTLCZ val_constr;
21238 val_constr.datalen = *((uint32_t*)val);
21239 if (val_constr.datalen > 0)
21240 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
21242 val_constr.data = NULL;
21243 uint32_t* val_vals = (uint32_t*)(val + 4);
21244 for (size_t q = 0; q < val_constr.datalen; q++) {
21245 uint32_t val_conv_16 = val_vals[q];
21246 LDKUpdateFailHTLC val_conv_16_conv;
21247 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
21248 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
21249 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
21250 val_constr.data[q] = val_conv_16_conv;
21252 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
21255 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
21256 LDKCommitmentUpdate this_ptr_conv;
21257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21258 this_ptr_conv.is_owned = false;
21259 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
21260 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
21261 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21262 for (size_t z = 0; z < ret_var.datalen; z++) {
21263 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
21264 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21265 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21266 uint64_t ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
21267 if (ret_conv_25_var.is_owned) {
21268 ret_conv_25_ref |= 1;
21270 ret_arr_ptr[z] = ret_conv_25_ref;
21272 FREE(ret_var.data);
21276 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
21277 LDKCommitmentUpdate this_ptr_conv;
21278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21279 this_ptr_conv.is_owned = false;
21280 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
21281 val_constr.datalen = *((uint32_t*)val);
21282 if (val_constr.datalen > 0)
21283 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
21285 val_constr.data = NULL;
21286 uint32_t* val_vals = (uint32_t*)(val + 4);
21287 for (size_t z = 0; z < val_constr.datalen; z++) {
21288 uint32_t val_conv_25 = val_vals[z];
21289 LDKUpdateFailMalformedHTLC val_conv_25_conv;
21290 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
21291 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
21292 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
21293 val_constr.data[z] = val_conv_25_conv;
21295 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
21298 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
21299 LDKCommitmentUpdate this_ptr_conv;
21300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21301 this_ptr_conv.is_owned = false;
21302 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
21303 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21304 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21305 uint64_t ret_ref = (uint64_t)ret_var.inner;
21306 if (ret_var.is_owned) {
21312 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
21313 LDKCommitmentUpdate this_ptr_conv;
21314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21315 this_ptr_conv.is_owned = false;
21316 LDKUpdateFee val_conv;
21317 val_conv.inner = (void*)(val & (~1));
21318 val_conv.is_owned = (val & 1) || (val == 0);
21319 val_conv = UpdateFee_clone(&val_conv);
21320 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
21323 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
21324 LDKCommitmentUpdate this_ptr_conv;
21325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21326 this_ptr_conv.is_owned = false;
21327 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
21328 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21329 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21330 uint64_t ret_ref = (uint64_t)ret_var.inner;
21331 if (ret_var.is_owned) {
21337 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
21338 LDKCommitmentUpdate this_ptr_conv;
21339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21340 this_ptr_conv.is_owned = false;
21341 LDKCommitmentSigned val_conv;
21342 val_conv.inner = (void*)(val & (~1));
21343 val_conv.is_owned = (val & 1) || (val == 0);
21344 val_conv = CommitmentSigned_clone(&val_conv);
21345 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
21348 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) {
21349 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
21350 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
21351 if (update_add_htlcs_arg_constr.datalen > 0)
21352 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
21354 update_add_htlcs_arg_constr.data = NULL;
21355 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
21356 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
21357 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
21358 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
21359 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
21360 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
21361 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
21362 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
21364 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
21365 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
21366 if (update_fulfill_htlcs_arg_constr.datalen > 0)
21367 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
21369 update_fulfill_htlcs_arg_constr.data = NULL;
21370 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
21371 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
21372 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
21373 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
21374 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
21375 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
21376 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
21377 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
21379 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
21380 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
21381 if (update_fail_htlcs_arg_constr.datalen > 0)
21382 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
21384 update_fail_htlcs_arg_constr.data = NULL;
21385 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
21386 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
21387 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
21388 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
21389 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
21390 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
21391 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
21392 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
21394 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
21395 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
21396 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
21397 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
21399 update_fail_malformed_htlcs_arg_constr.data = NULL;
21400 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
21401 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
21402 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
21403 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
21404 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
21405 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);
21406 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
21407 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
21409 LDKUpdateFee update_fee_arg_conv;
21410 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
21411 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
21412 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
21413 LDKCommitmentSigned commitment_signed_arg_conv;
21414 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
21415 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
21416 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
21417 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);
21418 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21419 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21420 uint64_t ret_ref = (uint64_t)ret_var.inner;
21421 if (ret_var.is_owned) {
21427 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
21428 LDKCommitmentUpdate orig_conv;
21429 orig_conv.inner = (void*)(orig & (~1));
21430 orig_conv.is_owned = false;
21431 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
21432 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21433 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21434 uint64_t ret_ref = (uint64_t)ret_var.inner;
21435 if (ret_var.is_owned) {
21441 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
21442 if ((this_ptr & 1) != 0) return;
21443 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21444 CHECK_ACCESS(this_ptr_ptr);
21445 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
21446 FREE((void*)this_ptr);
21447 ChannelMessageHandler_free(this_ptr_conv);
21450 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
21451 if ((this_ptr & 1) != 0) return;
21452 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21453 CHECK_ACCESS(this_ptr_ptr);
21454 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
21455 FREE((void*)this_ptr);
21456 RoutingMessageHandler_free(this_ptr_conv);
21459 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
21460 LDKAcceptChannel obj_conv;
21461 obj_conv.inner = (void*)(obj & (~1));
21462 obj_conv.is_owned = false;
21463 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
21464 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21465 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21466 CVec_u8Z_free(ret_var);
21470 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
21471 LDKu8slice ser_ref;
21472 ser_ref.datalen = *((uint32_t*)ser);
21473 ser_ref.data = (int8_t*)(ser + 4);
21474 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21475 *ret_conv = AcceptChannel_read(ser_ref);
21476 return (uint64_t)ret_conv;
21479 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
21480 LDKAnnouncementSignatures obj_conv;
21481 obj_conv.inner = (void*)(obj & (~1));
21482 obj_conv.is_owned = false;
21483 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
21484 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21485 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21486 CVec_u8Z_free(ret_var);
21490 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
21491 LDKu8slice ser_ref;
21492 ser_ref.datalen = *((uint32_t*)ser);
21493 ser_ref.data = (int8_t*)(ser + 4);
21494 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21495 *ret_conv = AnnouncementSignatures_read(ser_ref);
21496 return (uint64_t)ret_conv;
21499 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
21500 LDKChannelReestablish obj_conv;
21501 obj_conv.inner = (void*)(obj & (~1));
21502 obj_conv.is_owned = false;
21503 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
21504 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21505 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21506 CVec_u8Z_free(ret_var);
21510 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
21511 LDKu8slice ser_ref;
21512 ser_ref.datalen = *((uint32_t*)ser);
21513 ser_ref.data = (int8_t*)(ser + 4);
21514 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21515 *ret_conv = ChannelReestablish_read(ser_ref);
21516 return (uint64_t)ret_conv;
21519 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
21520 LDKClosingSigned obj_conv;
21521 obj_conv.inner = (void*)(obj & (~1));
21522 obj_conv.is_owned = false;
21523 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
21524 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21525 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21526 CVec_u8Z_free(ret_var);
21530 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
21531 LDKu8slice ser_ref;
21532 ser_ref.datalen = *((uint32_t*)ser);
21533 ser_ref.data = (int8_t*)(ser + 4);
21534 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21535 *ret_conv = ClosingSigned_read(ser_ref);
21536 return (uint64_t)ret_conv;
21539 int8_tArray __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
21540 LDKClosingSignedFeeRange obj_conv;
21541 obj_conv.inner = (void*)(obj & (~1));
21542 obj_conv.is_owned = false;
21543 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
21544 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21545 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21546 CVec_u8Z_free(ret_var);
21550 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
21551 LDKu8slice ser_ref;
21552 ser_ref.datalen = *((uint32_t*)ser);
21553 ser_ref.data = (int8_t*)(ser + 4);
21554 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21555 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
21556 return (uint64_t)ret_conv;
21559 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
21560 LDKCommitmentSigned obj_conv;
21561 obj_conv.inner = (void*)(obj & (~1));
21562 obj_conv.is_owned = false;
21563 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
21564 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21565 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21566 CVec_u8Z_free(ret_var);
21570 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
21571 LDKu8slice ser_ref;
21572 ser_ref.datalen = *((uint32_t*)ser);
21573 ser_ref.data = (int8_t*)(ser + 4);
21574 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21575 *ret_conv = CommitmentSigned_read(ser_ref);
21576 return (uint64_t)ret_conv;
21579 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
21580 LDKFundingCreated obj_conv;
21581 obj_conv.inner = (void*)(obj & (~1));
21582 obj_conv.is_owned = false;
21583 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
21584 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21585 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21586 CVec_u8Z_free(ret_var);
21590 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
21591 LDKu8slice ser_ref;
21592 ser_ref.datalen = *((uint32_t*)ser);
21593 ser_ref.data = (int8_t*)(ser + 4);
21594 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21595 *ret_conv = FundingCreated_read(ser_ref);
21596 return (uint64_t)ret_conv;
21599 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
21600 LDKFundingSigned obj_conv;
21601 obj_conv.inner = (void*)(obj & (~1));
21602 obj_conv.is_owned = false;
21603 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
21604 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21605 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21606 CVec_u8Z_free(ret_var);
21610 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
21611 LDKu8slice ser_ref;
21612 ser_ref.datalen = *((uint32_t*)ser);
21613 ser_ref.data = (int8_t*)(ser + 4);
21614 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21615 *ret_conv = FundingSigned_read(ser_ref);
21616 return (uint64_t)ret_conv;
21619 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
21620 LDKFundingLocked obj_conv;
21621 obj_conv.inner = (void*)(obj & (~1));
21622 obj_conv.is_owned = false;
21623 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
21624 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21625 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21626 CVec_u8Z_free(ret_var);
21630 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
21631 LDKu8slice ser_ref;
21632 ser_ref.datalen = *((uint32_t*)ser);
21633 ser_ref.data = (int8_t*)(ser + 4);
21634 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21635 *ret_conv = FundingLocked_read(ser_ref);
21636 return (uint64_t)ret_conv;
21639 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
21641 obj_conv.inner = (void*)(obj & (~1));
21642 obj_conv.is_owned = false;
21643 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
21644 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21645 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21646 CVec_u8Z_free(ret_var);
21650 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
21651 LDKu8slice ser_ref;
21652 ser_ref.datalen = *((uint32_t*)ser);
21653 ser_ref.data = (int8_t*)(ser + 4);
21654 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21655 *ret_conv = Init_read(ser_ref);
21656 return (uint64_t)ret_conv;
21659 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
21660 LDKOpenChannel obj_conv;
21661 obj_conv.inner = (void*)(obj & (~1));
21662 obj_conv.is_owned = false;
21663 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
21664 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21665 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21666 CVec_u8Z_free(ret_var);
21670 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
21671 LDKu8slice ser_ref;
21672 ser_ref.datalen = *((uint32_t*)ser);
21673 ser_ref.data = (int8_t*)(ser + 4);
21674 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21675 *ret_conv = OpenChannel_read(ser_ref);
21676 return (uint64_t)ret_conv;
21679 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
21680 LDKRevokeAndACK obj_conv;
21681 obj_conv.inner = (void*)(obj & (~1));
21682 obj_conv.is_owned = false;
21683 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
21684 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21685 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21686 CVec_u8Z_free(ret_var);
21690 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
21691 LDKu8slice ser_ref;
21692 ser_ref.datalen = *((uint32_t*)ser);
21693 ser_ref.data = (int8_t*)(ser + 4);
21694 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21695 *ret_conv = RevokeAndACK_read(ser_ref);
21696 return (uint64_t)ret_conv;
21699 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
21700 LDKShutdown obj_conv;
21701 obj_conv.inner = (void*)(obj & (~1));
21702 obj_conv.is_owned = false;
21703 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
21704 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21705 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21706 CVec_u8Z_free(ret_var);
21710 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
21711 LDKu8slice ser_ref;
21712 ser_ref.datalen = *((uint32_t*)ser);
21713 ser_ref.data = (int8_t*)(ser + 4);
21714 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21715 *ret_conv = Shutdown_read(ser_ref);
21716 return (uint64_t)ret_conv;
21719 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
21720 LDKUpdateFailHTLC obj_conv;
21721 obj_conv.inner = (void*)(obj & (~1));
21722 obj_conv.is_owned = false;
21723 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
21724 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21725 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21726 CVec_u8Z_free(ret_var);
21730 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
21731 LDKu8slice ser_ref;
21732 ser_ref.datalen = *((uint32_t*)ser);
21733 ser_ref.data = (int8_t*)(ser + 4);
21734 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21735 *ret_conv = UpdateFailHTLC_read(ser_ref);
21736 return (uint64_t)ret_conv;
21739 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
21740 LDKUpdateFailMalformedHTLC obj_conv;
21741 obj_conv.inner = (void*)(obj & (~1));
21742 obj_conv.is_owned = false;
21743 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
21744 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21745 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21746 CVec_u8Z_free(ret_var);
21750 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
21751 LDKu8slice ser_ref;
21752 ser_ref.datalen = *((uint32_t*)ser);
21753 ser_ref.data = (int8_t*)(ser + 4);
21754 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21755 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
21756 return (uint64_t)ret_conv;
21759 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
21760 LDKUpdateFee obj_conv;
21761 obj_conv.inner = (void*)(obj & (~1));
21762 obj_conv.is_owned = false;
21763 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
21764 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21765 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21766 CVec_u8Z_free(ret_var);
21770 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
21771 LDKu8slice ser_ref;
21772 ser_ref.datalen = *((uint32_t*)ser);
21773 ser_ref.data = (int8_t*)(ser + 4);
21774 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21775 *ret_conv = UpdateFee_read(ser_ref);
21776 return (uint64_t)ret_conv;
21779 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
21780 LDKUpdateFulfillHTLC obj_conv;
21781 obj_conv.inner = (void*)(obj & (~1));
21782 obj_conv.is_owned = false;
21783 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
21784 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21785 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21786 CVec_u8Z_free(ret_var);
21790 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
21791 LDKu8slice ser_ref;
21792 ser_ref.datalen = *((uint32_t*)ser);
21793 ser_ref.data = (int8_t*)(ser + 4);
21794 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21795 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
21796 return (uint64_t)ret_conv;
21799 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
21800 LDKUpdateAddHTLC obj_conv;
21801 obj_conv.inner = (void*)(obj & (~1));
21802 obj_conv.is_owned = false;
21803 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
21804 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21805 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21806 CVec_u8Z_free(ret_var);
21810 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
21811 LDKu8slice ser_ref;
21812 ser_ref.datalen = *((uint32_t*)ser);
21813 ser_ref.data = (int8_t*)(ser + 4);
21814 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21815 *ret_conv = UpdateAddHTLC_read(ser_ref);
21816 return (uint64_t)ret_conv;
21819 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
21821 obj_conv.inner = (void*)(obj & (~1));
21822 obj_conv.is_owned = false;
21823 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
21824 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21825 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21826 CVec_u8Z_free(ret_var);
21830 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
21831 LDKu8slice ser_ref;
21832 ser_ref.datalen = *((uint32_t*)ser);
21833 ser_ref.data = (int8_t*)(ser + 4);
21834 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21835 *ret_conv = Ping_read(ser_ref);
21836 return (uint64_t)ret_conv;
21839 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
21841 obj_conv.inner = (void*)(obj & (~1));
21842 obj_conv.is_owned = false;
21843 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
21844 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21845 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21846 CVec_u8Z_free(ret_var);
21850 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
21851 LDKu8slice ser_ref;
21852 ser_ref.datalen = *((uint32_t*)ser);
21853 ser_ref.data = (int8_t*)(ser + 4);
21854 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21855 *ret_conv = Pong_read(ser_ref);
21856 return (uint64_t)ret_conv;
21859 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
21860 LDKUnsignedChannelAnnouncement obj_conv;
21861 obj_conv.inner = (void*)(obj & (~1));
21862 obj_conv.is_owned = false;
21863 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
21864 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21865 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21866 CVec_u8Z_free(ret_var);
21870 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
21871 LDKu8slice ser_ref;
21872 ser_ref.datalen = *((uint32_t*)ser);
21873 ser_ref.data = (int8_t*)(ser + 4);
21874 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21875 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
21876 return (uint64_t)ret_conv;
21879 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
21880 LDKChannelAnnouncement obj_conv;
21881 obj_conv.inner = (void*)(obj & (~1));
21882 obj_conv.is_owned = false;
21883 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
21884 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21885 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21886 CVec_u8Z_free(ret_var);
21890 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
21891 LDKu8slice ser_ref;
21892 ser_ref.datalen = *((uint32_t*)ser);
21893 ser_ref.data = (int8_t*)(ser + 4);
21894 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21895 *ret_conv = ChannelAnnouncement_read(ser_ref);
21896 return (uint64_t)ret_conv;
21899 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
21900 LDKUnsignedChannelUpdate obj_conv;
21901 obj_conv.inner = (void*)(obj & (~1));
21902 obj_conv.is_owned = false;
21903 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
21904 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21905 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21906 CVec_u8Z_free(ret_var);
21910 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
21911 LDKu8slice ser_ref;
21912 ser_ref.datalen = *((uint32_t*)ser);
21913 ser_ref.data = (int8_t*)(ser + 4);
21914 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21915 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
21916 return (uint64_t)ret_conv;
21919 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
21920 LDKChannelUpdate obj_conv;
21921 obj_conv.inner = (void*)(obj & (~1));
21922 obj_conv.is_owned = false;
21923 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
21924 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21925 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21926 CVec_u8Z_free(ret_var);
21930 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
21931 LDKu8slice ser_ref;
21932 ser_ref.datalen = *((uint32_t*)ser);
21933 ser_ref.data = (int8_t*)(ser + 4);
21934 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21935 *ret_conv = ChannelUpdate_read(ser_ref);
21936 return (uint64_t)ret_conv;
21939 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
21940 LDKErrorMessage obj_conv;
21941 obj_conv.inner = (void*)(obj & (~1));
21942 obj_conv.is_owned = false;
21943 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
21944 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21945 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21946 CVec_u8Z_free(ret_var);
21950 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
21951 LDKu8slice ser_ref;
21952 ser_ref.datalen = *((uint32_t*)ser);
21953 ser_ref.data = (int8_t*)(ser + 4);
21954 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21955 *ret_conv = ErrorMessage_read(ser_ref);
21956 return (uint64_t)ret_conv;
21959 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
21960 LDKUnsignedNodeAnnouncement obj_conv;
21961 obj_conv.inner = (void*)(obj & (~1));
21962 obj_conv.is_owned = false;
21963 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
21964 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21965 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21966 CVec_u8Z_free(ret_var);
21970 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
21971 LDKu8slice ser_ref;
21972 ser_ref.datalen = *((uint32_t*)ser);
21973 ser_ref.data = (int8_t*)(ser + 4);
21974 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21975 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
21976 return (uint64_t)ret_conv;
21979 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
21980 LDKNodeAnnouncement obj_conv;
21981 obj_conv.inner = (void*)(obj & (~1));
21982 obj_conv.is_owned = false;
21983 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
21984 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21985 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21986 CVec_u8Z_free(ret_var);
21990 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
21991 LDKu8slice ser_ref;
21992 ser_ref.datalen = *((uint32_t*)ser);
21993 ser_ref.data = (int8_t*)(ser + 4);
21994 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21995 *ret_conv = NodeAnnouncement_read(ser_ref);
21996 return (uint64_t)ret_conv;
21999 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
22000 LDKu8slice ser_ref;
22001 ser_ref.datalen = *((uint32_t*)ser);
22002 ser_ref.data = (int8_t*)(ser + 4);
22003 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22004 *ret_conv = QueryShortChannelIds_read(ser_ref);
22005 return (uint64_t)ret_conv;
22008 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
22009 LDKQueryShortChannelIds obj_conv;
22010 obj_conv.inner = (void*)(obj & (~1));
22011 obj_conv.is_owned = false;
22012 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
22013 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22014 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22015 CVec_u8Z_free(ret_var);
22019 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
22020 LDKReplyShortChannelIdsEnd obj_conv;
22021 obj_conv.inner = (void*)(obj & (~1));
22022 obj_conv.is_owned = false;
22023 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
22024 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22025 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22026 CVec_u8Z_free(ret_var);
22030 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
22031 LDKu8slice ser_ref;
22032 ser_ref.datalen = *((uint32_t*)ser);
22033 ser_ref.data = (int8_t*)(ser + 4);
22034 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22035 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
22036 return (uint64_t)ret_conv;
22039 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
22040 LDKQueryChannelRange this_arg_conv;
22041 this_arg_conv.inner = (void*)(this_arg & (~1));
22042 this_arg_conv.is_owned = false;
22043 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
22047 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
22048 LDKQueryChannelRange obj_conv;
22049 obj_conv.inner = (void*)(obj & (~1));
22050 obj_conv.is_owned = false;
22051 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
22052 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22053 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22054 CVec_u8Z_free(ret_var);
22058 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
22059 LDKu8slice ser_ref;
22060 ser_ref.datalen = *((uint32_t*)ser);
22061 ser_ref.data = (int8_t*)(ser + 4);
22062 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22063 *ret_conv = QueryChannelRange_read(ser_ref);
22064 return (uint64_t)ret_conv;
22067 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
22068 LDKu8slice ser_ref;
22069 ser_ref.datalen = *((uint32_t*)ser);
22070 ser_ref.data = (int8_t*)(ser + 4);
22071 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22072 *ret_conv = ReplyChannelRange_read(ser_ref);
22073 return (uint64_t)ret_conv;
22076 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
22077 LDKReplyChannelRange obj_conv;
22078 obj_conv.inner = (void*)(obj & (~1));
22079 obj_conv.is_owned = false;
22080 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
22081 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22082 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22083 CVec_u8Z_free(ret_var);
22087 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
22088 LDKGossipTimestampFilter obj_conv;
22089 obj_conv.inner = (void*)(obj & (~1));
22090 obj_conv.is_owned = false;
22091 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
22092 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22093 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22094 CVec_u8Z_free(ret_var);
22098 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
22099 LDKu8slice ser_ref;
22100 ser_ref.datalen = *((uint32_t*)ser);
22101 ser_ref.data = (int8_t*)(ser + 4);
22102 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22103 *ret_conv = GossipTimestampFilter_read(ser_ref);
22104 return (uint64_t)ret_conv;
22107 void __attribute__((visibility("default"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
22108 if ((this_ptr & 1) != 0) return;
22109 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
22110 CHECK_ACCESS(this_ptr_ptr);
22111 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
22112 FREE((void*)this_ptr);
22113 CustomMessageHandler_free(this_ptr_conv);
22116 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
22117 LDKIgnoringMessageHandler this_obj_conv;
22118 this_obj_conv.inner = (void*)(this_obj & (~1));
22119 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22120 IgnoringMessageHandler_free(this_obj_conv);
22123 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
22124 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
22125 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22126 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22127 uint64_t ret_ref = (uint64_t)ret_var.inner;
22128 if (ret_var.is_owned) {
22134 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
22135 LDKIgnoringMessageHandler this_arg_conv;
22136 this_arg_conv.inner = (void*)(this_arg & (~1));
22137 this_arg_conv.is_owned = false;
22138 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
22139 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
22140 return (uint64_t)ret_ret;
22143 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
22144 LDKIgnoringMessageHandler this_arg_conv;
22145 this_arg_conv.inner = (void*)(this_arg & (~1));
22146 this_arg_conv.is_owned = false;
22147 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
22148 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
22149 return (uint64_t)ret_ret;
22152 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
22153 LDKIgnoringMessageHandler this_arg_conv;
22154 this_arg_conv.inner = (void*)(this_arg & (~1));
22155 this_arg_conv.is_owned = false;
22156 LDKCustomMessageReader* ret_ret =MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
22157 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
22158 return (uint64_t)ret_ret;
22161 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
22162 LDKIgnoringMessageHandler this_arg_conv;
22163 this_arg_conv.inner = (void*)(this_arg & (~1));
22164 this_arg_conv.is_owned = false;
22165 LDKCustomMessageHandler* ret_ret =MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
22166 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
22167 return (uint64_t)ret_ret;
22170 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
22171 LDKErroringMessageHandler this_obj_conv;
22172 this_obj_conv.inner = (void*)(this_obj & (~1));
22173 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22174 ErroringMessageHandler_free(this_obj_conv);
22177 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
22178 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
22179 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22180 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22181 uint64_t ret_ref = (uint64_t)ret_var.inner;
22182 if (ret_var.is_owned) {
22188 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
22189 LDKErroringMessageHandler this_arg_conv;
22190 this_arg_conv.inner = (void*)(this_arg & (~1));
22191 this_arg_conv.is_owned = false;
22192 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
22193 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
22194 return (uint64_t)ret_ret;
22197 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
22198 LDKErroringMessageHandler this_arg_conv;
22199 this_arg_conv.inner = (void*)(this_arg & (~1));
22200 this_arg_conv.is_owned = false;
22201 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
22202 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
22203 return (uint64_t)ret_ret;
22206 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
22207 LDKMessageHandler this_obj_conv;
22208 this_obj_conv.inner = (void*)(this_obj & (~1));
22209 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22210 MessageHandler_free(this_obj_conv);
22213 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
22214 LDKMessageHandler this_ptr_conv;
22215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22216 this_ptr_conv.is_owned = false;
22217 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
22221 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
22222 LDKMessageHandler this_ptr_conv;
22223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22224 this_ptr_conv.is_owned = false;
22225 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22226 CHECK_ACCESS(val_ptr);
22227 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
22228 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
22231 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
22232 LDKMessageHandler this_ptr_conv;
22233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22234 this_ptr_conv.is_owned = false;
22235 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
22239 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
22240 LDKMessageHandler this_ptr_conv;
22241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22242 this_ptr_conv.is_owned = false;
22243 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22244 CHECK_ACCESS(val_ptr);
22245 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
22246 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
22249 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
22250 void* chan_handler_arg_ptr = (void*)(((uint64_t)chan_handler_arg) & ~1);
22251 CHECK_ACCESS(chan_handler_arg_ptr);
22252 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
22253 void* route_handler_arg_ptr = (void*)(((uint64_t)route_handler_arg) & ~1);
22254 CHECK_ACCESS(route_handler_arg_ptr);
22255 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
22256 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
22257 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22258 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22259 uint64_t ret_ref = (uint64_t)ret_var.inner;
22260 if (ret_var.is_owned) {
22266 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
22267 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
22268 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
22269 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
22270 LDKSocketDescriptor* ret_ret =MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
22271 *ret_ret = SocketDescriptor_clone(orig_conv);
22272 return (uint64_t)ret_ret;
22275 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
22276 if ((this_ptr & 1) != 0) return;
22277 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
22278 CHECK_ACCESS(this_ptr_ptr);
22279 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
22280 FREE((void*)this_ptr);
22281 SocketDescriptor_free(this_ptr_conv);
22284 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
22285 LDKPeerHandleError this_obj_conv;
22286 this_obj_conv.inner = (void*)(this_obj & (~1));
22287 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22288 PeerHandleError_free(this_obj_conv);
22291 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
22292 LDKPeerHandleError this_ptr_conv;
22293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22294 this_ptr_conv.is_owned = false;
22295 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
22299 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
22300 LDKPeerHandleError this_ptr_conv;
22301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22302 this_ptr_conv.is_owned = false;
22303 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
22306 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
22307 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
22308 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22309 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22310 uint64_t ret_ref = (uint64_t)ret_var.inner;
22311 if (ret_var.is_owned) {
22317 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
22318 LDKPeerHandleError orig_conv;
22319 orig_conv.inner = (void*)(orig & (~1));
22320 orig_conv.is_owned = false;
22321 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
22322 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22323 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22324 uint64_t ret_ref = (uint64_t)ret_var.inner;
22325 if (ret_var.is_owned) {
22331 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
22332 LDKPeerManager this_obj_conv;
22333 this_obj_conv.inner = (void*)(this_obj & (~1));
22334 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22335 PeerManager_free(this_obj_conv);
22338 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) {
22339 LDKMessageHandler message_handler_conv;
22340 message_handler_conv.inner = (void*)(message_handler & (~1));
22341 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
22342 // Warning: we need a move here but no clone is available for LDKMessageHandler
22343 LDKSecretKey our_node_secret_ref;
22344 CHECK(*((uint32_t*)our_node_secret) == 32);
22345 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
22346 unsigned char ephemeral_random_data_arr[32];
22347 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
22348 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
22349 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
22350 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
22351 CHECK_ACCESS(logger_ptr);
22352 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22353 void* custom_message_handler_ptr = (void*)(((uint64_t)custom_message_handler) & ~1);
22354 CHECK_ACCESS(custom_message_handler_ptr);
22355 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
22356 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
22357 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22358 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22359 uint64_t ret_ref = (uint64_t)ret_var.inner;
22360 if (ret_var.is_owned) {
22366 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
22367 LDKPeerManager this_arg_conv;
22368 this_arg_conv.inner = (void*)(this_arg & (~1));
22369 this_arg_conv.is_owned = false;
22370 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
22371 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
22372 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
22373 for (size_t m = 0; m < ret_var.datalen; m++) {
22374 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22375 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
22376 ret_arr_ptr[m] = ret_conv_12_arr;
22378 FREE(ret_var.data);
22382 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
22383 LDKPeerManager this_arg_conv;
22384 this_arg_conv.inner = (void*)(this_arg & (~1));
22385 this_arg_conv.is_owned = false;
22386 LDKPublicKey their_node_id_ref;
22387 CHECK(*((uint32_t*)their_node_id) == 33);
22388 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
22389 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
22390 CHECK_ACCESS(descriptor_ptr);
22391 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
22392 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22393 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
22394 return (uint64_t)ret_conv;
22397 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
22398 LDKPeerManager this_arg_conv;
22399 this_arg_conv.inner = (void*)(this_arg & (~1));
22400 this_arg_conv.is_owned = false;
22401 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
22402 CHECK_ACCESS(descriptor_ptr);
22403 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
22404 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22405 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
22406 return (uint64_t)ret_conv;
22409 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
22410 LDKPeerManager this_arg_conv;
22411 this_arg_conv.inner = (void*)(this_arg & (~1));
22412 this_arg_conv.is_owned = false;
22413 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
22414 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
22415 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
22416 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22417 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
22418 return (uint64_t)ret_conv;
22421 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
22422 LDKPeerManager this_arg_conv;
22423 this_arg_conv.inner = (void*)(this_arg & (~1));
22424 this_arg_conv.is_owned = false;
22425 void* peer_descriptor_ptr = (void*)(((uint64_t)peer_descriptor) & ~1);
22426 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
22427 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
22428 LDKu8slice data_ref;
22429 data_ref.datalen = *((uint32_t*)data);
22430 data_ref.data = (int8_t*)(data + 4);
22431 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22432 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
22433 return (uint64_t)ret_conv;
22436 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
22437 LDKPeerManager this_arg_conv;
22438 this_arg_conv.inner = (void*)(this_arg & (~1));
22439 this_arg_conv.is_owned = false;
22440 PeerManager_process_events(&this_arg_conv);
22443 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
22444 LDKPeerManager this_arg_conv;
22445 this_arg_conv.inner = (void*)(this_arg & (~1));
22446 this_arg_conv.is_owned = false;
22447 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
22448 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
22449 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
22450 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
22453 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
22454 LDKPeerManager this_arg_conv;
22455 this_arg_conv.inner = (void*)(this_arg & (~1));
22456 this_arg_conv.is_owned = false;
22457 LDKPublicKey node_id_ref;
22458 CHECK(*((uint32_t*)node_id) == 33);
22459 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
22460 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
22463 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
22464 LDKPeerManager this_arg_conv;
22465 this_arg_conv.inner = (void*)(this_arg & (~1));
22466 this_arg_conv.is_owned = false;
22467 PeerManager_timer_tick_occurred(&this_arg_conv);
22470 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
22471 unsigned char commitment_seed_arr[32];
22472 CHECK(*((uint32_t*)commitment_seed) == 32);
22473 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
22474 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
22475 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22476 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
22480 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) {
22481 LDKCVec_u8Z to_holder_script_ref;
22482 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
22483 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
22484 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
22485 LDKCVec_u8Z to_counterparty_script_ref;
22486 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
22487 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
22488 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
22489 LDKOutPoint funding_outpoint_conv;
22490 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
22491 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
22492 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
22493 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);
22494 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22495 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22496 Transaction_free(ret_var);
22500 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
22501 LDKPublicKey per_commitment_point_ref;
22502 CHECK(*((uint32_t*)per_commitment_point) == 33);
22503 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
22504 unsigned char base_secret_arr[32];
22505 CHECK(*((uint32_t*)base_secret) == 32);
22506 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
22507 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
22508 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
22509 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
22510 return (uint64_t)ret_conv;
22513 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
22514 LDKPublicKey per_commitment_point_ref;
22515 CHECK(*((uint32_t*)per_commitment_point) == 33);
22516 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
22517 LDKPublicKey base_point_ref;
22518 CHECK(*((uint32_t*)base_point) == 33);
22519 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
22520 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22521 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
22522 return (uint64_t)ret_conv;
22525 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
22526 unsigned char per_commitment_secret_arr[32];
22527 CHECK(*((uint32_t*)per_commitment_secret) == 32);
22528 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
22529 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
22530 unsigned char countersignatory_revocation_base_secret_arr[32];
22531 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
22532 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
22533 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
22534 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
22535 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
22536 return (uint64_t)ret_conv;
22539 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
22540 LDKPublicKey per_commitment_point_ref;
22541 CHECK(*((uint32_t*)per_commitment_point) == 33);
22542 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
22543 LDKPublicKey countersignatory_revocation_base_point_ref;
22544 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
22545 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
22546 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22547 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
22548 return (uint64_t)ret_conv;
22551 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
22552 LDKTxCreationKeys this_obj_conv;
22553 this_obj_conv.inner = (void*)(this_obj & (~1));
22554 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22555 TxCreationKeys_free(this_obj_conv);
22558 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
22559 LDKTxCreationKeys this_ptr_conv;
22560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22561 this_ptr_conv.is_owned = false;
22562 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22563 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
22567 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
22568 LDKTxCreationKeys this_ptr_conv;
22569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22570 this_ptr_conv.is_owned = false;
22571 LDKPublicKey val_ref;
22572 CHECK(*((uint32_t*)val) == 33);
22573 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22574 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
22577 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
22578 LDKTxCreationKeys this_ptr_conv;
22579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22580 this_ptr_conv.is_owned = false;
22581 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22582 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
22586 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
22587 LDKTxCreationKeys this_ptr_conv;
22588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22589 this_ptr_conv.is_owned = false;
22590 LDKPublicKey val_ref;
22591 CHECK(*((uint32_t*)val) == 33);
22592 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22593 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
22596 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
22597 LDKTxCreationKeys this_ptr_conv;
22598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22599 this_ptr_conv.is_owned = false;
22600 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22601 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
22605 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
22606 LDKTxCreationKeys this_ptr_conv;
22607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22608 this_ptr_conv.is_owned = false;
22609 LDKPublicKey val_ref;
22610 CHECK(*((uint32_t*)val) == 33);
22611 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22612 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
22615 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
22616 LDKTxCreationKeys this_ptr_conv;
22617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22618 this_ptr_conv.is_owned = false;
22619 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22620 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
22624 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
22625 LDKTxCreationKeys this_ptr_conv;
22626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22627 this_ptr_conv.is_owned = false;
22628 LDKPublicKey val_ref;
22629 CHECK(*((uint32_t*)val) == 33);
22630 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22631 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
22634 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
22635 LDKTxCreationKeys this_ptr_conv;
22636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22637 this_ptr_conv.is_owned = false;
22638 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22639 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
22643 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
22644 LDKTxCreationKeys this_ptr_conv;
22645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22646 this_ptr_conv.is_owned = false;
22647 LDKPublicKey val_ref;
22648 CHECK(*((uint32_t*)val) == 33);
22649 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22650 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
22653 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) {
22654 LDKPublicKey per_commitment_point_arg_ref;
22655 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
22656 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
22657 LDKPublicKey revocation_key_arg_ref;
22658 CHECK(*((uint32_t*)revocation_key_arg) == 33);
22659 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
22660 LDKPublicKey broadcaster_htlc_key_arg_ref;
22661 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
22662 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
22663 LDKPublicKey countersignatory_htlc_key_arg_ref;
22664 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
22665 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
22666 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
22667 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
22668 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
22669 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);
22670 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22671 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22672 uint64_t ret_ref = (uint64_t)ret_var.inner;
22673 if (ret_var.is_owned) {
22679 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
22680 LDKTxCreationKeys orig_conv;
22681 orig_conv.inner = (void*)(orig & (~1));
22682 orig_conv.is_owned = false;
22683 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
22684 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22685 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22686 uint64_t ret_ref = (uint64_t)ret_var.inner;
22687 if (ret_var.is_owned) {
22693 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
22694 LDKTxCreationKeys obj_conv;
22695 obj_conv.inner = (void*)(obj & (~1));
22696 obj_conv.is_owned = false;
22697 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
22698 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22699 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22700 CVec_u8Z_free(ret_var);
22704 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
22705 LDKu8slice ser_ref;
22706 ser_ref.datalen = *((uint32_t*)ser);
22707 ser_ref.data = (int8_t*)(ser + 4);
22708 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
22709 *ret_conv = TxCreationKeys_read(ser_ref);
22710 return (uint64_t)ret_conv;
22713 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
22714 LDKChannelPublicKeys this_obj_conv;
22715 this_obj_conv.inner = (void*)(this_obj & (~1));
22716 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22717 ChannelPublicKeys_free(this_obj_conv);
22720 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
22721 LDKChannelPublicKeys this_ptr_conv;
22722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22723 this_ptr_conv.is_owned = false;
22724 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22725 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
22729 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
22730 LDKChannelPublicKeys this_ptr_conv;
22731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22732 this_ptr_conv.is_owned = false;
22733 LDKPublicKey val_ref;
22734 CHECK(*((uint32_t*)val) == 33);
22735 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22736 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
22739 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
22740 LDKChannelPublicKeys this_ptr_conv;
22741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22742 this_ptr_conv.is_owned = false;
22743 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22744 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
22748 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
22749 LDKChannelPublicKeys this_ptr_conv;
22750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22751 this_ptr_conv.is_owned = false;
22752 LDKPublicKey val_ref;
22753 CHECK(*((uint32_t*)val) == 33);
22754 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22755 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
22758 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
22759 LDKChannelPublicKeys this_ptr_conv;
22760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22761 this_ptr_conv.is_owned = false;
22762 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22763 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
22767 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
22768 LDKChannelPublicKeys this_ptr_conv;
22769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22770 this_ptr_conv.is_owned = false;
22771 LDKPublicKey val_ref;
22772 CHECK(*((uint32_t*)val) == 33);
22773 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22774 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
22777 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
22778 LDKChannelPublicKeys this_ptr_conv;
22779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22780 this_ptr_conv.is_owned = false;
22781 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22782 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
22786 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
22787 LDKChannelPublicKeys this_ptr_conv;
22788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22789 this_ptr_conv.is_owned = false;
22790 LDKPublicKey val_ref;
22791 CHECK(*((uint32_t*)val) == 33);
22792 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22793 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
22796 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
22797 LDKChannelPublicKeys this_ptr_conv;
22798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22799 this_ptr_conv.is_owned = false;
22800 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22801 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
22805 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
22806 LDKChannelPublicKeys this_ptr_conv;
22807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22808 this_ptr_conv.is_owned = false;
22809 LDKPublicKey val_ref;
22810 CHECK(*((uint32_t*)val) == 33);
22811 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22812 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
22815 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) {
22816 LDKPublicKey funding_pubkey_arg_ref;
22817 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
22818 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
22819 LDKPublicKey revocation_basepoint_arg_ref;
22820 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
22821 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
22822 LDKPublicKey payment_point_arg_ref;
22823 CHECK(*((uint32_t*)payment_point_arg) == 33);
22824 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
22825 LDKPublicKey delayed_payment_basepoint_arg_ref;
22826 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
22827 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
22828 LDKPublicKey htlc_basepoint_arg_ref;
22829 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
22830 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
22831 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);
22832 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22833 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22834 uint64_t ret_ref = (uint64_t)ret_var.inner;
22835 if (ret_var.is_owned) {
22841 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
22842 LDKChannelPublicKeys orig_conv;
22843 orig_conv.inner = (void*)(orig & (~1));
22844 orig_conv.is_owned = false;
22845 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
22846 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22847 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22848 uint64_t ret_ref = (uint64_t)ret_var.inner;
22849 if (ret_var.is_owned) {
22855 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
22856 LDKChannelPublicKeys obj_conv;
22857 obj_conv.inner = (void*)(obj & (~1));
22858 obj_conv.is_owned = false;
22859 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
22860 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22861 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22862 CVec_u8Z_free(ret_var);
22866 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
22867 LDKu8slice ser_ref;
22868 ser_ref.datalen = *((uint32_t*)ser);
22869 ser_ref.data = (int8_t*)(ser + 4);
22870 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
22871 *ret_conv = ChannelPublicKeys_read(ser_ref);
22872 return (uint64_t)ret_conv;
22875 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) {
22876 LDKPublicKey per_commitment_point_ref;
22877 CHECK(*((uint32_t*)per_commitment_point) == 33);
22878 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
22879 LDKPublicKey broadcaster_delayed_payment_base_ref;
22880 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
22881 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
22882 LDKPublicKey broadcaster_htlc_base_ref;
22883 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
22884 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
22885 LDKPublicKey countersignatory_revocation_base_ref;
22886 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
22887 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
22888 LDKPublicKey countersignatory_htlc_base_ref;
22889 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
22890 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
22891 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
22892 *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);
22893 return (uint64_t)ret_conv;
22896 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
22897 LDKPublicKey per_commitment_point_ref;
22898 CHECK(*((uint32_t*)per_commitment_point) == 33);
22899 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
22900 LDKChannelPublicKeys broadcaster_keys_conv;
22901 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
22902 broadcaster_keys_conv.is_owned = false;
22903 LDKChannelPublicKeys countersignatory_keys_conv;
22904 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
22905 countersignatory_keys_conv.is_owned = false;
22906 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
22907 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
22908 return (uint64_t)ret_conv;
22911 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
22912 LDKPublicKey revocation_key_ref;
22913 CHECK(*((uint32_t*)revocation_key) == 33);
22914 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
22915 LDKPublicKey broadcaster_delayed_payment_key_ref;
22916 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
22917 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
22918 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
22919 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22920 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22921 CVec_u8Z_free(ret_var);
22925 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
22926 LDKHTLCOutputInCommitment this_obj_conv;
22927 this_obj_conv.inner = (void*)(this_obj & (~1));
22928 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22929 HTLCOutputInCommitment_free(this_obj_conv);
22932 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
22933 LDKHTLCOutputInCommitment this_ptr_conv;
22934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22935 this_ptr_conv.is_owned = false;
22936 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
22940 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
22941 LDKHTLCOutputInCommitment this_ptr_conv;
22942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22943 this_ptr_conv.is_owned = false;
22944 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
22947 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
22948 LDKHTLCOutputInCommitment this_ptr_conv;
22949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22950 this_ptr_conv.is_owned = false;
22951 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
22955 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
22956 LDKHTLCOutputInCommitment this_ptr_conv;
22957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22958 this_ptr_conv.is_owned = false;
22959 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
22962 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
22963 LDKHTLCOutputInCommitment this_ptr_conv;
22964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22965 this_ptr_conv.is_owned = false;
22966 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
22970 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
22971 LDKHTLCOutputInCommitment this_ptr_conv;
22972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22973 this_ptr_conv.is_owned = false;
22974 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
22977 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
22978 LDKHTLCOutputInCommitment this_ptr_conv;
22979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22980 this_ptr_conv.is_owned = false;
22981 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22982 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
22986 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
22987 LDKHTLCOutputInCommitment this_ptr_conv;
22988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22989 this_ptr_conv.is_owned = false;
22990 LDKThirtyTwoBytes val_ref;
22991 CHECK(*((uint32_t*)val) == 32);
22992 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22993 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
22996 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
22997 LDKHTLCOutputInCommitment this_ptr_conv;
22998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22999 this_ptr_conv.is_owned = false;
23000 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
23001 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
23002 uint64_t ret_ref = (uint64_t)ret_copy;
23006 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
23007 LDKHTLCOutputInCommitment this_ptr_conv;
23008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23009 this_ptr_conv.is_owned = false;
23010 void* val_ptr = (void*)(((uint64_t)val) & ~1);
23011 CHECK_ACCESS(val_ptr);
23012 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
23013 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
23014 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
23017 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) {
23018 LDKThirtyTwoBytes payment_hash_arg_ref;
23019 CHECK(*((uint32_t*)payment_hash_arg) == 32);
23020 memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
23021 void* transaction_output_index_arg_ptr = (void*)(((uint64_t)transaction_output_index_arg) & ~1);
23022 CHECK_ACCESS(transaction_output_index_arg_ptr);
23023 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
23024 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
23025 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
23026 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23027 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23028 uint64_t ret_ref = (uint64_t)ret_var.inner;
23029 if (ret_var.is_owned) {
23035 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
23036 LDKHTLCOutputInCommitment orig_conv;
23037 orig_conv.inner = (void*)(orig & (~1));
23038 orig_conv.is_owned = false;
23039 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
23040 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23041 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23042 uint64_t ret_ref = (uint64_t)ret_var.inner;
23043 if (ret_var.is_owned) {
23049 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
23050 LDKHTLCOutputInCommitment obj_conv;
23051 obj_conv.inner = (void*)(obj & (~1));
23052 obj_conv.is_owned = false;
23053 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
23054 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23055 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23056 CVec_u8Z_free(ret_var);
23060 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
23061 LDKu8slice ser_ref;
23062 ser_ref.datalen = *((uint32_t*)ser);
23063 ser_ref.data = (int8_t*)(ser + 4);
23064 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
23065 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
23066 return (uint64_t)ret_conv;
23069 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
23070 LDKHTLCOutputInCommitment htlc_conv;
23071 htlc_conv.inner = (void*)(htlc & (~1));
23072 htlc_conv.is_owned = false;
23073 LDKTxCreationKeys keys_conv;
23074 keys_conv.inner = (void*)(keys & (~1));
23075 keys_conv.is_owned = false;
23076 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
23077 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23078 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23079 CVec_u8Z_free(ret_var);
23083 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
23084 LDKPublicKey broadcaster_ref;
23085 CHECK(*((uint32_t*)broadcaster) == 33);
23086 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
23087 LDKPublicKey countersignatory_ref;
23088 CHECK(*((uint32_t*)countersignatory) == 33);
23089 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
23090 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
23091 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23092 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23093 CVec_u8Z_free(ret_var);
23097 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) {
23098 unsigned char commitment_txid_arr[32];
23099 CHECK(*((uint32_t*)commitment_txid) == 32);
23100 memcpy(commitment_txid_arr, (uint8_t*)(commitment_txid + 4), 32);
23101 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
23102 LDKHTLCOutputInCommitment htlc_conv;
23103 htlc_conv.inner = (void*)(htlc & (~1));
23104 htlc_conv.is_owned = false;
23105 LDKPublicKey broadcaster_delayed_payment_key_ref;
23106 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
23107 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
23108 LDKPublicKey revocation_key_ref;
23109 CHECK(*((uint32_t*)revocation_key) == 33);
23110 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
23111 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
23112 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23113 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23114 Transaction_free(ret_var);
23118 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
23119 LDKChannelTransactionParameters this_obj_conv;
23120 this_obj_conv.inner = (void*)(this_obj & (~1));
23121 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23122 ChannelTransactionParameters_free(this_obj_conv);
23125 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
23126 LDKChannelTransactionParameters this_ptr_conv;
23127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23128 this_ptr_conv.is_owned = false;
23129 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
23130 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23131 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23132 uint64_t ret_ref = (uint64_t)ret_var.inner;
23133 if (ret_var.is_owned) {
23139 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
23140 LDKChannelTransactionParameters this_ptr_conv;
23141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23142 this_ptr_conv.is_owned = false;
23143 LDKChannelPublicKeys val_conv;
23144 val_conv.inner = (void*)(val & (~1));
23145 val_conv.is_owned = (val & 1) || (val == 0);
23146 val_conv = ChannelPublicKeys_clone(&val_conv);
23147 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
23150 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
23151 LDKChannelTransactionParameters this_ptr_conv;
23152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23153 this_ptr_conv.is_owned = false;
23154 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
23158 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
23159 LDKChannelTransactionParameters this_ptr_conv;
23160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23161 this_ptr_conv.is_owned = false;
23162 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
23165 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
23166 LDKChannelTransactionParameters this_ptr_conv;
23167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23168 this_ptr_conv.is_owned = false;
23169 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
23173 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
23174 LDKChannelTransactionParameters this_ptr_conv;
23175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23176 this_ptr_conv.is_owned = false;
23177 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
23180 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
23181 LDKChannelTransactionParameters this_ptr_conv;
23182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23183 this_ptr_conv.is_owned = false;
23184 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
23185 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23186 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23187 uint64_t ret_ref = (uint64_t)ret_var.inner;
23188 if (ret_var.is_owned) {
23194 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
23195 LDKChannelTransactionParameters this_ptr_conv;
23196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23197 this_ptr_conv.is_owned = false;
23198 LDKCounterpartyChannelTransactionParameters val_conv;
23199 val_conv.inner = (void*)(val & (~1));
23200 val_conv.is_owned = (val & 1) || (val == 0);
23201 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
23202 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
23205 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
23206 LDKChannelTransactionParameters this_ptr_conv;
23207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23208 this_ptr_conv.is_owned = false;
23209 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
23210 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23211 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23212 uint64_t ret_ref = (uint64_t)ret_var.inner;
23213 if (ret_var.is_owned) {
23219 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
23220 LDKChannelTransactionParameters this_ptr_conv;
23221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23222 this_ptr_conv.is_owned = false;
23223 LDKOutPoint val_conv;
23224 val_conv.inner = (void*)(val & (~1));
23225 val_conv.is_owned = (val & 1) || (val == 0);
23226 val_conv = OutPoint_clone(&val_conv);
23227 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
23230 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) {
23231 LDKChannelPublicKeys holder_pubkeys_arg_conv;
23232 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
23233 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
23234 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
23235 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
23236 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
23237 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
23238 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
23239 LDKOutPoint funding_outpoint_arg_conv;
23240 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
23241 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
23242 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
23243 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);
23244 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23245 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23246 uint64_t ret_ref = (uint64_t)ret_var.inner;
23247 if (ret_var.is_owned) {
23253 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
23254 LDKChannelTransactionParameters orig_conv;
23255 orig_conv.inner = (void*)(orig & (~1));
23256 orig_conv.is_owned = false;
23257 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
23258 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23259 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23260 uint64_t ret_ref = (uint64_t)ret_var.inner;
23261 if (ret_var.is_owned) {
23267 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
23268 LDKCounterpartyChannelTransactionParameters this_obj_conv;
23269 this_obj_conv.inner = (void*)(this_obj & (~1));
23270 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23271 CounterpartyChannelTransactionParameters_free(this_obj_conv);
23274 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
23275 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
23276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23277 this_ptr_conv.is_owned = false;
23278 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
23279 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23280 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23281 uint64_t ret_ref = (uint64_t)ret_var.inner;
23282 if (ret_var.is_owned) {
23288 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
23289 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
23290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23291 this_ptr_conv.is_owned = false;
23292 LDKChannelPublicKeys val_conv;
23293 val_conv.inner = (void*)(val & (~1));
23294 val_conv.is_owned = (val & 1) || (val == 0);
23295 val_conv = ChannelPublicKeys_clone(&val_conv);
23296 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
23299 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
23300 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
23301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23302 this_ptr_conv.is_owned = false;
23303 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
23307 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
23308 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
23309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23310 this_ptr_conv.is_owned = false;
23311 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
23314 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
23315 LDKChannelPublicKeys pubkeys_arg_conv;
23316 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
23317 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
23318 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
23319 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
23320 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23321 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23322 uint64_t ret_ref = (uint64_t)ret_var.inner;
23323 if (ret_var.is_owned) {
23329 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
23330 LDKCounterpartyChannelTransactionParameters orig_conv;
23331 orig_conv.inner = (void*)(orig & (~1));
23332 orig_conv.is_owned = false;
23333 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
23334 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23335 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23336 uint64_t ret_ref = (uint64_t)ret_var.inner;
23337 if (ret_var.is_owned) {
23343 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
23344 LDKChannelTransactionParameters this_arg_conv;
23345 this_arg_conv.inner = (void*)(this_arg & (~1));
23346 this_arg_conv.is_owned = false;
23347 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
23351 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
23352 LDKChannelTransactionParameters this_arg_conv;
23353 this_arg_conv.inner = (void*)(this_arg & (~1));
23354 this_arg_conv.is_owned = false;
23355 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
23356 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23357 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23358 uint64_t ret_ref = (uint64_t)ret_var.inner;
23359 if (ret_var.is_owned) {
23365 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
23366 LDKChannelTransactionParameters this_arg_conv;
23367 this_arg_conv.inner = (void*)(this_arg & (~1));
23368 this_arg_conv.is_owned = false;
23369 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
23370 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23371 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23372 uint64_t ret_ref = (uint64_t)ret_var.inner;
23373 if (ret_var.is_owned) {
23379 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
23380 LDKCounterpartyChannelTransactionParameters obj_conv;
23381 obj_conv.inner = (void*)(obj & (~1));
23382 obj_conv.is_owned = false;
23383 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
23384 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23385 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23386 CVec_u8Z_free(ret_var);
23390 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
23391 LDKu8slice ser_ref;
23392 ser_ref.datalen = *((uint32_t*)ser);
23393 ser_ref.data = (int8_t*)(ser + 4);
23394 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
23395 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
23396 return (uint64_t)ret_conv;
23399 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
23400 LDKChannelTransactionParameters obj_conv;
23401 obj_conv.inner = (void*)(obj & (~1));
23402 obj_conv.is_owned = false;
23403 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
23404 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23405 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23406 CVec_u8Z_free(ret_var);
23410 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
23411 LDKu8slice ser_ref;
23412 ser_ref.datalen = *((uint32_t*)ser);
23413 ser_ref.data = (int8_t*)(ser + 4);
23414 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
23415 *ret_conv = ChannelTransactionParameters_read(ser_ref);
23416 return (uint64_t)ret_conv;
23419 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
23420 LDKDirectedChannelTransactionParameters this_obj_conv;
23421 this_obj_conv.inner = (void*)(this_obj & (~1));
23422 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23423 DirectedChannelTransactionParameters_free(this_obj_conv);
23426 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
23427 LDKDirectedChannelTransactionParameters this_arg_conv;
23428 this_arg_conv.inner = (void*)(this_arg & (~1));
23429 this_arg_conv.is_owned = false;
23430 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
23431 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23432 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23433 uint64_t ret_ref = (uint64_t)ret_var.inner;
23434 if (ret_var.is_owned) {
23440 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
23441 LDKDirectedChannelTransactionParameters this_arg_conv;
23442 this_arg_conv.inner = (void*)(this_arg & (~1));
23443 this_arg_conv.is_owned = false;
23444 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
23445 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23446 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23447 uint64_t ret_ref = (uint64_t)ret_var.inner;
23448 if (ret_var.is_owned) {
23454 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
23455 LDKDirectedChannelTransactionParameters this_arg_conv;
23456 this_arg_conv.inner = (void*)(this_arg & (~1));
23457 this_arg_conv.is_owned = false;
23458 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
23462 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
23463 LDKDirectedChannelTransactionParameters this_arg_conv;
23464 this_arg_conv.inner = (void*)(this_arg & (~1));
23465 this_arg_conv.is_owned = false;
23466 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
23470 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
23471 LDKDirectedChannelTransactionParameters this_arg_conv;
23472 this_arg_conv.inner = (void*)(this_arg & (~1));
23473 this_arg_conv.is_owned = false;
23474 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
23475 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23476 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23477 uint64_t ret_ref = (uint64_t)ret_var.inner;
23478 if (ret_var.is_owned) {
23484 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
23485 LDKHolderCommitmentTransaction this_obj_conv;
23486 this_obj_conv.inner = (void*)(this_obj & (~1));
23487 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23488 HolderCommitmentTransaction_free(this_obj_conv);
23491 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
23492 LDKHolderCommitmentTransaction this_ptr_conv;
23493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23494 this_ptr_conv.is_owned = false;
23495 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
23496 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
23500 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
23501 LDKHolderCommitmentTransaction this_ptr_conv;
23502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23503 this_ptr_conv.is_owned = false;
23504 LDKSignature val_ref;
23505 CHECK(*((uint32_t*)val) == 64);
23506 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
23507 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
23510 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
23511 LDKHolderCommitmentTransaction this_ptr_conv;
23512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23513 this_ptr_conv.is_owned = false;
23514 LDKCVec_SignatureZ val_constr;
23515 val_constr.datalen = *((uint32_t*)val);
23516 if (val_constr.datalen > 0)
23517 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
23519 val_constr.data = NULL;
23520 int8_tArray* val_vals = (int8_tArray*)(val + 4);
23521 for (size_t m = 0; m < val_constr.datalen; m++) {
23522 int8_tArray val_conv_12 = val_vals[m];
23523 LDKSignature val_conv_12_ref;
23524 CHECK(*((uint32_t*)val_conv_12) == 64);
23525 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
23526 val_constr.data[m] = val_conv_12_ref;
23528 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
23531 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
23532 LDKHolderCommitmentTransaction orig_conv;
23533 orig_conv.inner = (void*)(orig & (~1));
23534 orig_conv.is_owned = false;
23535 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
23536 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23537 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23538 uint64_t ret_ref = (uint64_t)ret_var.inner;
23539 if (ret_var.is_owned) {
23545 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
23546 LDKHolderCommitmentTransaction obj_conv;
23547 obj_conv.inner = (void*)(obj & (~1));
23548 obj_conv.is_owned = false;
23549 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
23550 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23551 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23552 CVec_u8Z_free(ret_var);
23556 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
23557 LDKu8slice ser_ref;
23558 ser_ref.datalen = *((uint32_t*)ser);
23559 ser_ref.data = (int8_t*)(ser + 4);
23560 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
23561 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
23562 return (uint64_t)ret_conv;
23565 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) {
23566 LDKCommitmentTransaction commitment_tx_conv;
23567 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
23568 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
23569 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
23570 LDKSignature counterparty_sig_ref;
23571 CHECK(*((uint32_t*)counterparty_sig) == 64);
23572 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
23573 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
23574 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
23575 if (counterparty_htlc_sigs_constr.datalen > 0)
23576 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
23578 counterparty_htlc_sigs_constr.data = NULL;
23579 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
23580 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
23581 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
23582 LDKSignature counterparty_htlc_sigs_conv_12_ref;
23583 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
23584 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
23585 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
23587 LDKPublicKey holder_funding_key_ref;
23588 CHECK(*((uint32_t*)holder_funding_key) == 33);
23589 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
23590 LDKPublicKey counterparty_funding_key_ref;
23591 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
23592 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
23593 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
23594 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23595 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23596 uint64_t ret_ref = (uint64_t)ret_var.inner;
23597 if (ret_var.is_owned) {
23603 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
23604 LDKBuiltCommitmentTransaction this_obj_conv;
23605 this_obj_conv.inner = (void*)(this_obj & (~1));
23606 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23607 BuiltCommitmentTransaction_free(this_obj_conv);
23610 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
23611 LDKBuiltCommitmentTransaction this_ptr_conv;
23612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23613 this_ptr_conv.is_owned = false;
23614 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
23615 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23616 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23617 Transaction_free(ret_var);
23621 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
23622 LDKBuiltCommitmentTransaction this_ptr_conv;
23623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23624 this_ptr_conv.is_owned = false;
23625 LDKTransaction val_ref;
23626 val_ref.datalen = *((uint32_t*)val);
23627 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
23628 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
23629 val_ref.data_is_owned = true;
23630 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
23633 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
23634 LDKBuiltCommitmentTransaction this_ptr_conv;
23635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23636 this_ptr_conv.is_owned = false;
23637 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23638 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
23642 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
23643 LDKBuiltCommitmentTransaction this_ptr_conv;
23644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23645 this_ptr_conv.is_owned = false;
23646 LDKThirtyTwoBytes val_ref;
23647 CHECK(*((uint32_t*)val) == 32);
23648 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23649 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
23652 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
23653 LDKTransaction transaction_arg_ref;
23654 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
23655 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
23656 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
23657 transaction_arg_ref.data_is_owned = true;
23658 LDKThirtyTwoBytes txid_arg_ref;
23659 CHECK(*((uint32_t*)txid_arg) == 32);
23660 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
23661 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
23662 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23663 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23664 uint64_t ret_ref = (uint64_t)ret_var.inner;
23665 if (ret_var.is_owned) {
23671 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
23672 LDKBuiltCommitmentTransaction orig_conv;
23673 orig_conv.inner = (void*)(orig & (~1));
23674 orig_conv.is_owned = false;
23675 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
23676 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23677 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23678 uint64_t ret_ref = (uint64_t)ret_var.inner;
23679 if (ret_var.is_owned) {
23685 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
23686 LDKBuiltCommitmentTransaction obj_conv;
23687 obj_conv.inner = (void*)(obj & (~1));
23688 obj_conv.is_owned = false;
23689 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
23690 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23691 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23692 CVec_u8Z_free(ret_var);
23696 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
23697 LDKu8slice ser_ref;
23698 ser_ref.datalen = *((uint32_t*)ser);
23699 ser_ref.data = (int8_t*)(ser + 4);
23700 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
23701 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
23702 return (uint64_t)ret_conv;
23705 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
23706 LDKBuiltCommitmentTransaction this_arg_conv;
23707 this_arg_conv.inner = (void*)(this_arg & (~1));
23708 this_arg_conv.is_owned = false;
23709 LDKu8slice funding_redeemscript_ref;
23710 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
23711 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
23712 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23713 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
23717 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) {
23718 LDKBuiltCommitmentTransaction this_arg_conv;
23719 this_arg_conv.inner = (void*)(this_arg & (~1));
23720 this_arg_conv.is_owned = false;
23721 unsigned char funding_key_arr[32];
23722 CHECK(*((uint32_t*)funding_key) == 32);
23723 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
23724 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
23725 LDKu8slice funding_redeemscript_ref;
23726 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
23727 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
23728 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
23729 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
23733 void __attribute__((visibility("default"))) TS_ClosingTransaction_free(uint32_t this_obj) {
23734 LDKClosingTransaction this_obj_conv;
23735 this_obj_conv.inner = (void*)(this_obj & (~1));
23736 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23737 ClosingTransaction_free(this_obj_conv);
23740 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_clone(uint32_t orig) {
23741 LDKClosingTransaction orig_conv;
23742 orig_conv.inner = (void*)(orig & (~1));
23743 orig_conv.is_owned = false;
23744 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
23745 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23746 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23747 uint64_t ret_ref = (uint64_t)ret_var.inner;
23748 if (ret_var.is_owned) {
23754 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_hash(uint32_t o) {
23755 LDKClosingTransaction o_conv;
23756 o_conv.inner = (void*)(o & (~1));
23757 o_conv.is_owned = false;
23758 int64_t ret_val = ClosingTransaction_hash(&o_conv);
23762 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) {
23763 LDKCVec_u8Z to_holder_script_ref;
23764 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
23765 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
23766 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
23767 LDKCVec_u8Z to_counterparty_script_ref;
23768 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
23769 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
23770 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
23771 LDKOutPoint funding_outpoint_conv;
23772 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
23773 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
23774 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
23775 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
23776 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23777 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23778 uint64_t ret_ref = (uint64_t)ret_var.inner;
23779 if (ret_var.is_owned) {
23785 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
23786 LDKClosingTransaction this_arg_conv;
23787 this_arg_conv.inner = (void*)(this_arg & (~1));
23788 this_arg_conv.is_owned = false;
23789 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
23790 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23791 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23792 uint64_t ret_ref = (uint64_t)ret_var.inner;
23793 if (ret_var.is_owned) {
23799 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
23800 LDKClosingTransaction this_arg_conv;
23801 this_arg_conv.inner = (void*)(this_arg & (~1));
23802 this_arg_conv.is_owned = false;
23803 LDKOutPoint funding_outpoint_conv;
23804 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
23805 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
23806 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
23807 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
23808 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
23809 return (uint64_t)ret_conv;
23812 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
23813 LDKClosingTransaction this_arg_conv;
23814 this_arg_conv.inner = (void*)(this_arg & (~1));
23815 this_arg_conv.is_owned = false;
23816 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
23820 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
23821 LDKClosingTransaction this_arg_conv;
23822 this_arg_conv.inner = (void*)(this_arg & (~1));
23823 this_arg_conv.is_owned = false;
23824 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
23828 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
23829 LDKClosingTransaction this_arg_conv;
23830 this_arg_conv.inner = (void*)(this_arg & (~1));
23831 this_arg_conv.is_owned = false;
23832 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
23833 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23834 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23838 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
23839 LDKClosingTransaction this_arg_conv;
23840 this_arg_conv.inner = (void*)(this_arg & (~1));
23841 this_arg_conv.is_owned = false;
23842 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
23843 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23844 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23848 void __attribute__((visibility("default"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
23849 LDKTrustedClosingTransaction this_obj_conv;
23850 this_obj_conv.inner = (void*)(this_obj & (~1));
23851 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23852 TrustedClosingTransaction_free(this_obj_conv);
23855 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
23856 LDKTrustedClosingTransaction this_arg_conv;
23857 this_arg_conv.inner = (void*)(this_arg & (~1));
23858 this_arg_conv.is_owned = false;
23859 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
23860 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23861 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23862 Transaction_free(ret_var);
23866 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
23867 LDKTrustedClosingTransaction this_arg_conv;
23868 this_arg_conv.inner = (void*)(this_arg & (~1));
23869 this_arg_conv.is_owned = false;
23870 LDKu8slice funding_redeemscript_ref;
23871 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
23872 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
23873 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23874 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
23878 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) {
23879 LDKTrustedClosingTransaction this_arg_conv;
23880 this_arg_conv.inner = (void*)(this_arg & (~1));
23881 this_arg_conv.is_owned = false;
23882 unsigned char funding_key_arr[32];
23883 CHECK(*((uint32_t*)funding_key) == 32);
23884 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
23885 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
23886 LDKu8slice funding_redeemscript_ref;
23887 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
23888 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
23889 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
23890 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
23894 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
23895 LDKCommitmentTransaction this_obj_conv;
23896 this_obj_conv.inner = (void*)(this_obj & (~1));
23897 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23898 CommitmentTransaction_free(this_obj_conv);
23901 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
23902 LDKCommitmentTransaction orig_conv;
23903 orig_conv.inner = (void*)(orig & (~1));
23904 orig_conv.is_owned = false;
23905 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
23906 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23907 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23908 uint64_t ret_ref = (uint64_t)ret_var.inner;
23909 if (ret_var.is_owned) {
23915 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
23916 LDKCommitmentTransaction obj_conv;
23917 obj_conv.inner = (void*)(obj & (~1));
23918 obj_conv.is_owned = false;
23919 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
23920 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23921 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23922 CVec_u8Z_free(ret_var);
23926 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
23927 LDKu8slice ser_ref;
23928 ser_ref.datalen = *((uint32_t*)ser);
23929 ser_ref.data = (int8_t*)(ser + 4);
23930 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
23931 *ret_conv = CommitmentTransaction_read(ser_ref);
23932 return (uint64_t)ret_conv;
23935 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
23936 LDKCommitmentTransaction this_arg_conv;
23937 this_arg_conv.inner = (void*)(this_arg & (~1));
23938 this_arg_conv.is_owned = false;
23939 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
23943 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
23944 LDKCommitmentTransaction this_arg_conv;
23945 this_arg_conv.inner = (void*)(this_arg & (~1));
23946 this_arg_conv.is_owned = false;
23947 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
23951 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
23952 LDKCommitmentTransaction this_arg_conv;
23953 this_arg_conv.inner = (void*)(this_arg & (~1));
23954 this_arg_conv.is_owned = false;
23955 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
23959 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
23960 LDKCommitmentTransaction this_arg_conv;
23961 this_arg_conv.inner = (void*)(this_arg & (~1));
23962 this_arg_conv.is_owned = false;
23963 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
23967 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
23968 LDKCommitmentTransaction this_arg_conv;
23969 this_arg_conv.inner = (void*)(this_arg & (~1));
23970 this_arg_conv.is_owned = false;
23971 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
23972 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23973 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23974 uint64_t ret_ref = (uint64_t)ret_var.inner;
23975 if (ret_var.is_owned) {
23981 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
23982 LDKCommitmentTransaction this_arg_conv;
23983 this_arg_conv.inner = (void*)(this_arg & (~1));
23984 this_arg_conv.is_owned = false;
23985 LDKDirectedChannelTransactionParameters channel_parameters_conv;
23986 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
23987 channel_parameters_conv.is_owned = false;
23988 LDKChannelPublicKeys broadcaster_keys_conv;
23989 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
23990 broadcaster_keys_conv.is_owned = false;
23991 LDKChannelPublicKeys countersignatory_keys_conv;
23992 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
23993 countersignatory_keys_conv.is_owned = false;
23994 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
23995 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
23996 return (uint64_t)ret_conv;
23999 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
24000 LDKTrustedCommitmentTransaction this_obj_conv;
24001 this_obj_conv.inner = (void*)(this_obj & (~1));
24002 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24003 TrustedCommitmentTransaction_free(this_obj_conv);
24006 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
24007 LDKTrustedCommitmentTransaction this_arg_conv;
24008 this_arg_conv.inner = (void*)(this_arg & (~1));
24009 this_arg_conv.is_owned = false;
24010 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24011 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
24015 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
24016 LDKTrustedCommitmentTransaction this_arg_conv;
24017 this_arg_conv.inner = (void*)(this_arg & (~1));
24018 this_arg_conv.is_owned = false;
24019 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
24020 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24021 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24022 uint64_t ret_ref = (uint64_t)ret_var.inner;
24023 if (ret_var.is_owned) {
24029 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
24030 LDKTrustedCommitmentTransaction this_arg_conv;
24031 this_arg_conv.inner = (void*)(this_arg & (~1));
24032 this_arg_conv.is_owned = false;
24033 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
24034 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24035 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24036 uint64_t ret_ref = (uint64_t)ret_var.inner;
24037 if (ret_var.is_owned) {
24043 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
24044 LDKTrustedCommitmentTransaction this_arg_conv;
24045 this_arg_conv.inner = (void*)(this_arg & (~1));
24046 this_arg_conv.is_owned = false;
24047 unsigned char htlc_base_key_arr[32];
24048 CHECK(*((uint32_t*)htlc_base_key) == 32);
24049 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
24050 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
24051 LDKDirectedChannelTransactionParameters channel_parameters_conv;
24052 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
24053 channel_parameters_conv.is_owned = false;
24054 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
24055 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
24056 return (uint64_t)ret_conv;
24059 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) {
24060 LDKPublicKey broadcaster_payment_basepoint_ref;
24061 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
24062 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
24063 LDKPublicKey countersignatory_payment_basepoint_ref;
24064 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
24065 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
24066 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
24070 jboolean __attribute__((visibility("default"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
24071 LDKInitFeatures a_conv;
24072 a_conv.inner = (void*)(a & (~1));
24073 a_conv.is_owned = false;
24074 LDKInitFeatures b_conv;
24075 b_conv.inner = (void*)(b & (~1));
24076 b_conv.is_owned = false;
24077 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
24081 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
24082 LDKNodeFeatures a_conv;
24083 a_conv.inner = (void*)(a & (~1));
24084 a_conv.is_owned = false;
24085 LDKNodeFeatures b_conv;
24086 b_conv.inner = (void*)(b & (~1));
24087 b_conv.is_owned = false;
24088 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
24092 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
24093 LDKChannelFeatures a_conv;
24094 a_conv.inner = (void*)(a & (~1));
24095 a_conv.is_owned = false;
24096 LDKChannelFeatures b_conv;
24097 b_conv.inner = (void*)(b & (~1));
24098 b_conv.is_owned = false;
24099 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
24103 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
24104 LDKInvoiceFeatures a_conv;
24105 a_conv.inner = (void*)(a & (~1));
24106 a_conv.is_owned = false;
24107 LDKInvoiceFeatures b_conv;
24108 b_conv.inner = (void*)(b & (~1));
24109 b_conv.is_owned = false;
24110 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
24114 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
24115 LDKInitFeatures orig_conv;
24116 orig_conv.inner = (void*)(orig & (~1));
24117 orig_conv.is_owned = false;
24118 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
24119 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24120 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24121 uint64_t ret_ref = (uint64_t)ret_var.inner;
24122 if (ret_var.is_owned) {
24128 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
24129 LDKNodeFeatures orig_conv;
24130 orig_conv.inner = (void*)(orig & (~1));
24131 orig_conv.is_owned = false;
24132 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
24133 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24134 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24135 uint64_t ret_ref = (uint64_t)ret_var.inner;
24136 if (ret_var.is_owned) {
24142 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
24143 LDKChannelFeatures orig_conv;
24144 orig_conv.inner = (void*)(orig & (~1));
24145 orig_conv.is_owned = false;
24146 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
24147 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24148 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24149 uint64_t ret_ref = (uint64_t)ret_var.inner;
24150 if (ret_var.is_owned) {
24156 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
24157 LDKInvoiceFeatures orig_conv;
24158 orig_conv.inner = (void*)(orig & (~1));
24159 orig_conv.is_owned = false;
24160 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
24161 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24162 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24163 uint64_t ret_ref = (uint64_t)ret_var.inner;
24164 if (ret_var.is_owned) {
24170 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
24171 LDKInitFeatures this_obj_conv;
24172 this_obj_conv.inner = (void*)(this_obj & (~1));
24173 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24174 InitFeatures_free(this_obj_conv);
24177 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
24178 LDKNodeFeatures this_obj_conv;
24179 this_obj_conv.inner = (void*)(this_obj & (~1));
24180 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24181 NodeFeatures_free(this_obj_conv);
24184 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
24185 LDKChannelFeatures this_obj_conv;
24186 this_obj_conv.inner = (void*)(this_obj & (~1));
24187 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24188 ChannelFeatures_free(this_obj_conv);
24191 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
24192 LDKInvoiceFeatures this_obj_conv;
24193 this_obj_conv.inner = (void*)(this_obj & (~1));
24194 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24195 InvoiceFeatures_free(this_obj_conv);
24198 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
24199 LDKInitFeatures ret_var = InitFeatures_empty();
24200 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24201 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24202 uint64_t ret_ref = (uint64_t)ret_var.inner;
24203 if (ret_var.is_owned) {
24209 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
24210 LDKInitFeatures ret_var = InitFeatures_known();
24211 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24212 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24213 uint64_t ret_ref = (uint64_t)ret_var.inner;
24214 if (ret_var.is_owned) {
24220 jboolean __attribute__((visibility("default"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
24221 LDKInitFeatures this_arg_conv;
24222 this_arg_conv.inner = (void*)(this_arg & (~1));
24223 this_arg_conv.is_owned = false;
24224 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
24228 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
24229 LDKNodeFeatures ret_var = NodeFeatures_empty();
24230 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24231 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24232 uint64_t ret_ref = (uint64_t)ret_var.inner;
24233 if (ret_var.is_owned) {
24239 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
24240 LDKNodeFeatures ret_var = NodeFeatures_known();
24241 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24242 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24243 uint64_t ret_ref = (uint64_t)ret_var.inner;
24244 if (ret_var.is_owned) {
24250 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
24251 LDKNodeFeatures this_arg_conv;
24252 this_arg_conv.inner = (void*)(this_arg & (~1));
24253 this_arg_conv.is_owned = false;
24254 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
24258 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
24259 LDKChannelFeatures ret_var = ChannelFeatures_empty();
24260 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24261 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24262 uint64_t ret_ref = (uint64_t)ret_var.inner;
24263 if (ret_var.is_owned) {
24269 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
24270 LDKChannelFeatures ret_var = ChannelFeatures_known();
24271 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24272 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24273 uint64_t ret_ref = (uint64_t)ret_var.inner;
24274 if (ret_var.is_owned) {
24280 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
24281 LDKChannelFeatures this_arg_conv;
24282 this_arg_conv.inner = (void*)(this_arg & (~1));
24283 this_arg_conv.is_owned = false;
24284 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
24288 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
24289 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
24290 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24291 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24292 uint64_t ret_ref = (uint64_t)ret_var.inner;
24293 if (ret_var.is_owned) {
24299 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
24300 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
24301 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24302 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24303 uint64_t ret_ref = (uint64_t)ret_var.inner;
24304 if (ret_var.is_owned) {
24310 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
24311 LDKInvoiceFeatures this_arg_conv;
24312 this_arg_conv.inner = (void*)(this_arg & (~1));
24313 this_arg_conv.is_owned = false;
24314 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
24318 jboolean __attribute__((visibility("default"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
24319 LDKInitFeatures this_arg_conv;
24320 this_arg_conv.inner = (void*)(this_arg & (~1));
24321 this_arg_conv.is_owned = false;
24322 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
24326 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) {
24327 LDKNodeFeatures this_arg_conv;
24328 this_arg_conv.inner = (void*)(this_arg & (~1));
24329 this_arg_conv.is_owned = false;
24330 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
24334 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) {
24335 LDKInvoiceFeatures this_arg_conv;
24336 this_arg_conv.inner = (void*)(this_arg & (~1));
24337 this_arg_conv.is_owned = false;
24338 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
24342 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
24343 LDKInitFeatures obj_conv;
24344 obj_conv.inner = (void*)(obj & (~1));
24345 obj_conv.is_owned = false;
24346 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
24347 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24348 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24349 CVec_u8Z_free(ret_var);
24353 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
24354 LDKNodeFeatures obj_conv;
24355 obj_conv.inner = (void*)(obj & (~1));
24356 obj_conv.is_owned = false;
24357 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
24358 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24359 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24360 CVec_u8Z_free(ret_var);
24364 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
24365 LDKChannelFeatures obj_conv;
24366 obj_conv.inner = (void*)(obj & (~1));
24367 obj_conv.is_owned = false;
24368 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
24369 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24370 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24371 CVec_u8Z_free(ret_var);
24375 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
24376 LDKInvoiceFeatures obj_conv;
24377 obj_conv.inner = (void*)(obj & (~1));
24378 obj_conv.is_owned = false;
24379 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
24380 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24381 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24382 CVec_u8Z_free(ret_var);
24386 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
24387 LDKu8slice ser_ref;
24388 ser_ref.datalen = *((uint32_t*)ser);
24389 ser_ref.data = (int8_t*)(ser + 4);
24390 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
24391 *ret_conv = InitFeatures_read(ser_ref);
24392 return (uint64_t)ret_conv;
24395 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
24396 LDKu8slice ser_ref;
24397 ser_ref.datalen = *((uint32_t*)ser);
24398 ser_ref.data = (int8_t*)(ser + 4);
24399 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
24400 *ret_conv = NodeFeatures_read(ser_ref);
24401 return (uint64_t)ret_conv;
24404 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
24405 LDKu8slice ser_ref;
24406 ser_ref.datalen = *((uint32_t*)ser);
24407 ser_ref.data = (int8_t*)(ser + 4);
24408 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
24409 *ret_conv = ChannelFeatures_read(ser_ref);
24410 return (uint64_t)ret_conv;
24413 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
24414 LDKu8slice ser_ref;
24415 ser_ref.datalen = *((uint32_t*)ser);
24416 ser_ref.data = (int8_t*)(ser + 4);
24417 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
24418 *ret_conv = InvoiceFeatures_read(ser_ref);
24419 return (uint64_t)ret_conv;
24422 void __attribute__((visibility("default"))) TS_ShutdownScript_free(uint32_t this_obj) {
24423 LDKShutdownScript this_obj_conv;
24424 this_obj_conv.inner = (void*)(this_obj & (~1));
24425 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24426 ShutdownScript_free(this_obj_conv);
24429 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_clone(uint32_t orig) {
24430 LDKShutdownScript orig_conv;
24431 orig_conv.inner = (void*)(orig & (~1));
24432 orig_conv.is_owned = false;
24433 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
24434 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24435 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24436 uint64_t ret_ref = (uint64_t)ret_var.inner;
24437 if (ret_var.is_owned) {
24443 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
24444 LDKInvalidShutdownScript this_obj_conv;
24445 this_obj_conv.inner = (void*)(this_obj & (~1));
24446 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24447 InvalidShutdownScript_free(this_obj_conv);
24450 int8_tArray __attribute__((visibility("default"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
24451 LDKInvalidShutdownScript this_ptr_conv;
24452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24453 this_ptr_conv.is_owned = false;
24454 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
24455 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24456 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24460 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
24461 LDKInvalidShutdownScript this_ptr_conv;
24462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24463 this_ptr_conv.is_owned = false;
24464 LDKCVec_u8Z val_ref;
24465 val_ref.datalen = *((uint32_t*)val);
24466 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
24467 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
24468 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
24471 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
24472 LDKCVec_u8Z script_arg_ref;
24473 script_arg_ref.datalen = *((uint32_t*)script_arg);
24474 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
24475 memcpy(script_arg_ref.data, (uint8_t*)(script_arg + 4), script_arg_ref.datalen);
24476 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
24477 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24478 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24479 uint64_t ret_ref = (uint64_t)ret_var.inner;
24480 if (ret_var.is_owned) {
24486 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_clone(uint32_t orig) {
24487 LDKInvalidShutdownScript orig_conv;
24488 orig_conv.inner = (void*)(orig & (~1));
24489 orig_conv.is_owned = false;
24490 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
24491 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24492 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24493 uint64_t ret_ref = (uint64_t)ret_var.inner;
24494 if (ret_var.is_owned) {
24500 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_write(uint32_t obj) {
24501 LDKShutdownScript obj_conv;
24502 obj_conv.inner = (void*)(obj & (~1));
24503 obj_conv.is_owned = false;
24504 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
24505 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24506 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24507 CVec_u8Z_free(ret_var);
24511 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_read(int8_tArray ser) {
24512 LDKu8slice ser_ref;
24513 ser_ref.datalen = *((uint32_t*)ser);
24514 ser_ref.data = (int8_t*)(ser + 4);
24515 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
24516 *ret_conv = ShutdownScript_read(ser_ref);
24517 return (uint64_t)ret_conv;
24520 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
24521 unsigned char pubkey_hash_arr[20];
24522 CHECK(*((uint32_t*)pubkey_hash) == 20);
24523 memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
24524 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
24525 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
24526 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24527 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24528 uint64_t ret_ref = (uint64_t)ret_var.inner;
24529 if (ret_var.is_owned) {
24535 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
24536 unsigned char script_hash_arr[32];
24537 CHECK(*((uint32_t*)script_hash) == 32);
24538 memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 32);
24539 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
24540 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
24541 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24542 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24543 uint64_t ret_ref = (uint64_t)ret_var.inner;
24544 if (ret_var.is_owned) {
24550 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
24551 LDKu8slice program_ref;
24552 program_ref.datalen = *((uint32_t*)program);
24553 program_ref.data = (int8_t*)(program + 4);
24554 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
24555 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
24556 return (uint64_t)ret_conv;
24559 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
24560 LDKShutdownScript this_arg_conv;
24561 this_arg_conv.inner = (void*)(this_arg & (~1));
24562 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24563 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
24564 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
24565 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24566 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24567 CVec_u8Z_free(ret_var);
24571 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
24572 LDKShutdownScript this_arg_conv;
24573 this_arg_conv.inner = (void*)(this_arg & (~1));
24574 this_arg_conv.is_owned = false;
24575 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24576 memcpy((uint8_t*)(ret_arr + 4), ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
24580 jboolean __attribute__((visibility("default"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
24581 LDKShutdownScript this_arg_conv;
24582 this_arg_conv.inner = (void*)(this_arg & (~1));
24583 this_arg_conv.is_owned = false;
24584 LDKInitFeatures features_conv;
24585 features_conv.inner = (void*)(features & (~1));
24586 features_conv.is_owned = false;
24587 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
24591 void __attribute__((visibility("default"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
24592 if ((this_ptr & 1) != 0) return;
24593 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
24594 CHECK_ACCESS(this_ptr_ptr);
24595 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
24596 FREE((void*)this_ptr);
24597 CustomMessageReader_free(this_ptr_conv);
24600 uint32_t __attribute__((visibility("default"))) TS_Type_clone(uint32_t orig) {
24601 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
24602 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
24603 LDKType* orig_conv = (LDKType*)orig_ptr;
24604 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
24605 *ret_ret = Type_clone(orig_conv);
24606 return (uint64_t)ret_ret;
24609 void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) {
24610 if ((this_ptr & 1) != 0) return;
24611 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
24612 CHECK_ACCESS(this_ptr_ptr);
24613 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
24614 FREE((void*)this_ptr);
24615 Type_free(this_ptr_conv);
24618 void __attribute__((visibility("default"))) TS_Score_free(uint32_t this_ptr) {
24619 if ((this_ptr & 1) != 0) return;
24620 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
24621 CHECK_ACCESS(this_ptr_ptr);
24622 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
24623 FREE((void*)this_ptr);
24624 Score_free(this_ptr_conv);
24627 void __attribute__((visibility("default"))) TS_NodeId_free(uint32_t this_obj) {
24628 LDKNodeId this_obj_conv;
24629 this_obj_conv.inner = (void*)(this_obj & (~1));
24630 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24631 NodeId_free(this_obj_conv);
24634 uint32_t __attribute__((visibility("default"))) TS_NodeId_clone(uint32_t orig) {
24635 LDKNodeId orig_conv;
24636 orig_conv.inner = (void*)(orig & (~1));
24637 orig_conv.is_owned = false;
24638 LDKNodeId ret_var = NodeId_clone(&orig_conv);
24639 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24640 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24641 uint64_t ret_ref = (uint64_t)ret_var.inner;
24642 if (ret_var.is_owned) {
24648 uint32_t __attribute__((visibility("default"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
24649 LDKPublicKey pubkey_ref;
24650 CHECK(*((uint32_t*)pubkey) == 33);
24651 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
24652 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
24653 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24654 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24655 uint64_t ret_ref = (uint64_t)ret_var.inner;
24656 if (ret_var.is_owned) {
24662 int8_tArray __attribute__((visibility("default"))) TS_NodeId_as_slice(uint32_t this_arg) {
24663 LDKNodeId this_arg_conv;
24664 this_arg_conv.inner = (void*)(this_arg & (~1));
24665 this_arg_conv.is_owned = false;
24666 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
24667 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24668 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24672 int64_t __attribute__((visibility("default"))) TS_NodeId_hash(uint32_t o) {
24674 o_conv.inner = (void*)(o & (~1));
24675 o_conv.is_owned = false;
24676 int64_t ret_val = NodeId_hash(&o_conv);
24680 int8_tArray __attribute__((visibility("default"))) TS_NodeId_write(uint32_t obj) {
24681 LDKNodeId obj_conv;
24682 obj_conv.inner = (void*)(obj & (~1));
24683 obj_conv.is_owned = false;
24684 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
24685 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24686 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24687 CVec_u8Z_free(ret_var);
24691 uint32_t __attribute__((visibility("default"))) TS_NodeId_read(int8_tArray ser) {
24692 LDKu8slice ser_ref;
24693 ser_ref.datalen = *((uint32_t*)ser);
24694 ser_ref.data = (int8_t*)(ser + 4);
24695 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24696 *ret_conv = NodeId_read(ser_ref);
24697 return (uint64_t)ret_conv;
24700 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
24701 LDKNetworkGraph this_obj_conv;
24702 this_obj_conv.inner = (void*)(this_obj & (~1));
24703 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24704 NetworkGraph_free(this_obj_conv);
24707 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
24708 LDKNetworkGraph orig_conv;
24709 orig_conv.inner = (void*)(orig & (~1));
24710 orig_conv.is_owned = false;
24711 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
24712 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24713 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24714 uint64_t ret_ref = (uint64_t)ret_var.inner;
24715 if (ret_var.is_owned) {
24721 void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
24722 LDKReadOnlyNetworkGraph this_obj_conv;
24723 this_obj_conv.inner = (void*)(this_obj & (~1));
24724 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24725 ReadOnlyNetworkGraph_free(this_obj_conv);
24728 void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
24729 if ((this_ptr & 1) != 0) return;
24730 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
24731 CHECK_ACCESS(this_ptr_ptr);
24732 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
24733 FREE((void*)this_ptr);
24734 NetworkUpdate_free(this_ptr_conv);
24737 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) {
24738 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
24739 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
24740 *ret_copy = NetworkUpdate_clone(orig_conv);
24741 uint64_t ret_ref = (uint64_t)ret_copy;
24745 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
24746 LDKChannelUpdate msg_conv;
24747 msg_conv.inner = (void*)(msg & (~1));
24748 msg_conv.is_owned = (msg & 1) || (msg == 0);
24749 msg_conv = ChannelUpdate_clone(&msg_conv);
24750 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
24751 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
24752 uint64_t ret_ref = (uint64_t)ret_copy;
24756 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
24757 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
24758 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
24759 uint64_t ret_ref = (uint64_t)ret_copy;
24763 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
24764 LDKPublicKey node_id_ref;
24765 CHECK(*((uint32_t*)node_id) == 33);
24766 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
24767 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
24768 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
24769 uint64_t ret_ref = (uint64_t)ret_copy;
24773 int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) {
24774 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
24775 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
24776 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24777 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24778 CVec_u8Z_free(ret_var);
24782 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
24783 LDKNetGraphMsgHandler this_arg_conv;
24784 this_arg_conv.inner = (void*)(this_arg & (~1));
24785 this_arg_conv.is_owned = false;
24786 LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
24787 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
24788 return (uint64_t)ret_ret;
24791 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
24792 LDKNetGraphMsgHandler this_obj_conv;
24793 this_obj_conv.inner = (void*)(this_obj & (~1));
24794 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24795 NetGraphMsgHandler_free(this_obj_conv);
24798 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_get_network_graph(uint32_t this_ptr) {
24799 LDKNetGraphMsgHandler this_ptr_conv;
24800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24801 this_ptr_conv.is_owned = false;
24802 LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv);
24803 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24804 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24805 uint64_t ret_ref = (uint64_t)ret_var.inner;
24806 if (ret_var.is_owned) {
24812 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_set_network_graph(uint32_t this_ptr, uint32_t val) {
24813 LDKNetGraphMsgHandler this_ptr_conv;
24814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24815 this_ptr_conv.is_owned = false;
24816 LDKNetworkGraph val_conv;
24817 val_conv.inner = (void*)(val & (~1));
24818 val_conv.is_owned = (val & 1) || (val == 0);
24819 val_conv = NetworkGraph_clone(&val_conv);
24820 NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv);
24823 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
24824 LDKNetworkGraph network_graph_conv;
24825 network_graph_conv.inner = (void*)(network_graph & (~1));
24826 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
24827 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
24828 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
24829 CHECK_ACCESS(chain_access_ptr);
24830 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
24831 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
24832 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
24833 // Manually implement clone for Java trait instances
24835 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
24836 CHECK_ACCESS(logger_ptr);
24837 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24838 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv);
24839 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24840 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24841 uint64_t ret_ref = (uint64_t)ret_var.inner;
24842 if (ret_var.is_owned) {
24848 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
24849 LDKNetGraphMsgHandler this_arg_conv;
24850 this_arg_conv.inner = (void*)(this_arg & (~1));
24851 this_arg_conv.is_owned = false;
24852 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
24853 CHECK_ACCESS(chain_access_ptr);
24854 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
24855 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
24856 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
24857 // Manually implement clone for Java trait instances
24859 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
24862 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
24863 LDKNetGraphMsgHandler this_arg_conv;
24864 this_arg_conv.inner = (void*)(this_arg & (~1));
24865 this_arg_conv.is_owned = false;
24866 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
24867 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
24868 return (uint64_t)ret_ret;
24871 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
24872 LDKNetGraphMsgHandler this_arg_conv;
24873 this_arg_conv.inner = (void*)(this_arg & (~1));
24874 this_arg_conv.is_owned = false;
24875 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
24876 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
24877 return (uint64_t)ret_ret;
24880 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
24881 LDKDirectionalChannelInfo this_obj_conv;
24882 this_obj_conv.inner = (void*)(this_obj & (~1));
24883 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24884 DirectionalChannelInfo_free(this_obj_conv);
24887 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
24888 LDKDirectionalChannelInfo this_ptr_conv;
24889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24890 this_ptr_conv.is_owned = false;
24891 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
24895 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
24896 LDKDirectionalChannelInfo this_ptr_conv;
24897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24898 this_ptr_conv.is_owned = false;
24899 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
24902 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
24903 LDKDirectionalChannelInfo this_ptr_conv;
24904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24905 this_ptr_conv.is_owned = false;
24906 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
24910 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
24911 LDKDirectionalChannelInfo this_ptr_conv;
24912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24913 this_ptr_conv.is_owned = false;
24914 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
24917 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
24918 LDKDirectionalChannelInfo this_ptr_conv;
24919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24920 this_ptr_conv.is_owned = false;
24921 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
24925 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
24926 LDKDirectionalChannelInfo this_ptr_conv;
24927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24928 this_ptr_conv.is_owned = false;
24929 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
24932 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
24933 LDKDirectionalChannelInfo this_ptr_conv;
24934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24935 this_ptr_conv.is_owned = false;
24936 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
24940 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
24941 LDKDirectionalChannelInfo this_ptr_conv;
24942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24943 this_ptr_conv.is_owned = false;
24944 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
24947 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
24948 LDKDirectionalChannelInfo this_ptr_conv;
24949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24950 this_ptr_conv.is_owned = false;
24951 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24952 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
24953 uint64_t ret_ref = (uint64_t)ret_copy;
24957 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
24958 LDKDirectionalChannelInfo this_ptr_conv;
24959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24960 this_ptr_conv.is_owned = false;
24961 void* val_ptr = (void*)(((uint64_t)val) & ~1);
24962 CHECK_ACCESS(val_ptr);
24963 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
24964 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
24965 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
24968 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
24969 LDKDirectionalChannelInfo this_ptr_conv;
24970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24971 this_ptr_conv.is_owned = false;
24972 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
24973 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24974 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24975 uint64_t ret_ref = (uint64_t)ret_var.inner;
24976 if (ret_var.is_owned) {
24982 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
24983 LDKDirectionalChannelInfo this_ptr_conv;
24984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24985 this_ptr_conv.is_owned = false;
24986 LDKRoutingFees val_conv;
24987 val_conv.inner = (void*)(val & (~1));
24988 val_conv.is_owned = (val & 1) || (val == 0);
24989 val_conv = RoutingFees_clone(&val_conv);
24990 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
24993 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
24994 LDKDirectionalChannelInfo this_ptr_conv;
24995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24996 this_ptr_conv.is_owned = false;
24997 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
24998 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24999 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25000 uint64_t ret_ref = (uint64_t)ret_var.inner;
25001 if (ret_var.is_owned) {
25007 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
25008 LDKDirectionalChannelInfo this_ptr_conv;
25009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25010 this_ptr_conv.is_owned = false;
25011 LDKChannelUpdate val_conv;
25012 val_conv.inner = (void*)(val & (~1));
25013 val_conv.is_owned = (val & 1) || (val == 0);
25014 val_conv = ChannelUpdate_clone(&val_conv);
25015 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
25018 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) {
25019 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
25020 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
25021 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
25022 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
25023 LDKRoutingFees fees_arg_conv;
25024 fees_arg_conv.inner = (void*)(fees_arg & (~1));
25025 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
25026 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
25027 LDKChannelUpdate last_update_message_arg_conv;
25028 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
25029 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
25030 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
25031 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);
25032 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25033 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25034 uint64_t ret_ref = (uint64_t)ret_var.inner;
25035 if (ret_var.is_owned) {
25041 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
25042 LDKDirectionalChannelInfo orig_conv;
25043 orig_conv.inner = (void*)(orig & (~1));
25044 orig_conv.is_owned = false;
25045 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
25046 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25047 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25048 uint64_t ret_ref = (uint64_t)ret_var.inner;
25049 if (ret_var.is_owned) {
25055 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
25056 LDKDirectionalChannelInfo obj_conv;
25057 obj_conv.inner = (void*)(obj & (~1));
25058 obj_conv.is_owned = false;
25059 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
25060 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25061 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25062 CVec_u8Z_free(ret_var);
25066 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
25067 LDKu8slice ser_ref;
25068 ser_ref.datalen = *((uint32_t*)ser);
25069 ser_ref.data = (int8_t*)(ser + 4);
25070 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
25071 *ret_conv = DirectionalChannelInfo_read(ser_ref);
25072 return (uint64_t)ret_conv;
25075 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
25076 LDKChannelInfo this_obj_conv;
25077 this_obj_conv.inner = (void*)(this_obj & (~1));
25078 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25079 ChannelInfo_free(this_obj_conv);
25082 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
25083 LDKChannelInfo this_ptr_conv;
25084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25085 this_ptr_conv.is_owned = false;
25086 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
25087 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25088 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25089 uint64_t ret_ref = (uint64_t)ret_var.inner;
25090 if (ret_var.is_owned) {
25096 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
25097 LDKChannelInfo this_ptr_conv;
25098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25099 this_ptr_conv.is_owned = false;
25100 LDKChannelFeatures val_conv;
25101 val_conv.inner = (void*)(val & (~1));
25102 val_conv.is_owned = (val & 1) || (val == 0);
25103 val_conv = ChannelFeatures_clone(&val_conv);
25104 ChannelInfo_set_features(&this_ptr_conv, val_conv);
25107 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
25108 LDKChannelInfo this_ptr_conv;
25109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25110 this_ptr_conv.is_owned = false;
25111 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
25112 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25113 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25114 uint64_t ret_ref = (uint64_t)ret_var.inner;
25115 if (ret_var.is_owned) {
25121 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
25122 LDKChannelInfo this_ptr_conv;
25123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25124 this_ptr_conv.is_owned = false;
25125 LDKNodeId val_conv;
25126 val_conv.inner = (void*)(val & (~1));
25127 val_conv.is_owned = (val & 1) || (val == 0);
25128 val_conv = NodeId_clone(&val_conv);
25129 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
25132 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
25133 LDKChannelInfo this_ptr_conv;
25134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25135 this_ptr_conv.is_owned = false;
25136 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
25137 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25138 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25139 uint64_t ret_ref = (uint64_t)ret_var.inner;
25140 if (ret_var.is_owned) {
25146 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
25147 LDKChannelInfo this_ptr_conv;
25148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25149 this_ptr_conv.is_owned = false;
25150 LDKDirectionalChannelInfo val_conv;
25151 val_conv.inner = (void*)(val & (~1));
25152 val_conv.is_owned = (val & 1) || (val == 0);
25153 val_conv = DirectionalChannelInfo_clone(&val_conv);
25154 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
25157 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
25158 LDKChannelInfo this_ptr_conv;
25159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25160 this_ptr_conv.is_owned = false;
25161 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
25162 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25163 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25164 uint64_t ret_ref = (uint64_t)ret_var.inner;
25165 if (ret_var.is_owned) {
25171 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
25172 LDKChannelInfo this_ptr_conv;
25173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25174 this_ptr_conv.is_owned = false;
25175 LDKNodeId val_conv;
25176 val_conv.inner = (void*)(val & (~1));
25177 val_conv.is_owned = (val & 1) || (val == 0);
25178 val_conv = NodeId_clone(&val_conv);
25179 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
25182 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
25183 LDKChannelInfo this_ptr_conv;
25184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25185 this_ptr_conv.is_owned = false;
25186 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
25187 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25188 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25189 uint64_t ret_ref = (uint64_t)ret_var.inner;
25190 if (ret_var.is_owned) {
25196 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
25197 LDKChannelInfo this_ptr_conv;
25198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25199 this_ptr_conv.is_owned = false;
25200 LDKDirectionalChannelInfo val_conv;
25201 val_conv.inner = (void*)(val & (~1));
25202 val_conv.is_owned = (val & 1) || (val == 0);
25203 val_conv = DirectionalChannelInfo_clone(&val_conv);
25204 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
25207 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
25208 LDKChannelInfo this_ptr_conv;
25209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25210 this_ptr_conv.is_owned = false;
25211 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25212 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
25213 uint64_t ret_ref = (uint64_t)ret_copy;
25217 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
25218 LDKChannelInfo this_ptr_conv;
25219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25220 this_ptr_conv.is_owned = false;
25221 void* val_ptr = (void*)(((uint64_t)val) & ~1);
25222 CHECK_ACCESS(val_ptr);
25223 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25224 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
25225 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
25228 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
25229 LDKChannelInfo this_ptr_conv;
25230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25231 this_ptr_conv.is_owned = false;
25232 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
25233 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25234 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25235 uint64_t ret_ref = (uint64_t)ret_var.inner;
25236 if (ret_var.is_owned) {
25242 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
25243 LDKChannelInfo this_ptr_conv;
25244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25245 this_ptr_conv.is_owned = false;
25246 LDKChannelAnnouncement val_conv;
25247 val_conv.inner = (void*)(val & (~1));
25248 val_conv.is_owned = (val & 1) || (val == 0);
25249 val_conv = ChannelAnnouncement_clone(&val_conv);
25250 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
25253 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) {
25254 LDKChannelFeatures features_arg_conv;
25255 features_arg_conv.inner = (void*)(features_arg & (~1));
25256 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
25257 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
25258 LDKNodeId node_one_arg_conv;
25259 node_one_arg_conv.inner = (void*)(node_one_arg & (~1));
25260 node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0);
25261 node_one_arg_conv = NodeId_clone(&node_one_arg_conv);
25262 LDKDirectionalChannelInfo one_to_two_arg_conv;
25263 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
25264 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
25265 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
25266 LDKNodeId node_two_arg_conv;
25267 node_two_arg_conv.inner = (void*)(node_two_arg & (~1));
25268 node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0);
25269 node_two_arg_conv = NodeId_clone(&node_two_arg_conv);
25270 LDKDirectionalChannelInfo two_to_one_arg_conv;
25271 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
25272 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
25273 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
25274 void* capacity_sats_arg_ptr = (void*)(((uint64_t)capacity_sats_arg) & ~1);
25275 CHECK_ACCESS(capacity_sats_arg_ptr);
25276 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(capacity_sats_arg_ptr);
25277 capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
25278 LDKChannelAnnouncement announcement_message_arg_conv;
25279 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
25280 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
25281 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
25282 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);
25283 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25284 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25285 uint64_t ret_ref = (uint64_t)ret_var.inner;
25286 if (ret_var.is_owned) {
25292 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
25293 LDKChannelInfo orig_conv;
25294 orig_conv.inner = (void*)(orig & (~1));
25295 orig_conv.is_owned = false;
25296 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
25297 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25298 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25299 uint64_t ret_ref = (uint64_t)ret_var.inner;
25300 if (ret_var.is_owned) {
25306 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
25307 LDKChannelInfo obj_conv;
25308 obj_conv.inner = (void*)(obj & (~1));
25309 obj_conv.is_owned = false;
25310 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
25311 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25312 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25313 CVec_u8Z_free(ret_var);
25317 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
25318 LDKu8slice ser_ref;
25319 ser_ref.datalen = *((uint32_t*)ser);
25320 ser_ref.data = (int8_t*)(ser + 4);
25321 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
25322 *ret_conv = ChannelInfo_read(ser_ref);
25323 return (uint64_t)ret_conv;
25326 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
25327 LDKRoutingFees this_obj_conv;
25328 this_obj_conv.inner = (void*)(this_obj & (~1));
25329 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25330 RoutingFees_free(this_obj_conv);
25333 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
25334 LDKRoutingFees this_ptr_conv;
25335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25336 this_ptr_conv.is_owned = false;
25337 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
25341 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
25342 LDKRoutingFees this_ptr_conv;
25343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25344 this_ptr_conv.is_owned = false;
25345 RoutingFees_set_base_msat(&this_ptr_conv, val);
25348 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
25349 LDKRoutingFees this_ptr_conv;
25350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25351 this_ptr_conv.is_owned = false;
25352 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
25356 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
25357 LDKRoutingFees this_ptr_conv;
25358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25359 this_ptr_conv.is_owned = false;
25360 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
25363 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
25364 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
25365 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25366 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25367 uint64_t ret_ref = (uint64_t)ret_var.inner;
25368 if (ret_var.is_owned) {
25374 jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
25375 LDKRoutingFees a_conv;
25376 a_conv.inner = (void*)(a & (~1));
25377 a_conv.is_owned = false;
25378 LDKRoutingFees b_conv;
25379 b_conv.inner = (void*)(b & (~1));
25380 b_conv.is_owned = false;
25381 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
25385 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
25386 LDKRoutingFees orig_conv;
25387 orig_conv.inner = (void*)(orig & (~1));
25388 orig_conv.is_owned = false;
25389 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
25390 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25391 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25392 uint64_t ret_ref = (uint64_t)ret_var.inner;
25393 if (ret_var.is_owned) {
25399 int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) {
25400 LDKRoutingFees o_conv;
25401 o_conv.inner = (void*)(o & (~1));
25402 o_conv.is_owned = false;
25403 int64_t ret_val = RoutingFees_hash(&o_conv);
25407 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
25408 LDKRoutingFees obj_conv;
25409 obj_conv.inner = (void*)(obj & (~1));
25410 obj_conv.is_owned = false;
25411 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
25412 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25413 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25414 CVec_u8Z_free(ret_var);
25418 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
25419 LDKu8slice ser_ref;
25420 ser_ref.datalen = *((uint32_t*)ser);
25421 ser_ref.data = (int8_t*)(ser + 4);
25422 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
25423 *ret_conv = RoutingFees_read(ser_ref);
25424 return (uint64_t)ret_conv;
25427 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
25428 LDKNodeAnnouncementInfo this_obj_conv;
25429 this_obj_conv.inner = (void*)(this_obj & (~1));
25430 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25431 NodeAnnouncementInfo_free(this_obj_conv);
25434 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
25435 LDKNodeAnnouncementInfo this_ptr_conv;
25436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25437 this_ptr_conv.is_owned = false;
25438 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
25439 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25440 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25441 uint64_t ret_ref = (uint64_t)ret_var.inner;
25442 if (ret_var.is_owned) {
25448 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
25449 LDKNodeAnnouncementInfo this_ptr_conv;
25450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25451 this_ptr_conv.is_owned = false;
25452 LDKNodeFeatures val_conv;
25453 val_conv.inner = (void*)(val & (~1));
25454 val_conv.is_owned = (val & 1) || (val == 0);
25455 val_conv = NodeFeatures_clone(&val_conv);
25456 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
25459 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
25460 LDKNodeAnnouncementInfo this_ptr_conv;
25461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25462 this_ptr_conv.is_owned = false;
25463 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
25467 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
25468 LDKNodeAnnouncementInfo this_ptr_conv;
25469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25470 this_ptr_conv.is_owned = false;
25471 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
25474 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
25475 LDKNodeAnnouncementInfo this_ptr_conv;
25476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25477 this_ptr_conv.is_owned = false;
25478 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
25479 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
25483 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
25484 LDKNodeAnnouncementInfo this_ptr_conv;
25485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25486 this_ptr_conv.is_owned = false;
25487 LDKThreeBytes val_ref;
25488 CHECK(*((uint32_t*)val) == 3);
25489 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
25490 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
25493 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
25494 LDKNodeAnnouncementInfo this_ptr_conv;
25495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25496 this_ptr_conv.is_owned = false;
25497 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25498 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
25502 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
25503 LDKNodeAnnouncementInfo this_ptr_conv;
25504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25505 this_ptr_conv.is_owned = false;
25506 LDKThirtyTwoBytes val_ref;
25507 CHECK(*((uint32_t*)val) == 32);
25508 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
25509 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
25512 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
25513 LDKNodeAnnouncementInfo this_ptr_conv;
25514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25515 this_ptr_conv.is_owned = false;
25516 LDKCVec_NetAddressZ val_constr;
25517 val_constr.datalen = *((uint32_t*)val);
25518 if (val_constr.datalen > 0)
25519 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
25521 val_constr.data = NULL;
25522 uint32_t* val_vals = (uint32_t*)(val + 4);
25523 for (size_t m = 0; m < val_constr.datalen; m++) {
25524 uint32_t val_conv_12 = val_vals[m];
25525 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
25526 CHECK_ACCESS(val_conv_12_ptr);
25527 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
25528 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
25529 val_constr.data[m] = val_conv_12_conv;
25531 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
25534 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
25535 LDKNodeAnnouncementInfo this_ptr_conv;
25536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25537 this_ptr_conv.is_owned = false;
25538 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
25539 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25540 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25541 uint64_t ret_ref = (uint64_t)ret_var.inner;
25542 if (ret_var.is_owned) {
25548 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
25549 LDKNodeAnnouncementInfo this_ptr_conv;
25550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25551 this_ptr_conv.is_owned = false;
25552 LDKNodeAnnouncement val_conv;
25553 val_conv.inner = (void*)(val & (~1));
25554 val_conv.is_owned = (val & 1) || (val == 0);
25555 val_conv = NodeAnnouncement_clone(&val_conv);
25556 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
25559 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) {
25560 LDKNodeFeatures features_arg_conv;
25561 features_arg_conv.inner = (void*)(features_arg & (~1));
25562 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
25563 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
25564 LDKThreeBytes rgb_arg_ref;
25565 CHECK(*((uint32_t*)rgb_arg) == 3);
25566 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
25567 LDKThirtyTwoBytes alias_arg_ref;
25568 CHECK(*((uint32_t*)alias_arg) == 32);
25569 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
25570 LDKCVec_NetAddressZ addresses_arg_constr;
25571 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
25572 if (addresses_arg_constr.datalen > 0)
25573 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
25575 addresses_arg_constr.data = NULL;
25576 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
25577 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
25578 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
25579 void* addresses_arg_conv_12_ptr = (void*)(((uint64_t)addresses_arg_conv_12) & ~1);
25580 CHECK_ACCESS(addresses_arg_conv_12_ptr);
25581 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
25582 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
25584 LDKNodeAnnouncement announcement_message_arg_conv;
25585 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
25586 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
25587 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
25588 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
25589 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25590 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25591 uint64_t ret_ref = (uint64_t)ret_var.inner;
25592 if (ret_var.is_owned) {
25598 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
25599 LDKNodeAnnouncementInfo orig_conv;
25600 orig_conv.inner = (void*)(orig & (~1));
25601 orig_conv.is_owned = false;
25602 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
25603 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25604 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25605 uint64_t ret_ref = (uint64_t)ret_var.inner;
25606 if (ret_var.is_owned) {
25612 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
25613 LDKNodeAnnouncementInfo obj_conv;
25614 obj_conv.inner = (void*)(obj & (~1));
25615 obj_conv.is_owned = false;
25616 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
25617 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25618 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25619 CVec_u8Z_free(ret_var);
25623 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
25624 LDKu8slice ser_ref;
25625 ser_ref.datalen = *((uint32_t*)ser);
25626 ser_ref.data = (int8_t*)(ser + 4);
25627 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
25628 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
25629 return (uint64_t)ret_conv;
25632 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
25633 LDKNodeInfo this_obj_conv;
25634 this_obj_conv.inner = (void*)(this_obj & (~1));
25635 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25636 NodeInfo_free(this_obj_conv);
25639 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
25640 LDKNodeInfo this_ptr_conv;
25641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25642 this_ptr_conv.is_owned = false;
25643 LDKCVec_u64Z val_constr;
25644 val_constr.datalen = *((uint32_t*)val);
25645 if (val_constr.datalen > 0)
25646 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
25648 val_constr.data = NULL;
25649 int64_t* val_vals = (int64_t*)(val + 4);
25650 for (size_t i = 0; i < val_constr.datalen; i++) {
25651 int64_t val_conv_8 = val_vals[i];
25652 val_constr.data[i] = val_conv_8;
25654 NodeInfo_set_channels(&this_ptr_conv, val_constr);
25657 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
25658 LDKNodeInfo this_ptr_conv;
25659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25660 this_ptr_conv.is_owned = false;
25661 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
25662 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25663 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25664 uint64_t ret_ref = (uint64_t)ret_var.inner;
25665 if (ret_var.is_owned) {
25671 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
25672 LDKNodeInfo this_ptr_conv;
25673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25674 this_ptr_conv.is_owned = false;
25675 LDKRoutingFees val_conv;
25676 val_conv.inner = (void*)(val & (~1));
25677 val_conv.is_owned = (val & 1) || (val == 0);
25678 val_conv = RoutingFees_clone(&val_conv);
25679 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
25682 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
25683 LDKNodeInfo this_ptr_conv;
25684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25685 this_ptr_conv.is_owned = false;
25686 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
25687 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25688 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25689 uint64_t ret_ref = (uint64_t)ret_var.inner;
25690 if (ret_var.is_owned) {
25696 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
25697 LDKNodeInfo this_ptr_conv;
25698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25699 this_ptr_conv.is_owned = false;
25700 LDKNodeAnnouncementInfo val_conv;
25701 val_conv.inner = (void*)(val & (~1));
25702 val_conv.is_owned = (val & 1) || (val == 0);
25703 val_conv = NodeAnnouncementInfo_clone(&val_conv);
25704 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
25707 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
25708 LDKCVec_u64Z channels_arg_constr;
25709 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
25710 if (channels_arg_constr.datalen > 0)
25711 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
25713 channels_arg_constr.data = NULL;
25714 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
25715 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
25716 int64_t channels_arg_conv_8 = channels_arg_vals[i];
25717 channels_arg_constr.data[i] = channels_arg_conv_8;
25719 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
25720 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
25721 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
25722 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
25723 LDKNodeAnnouncementInfo announcement_info_arg_conv;
25724 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
25725 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
25726 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
25727 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
25728 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25729 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25730 uint64_t ret_ref = (uint64_t)ret_var.inner;
25731 if (ret_var.is_owned) {
25737 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
25738 LDKNodeInfo orig_conv;
25739 orig_conv.inner = (void*)(orig & (~1));
25740 orig_conv.is_owned = false;
25741 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
25742 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25743 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25744 uint64_t ret_ref = (uint64_t)ret_var.inner;
25745 if (ret_var.is_owned) {
25751 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
25752 LDKNodeInfo obj_conv;
25753 obj_conv.inner = (void*)(obj & (~1));
25754 obj_conv.is_owned = false;
25755 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
25756 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25757 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25758 CVec_u8Z_free(ret_var);
25762 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
25763 LDKu8slice ser_ref;
25764 ser_ref.datalen = *((uint32_t*)ser);
25765 ser_ref.data = (int8_t*)(ser + 4);
25766 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
25767 *ret_conv = NodeInfo_read(ser_ref);
25768 return (uint64_t)ret_conv;
25771 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
25772 LDKNetworkGraph obj_conv;
25773 obj_conv.inner = (void*)(obj & (~1));
25774 obj_conv.is_owned = false;
25775 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
25776 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25777 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25778 CVec_u8Z_free(ret_var);
25782 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
25783 LDKu8slice ser_ref;
25784 ser_ref.datalen = *((uint32_t*)ser);
25785 ser_ref.data = (int8_t*)(ser + 4);
25786 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
25787 *ret_conv = NetworkGraph_read(ser_ref);
25788 return (uint64_t)ret_conv;
25791 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
25792 LDKThirtyTwoBytes genesis_hash_ref;
25793 CHECK(*((uint32_t*)genesis_hash) == 32);
25794 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
25795 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
25796 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25797 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25798 uint64_t ret_ref = (uint64_t)ret_var.inner;
25799 if (ret_var.is_owned) {
25805 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
25806 LDKNetworkGraph this_arg_conv;
25807 this_arg_conv.inner = (void*)(this_arg & (~1));
25808 this_arg_conv.is_owned = false;
25809 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
25810 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25811 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25812 uint64_t ret_ref = (uint64_t)ret_var.inner;
25813 if (ret_var.is_owned) {
25819 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
25820 LDKNetworkGraph this_arg_conv;
25821 this_arg_conv.inner = (void*)(this_arg & (~1));
25822 this_arg_conv.is_owned = false;
25823 LDKNodeAnnouncement msg_conv;
25824 msg_conv.inner = (void*)(msg & (~1));
25825 msg_conv.is_owned = false;
25826 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25827 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
25828 return (uint64_t)ret_conv;
25831 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
25832 LDKNetworkGraph this_arg_conv;
25833 this_arg_conv.inner = (void*)(this_arg & (~1));
25834 this_arg_conv.is_owned = false;
25835 LDKUnsignedNodeAnnouncement msg_conv;
25836 msg_conv.inner = (void*)(msg & (~1));
25837 msg_conv.is_owned = false;
25838 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25839 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
25840 return (uint64_t)ret_conv;
25843 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
25844 LDKNetworkGraph this_arg_conv;
25845 this_arg_conv.inner = (void*)(this_arg & (~1));
25846 this_arg_conv.is_owned = false;
25847 LDKChannelAnnouncement msg_conv;
25848 msg_conv.inner = (void*)(msg & (~1));
25849 msg_conv.is_owned = false;
25850 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
25851 CHECK_ACCESS(chain_access_ptr);
25852 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
25853 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
25854 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
25855 // Manually implement clone for Java trait instances
25857 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25858 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
25859 return (uint64_t)ret_conv;
25862 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
25863 LDKNetworkGraph this_arg_conv;
25864 this_arg_conv.inner = (void*)(this_arg & (~1));
25865 this_arg_conv.is_owned = false;
25866 LDKUnsignedChannelAnnouncement msg_conv;
25867 msg_conv.inner = (void*)(msg & (~1));
25868 msg_conv.is_owned = false;
25869 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
25870 CHECK_ACCESS(chain_access_ptr);
25871 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
25872 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
25873 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
25874 // Manually implement clone for Java trait instances
25876 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25877 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
25878 return (uint64_t)ret_conv;
25881 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
25882 LDKNetworkGraph this_arg_conv;
25883 this_arg_conv.inner = (void*)(this_arg & (~1));
25884 this_arg_conv.is_owned = false;
25885 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
25888 void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
25889 LDKNetworkGraph this_arg_conv;
25890 this_arg_conv.inner = (void*)(this_arg & (~1));
25891 this_arg_conv.is_owned = false;
25892 LDKPublicKey _node_id_ref;
25893 CHECK(*((uint32_t*)_node_id) == 33);
25894 memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33);
25895 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
25898 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
25899 LDKNetworkGraph this_arg_conv;
25900 this_arg_conv.inner = (void*)(this_arg & (~1));
25901 this_arg_conv.is_owned = false;
25902 LDKChannelUpdate msg_conv;
25903 msg_conv.inner = (void*)(msg & (~1));
25904 msg_conv.is_owned = false;
25905 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25906 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
25907 return (uint64_t)ret_conv;
25910 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
25911 LDKNetworkGraph this_arg_conv;
25912 this_arg_conv.inner = (void*)(this_arg & (~1));
25913 this_arg_conv.is_owned = false;
25914 LDKUnsignedChannelUpdate msg_conv;
25915 msg_conv.inner = (void*)(msg & (~1));
25916 msg_conv.is_owned = false;
25917 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25918 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
25919 return (uint64_t)ret_conv;
25922 uint32_t __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
25923 LDKReadOnlyNetworkGraph this_arg_conv;
25924 this_arg_conv.inner = (void*)(this_arg & (~1));
25925 this_arg_conv.is_owned = false;
25926 LDKPublicKey pubkey_ref;
25927 CHECK(*((uint32_t*)pubkey) == 33);
25928 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
25929 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
25930 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
25931 uint64_t ret_ref = (uint64_t)ret_copy;
25935 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
25936 LDKRouteHop this_obj_conv;
25937 this_obj_conv.inner = (void*)(this_obj & (~1));
25938 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25939 RouteHop_free(this_obj_conv);
25942 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
25943 LDKRouteHop this_ptr_conv;
25944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25945 this_ptr_conv.is_owned = false;
25946 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25947 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
25951 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
25952 LDKRouteHop this_ptr_conv;
25953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25954 this_ptr_conv.is_owned = false;
25955 LDKPublicKey val_ref;
25956 CHECK(*((uint32_t*)val) == 33);
25957 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25958 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
25961 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
25962 LDKRouteHop this_ptr_conv;
25963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25964 this_ptr_conv.is_owned = false;
25965 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
25966 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25967 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25968 uint64_t ret_ref = (uint64_t)ret_var.inner;
25969 if (ret_var.is_owned) {
25975 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
25976 LDKRouteHop this_ptr_conv;
25977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25978 this_ptr_conv.is_owned = false;
25979 LDKNodeFeatures val_conv;
25980 val_conv.inner = (void*)(val & (~1));
25981 val_conv.is_owned = (val & 1) || (val == 0);
25982 val_conv = NodeFeatures_clone(&val_conv);
25983 RouteHop_set_node_features(&this_ptr_conv, val_conv);
25986 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
25987 LDKRouteHop this_ptr_conv;
25988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25989 this_ptr_conv.is_owned = false;
25990 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
25994 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25995 LDKRouteHop this_ptr_conv;
25996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25997 this_ptr_conv.is_owned = false;
25998 RouteHop_set_short_channel_id(&this_ptr_conv, val);
26001 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
26002 LDKRouteHop this_ptr_conv;
26003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26004 this_ptr_conv.is_owned = false;
26005 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
26006 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26007 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26008 uint64_t ret_ref = (uint64_t)ret_var.inner;
26009 if (ret_var.is_owned) {
26015 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
26016 LDKRouteHop this_ptr_conv;
26017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26018 this_ptr_conv.is_owned = false;
26019 LDKChannelFeatures val_conv;
26020 val_conv.inner = (void*)(val & (~1));
26021 val_conv.is_owned = (val & 1) || (val == 0);
26022 val_conv = ChannelFeatures_clone(&val_conv);
26023 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
26026 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
26027 LDKRouteHop this_ptr_conv;
26028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26029 this_ptr_conv.is_owned = false;
26030 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
26034 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
26035 LDKRouteHop this_ptr_conv;
26036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26037 this_ptr_conv.is_owned = false;
26038 RouteHop_set_fee_msat(&this_ptr_conv, val);
26041 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
26042 LDKRouteHop this_ptr_conv;
26043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26044 this_ptr_conv.is_owned = false;
26045 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
26049 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
26050 LDKRouteHop this_ptr_conv;
26051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26052 this_ptr_conv.is_owned = false;
26053 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
26056 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) {
26057 LDKPublicKey pubkey_arg_ref;
26058 CHECK(*((uint32_t*)pubkey_arg) == 33);
26059 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
26060 LDKNodeFeatures node_features_arg_conv;
26061 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
26062 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
26063 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
26064 LDKChannelFeatures channel_features_arg_conv;
26065 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
26066 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
26067 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
26068 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);
26069 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26070 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26071 uint64_t ret_ref = (uint64_t)ret_var.inner;
26072 if (ret_var.is_owned) {
26078 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
26079 LDKRouteHop orig_conv;
26080 orig_conv.inner = (void*)(orig & (~1));
26081 orig_conv.is_owned = false;
26082 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
26083 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26084 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26085 uint64_t ret_ref = (uint64_t)ret_var.inner;
26086 if (ret_var.is_owned) {
26092 int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) {
26093 LDKRouteHop o_conv;
26094 o_conv.inner = (void*)(o & (~1));
26095 o_conv.is_owned = false;
26096 int64_t ret_val = RouteHop_hash(&o_conv);
26100 jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
26101 LDKRouteHop a_conv;
26102 a_conv.inner = (void*)(a & (~1));
26103 a_conv.is_owned = false;
26104 LDKRouteHop b_conv;
26105 b_conv.inner = (void*)(b & (~1));
26106 b_conv.is_owned = false;
26107 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
26111 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
26112 LDKRouteHop obj_conv;
26113 obj_conv.inner = (void*)(obj & (~1));
26114 obj_conv.is_owned = false;
26115 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
26116 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
26117 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
26118 CVec_u8Z_free(ret_var);
26122 uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) {
26123 LDKu8slice ser_ref;
26124 ser_ref.datalen = *((uint32_t*)ser);
26125 ser_ref.data = (int8_t*)(ser + 4);
26126 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26127 *ret_conv = RouteHop_read(ser_ref);
26128 return (uint64_t)ret_conv;
26131 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
26132 LDKRoute this_obj_conv;
26133 this_obj_conv.inner = (void*)(this_obj & (~1));
26134 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26135 Route_free(this_obj_conv);
26138 ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) {
26139 LDKRoute this_ptr_conv;
26140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26141 this_ptr_conv.is_owned = false;
26142 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
26143 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
26144 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4);
26145 for (size_t m = 0; m < ret_var.datalen; m++) {
26146 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
26147 uint32_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26148 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4);
26149 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
26150 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
26151 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26152 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26153 uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
26154 if (ret_conv_12_conv_10_var.is_owned) {
26155 ret_conv_12_conv_10_ref |= 1;
26157 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
26159 FREE(ret_conv_12_var.data);
26160 ret_arr_ptr[m] = ret_conv_12_arr;
26162 FREE(ret_var.data);
26166 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
26167 LDKRoute this_ptr_conv;
26168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26169 this_ptr_conv.is_owned = false;
26170 LDKCVec_CVec_RouteHopZZ val_constr;
26171 val_constr.datalen = *((uint32_t*)val);
26172 if (val_constr.datalen > 0)
26173 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
26175 val_constr.data = NULL;
26176 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
26177 for (size_t m = 0; m < val_constr.datalen; m++) {
26178 uint32_tArray val_conv_12 = val_vals[m];
26179 LDKCVec_RouteHopZ val_conv_12_constr;
26180 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
26181 if (val_conv_12_constr.datalen > 0)
26182 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26184 val_conv_12_constr.data = NULL;
26185 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
26186 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
26187 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
26188 LDKRouteHop val_conv_12_conv_10_conv;
26189 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
26190 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
26191 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
26192 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
26194 val_constr.data[m] = val_conv_12_constr;
26196 Route_set_paths(&this_ptr_conv, val_constr);
26199 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) {
26200 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
26201 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
26202 if (paths_arg_constr.datalen > 0)
26203 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
26205 paths_arg_constr.data = NULL;
26206 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
26207 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
26208 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
26209 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
26210 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
26211 if (paths_arg_conv_12_constr.datalen > 0)
26212 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26214 paths_arg_conv_12_constr.data = NULL;
26215 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
26216 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
26217 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
26218 LDKRouteHop paths_arg_conv_12_conv_10_conv;
26219 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
26220 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
26221 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
26222 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
26224 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
26226 LDKRoute ret_var = Route_new(paths_arg_constr);
26227 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26228 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26229 uint64_t ret_ref = (uint64_t)ret_var.inner;
26230 if (ret_var.is_owned) {
26236 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
26237 LDKRoute orig_conv;
26238 orig_conv.inner = (void*)(orig & (~1));
26239 orig_conv.is_owned = false;
26240 LDKRoute ret_var = Route_clone(&orig_conv);
26241 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26242 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26243 uint64_t ret_ref = (uint64_t)ret_var.inner;
26244 if (ret_var.is_owned) {
26250 int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) {
26252 o_conv.inner = (void*)(o & (~1));
26253 o_conv.is_owned = false;
26254 int64_t ret_val = Route_hash(&o_conv);
26258 jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) {
26260 a_conv.inner = (void*)(a & (~1));
26261 a_conv.is_owned = false;
26263 b_conv.inner = (void*)(b & (~1));
26264 b_conv.is_owned = false;
26265 jboolean ret_val = Route_eq(&a_conv, &b_conv);
26269 int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) {
26270 LDKRoute this_arg_conv;
26271 this_arg_conv.inner = (void*)(this_arg & (~1));
26272 this_arg_conv.is_owned = false;
26273 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
26277 int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) {
26278 LDKRoute this_arg_conv;
26279 this_arg_conv.inner = (void*)(this_arg & (~1));
26280 this_arg_conv.is_owned = false;
26281 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
26285 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
26287 obj_conv.inner = (void*)(obj & (~1));
26288 obj_conv.is_owned = false;
26289 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
26290 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
26291 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
26292 CVec_u8Z_free(ret_var);
26296 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
26297 LDKu8slice ser_ref;
26298 ser_ref.datalen = *((uint32_t*)ser);
26299 ser_ref.data = (int8_t*)(ser + 4);
26300 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
26301 *ret_conv = Route_read(ser_ref);
26302 return (uint64_t)ret_conv;
26305 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
26306 LDKRouteHint this_obj_conv;
26307 this_obj_conv.inner = (void*)(this_obj & (~1));
26308 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26309 RouteHint_free(this_obj_conv);
26312 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
26313 LDKRouteHint orig_conv;
26314 orig_conv.inner = (void*)(orig & (~1));
26315 orig_conv.is_owned = false;
26316 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
26317 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26318 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26319 uint64_t ret_ref = (uint64_t)ret_var.inner;
26320 if (ret_var.is_owned) {
26326 int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) {
26327 LDKRouteHint o_conv;
26328 o_conv.inner = (void*)(o & (~1));
26329 o_conv.is_owned = false;
26330 int64_t ret_val = RouteHint_hash(&o_conv);
26334 jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
26335 LDKRouteHint a_conv;
26336 a_conv.inner = (void*)(a & (~1));
26337 a_conv.is_owned = false;
26338 LDKRouteHint b_conv;
26339 b_conv.inner = (void*)(b & (~1));
26340 b_conv.is_owned = false;
26341 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
26345 void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
26346 LDKRouteHintHop this_obj_conv;
26347 this_obj_conv.inner = (void*)(this_obj & (~1));
26348 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26349 RouteHintHop_free(this_obj_conv);
26352 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
26353 LDKRouteHintHop this_ptr_conv;
26354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26355 this_ptr_conv.is_owned = false;
26356 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
26357 memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
26361 void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
26362 LDKRouteHintHop this_ptr_conv;
26363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26364 this_ptr_conv.is_owned = false;
26365 LDKPublicKey val_ref;
26366 CHECK(*((uint32_t*)val) == 33);
26367 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
26368 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
26371 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
26372 LDKRouteHintHop this_ptr_conv;
26373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26374 this_ptr_conv.is_owned = false;
26375 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
26379 void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
26380 LDKRouteHintHop this_ptr_conv;
26381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26382 this_ptr_conv.is_owned = false;
26383 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
26386 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
26387 LDKRouteHintHop this_ptr_conv;
26388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26389 this_ptr_conv.is_owned = false;
26390 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
26391 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26392 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26393 uint64_t ret_ref = (uint64_t)ret_var.inner;
26394 if (ret_var.is_owned) {
26400 void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
26401 LDKRouteHintHop this_ptr_conv;
26402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26403 this_ptr_conv.is_owned = false;
26404 LDKRoutingFees val_conv;
26405 val_conv.inner = (void*)(val & (~1));
26406 val_conv.is_owned = (val & 1) || (val == 0);
26407 val_conv = RoutingFees_clone(&val_conv);
26408 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
26411 int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
26412 LDKRouteHintHop this_ptr_conv;
26413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26414 this_ptr_conv.is_owned = false;
26415 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
26419 void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
26420 LDKRouteHintHop this_ptr_conv;
26421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26422 this_ptr_conv.is_owned = false;
26423 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
26426 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
26427 LDKRouteHintHop this_ptr_conv;
26428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26429 this_ptr_conv.is_owned = false;
26430 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26431 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
26432 uint64_t ret_ref = (uint64_t)ret_copy;
26436 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
26437 LDKRouteHintHop this_ptr_conv;
26438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26439 this_ptr_conv.is_owned = false;
26440 void* val_ptr = (void*)(((uint64_t)val) & ~1);
26441 CHECK_ACCESS(val_ptr);
26442 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26443 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
26444 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
26447 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
26448 LDKRouteHintHop this_ptr_conv;
26449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26450 this_ptr_conv.is_owned = false;
26451 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26452 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
26453 uint64_t ret_ref = (uint64_t)ret_copy;
26457 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
26458 LDKRouteHintHop this_ptr_conv;
26459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26460 this_ptr_conv.is_owned = false;
26461 void* val_ptr = (void*)(((uint64_t)val) & ~1);
26462 CHECK_ACCESS(val_ptr);
26463 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26464 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
26465 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
26468 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) {
26469 LDKPublicKey src_node_id_arg_ref;
26470 CHECK(*((uint32_t*)src_node_id_arg) == 33);
26471 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
26472 LDKRoutingFees fees_arg_conv;
26473 fees_arg_conv.inner = (void*)(fees_arg & (~1));
26474 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
26475 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
26476 void* htlc_minimum_msat_arg_ptr = (void*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
26477 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
26478 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
26479 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
26480 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
26481 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
26482 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
26483 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
26484 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);
26485 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26486 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26487 uint64_t ret_ref = (uint64_t)ret_var.inner;
26488 if (ret_var.is_owned) {
26494 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
26495 LDKRouteHintHop orig_conv;
26496 orig_conv.inner = (void*)(orig & (~1));
26497 orig_conv.is_owned = false;
26498 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
26499 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26500 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26501 uint64_t ret_ref = (uint64_t)ret_var.inner;
26502 if (ret_var.is_owned) {
26508 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) {
26509 LDKRouteHintHop o_conv;
26510 o_conv.inner = (void*)(o & (~1));
26511 o_conv.is_owned = false;
26512 int64_t ret_val = RouteHintHop_hash(&o_conv);
26516 jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
26517 LDKRouteHintHop a_conv;
26518 a_conv.inner = (void*)(a & (~1));
26519 a_conv.is_owned = false;
26520 LDKRouteHintHop b_conv;
26521 b_conv.inner = (void*)(b & (~1));
26522 b_conv.is_owned = false;
26523 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
26527 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) {
26528 LDKPublicKey our_node_pubkey_ref;
26529 CHECK(*((uint32_t*)our_node_pubkey) == 33);
26530 memcpy(our_node_pubkey_ref.compressed_form, (uint8_t*)(our_node_pubkey + 4), 33);
26531 LDKNetworkGraph network_conv;
26532 network_conv.inner = (void*)(network & (~1));
26533 network_conv.is_owned = false;
26534 LDKPublicKey payee_ref;
26535 CHECK(*((uint32_t*)payee) == 33);
26536 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
26537 LDKCVec_ChannelDetailsZ first_hops_constr;
26538 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
26539 if (first_hops != 0) {
26540 first_hops_constr.datalen = *((uint32_t*)first_hops);
26541 if (first_hops_constr.datalen > 0)
26542 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
26544 first_hops_constr.data = NULL;
26545 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
26546 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
26547 uint32_t first_hops_conv_16 = first_hops_vals[q];
26548 LDKChannelDetails first_hops_conv_16_conv;
26549 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
26550 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
26551 first_hops_constr.data[q] = first_hops_conv_16_conv;
26553 first_hops_ptr = &first_hops_constr;
26555 LDKCVec_RouteHintZ last_hops_constr;
26556 last_hops_constr.datalen = *((uint32_t*)last_hops);
26557 if (last_hops_constr.datalen > 0)
26558 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
26560 last_hops_constr.data = NULL;
26561 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
26562 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
26563 uint32_t last_hops_conv_11 = last_hops_vals[l];
26564 LDKRouteHint last_hops_conv_11_conv;
26565 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
26566 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
26567 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
26568 last_hops_constr.data[l] = last_hops_conv_11_conv;
26570 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
26571 CHECK_ACCESS(logger_ptr);
26572 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26573 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
26574 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
26575 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
26576 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26577 *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);
26578 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
26579 return (uint64_t)ret_conv;
26582 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) {
26583 LDKPublicKey our_node_pubkey_ref;
26584 CHECK(*((uint32_t*)our_node_pubkey) == 33);
26585 memcpy(our_node_pubkey_ref.compressed_form, (uint8_t*)(our_node_pubkey + 4), 33);
26586 LDKNetworkGraph network_conv;
26587 network_conv.inner = (void*)(network & (~1));
26588 network_conv.is_owned = false;
26589 LDKPublicKey payee_ref;
26590 CHECK(*((uint32_t*)payee) == 33);
26591 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
26592 LDKInvoiceFeatures payee_features_conv;
26593 payee_features_conv.inner = (void*)(payee_features & (~1));
26594 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
26595 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
26596 LDKCVec_ChannelDetailsZ first_hops_constr;
26597 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
26598 if (first_hops != 0) {
26599 first_hops_constr.datalen = *((uint32_t*)first_hops);
26600 if (first_hops_constr.datalen > 0)
26601 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
26603 first_hops_constr.data = NULL;
26604 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
26605 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
26606 uint32_t first_hops_conv_16 = first_hops_vals[q];
26607 LDKChannelDetails first_hops_conv_16_conv;
26608 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
26609 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
26610 first_hops_constr.data[q] = first_hops_conv_16_conv;
26612 first_hops_ptr = &first_hops_constr;
26614 LDKCVec_RouteHintZ last_hops_constr;
26615 last_hops_constr.datalen = *((uint32_t*)last_hops);
26616 if (last_hops_constr.datalen > 0)
26617 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
26619 last_hops_constr.data = NULL;
26620 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
26621 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
26622 uint32_t last_hops_conv_11 = last_hops_vals[l];
26623 LDKRouteHint last_hops_conv_11_conv;
26624 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
26625 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
26626 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
26627 last_hops_constr.data[l] = last_hops_conv_11_conv;
26629 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
26630 CHECK_ACCESS(logger_ptr);
26631 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26632 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
26633 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
26634 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
26635 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26636 *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);
26637 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
26638 return (uint64_t)ret_conv;
26641 void __attribute__((visibility("default"))) TS_Scorer_free(uint32_t this_obj) {
26642 LDKScorer this_obj_conv;
26643 this_obj_conv.inner = (void*)(this_obj & (~1));
26644 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26645 Scorer_free(this_obj_conv);
26648 uint32_t __attribute__((visibility("default"))) TS_Scorer_new(int64_t base_penalty_msat) {
26649 LDKScorer ret_var = Scorer_new(base_penalty_msat);
26650 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26651 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26652 uint64_t ret_ref = (uint64_t)ret_var.inner;
26653 if (ret_var.is_owned) {
26659 uint32_t __attribute__((visibility("default"))) TS_Scorer_default() {
26660 LDKScorer ret_var = Scorer_default();
26661 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26662 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26663 uint64_t ret_ref = (uint64_t)ret_var.inner;
26664 if (ret_var.is_owned) {
26670 uint32_t __attribute__((visibility("default"))) TS_Scorer_as_Score(uint32_t this_arg) {
26671 LDKScorer this_arg_conv;
26672 this_arg_conv.inner = (void*)(this_arg & (~1));
26673 this_arg_conv.is_owned = false;
26674 LDKScore* ret_ret =MALLOC(sizeof(LDKScore), "LDKScore");
26675 *ret_ret = Scorer_as_Score(&this_arg_conv);
26676 return (uint64_t)ret_ret;
26679 void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) {
26680 LDKFilesystemPersister this_obj_conv;
26681 this_obj_conv.inner = (void*)(this_obj & (~1));
26682 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26683 FilesystemPersister_free(this_obj_conv);
26686 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_new(jstring path_to_channel_data) {
26687 LDKStr path_to_channel_data_conv = str_ref_to_owned_c(path_to_channel_data);
26688 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
26689 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26690 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26691 uint64_t ret_ref = (uint64_t)ret_var.inner;
26692 if (ret_var.is_owned) {
26698 jstring __attribute__((visibility("default"))) TS_FilesystemPersister_get_data_dir(uint32_t this_arg) {
26699 LDKFilesystemPersister this_arg_conv;
26700 this_arg_conv.inner = (void*)(this_arg & (~1));
26701 this_arg_conv.is_owned = false;
26702 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
26703 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26708 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_persist_manager(jstring data_dir, uint32_t manager) {
26709 LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
26710 LDKChannelManager manager_conv;
26711 manager_conv.inner = (void*)(manager & (~1));
26712 manager_conv.is_owned = false;
26713 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
26714 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
26715 return (uint64_t)ret_conv;
26718 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_read_channelmonitors(uint32_t this_arg, uint32_t keys_manager) {
26719 LDKFilesystemPersister this_arg_conv;
26720 this_arg_conv.inner = (void*)(this_arg & (~1));
26721 this_arg_conv.is_owned = false;
26722 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
26723 CHECK_ACCESS(keys_manager_ptr);
26724 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
26725 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
26726 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
26727 return (uint64_t)ret_conv;
26730 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_as_Persist(uint32_t this_arg) {
26731 LDKFilesystemPersister this_arg_conv;
26732 this_arg_conv.inner = (void*)(this_arg & (~1));
26733 this_arg_conv.is_owned = false;
26734 LDKPersist* ret_ret =MALLOC(sizeof(LDKPersist), "LDKPersist");
26735 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
26736 return (uint64_t)ret_ret;
26739 void __attribute__((visibility("default"))) TS_BackgroundProcessor_free(uint32_t this_obj) {
26740 LDKBackgroundProcessor this_obj_conv;
26741 this_obj_conv.inner = (void*)(this_obj & (~1));
26742 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26743 BackgroundProcessor_free(this_obj_conv);
26746 void __attribute__((visibility("default"))) TS_ChannelManagerPersister_free(uint32_t this_ptr) {
26747 if ((this_ptr & 1) != 0) return;
26748 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
26749 CHECK_ACCESS(this_ptr_ptr);
26750 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(this_ptr_ptr);
26751 FREE((void*)this_ptr);
26752 ChannelManagerPersister_free(this_ptr_conv);
26755 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) {
26756 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
26757 CHECK_ACCESS(persister_ptr);
26758 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(persister_ptr);
26759 void* event_handler_ptr = (void*)(((uint64_t)event_handler) & ~1);
26760 CHECK_ACCESS(event_handler_ptr);
26761 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
26762 LDKChainMonitor chain_monitor_conv;
26763 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
26764 chain_monitor_conv.is_owned = false;
26765 LDKChannelManager channel_manager_conv;
26766 channel_manager_conv.inner = (void*)(channel_manager & (~1));
26767 channel_manager_conv.is_owned = false;
26768 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
26769 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
26770 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
26771 LDKPeerManager peer_manager_conv;
26772 peer_manager_conv.inner = (void*)(peer_manager & (~1));
26773 peer_manager_conv.is_owned = false;
26774 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
26775 CHECK_ACCESS(logger_ptr);
26776 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26777 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);
26778 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26779 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26780 uint64_t ret_ref = (uint64_t)ret_var.inner;
26781 if (ret_var.is_owned) {
26787 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_join(uint32_t this_arg) {
26788 LDKBackgroundProcessor this_arg_conv;
26789 this_arg_conv.inner = (void*)(this_arg & (~1));
26790 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26791 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
26792 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
26793 *ret_conv = BackgroundProcessor_join(this_arg_conv);
26794 return (uint64_t)ret_conv;
26797 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_stop(uint32_t this_arg) {
26798 LDKBackgroundProcessor this_arg_conv;
26799 this_arg_conv.inner = (void*)(this_arg & (~1));
26800 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26801 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
26802 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
26803 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
26804 return (uint64_t)ret_conv;
26807 void __attribute__((visibility("default"))) TS_check_platform() {
26811 void __attribute__((visibility("default"))) TS_Invoice_free(uint32_t this_obj) {
26812 LDKInvoice this_obj_conv;
26813 this_obj_conv.inner = (void*)(this_obj & (~1));
26814 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26815 Invoice_free(this_obj_conv);
26818 jboolean __attribute__((visibility("default"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
26820 a_conv.inner = (void*)(a & (~1));
26821 a_conv.is_owned = false;
26823 b_conv.inner = (void*)(b & (~1));
26824 b_conv.is_owned = false;
26825 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
26829 uint32_t __attribute__((visibility("default"))) TS_Invoice_clone(uint32_t orig) {
26830 LDKInvoice orig_conv;
26831 orig_conv.inner = (void*)(orig & (~1));
26832 orig_conv.is_owned = false;
26833 LDKInvoice ret_var = Invoice_clone(&orig_conv);
26834 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26835 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26836 uint64_t ret_ref = (uint64_t)ret_var.inner;
26837 if (ret_var.is_owned) {
26843 void __attribute__((visibility("default"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
26844 LDKSignedRawInvoice this_obj_conv;
26845 this_obj_conv.inner = (void*)(this_obj & (~1));
26846 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26847 SignedRawInvoice_free(this_obj_conv);
26850 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
26851 LDKSignedRawInvoice a_conv;
26852 a_conv.inner = (void*)(a & (~1));
26853 a_conv.is_owned = false;
26854 LDKSignedRawInvoice b_conv;
26855 b_conv.inner = (void*)(b & (~1));
26856 b_conv.is_owned = false;
26857 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
26861 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_clone(uint32_t orig) {
26862 LDKSignedRawInvoice orig_conv;
26863 orig_conv.inner = (void*)(orig & (~1));
26864 orig_conv.is_owned = false;
26865 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
26866 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26867 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26868 uint64_t ret_ref = (uint64_t)ret_var.inner;
26869 if (ret_var.is_owned) {
26875 void __attribute__((visibility("default"))) TS_RawInvoice_free(uint32_t this_obj) {
26876 LDKRawInvoice this_obj_conv;
26877 this_obj_conv.inner = (void*)(this_obj & (~1));
26878 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26879 RawInvoice_free(this_obj_conv);
26882 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
26883 LDKRawInvoice this_ptr_conv;
26884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26885 this_ptr_conv.is_owned = false;
26886 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
26887 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26888 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26889 uint64_t ret_ref = (uint64_t)ret_var.inner;
26890 if (ret_var.is_owned) {
26896 void __attribute__((visibility("default"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
26897 LDKRawInvoice this_ptr_conv;
26898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26899 this_ptr_conv.is_owned = false;
26900 LDKRawDataPart val_conv;
26901 val_conv.inner = (void*)(val & (~1));
26902 val_conv.is_owned = (val & 1) || (val == 0);
26903 val_conv = RawDataPart_clone(&val_conv);
26904 RawInvoice_set_data(&this_ptr_conv, val_conv);
26907 jboolean __attribute__((visibility("default"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
26908 LDKRawInvoice a_conv;
26909 a_conv.inner = (void*)(a & (~1));
26910 a_conv.is_owned = false;
26911 LDKRawInvoice b_conv;
26912 b_conv.inner = (void*)(b & (~1));
26913 b_conv.is_owned = false;
26914 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
26918 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_clone(uint32_t orig) {
26919 LDKRawInvoice orig_conv;
26920 orig_conv.inner = (void*)(orig & (~1));
26921 orig_conv.is_owned = false;
26922 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
26923 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26924 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26925 uint64_t ret_ref = (uint64_t)ret_var.inner;
26926 if (ret_var.is_owned) {
26932 void __attribute__((visibility("default"))) TS_RawDataPart_free(uint32_t this_obj) {
26933 LDKRawDataPart this_obj_conv;
26934 this_obj_conv.inner = (void*)(this_obj & (~1));
26935 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26936 RawDataPart_free(this_obj_conv);
26939 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
26940 LDKRawDataPart this_ptr_conv;
26941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26942 this_ptr_conv.is_owned = false;
26943 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
26944 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26945 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26946 uint64_t ret_ref = (uint64_t)ret_var.inner;
26947 if (ret_var.is_owned) {
26953 void __attribute__((visibility("default"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
26954 LDKRawDataPart this_ptr_conv;
26955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26956 this_ptr_conv.is_owned = false;
26957 LDKPositiveTimestamp val_conv;
26958 val_conv.inner = (void*)(val & (~1));
26959 val_conv.is_owned = (val & 1) || (val == 0);
26960 val_conv = PositiveTimestamp_clone(&val_conv);
26961 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
26964 jboolean __attribute__((visibility("default"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
26965 LDKRawDataPart a_conv;
26966 a_conv.inner = (void*)(a & (~1));
26967 a_conv.is_owned = false;
26968 LDKRawDataPart b_conv;
26969 b_conv.inner = (void*)(b & (~1));
26970 b_conv.is_owned = false;
26971 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
26975 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_clone(uint32_t orig) {
26976 LDKRawDataPart orig_conv;
26977 orig_conv.inner = (void*)(orig & (~1));
26978 orig_conv.is_owned = false;
26979 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
26980 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26981 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26982 uint64_t ret_ref = (uint64_t)ret_var.inner;
26983 if (ret_var.is_owned) {
26989 void __attribute__((visibility("default"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
26990 LDKPositiveTimestamp this_obj_conv;
26991 this_obj_conv.inner = (void*)(this_obj & (~1));
26992 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26993 PositiveTimestamp_free(this_obj_conv);
26996 jboolean __attribute__((visibility("default"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
26997 LDKPositiveTimestamp a_conv;
26998 a_conv.inner = (void*)(a & (~1));
26999 a_conv.is_owned = false;
27000 LDKPositiveTimestamp b_conv;
27001 b_conv.inner = (void*)(b & (~1));
27002 b_conv.is_owned = false;
27003 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
27007 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_clone(uint32_t orig) {
27008 LDKPositiveTimestamp orig_conv;
27009 orig_conv.inner = (void*)(orig & (~1));
27010 orig_conv.is_owned = false;
27011 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
27012 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27013 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27014 uint64_t ret_ref = (uint64_t)ret_var.inner;
27015 if (ret_var.is_owned) {
27021 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_clone(uint32_t orig) {
27022 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
27023 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
27027 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_milli() {
27028 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
27032 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_micro() {
27033 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
27037 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_nano() {
27038 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
27042 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_pico() {
27043 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
27047 jboolean __attribute__((visibility("default"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
27048 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
27049 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
27050 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
27054 int64_t __attribute__((visibility("default"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
27055 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
27056 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
27060 uint32_t __attribute__((visibility("default"))) TS_Currency_clone(uint32_t orig) {
27061 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
27062 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
27066 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin() {
27067 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
27071 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin_testnet() {
27072 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
27076 uint32_t __attribute__((visibility("default"))) TS_Currency_regtest() {
27077 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
27081 uint32_t __attribute__((visibility("default"))) TS_Currency_simnet() {
27082 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
27086 uint32_t __attribute__((visibility("default"))) TS_Currency_signet() {
27087 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
27091 int64_t __attribute__((visibility("default"))) TS_Currency_hash(uint32_t o) {
27092 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
27093 int64_t ret_val = Currency_hash(o_conv);
27097 jboolean __attribute__((visibility("default"))) TS_Currency_eq(uint32_t a, uint32_t b) {
27098 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
27099 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
27100 jboolean ret_val = Currency_eq(a_conv, b_conv);
27104 void __attribute__((visibility("default"))) TS_Sha256_free(uint32_t this_obj) {
27105 LDKSha256 this_obj_conv;
27106 this_obj_conv.inner = (void*)(this_obj & (~1));
27107 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27108 Sha256_free(this_obj_conv);
27111 uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
27112 LDKSha256 orig_conv;
27113 orig_conv.inner = (void*)(orig & (~1));
27114 orig_conv.is_owned = false;
27115 LDKSha256 ret_var = Sha256_clone(&orig_conv);
27116 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27117 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27118 uint64_t ret_ref = (uint64_t)ret_var.inner;
27119 if (ret_var.is_owned) {
27125 int64_t __attribute__((visibility("default"))) TS_Sha256_hash(uint32_t o) {
27127 o_conv.inner = (void*)(o & (~1));
27128 o_conv.is_owned = false;
27129 int64_t ret_val = Sha256_hash(&o_conv);
27133 jboolean __attribute__((visibility("default"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
27135 a_conv.inner = (void*)(a & (~1));
27136 a_conv.is_owned = false;
27138 b_conv.inner = (void*)(b & (~1));
27139 b_conv.is_owned = false;
27140 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
27144 void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
27145 LDKDescription this_obj_conv;
27146 this_obj_conv.inner = (void*)(this_obj & (~1));
27147 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27148 Description_free(this_obj_conv);
27151 uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
27152 LDKDescription orig_conv;
27153 orig_conv.inner = (void*)(orig & (~1));
27154 orig_conv.is_owned = false;
27155 LDKDescription ret_var = Description_clone(&orig_conv);
27156 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27157 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27158 uint64_t ret_ref = (uint64_t)ret_var.inner;
27159 if (ret_var.is_owned) {
27165 int64_t __attribute__((visibility("default"))) TS_Description_hash(uint32_t o) {
27166 LDKDescription o_conv;
27167 o_conv.inner = (void*)(o & (~1));
27168 o_conv.is_owned = false;
27169 int64_t ret_val = Description_hash(&o_conv);
27173 jboolean __attribute__((visibility("default"))) TS_Description_eq(uint32_t a, uint32_t b) {
27174 LDKDescription a_conv;
27175 a_conv.inner = (void*)(a & (~1));
27176 a_conv.is_owned = false;
27177 LDKDescription b_conv;
27178 b_conv.inner = (void*)(b & (~1));
27179 b_conv.is_owned = false;
27180 jboolean ret_val = Description_eq(&a_conv, &b_conv);
27184 void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
27185 LDKPayeePubKey this_obj_conv;
27186 this_obj_conv.inner = (void*)(this_obj & (~1));
27187 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27188 PayeePubKey_free(this_obj_conv);
27191 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
27192 LDKPayeePubKey orig_conv;
27193 orig_conv.inner = (void*)(orig & (~1));
27194 orig_conv.is_owned = false;
27195 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
27196 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27197 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27198 uint64_t ret_ref = (uint64_t)ret_var.inner;
27199 if (ret_var.is_owned) {
27205 int64_t __attribute__((visibility("default"))) TS_PayeePubKey_hash(uint32_t o) {
27206 LDKPayeePubKey o_conv;
27207 o_conv.inner = (void*)(o & (~1));
27208 o_conv.is_owned = false;
27209 int64_t ret_val = PayeePubKey_hash(&o_conv);
27213 jboolean __attribute__((visibility("default"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
27214 LDKPayeePubKey a_conv;
27215 a_conv.inner = (void*)(a & (~1));
27216 a_conv.is_owned = false;
27217 LDKPayeePubKey b_conv;
27218 b_conv.inner = (void*)(b & (~1));
27219 b_conv.is_owned = false;
27220 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
27224 void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
27225 LDKExpiryTime this_obj_conv;
27226 this_obj_conv.inner = (void*)(this_obj & (~1));
27227 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27228 ExpiryTime_free(this_obj_conv);
27231 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
27232 LDKExpiryTime orig_conv;
27233 orig_conv.inner = (void*)(orig & (~1));
27234 orig_conv.is_owned = false;
27235 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
27236 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27237 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27238 uint64_t ret_ref = (uint64_t)ret_var.inner;
27239 if (ret_var.is_owned) {
27245 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_hash(uint32_t o) {
27246 LDKExpiryTime o_conv;
27247 o_conv.inner = (void*)(o & (~1));
27248 o_conv.is_owned = false;
27249 int64_t ret_val = ExpiryTime_hash(&o_conv);
27253 jboolean __attribute__((visibility("default"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
27254 LDKExpiryTime a_conv;
27255 a_conv.inner = (void*)(a & (~1));
27256 a_conv.is_owned = false;
27257 LDKExpiryTime b_conv;
27258 b_conv.inner = (void*)(b & (~1));
27259 b_conv.is_owned = false;
27260 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
27264 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
27265 LDKMinFinalCltvExpiry this_obj_conv;
27266 this_obj_conv.inner = (void*)(this_obj & (~1));
27267 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27268 MinFinalCltvExpiry_free(this_obj_conv);
27271 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
27272 LDKMinFinalCltvExpiry orig_conv;
27273 orig_conv.inner = (void*)(orig & (~1));
27274 orig_conv.is_owned = false;
27275 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
27276 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27277 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27278 uint64_t ret_ref = (uint64_t)ret_var.inner;
27279 if (ret_var.is_owned) {
27285 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
27286 LDKMinFinalCltvExpiry o_conv;
27287 o_conv.inner = (void*)(o & (~1));
27288 o_conv.is_owned = false;
27289 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
27293 jboolean __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
27294 LDKMinFinalCltvExpiry a_conv;
27295 a_conv.inner = (void*)(a & (~1));
27296 a_conv.is_owned = false;
27297 LDKMinFinalCltvExpiry b_conv;
27298 b_conv.inner = (void*)(b & (~1));
27299 b_conv.is_owned = false;
27300 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
27304 void __attribute__((visibility("default"))) TS_Fallback_free(uint32_t this_ptr) {
27305 if ((this_ptr & 1) != 0) return;
27306 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27307 CHECK_ACCESS(this_ptr_ptr);
27308 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
27309 FREE((void*)this_ptr);
27310 Fallback_free(this_ptr_conv);
27313 uint32_t __attribute__((visibility("default"))) TS_Fallback_clone(uint32_t orig) {
27314 LDKFallback* orig_conv = (LDKFallback*)orig;
27315 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
27316 *ret_copy = Fallback_clone(orig_conv);
27317 uint64_t ret_ref = (uint64_t)ret_copy;
27321 uint32_t __attribute__((visibility("default"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
27323 LDKCVec_u8Z program_ref;
27324 program_ref.datalen = *((uint32_t*)program);
27325 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
27326 memcpy(program_ref.data, (uint8_t*)(program + 4), program_ref.datalen);
27327 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
27328 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
27329 uint64_t ret_ref = (uint64_t)ret_copy;
27333 uint32_t __attribute__((visibility("default"))) TS_Fallback_pub_key_hash(int8_tArray a) {
27334 LDKTwentyBytes a_ref;
27335 CHECK(*((uint32_t*)a) == 20);
27336 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
27337 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
27338 *ret_copy = Fallback_pub_key_hash(a_ref);
27339 uint64_t ret_ref = (uint64_t)ret_copy;
27343 uint32_t __attribute__((visibility("default"))) TS_Fallback_script_hash(int8_tArray a) {
27344 LDKTwentyBytes a_ref;
27345 CHECK(*((uint32_t*)a) == 20);
27346 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
27347 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
27348 *ret_copy = Fallback_script_hash(a_ref);
27349 uint64_t ret_ref = (uint64_t)ret_copy;
27353 int64_t __attribute__((visibility("default"))) TS_Fallback_hash(uint32_t o) {
27354 LDKFallback* o_conv = (LDKFallback*)o;
27355 int64_t ret_val = Fallback_hash(o_conv);
27359 jboolean __attribute__((visibility("default"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
27360 LDKFallback* a_conv = (LDKFallback*)a;
27361 LDKFallback* b_conv = (LDKFallback*)b;
27362 jboolean ret_val = Fallback_eq(a_conv, b_conv);
27366 void __attribute__((visibility("default"))) TS_InvoiceSignature_free(uint32_t this_obj) {
27367 LDKInvoiceSignature this_obj_conv;
27368 this_obj_conv.inner = (void*)(this_obj & (~1));
27369 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27370 InvoiceSignature_free(this_obj_conv);
27373 uint32_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone(uint32_t orig) {
27374 LDKInvoiceSignature orig_conv;
27375 orig_conv.inner = (void*)(orig & (~1));
27376 orig_conv.is_owned = false;
27377 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
27378 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27379 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27380 uint64_t ret_ref = (uint64_t)ret_var.inner;
27381 if (ret_var.is_owned) {
27387 jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
27388 LDKInvoiceSignature a_conv;
27389 a_conv.inner = (void*)(a & (~1));
27390 a_conv.is_owned = false;
27391 LDKInvoiceSignature b_conv;
27392 b_conv.inner = (void*)(b & (~1));
27393 b_conv.is_owned = false;
27394 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
27398 void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
27399 LDKPrivateRoute this_obj_conv;
27400 this_obj_conv.inner = (void*)(this_obj & (~1));
27401 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27402 PrivateRoute_free(this_obj_conv);
27405 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_clone(uint32_t orig) {
27406 LDKPrivateRoute orig_conv;
27407 orig_conv.inner = (void*)(orig & (~1));
27408 orig_conv.is_owned = false;
27409 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
27410 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27411 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27412 uint64_t ret_ref = (uint64_t)ret_var.inner;
27413 if (ret_var.is_owned) {
27419 int64_t __attribute__((visibility("default"))) TS_PrivateRoute_hash(uint32_t o) {
27420 LDKPrivateRoute o_conv;
27421 o_conv.inner = (void*)(o & (~1));
27422 o_conv.is_owned = false;
27423 int64_t ret_val = PrivateRoute_hash(&o_conv);
27427 jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
27428 LDKPrivateRoute a_conv;
27429 a_conv.inner = (void*)(a & (~1));
27430 a_conv.is_owned = false;
27431 LDKPrivateRoute b_conv;
27432 b_conv.inner = (void*)(b & (~1));
27433 b_conv.is_owned = false;
27434 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
27438 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
27439 LDKSignedRawInvoice this_arg_conv;
27440 this_arg_conv.inner = (void*)(this_arg & (~1));
27441 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27442 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
27443 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
27444 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
27445 return ((uint64_t)ret_conv);
27448 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
27449 LDKSignedRawInvoice this_arg_conv;
27450 this_arg_conv.inner = (void*)(this_arg & (~1));
27451 this_arg_conv.is_owned = false;
27452 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
27453 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27454 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27455 uint64_t ret_ref = (uint64_t)ret_var.inner;
27456 if (ret_var.is_owned) {
27462 int8_tArray __attribute__((visibility("default"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
27463 LDKSignedRawInvoice this_arg_conv;
27464 this_arg_conv.inner = (void*)(this_arg & (~1));
27465 this_arg_conv.is_owned = false;
27466 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
27467 memcpy((uint8_t*)(ret_arr + 4), *SignedRawInvoice_hash(&this_arg_conv), 32);
27471 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
27472 LDKSignedRawInvoice this_arg_conv;
27473 this_arg_conv.inner = (void*)(this_arg & (~1));
27474 this_arg_conv.is_owned = false;
27475 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
27476 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27477 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27478 uint64_t ret_ref = (uint64_t)ret_var.inner;
27479 if (ret_var.is_owned) {
27485 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
27486 LDKSignedRawInvoice this_arg_conv;
27487 this_arg_conv.inner = (void*)(this_arg & (~1));
27488 this_arg_conv.is_owned = false;
27489 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
27490 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
27491 return (uint64_t)ret_conv;
27494 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
27495 LDKSignedRawInvoice this_arg_conv;
27496 this_arg_conv.inner = (void*)(this_arg & (~1));
27497 this_arg_conv.is_owned = false;
27498 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
27502 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_hash(uint32_t this_arg) {
27503 LDKRawInvoice this_arg_conv;
27504 this_arg_conv.inner = (void*)(this_arg & (~1));
27505 this_arg_conv.is_owned = false;
27506 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
27507 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_hash(&this_arg_conv).data, 32);
27511 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
27512 LDKRawInvoice this_arg_conv;
27513 this_arg_conv.inner = (void*)(this_arg & (~1));
27514 this_arg_conv.is_owned = false;
27515 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
27516 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27517 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27518 uint64_t ret_ref = (uint64_t)ret_var.inner;
27519 if (ret_var.is_owned) {
27525 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description(uint32_t this_arg) {
27526 LDKRawInvoice this_arg_conv;
27527 this_arg_conv.inner = (void*)(this_arg & (~1));
27528 this_arg_conv.is_owned = false;
27529 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
27530 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27531 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27532 uint64_t ret_ref = (uint64_t)ret_var.inner;
27533 if (ret_var.is_owned) {
27539 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
27540 LDKRawInvoice this_arg_conv;
27541 this_arg_conv.inner = (void*)(this_arg & (~1));
27542 this_arg_conv.is_owned = false;
27543 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
27544 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27545 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27546 uint64_t ret_ref = (uint64_t)ret_var.inner;
27547 if (ret_var.is_owned) {
27553 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
27554 LDKRawInvoice this_arg_conv;
27555 this_arg_conv.inner = (void*)(this_arg & (~1));
27556 this_arg_conv.is_owned = false;
27557 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
27558 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27559 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27560 uint64_t ret_ref = (uint64_t)ret_var.inner;
27561 if (ret_var.is_owned) {
27567 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
27568 LDKRawInvoice this_arg_conv;
27569 this_arg_conv.inner = (void*)(this_arg & (~1));
27570 this_arg_conv.is_owned = false;
27571 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
27572 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27573 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27574 uint64_t ret_ref = (uint64_t)ret_var.inner;
27575 if (ret_var.is_owned) {
27581 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
27582 LDKRawInvoice this_arg_conv;
27583 this_arg_conv.inner = (void*)(this_arg & (~1));
27584 this_arg_conv.is_owned = false;
27585 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
27586 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27587 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27588 uint64_t ret_ref = (uint64_t)ret_var.inner;
27589 if (ret_var.is_owned) {
27595 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
27596 LDKRawInvoice this_arg_conv;
27597 this_arg_conv.inner = (void*)(this_arg & (~1));
27598 this_arg_conv.is_owned = false;
27599 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
27600 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_payment_secret(&this_arg_conv).data, 32);
27604 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_features(uint32_t this_arg) {
27605 LDKRawInvoice this_arg_conv;
27606 this_arg_conv.inner = (void*)(this_arg & (~1));
27607 this_arg_conv.is_owned = false;
27608 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
27609 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27610 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27611 uint64_t ret_ref = (uint64_t)ret_var.inner;
27612 if (ret_var.is_owned) {
27618 uint32_tArray __attribute__((visibility("default"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
27619 LDKRawInvoice this_arg_conv;
27620 this_arg_conv.inner = (void*)(this_arg & (~1));
27621 this_arg_conv.is_owned = false;
27622 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
27623 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
27624 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27625 for (size_t o = 0; o < ret_var.datalen; o++) {
27626 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
27627 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27628 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27629 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
27630 if (ret_conv_14_var.is_owned) {
27631 ret_conv_14_ref |= 1;
27633 ret_arr_ptr[o] = ret_conv_14_ref;
27635 FREE(ret_var.data);
27639 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
27640 LDKRawInvoice this_arg_conv;
27641 this_arg_conv.inner = (void*)(this_arg & (~1));
27642 this_arg_conv.is_owned = false;
27643 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27644 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
27645 uint64_t ret_ref = (uint64_t)ret_copy;
27649 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_currency(uint32_t this_arg) {
27650 LDKRawInvoice this_arg_conv;
27651 this_arg_conv.inner = (void*)(this_arg & (~1));
27652 this_arg_conv.is_owned = false;
27653 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
27657 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
27658 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27659 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
27660 return (uint64_t)ret_conv;
27663 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_system_time(int64_t time) {
27664 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27665 *ret_conv = PositiveTimestamp_from_system_time(time);
27666 return (uint64_t)ret_conv;
27669 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
27670 LDKPositiveTimestamp this_arg_conv;
27671 this_arg_conv.inner = (void*)(this_arg & (~1));
27672 this_arg_conv.is_owned = false;
27673 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
27677 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_time(uint32_t this_arg) {
27678 LDKPositiveTimestamp this_arg_conv;
27679 this_arg_conv.inner = (void*)(this_arg & (~1));
27680 this_arg_conv.is_owned = false;
27681 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
27685 uint32_t __attribute__((visibility("default"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
27686 LDKInvoice this_arg_conv;
27687 this_arg_conv.inner = (void*)(this_arg & (~1));
27688 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27689 this_arg_conv = Invoice_clone(&this_arg_conv);
27690 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
27691 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27692 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27693 uint64_t ret_ref = (uint64_t)ret_var.inner;
27694 if (ret_var.is_owned) {
27700 uint32_t __attribute__((visibility("default"))) TS_Invoice_check_signature(uint32_t this_arg) {
27701 LDKInvoice this_arg_conv;
27702 this_arg_conv.inner = (void*)(this_arg & (~1));
27703 this_arg_conv.is_owned = false;
27704 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
27705 *ret_conv = Invoice_check_signature(&this_arg_conv);
27706 return (uint64_t)ret_conv;
27709 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
27710 LDKSignedRawInvoice signed_invoice_conv;
27711 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
27712 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
27713 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
27714 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
27715 *ret_conv = Invoice_from_signed(signed_invoice_conv);
27716 return (uint64_t)ret_conv;
27719 int64_t __attribute__((visibility("default"))) TS_Invoice_timestamp(uint32_t this_arg) {
27720 LDKInvoice this_arg_conv;
27721 this_arg_conv.inner = (void*)(this_arg & (~1));
27722 this_arg_conv.is_owned = false;
27723 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
27727 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_hash(uint32_t this_arg) {
27728 LDKInvoice this_arg_conv;
27729 this_arg_conv.inner = (void*)(this_arg & (~1));
27730 this_arg_conv.is_owned = false;
27731 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
27732 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_hash(&this_arg_conv), 32);
27736 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
27737 LDKInvoice this_arg_conv;
27738 this_arg_conv.inner = (void*)(this_arg & (~1));
27739 this_arg_conv.is_owned = false;
27740 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
27741 memcpy((uint8_t*)(ret_arr + 4), Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
27745 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_secret(uint32_t this_arg) {
27746 LDKInvoice this_arg_conv;
27747 this_arg_conv.inner = (void*)(this_arg & (~1));
27748 this_arg_conv.is_owned = false;
27749 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
27750 memcpy((uint8_t*)(ret_arr + 4), Invoice_payment_secret(&this_arg_conv).data, 32);
27754 uint32_t __attribute__((visibility("default"))) TS_Invoice_features(uint32_t this_arg) {
27755 LDKInvoice this_arg_conv;
27756 this_arg_conv.inner = (void*)(this_arg & (~1));
27757 this_arg_conv.is_owned = false;
27758 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
27759 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27760 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27761 uint64_t ret_ref = (uint64_t)ret_var.inner;
27762 if (ret_var.is_owned) {
27768 int8_tArray __attribute__((visibility("default"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
27769 LDKInvoice this_arg_conv;
27770 this_arg_conv.inner = (void*)(this_arg & (~1));
27771 this_arg_conv.is_owned = false;
27772 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
27773 memcpy((uint8_t*)(ret_arr + 4), Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
27777 int64_t __attribute__((visibility("default"))) TS_Invoice_expiry_time(uint32_t this_arg) {
27778 LDKInvoice this_arg_conv;
27779 this_arg_conv.inner = (void*)(this_arg & (~1));
27780 this_arg_conv.is_owned = false;
27781 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
27785 int64_t __attribute__((visibility("default"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
27786 LDKInvoice this_arg_conv;
27787 this_arg_conv.inner = (void*)(this_arg & (~1));
27788 this_arg_conv.is_owned = false;
27789 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
27793 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_private_routes(uint32_t this_arg) {
27794 LDKInvoice this_arg_conv;
27795 this_arg_conv.inner = (void*)(this_arg & (~1));
27796 this_arg_conv.is_owned = false;
27797 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
27798 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
27799 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27800 for (size_t o = 0; o < ret_var.datalen; o++) {
27801 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
27802 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27803 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27804 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
27805 if (ret_conv_14_var.is_owned) {
27806 ret_conv_14_ref |= 1;
27808 ret_arr_ptr[o] = ret_conv_14_ref;
27810 FREE(ret_var.data);
27814 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_route_hints(uint32_t this_arg) {
27815 LDKInvoice this_arg_conv;
27816 this_arg_conv.inner = (void*)(this_arg & (~1));
27817 this_arg_conv.is_owned = false;
27818 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
27819 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
27820 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27821 for (size_t l = 0; l < ret_var.datalen; l++) {
27822 LDKRouteHint ret_conv_11_var = ret_var.data[l];
27823 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27824 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27825 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
27826 if (ret_conv_11_var.is_owned) {
27827 ret_conv_11_ref |= 1;
27829 ret_arr_ptr[l] = ret_conv_11_ref;
27831 FREE(ret_var.data);
27835 uint32_t __attribute__((visibility("default"))) TS_Invoice_currency(uint32_t this_arg) {
27836 LDKInvoice this_arg_conv;
27837 this_arg_conv.inner = (void*)(this_arg & (~1));
27838 this_arg_conv.is_owned = false;
27839 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
27843 uint32_t __attribute__((visibility("default"))) TS_Invoice_amount_pico_btc(uint32_t this_arg) {
27844 LDKInvoice this_arg_conv;
27845 this_arg_conv.inner = (void*)(this_arg & (~1));
27846 this_arg_conv.is_owned = false;
27847 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27848 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
27849 uint64_t ret_ref = (uint64_t)ret_copy;
27853 uint32_t __attribute__((visibility("default"))) TS_Description_new(jstring description) {
27854 LDKStr description_conv = str_ref_to_owned_c(description);
27855 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27856 *ret_conv = Description_new(description_conv);
27857 return (uint64_t)ret_conv;
27860 jstring __attribute__((visibility("default"))) TS_Description_into_inner(uint32_t this_arg) {
27861 LDKDescription this_arg_conv;
27862 this_arg_conv.inner = (void*)(this_arg & (~1));
27863 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27864 this_arg_conv = Description_clone(&this_arg_conv);
27865 LDKStr ret_str = Description_into_inner(this_arg_conv);
27866 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27871 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
27872 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
27873 *ret_conv = ExpiryTime_from_seconds(seconds);
27874 return (uint64_t)ret_conv;
27877 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_duration(int64_t duration) {
27878 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
27879 *ret_conv = ExpiryTime_from_duration(duration);
27880 return (uint64_t)ret_conv;
27883 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
27884 LDKExpiryTime this_arg_conv;
27885 this_arg_conv.inner = (void*)(this_arg & (~1));
27886 this_arg_conv.is_owned = false;
27887 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
27891 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
27892 LDKExpiryTime this_arg_conv;
27893 this_arg_conv.inner = (void*)(this_arg & (~1));
27894 this_arg_conv.is_owned = false;
27895 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
27899 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_new(uint32_t hops) {
27900 LDKRouteHint hops_conv;
27901 hops_conv.inner = (void*)(hops & (~1));
27902 hops_conv.is_owned = (hops & 1) || (hops == 0);
27903 hops_conv = RouteHint_clone(&hops_conv);
27904 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27905 *ret_conv = PrivateRoute_new(hops_conv);
27906 return (uint64_t)ret_conv;
27909 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
27910 LDKPrivateRoute this_arg_conv;
27911 this_arg_conv.inner = (void*)(this_arg & (~1));
27912 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27913 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
27914 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
27915 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27916 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27917 uint64_t ret_ref = (uint64_t)ret_var.inner;
27918 if (ret_var.is_owned) {
27924 uint32_t __attribute__((visibility("default"))) TS_CreationError_clone(uint32_t orig) {
27925 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
27926 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
27930 uint32_t __attribute__((visibility("default"))) TS_CreationError_description_too_long() {
27931 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
27935 uint32_t __attribute__((visibility("default"))) TS_CreationError_route_too_long() {
27936 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
27940 uint32_t __attribute__((visibility("default"))) TS_CreationError_timestamp_out_of_bounds() {
27941 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
27945 uint32_t __attribute__((visibility("default"))) TS_CreationError_expiry_time_out_of_bounds() {
27946 uint32_t ret_conv = LDKCreationError_to_js(CreationError_expiry_time_out_of_bounds());
27950 jboolean __attribute__((visibility("default"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
27951 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
27952 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
27953 jboolean ret_val = CreationError_eq(a_conv, b_conv);
27957 jstring __attribute__((visibility("default"))) TS_CreationError_to_str(uint32_t o) {
27958 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
27959 LDKStr ret_str = CreationError_to_str(o_conv);
27960 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27965 uint32_t __attribute__((visibility("default"))) TS_SemanticError_clone(uint32_t orig) {
27966 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
27967 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
27971 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_hash() {
27972 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
27976 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_hashes() {
27977 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
27981 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_description() {
27982 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
27986 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_descriptions() {
27987 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
27991 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_secret() {
27992 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
27996 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_secrets() {
27997 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
28001 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_features() {
28002 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
28006 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_recovery_id() {
28007 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
28011 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_signature() {
28012 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
28016 uint32_t __attribute__((visibility("default"))) TS_SemanticError_imprecise_amount() {
28017 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
28021 jboolean __attribute__((visibility("default"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
28022 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
28023 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
28024 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
28028 jstring __attribute__((visibility("default"))) TS_SemanticError_to_str(uint32_t o) {
28029 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
28030 LDKStr ret_str = SemanticError_to_str(o_conv);
28031 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28036 void __attribute__((visibility("default"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
28037 if ((this_ptr & 1) != 0) return;
28038 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
28039 CHECK_ACCESS(this_ptr_ptr);
28040 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
28041 FREE((void*)this_ptr);
28042 SignOrCreationError_free(this_ptr_conv);
28045 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_clone(uint32_t orig) {
28046 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
28047 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
28048 *ret_copy = SignOrCreationError_clone(orig_conv);
28049 uint64_t ret_ref = (uint64_t)ret_copy;
28053 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_sign_error() {
28054 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
28055 *ret_copy = SignOrCreationError_sign_error();
28056 uint64_t ret_ref = (uint64_t)ret_copy;
28060 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_creation_error(uint32_t a) {
28061 LDKCreationError a_conv = LDKCreationError_from_js(a);
28062 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
28063 *ret_copy = SignOrCreationError_creation_error(a_conv);
28064 uint64_t ret_ref = (uint64_t)ret_copy;
28068 jboolean __attribute__((visibility("default"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
28069 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
28070 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
28071 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
28075 jstring __attribute__((visibility("default"))) TS_SignOrCreationError_to_str(uint32_t o) {
28076 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
28077 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
28078 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28083 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) {
28084 LDKChannelManager channelmanager_conv;
28085 channelmanager_conv.inner = (void*)(channelmanager & (~1));
28086 channelmanager_conv.is_owned = false;
28087 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
28088 CHECK_ACCESS(keys_manager_ptr);
28089 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
28090 LDKCurrency network_conv = LDKCurrency_from_js(network);
28091 void* amt_msat_ptr = (void*)(((uint64_t)amt_msat) & ~1);
28092 CHECK_ACCESS(amt_msat_ptr);
28093 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
28094 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
28095 LDKStr description_conv = str_ref_to_owned_c(description);
28096 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
28097 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
28098 return (uint64_t)ret_conv;
28101 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_from_str(jstring s) {
28102 LDKStr s_conv = str_ref_to_owned_c(s);
28103 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
28104 *ret_conv = SiPrefix_from_str(s_conv);
28105 return (uint64_t)ret_conv;
28108 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_str(jstring s) {
28109 LDKStr s_conv = str_ref_to_owned_c(s);
28110 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
28111 *ret_conv = Invoice_from_str(s_conv);
28112 return (uint64_t)ret_conv;
28115 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_from_str(jstring s) {
28116 LDKStr s_conv = str_ref_to_owned_c(s);
28117 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
28118 *ret_conv = SignedRawInvoice_from_str(s_conv);
28119 return (uint64_t)ret_conv;
28122 jstring __attribute__((visibility("default"))) TS_Invoice_to_str(uint32_t o) {
28124 o_conv.inner = (void*)(o & (~1));
28125 o_conv.is_owned = false;
28126 LDKStr ret_str = Invoice_to_str(&o_conv);
28127 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28132 jstring __attribute__((visibility("default"))) TS_SignedRawInvoice_to_str(uint32_t o) {
28133 LDKSignedRawInvoice o_conv;
28134 o_conv.inner = (void*)(o & (~1));
28135 o_conv.is_owned = false;
28136 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
28137 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28142 jstring __attribute__((visibility("default"))) TS_Currency_to_str(uint32_t o) {
28143 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
28144 LDKStr ret_str = Currency_to_str(o_conv);
28145 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28150 jstring __attribute__((visibility("default"))) TS_SiPrefix_to_str(uint32_t o) {
28151 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
28152 LDKStr ret_str = SiPrefix_to_str(o_conv);
28153 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);