1 #include <rust_types.h>
6 // These should be provided...somehow...
7 void *memset(void *s, int c, size_t n);
8 void *memcpy(void *dest, const void *src, size_t n);
9 int memcmp(const void *s1, const void *s2, size_t n);
11 void __attribute__((noreturn)) abort(void);
12 static inline void assert(bool expression) {
13 if (!expression) { abort(); }
16 void *malloc(size_t size);
19 #define MALLOC(a, _) malloc(a)
20 #define FREE(p) if ((long)(p) > 1024) { free(p); }
21 #define DO_ASSERT(a) (void)(a)
24 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
25 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
26 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
27 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
29 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
31 typedef uint32_t int64_tArray;
32 typedef uint32_t int8_tArray;
33 typedef uint32_t uint32_tArray;
34 typedef uint32_t ptrArray;
35 typedef uint32_t jstring;
37 static inline uint32_t init_arr(size_t arr_len, size_t elem_size, const char *type_desc) {
38 uint32_t *elems = (uint32_t*)MALLOC(arr_len * elem_size + 4, type_desc);
40 return (uint32_t)elems;
43 jstring str_ref_to_ts(const char* chars, size_t len) {
44 char* err_buf = MALLOC(len + 4, "str conv buf");
45 *((uint32_t*)err_buf) = len;
46 memcpy(err_buf + 4, chars, len);
47 return (uint32_t) err_buf;
50 typedef bool jboolean;
52 uint32_t __attribute__((visibility("default"))) TS_malloc(uint32_t size) {
53 return (uint32_t)MALLOC(size, "JS-Called malloc");
55 void __attribute__((visibility("default"))) TS_free(uint32_t ptr) {
58 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
59 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
61 case 0: return LDKAccessError_UnknownChain;
62 case 1: return LDKAccessError_UnknownTx;
66 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
68 case LDKAccessError_UnknownChain: return 0;
69 case LDKAccessError_UnknownTx: return 1;
73 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
75 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
76 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
80 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
82 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
83 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
87 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
89 case 0: return LDKConfirmationTarget_Background;
90 case 1: return LDKConfirmationTarget_Normal;
91 case 2: return LDKConfirmationTarget_HighPriority;
95 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
97 case LDKConfirmationTarget_Background: return 0;
98 case LDKConfirmationTarget_Normal: return 1;
99 case LDKConfirmationTarget_HighPriority: return 2;
103 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
105 case 0: return LDKIOError_NotFound;
106 case 1: return LDKIOError_PermissionDenied;
107 case 2: return LDKIOError_ConnectionRefused;
108 case 3: return LDKIOError_ConnectionReset;
109 case 4: return LDKIOError_ConnectionAborted;
110 case 5: return LDKIOError_NotConnected;
111 case 6: return LDKIOError_AddrInUse;
112 case 7: return LDKIOError_AddrNotAvailable;
113 case 8: return LDKIOError_BrokenPipe;
114 case 9: return LDKIOError_AlreadyExists;
115 case 10: return LDKIOError_WouldBlock;
116 case 11: return LDKIOError_InvalidInput;
117 case 12: return LDKIOError_InvalidData;
118 case 13: return LDKIOError_TimedOut;
119 case 14: return LDKIOError_WriteZero;
120 case 15: return LDKIOError_Interrupted;
121 case 16: return LDKIOError_Other;
122 case 17: return LDKIOError_UnexpectedEof;
126 static inline int32_t LDKIOError_to_js(LDKIOError val) {
128 case LDKIOError_NotFound: return 0;
129 case LDKIOError_PermissionDenied: return 1;
130 case LDKIOError_ConnectionRefused: return 2;
131 case LDKIOError_ConnectionReset: return 3;
132 case LDKIOError_ConnectionAborted: return 4;
133 case LDKIOError_NotConnected: return 5;
134 case LDKIOError_AddrInUse: return 6;
135 case LDKIOError_AddrNotAvailable: return 7;
136 case LDKIOError_BrokenPipe: return 8;
137 case LDKIOError_AlreadyExists: return 9;
138 case LDKIOError_WouldBlock: return 10;
139 case LDKIOError_InvalidInput: return 11;
140 case LDKIOError_InvalidData: return 12;
141 case LDKIOError_TimedOut: return 13;
142 case LDKIOError_WriteZero: return 14;
143 case LDKIOError_Interrupted: return 15;
144 case LDKIOError_Other: return 16;
145 case LDKIOError_UnexpectedEof: return 17;
149 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
151 case 0: return LDKLevel_Off;
152 case 1: return LDKLevel_Error;
153 case 2: return LDKLevel_Warn;
154 case 3: return LDKLevel_Info;
155 case 4: return LDKLevel_Debug;
156 case 5: return LDKLevel_Trace;
160 static inline int32_t LDKLevel_to_js(LDKLevel val) {
162 case LDKLevel_Off: return 0;
163 case LDKLevel_Error: return 1;
164 case LDKLevel_Warn: return 2;
165 case LDKLevel_Info: return 3;
166 case LDKLevel_Debug: return 4;
167 case LDKLevel_Trace: return 5;
171 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
173 case 0: return LDKNetwork_Bitcoin;
174 case 1: return LDKNetwork_Testnet;
175 case 2: return LDKNetwork_Regtest;
176 case 3: return LDKNetwork_Signet;
180 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
182 case LDKNetwork_Bitcoin: return 0;
183 case LDKNetwork_Testnet: return 1;
184 case LDKNetwork_Regtest: return 2;
185 case LDKNetwork_Signet: return 3;
189 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
191 case 0: return LDKSecp256k1Error_IncorrectSignature;
192 case 1: return LDKSecp256k1Error_InvalidMessage;
193 case 2: return LDKSecp256k1Error_InvalidPublicKey;
194 case 3: return LDKSecp256k1Error_InvalidSignature;
195 case 4: return LDKSecp256k1Error_InvalidSecretKey;
196 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
197 case 6: return LDKSecp256k1Error_InvalidTweak;
198 case 7: return LDKSecp256k1Error_TweakCheckFailed;
199 case 8: return LDKSecp256k1Error_NotEnoughMemory;
203 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
205 case LDKSecp256k1Error_IncorrectSignature: return 0;
206 case LDKSecp256k1Error_InvalidMessage: return 1;
207 case LDKSecp256k1Error_InvalidPublicKey: return 2;
208 case LDKSecp256k1Error_InvalidSignature: return 3;
209 case LDKSecp256k1Error_InvalidSecretKey: return 4;
210 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
211 case LDKSecp256k1Error_InvalidTweak: return 6;
212 case LDKSecp256k1Error_TweakCheckFailed: return 7;
213 case LDKSecp256k1Error_NotEnoughMemory: return 8;
217 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u8Z_new(int8_tArray elems) {
218 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
219 ret->datalen = *((uint32_t*)elems);
220 if (ret->datalen == 0) {
223 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
224 int8_t *java_elems = (int8_t*)(elems + 4);
225 for (size_t i = 0; i < ret->datalen; i++) {
226 ret->data[i] = java_elems[i];
231 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
232 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
233 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
236 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
237 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
239 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
240 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
241 CHECK(val->result_ok);
242 LDKChannelConfig res_var = (*val->contents.result);
243 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
244 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
245 long res_ref = (long)res_var.inner & ~1;
248 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
249 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
250 CHECK(!val->result_ok);
251 LDKDecodeError err_var = (*val->contents.err);
252 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
253 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
254 long err_ref = (long)err_var.inner & ~1;
257 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
258 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
260 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
261 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
262 CHECK(val->result_ok);
263 LDKOutPoint res_var = (*val->contents.result);
264 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
265 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
266 long res_ref = (long)res_var.inner & ~1;
269 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
270 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
271 CHECK(!val->result_ok);
272 LDKDecodeError err_var = (*val->contents.err);
273 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
274 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
275 long err_ref = (long)err_var.inner & ~1;
278 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_result_ok(uint32_t arg) {
279 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
281 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_ok(uint32_t arg) {
282 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
283 CHECK(val->result_ok);
284 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
285 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).bytes, 32);
288 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_err(uint32_t arg) {
289 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
290 CHECK(!val->result_ok);
291 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
294 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_result_ok(uint32_t arg) {
295 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
297 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_ok(uint32_t arg) {
298 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
299 CHECK(val->result_ok);
300 int8_tArray res_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
301 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compressed_form, 33);
304 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_err(uint32_t arg) {
305 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
306 CHECK(!val->result_ok);
307 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
310 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_result_ok(uint32_t arg) {
311 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
313 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t arg) {
314 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
315 CHECK(val->result_ok);
316 LDKTxCreationKeys res_var = (*val->contents.result);
317 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
318 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
319 long res_ref = (long)res_var.inner & ~1;
322 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t arg) {
323 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
324 CHECK(!val->result_ok);
325 LDKDecodeError err_var = (*val->contents.err);
326 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
327 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
328 long err_ref = (long)err_var.inner & ~1;
331 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_result_ok(uint32_t arg) {
332 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
334 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t arg) {
335 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
336 CHECK(val->result_ok);
337 LDKChannelPublicKeys res_var = (*val->contents.result);
338 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
339 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
340 long res_ref = (long)res_var.inner & ~1;
343 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t arg) {
344 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
345 CHECK(!val->result_ok);
346 LDKDecodeError err_var = (*val->contents.err);
347 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
348 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
349 long err_ref = (long)err_var.inner & ~1;
352 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_result_ok(uint32_t arg) {
353 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
355 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_ok(uint32_t arg) {
356 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
357 CHECK(val->result_ok);
358 LDKTxCreationKeys res_var = (*val->contents.result);
359 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
360 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
361 long res_ref = (long)res_var.inner & ~1;
364 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_err(uint32_t arg) {
365 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
366 CHECK(!val->result_ok);
367 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
370 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u32Z_ref_from_ptr(uint32_t ptr) {
371 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
373 case LDKCOption_u32Z_Some: {
374 return 0 /* LDKCOption_u32Z - Some */; (void) obj->some;
376 case LDKCOption_u32Z_None: {
377 return 0 /* LDKCOption_u32Z - None */;
382 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_result_ok(uint32_t arg) {
383 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
385 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
386 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
387 CHECK(val->result_ok);
388 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
389 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
390 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
391 long res_ref = (long)res_var.inner & ~1;
394 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
395 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
396 CHECK(!val->result_ok);
397 LDKDecodeError err_var = (*val->contents.err);
398 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
399 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
400 long err_ref = (long)err_var.inner & ~1;
403 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
404 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
406 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
407 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
408 CHECK(val->result_ok);
409 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
410 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
411 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
412 long res_ref = (long)res_var.inner & ~1;
415 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
416 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
417 CHECK(!val->result_ok);
418 LDKDecodeError err_var = (*val->contents.err);
419 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
420 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
421 long err_ref = (long)err_var.inner & ~1;
424 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
425 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
427 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
428 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
429 CHECK(val->result_ok);
430 LDKChannelTransactionParameters res_var = (*val->contents.result);
431 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
432 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
433 long res_ref = (long)res_var.inner & ~1;
436 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
437 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
438 CHECK(!val->result_ok);
439 LDKDecodeError err_var = (*val->contents.err);
440 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
441 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
442 long err_ref = (long)err_var.inner & ~1;
445 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
446 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
448 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
449 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
450 CHECK(val->result_ok);
451 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
452 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
453 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
454 long res_ref = (long)res_var.inner & ~1;
457 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
458 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
459 CHECK(!val->result_ok);
460 LDKDecodeError err_var = (*val->contents.err);
461 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
462 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
463 long err_ref = (long)err_var.inner & ~1;
466 jboolean __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
467 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
469 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
470 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
471 CHECK(val->result_ok);
472 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
473 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
474 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
475 long res_ref = (long)res_var.inner & ~1;
478 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
479 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
480 CHECK(!val->result_ok);
481 LDKDecodeError err_var = (*val->contents.err);
482 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
483 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
484 long err_ref = (long)err_var.inner & ~1;
487 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
488 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
490 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
491 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
492 CHECK(val->result_ok);
493 LDKCommitmentTransaction res_var = (*val->contents.result);
494 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
495 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
496 long res_ref = (long)res_var.inner & ~1;
499 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
500 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
501 CHECK(!val->result_ok);
502 LDKDecodeError err_var = (*val->contents.err);
503 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
504 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
505 long err_ref = (long)err_var.inner & ~1;
508 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_result_ok(uint32_t arg) {
509 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
511 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
512 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
513 CHECK(val->result_ok);
514 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
515 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
516 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
517 long res_ref = (long)res_var.inner & ~1;
520 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
521 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
522 CHECK(!val->result_ok);
523 return *val->contents.err;
525 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_result_ok(uint32_t arg) {
526 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
528 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
529 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
530 CHECK(val->result_ok);
531 LDKCVec_SignatureZ res_var = (*val->contents.result);
532 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
533 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
534 for (size_t m = 0; m < res_var.datalen; m++) {
535 int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
536 memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64);
537 res_arr_ptr[m] = res_conv_12_arr;
541 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
542 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
543 CHECK(!val->result_ok);
544 return *val->contents.err;
546 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
547 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
549 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
550 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
551 CHECK(val->result_ok);
552 LDKChannelMonitorUpdate res_var = (*val->contents.result);
553 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
554 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
555 long res_ref = (long)res_var.inner & ~1;
558 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
559 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
560 CHECK(!val->result_ok);
561 LDKDecodeError err_var = (*val->contents.err);
562 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
563 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
564 long err_ref = (long)err_var.inner & ~1;
567 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
568 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
570 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
571 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
572 CHECK(val->result_ok);
573 LDKHTLCUpdate res_var = (*val->contents.result);
574 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
575 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
576 long res_ref = (long)res_var.inner & ~1;
579 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
580 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
581 CHECK(!val->result_ok);
582 LDKDecodeError err_var = (*val->contents.err);
583 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
584 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
585 long err_ref = (long)err_var.inner & ~1;
588 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
589 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
591 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
592 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
593 CHECK(val->result_ok);
594 return *val->contents.result;
596 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
597 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
598 CHECK(!val->result_ok);
599 LDKMonitorUpdateError err_var = (*val->contents.err);
600 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
601 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
602 long err_ref = (long)err_var.inner & ~1;
605 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
606 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
608 a_conv.inner = (void*)(a & (~1));
609 a_conv.is_owned = (a & 1) || (a == 0);
610 a_conv = OutPoint_clone(&a_conv);
613 b_ref.datalen = *((uint32_t*)b);
614 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
615 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
619 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_a(uint32_t ptr) {
620 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
621 LDKOutPoint a_var = tuple->a;
622 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
623 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
624 long a_ref = (long)a_var.inner & ~1;
627 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_b(uint32_t ptr) {
628 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
629 LDKCVec_u8Z b_var = tuple->b;
630 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
631 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
634 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
635 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
638 b_ref.datalen = *((uint32_t*)b);
639 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
640 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
644 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_a(uint32_t ptr) {
645 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
648 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_b(uint32_t ptr) {
649 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
650 LDKCVec_u8Z b_var = tuple->b;
651 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
652 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
655 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32ScriptZZ_new(uint32_tArray elems) {
656 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
657 ret->datalen = *((uint32_t*)elems);
658 if (ret->datalen == 0) {
661 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
662 uint32_t *java_elems = (uint32_t*)(elems + 4);
663 for (size_t i = 0; i < ret->datalen; i++) {
664 uint32_t arr_elem = java_elems[i];
665 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
666 // Warning: we may need a move here but no clone is available for LDKC2Tuple_u32ScriptZ
667 ret->data[i] = arr_elem_conv;
672 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
673 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
674 LDKThirtyTwoBytes a_ref;
675 CHECK(*((uint32_t*)a) == 32);
676 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
678 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
679 b_constr.datalen = *((uint32_t*)b);
680 if (b_constr.datalen > 0)
681 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
683 b_constr.data = NULL;
684 uint32_t* b_vals = (uint32_t*)(b + 4);
685 for (size_t e = 0; e < b_constr.datalen; e++) {
686 uint32_t b_conv_30 = b_vals[e];
687 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
688 // Warning: we may need a move here but no clone is available for LDKC2Tuple_u32ScriptZ
689 b_constr.data[e] = b_conv_30_conv;
694 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t ptr) {
695 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
696 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
697 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
700 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t ptr) {
701 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
702 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
703 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
704 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
705 for (size_t e = 0; e < b_var.datalen; e++) {
706 long b_conv_30_ref = (long)(&b_var.data[e]) | 1;
707 b_arr_ptr[e] = b_conv_30_ref;
711 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_new(uint32_tArray elems) {
712 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
713 ret->datalen = *((uint32_t*)elems);
714 if (ret->datalen == 0) {
717 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ 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 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
722 // Warning: we may need a move here but no clone is available for LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ
723 ret->data[i] = arr_elem_conv;
728 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
729 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
731 case LDKMonitorEvent_HTLCEvent: {
732 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
733 CHECK((((long)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
734 CHECK((((long)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
735 long htlc_event_ref = (long)htlc_event_var.inner & ~1;
736 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
738 case LDKMonitorEvent_CommitmentTxBroadcasted: {
739 LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
740 CHECK((((long)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
741 CHECK((((long)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
742 long commitment_tx_broadcasted_ref = (long)commitment_tx_broadcasted_var.inner & ~1;
743 return 0 /* LDKMonitorEvent - CommitmentTxBroadcasted */; (void) commitment_tx_broadcasted_ref;
748 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) {
749 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
750 ret->datalen = *((uint32_t*)elems);
751 if (ret->datalen == 0) {
754 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
755 uint32_t *java_elems = (uint32_t*)(elems + 4);
756 for (size_t i = 0; i < ret->datalen; i++) {
757 uint32_t arr_elem = java_elems[i];
758 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
759 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
760 ret->data[i] = arr_elem_conv;
765 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
766 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
767 for (size_t i = 0; i < ret.datalen; i++) {
768 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
772 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
773 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
775 case LDKSpendableOutputDescriptor_StaticOutput: {
776 LDKOutPoint outpoint_var = obj->static_output.outpoint;
777 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
778 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
779 long outpoint_ref = (long)outpoint_var.inner & ~1;
780 long output_ref = ((long)&obj->static_output.output) | 1;
781 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (long)output_ref;
783 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
784 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
785 CHECK((((long)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
786 CHECK((((long)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
787 long delayed_payment_output_ref = (long)delayed_payment_output_var.inner & ~1;
788 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
790 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
791 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
792 CHECK((((long)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
793 CHECK((((long)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
794 long static_payment_output_ref = (long)static_payment_output_var.inner & ~1;
795 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
800 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_SpendableOutputDescriptorZ_new(uint32_tArray elems) {
801 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
802 ret->datalen = *((uint32_t*)elems);
803 if (ret->datalen == 0) {
806 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
807 uint32_t *java_elems = (uint32_t*)(elems + 4);
808 for (size_t i = 0; i < ret->datalen; i++) {
809 uint32_t arr_elem = java_elems[i];
810 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
811 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
812 ret->data[i] = arr_elem_conv;
817 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
818 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
819 for (size_t i = 0; i < ret.datalen; i++) {
820 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
824 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
825 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
827 case LDKEvent_FundingGenerationReady: {
828 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
829 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
830 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
831 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
832 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
833 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;
835 case LDKEvent_PaymentReceived: {
836 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
837 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
838 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
839 memcpy((uint8_t*)(payment_secret_arr + 4), obj->payment_received.payment_secret.data, 32);
840 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) payment_secret_arr; (void) obj->payment_received.amt;
842 case LDKEvent_PaymentSent: {
843 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
844 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
845 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
847 case LDKEvent_PaymentFailed: {
848 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
849 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_failed.payment_hash.data, 32);
850 return 0 /* LDKEvent - PaymentFailed */; (void) payment_hash_arr; (void) obj->payment_failed.rejected_by_dest;
852 case LDKEvent_PendingHTLCsForwardable: {
853 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
855 case LDKEvent_SpendableOutputs: {
856 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
857 uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
858 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
859 for (size_t b = 0; b < outputs_var.datalen; b++) {
860 long outputs_conv_27_ref = ((long)&outputs_var.data[b]) | 1;
861 outputs_arr_ptr[b] = outputs_conv_27_ref;
863 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
868 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
869 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
870 ret->datalen = *((uint32_t*)elems);
871 if (ret->datalen == 0) {
874 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
875 uint32_t *java_elems = (uint32_t*)(elems + 4);
876 for (size_t i = 0; i < ret->datalen; i++) {
877 uint32_t arr_elem = java_elems[i];
878 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
879 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
880 ret->data[i] = arr_elem_conv;
885 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
886 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
887 for (size_t i = 0; i < ret.datalen; i++) {
888 ret.data[i] = Event_clone(&orig->data[i]);
892 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
893 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
895 LDKTransaction b_ref;
896 b_ref.datalen = *((uint32_t*)b);
897 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
898 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
899 b_ref.data_is_owned = false;
903 int64_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_a(uint32_t ptr) {
904 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
907 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_b(uint32_t ptr) {
908 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
909 LDKTransaction b_var = tuple->b;
910 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
911 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
914 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_usizeTransactionZZ_new(uint32_tArray elems) {
915 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
916 ret->datalen = *((uint32_t*)elems);
917 if (ret->datalen == 0) {
920 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
921 uint32_t *java_elems = (uint32_t*)(elems + 4);
922 for (size_t i = 0; i < ret->datalen; i++) {
923 uint32_t arr_elem = java_elems[i];
924 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
925 // Warning: we may need a move here but no clone is available for LDKC2Tuple_usizeTransactionZ
926 ret->data[i] = arr_elem_conv;
931 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
932 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
934 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
935 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
939 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_a(uint32_t ptr) {
940 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
943 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_b(uint32_t ptr) {
944 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
945 long b_ref = ((long)&tuple->b) | 1;
948 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
949 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
950 ret->datalen = *((uint32_t*)elems);
951 if (ret->datalen == 0) {
954 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
955 uint32_t *java_elems = (uint32_t*)(elems + 4);
956 for (size_t i = 0; i < ret->datalen; i++) {
957 uint32_t arr_elem = java_elems[i];
958 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
959 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
960 ret->data[i] = arr_elem_conv;
965 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
966 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
967 for (size_t i = 0; i < ret.datalen; i++) {
968 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
972 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
973 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
974 LDKThirtyTwoBytes a_ref;
975 CHECK(*((uint32_t*)a) == 32);
976 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
978 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
979 b_constr.datalen = *((uint32_t*)b);
980 if (b_constr.datalen > 0)
981 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
983 b_constr.data = NULL;
984 uint32_t* b_vals = (uint32_t*)(b + 4);
985 for (size_t z = 0; z < b_constr.datalen; z++) {
986 uint32_t b_conv_25 = b_vals[z];
987 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
988 b_conv_25_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1));
989 b_constr.data[z] = b_conv_25_conv;
994 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t ptr) {
995 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
996 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
997 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
1000 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t ptr) {
1001 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
1002 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
1003 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1004 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
1005 for (size_t z = 0; z < b_var.datalen; z++) {
1006 long b_conv_25_ref = (long)(&b_var.data[z]) | 1;
1007 b_arr_ptr[z] = b_conv_25_ref;
1011 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
1012 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
1013 ret->datalen = *((uint32_t*)elems);
1014 if (ret->datalen == 0) {
1017 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
1018 uint32_t *java_elems = (uint32_t*)(elems + 4);
1019 for (size_t i = 0; i < ret->datalen; i++) {
1020 uint32_t arr_elem = java_elems[i];
1021 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
1022 // Warning: we may need a move here but no clone is available for LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ
1023 ret->data[i] = arr_elem_conv;
1028 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1029 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1030 for (size_t i = 0; i < ret.datalen; i++) {
1031 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1035 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(uint32_t arg) {
1036 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1038 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
1039 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1040 CHECK(val->result_ok);
1041 return *val->contents.result;
1043 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
1044 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1045 CHECK(!val->result_ok);
1046 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
1049 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
1050 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1052 CHECK(*((uint32_t*)a) == 64);
1053 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
1055 LDKCVec_SignatureZ b_constr;
1056 b_constr.datalen = *((uint32_t*)b);
1057 if (b_constr.datalen > 0)
1058 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1060 b_constr.data = NULL;
1061 int8_tArray* b_vals = (int8_tArray*)(b + 4);
1062 for (size_t m = 0; m < b_constr.datalen; m++) {
1063 int8_tArray b_conv_12 = b_vals[m];
1064 LDKSignature b_conv_12_ref;
1065 CHECK(*((uint32_t*)b_conv_12) == 64);
1066 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
1067 b_constr.data[m] = b_conv_12_ref;
1072 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t ptr) {
1073 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1074 int8_tArray a_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1075 memcpy((uint8_t*)(a_arr + 4), tuple->a.compact_form, 64);
1078 ptrArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t ptr) {
1079 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1080 LDKCVec_SignatureZ b_var = tuple->b;
1081 ptrArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1082 int8_tArray *b_arr_ptr = (int8_tArray*)(b_arr + 4);
1083 for (size_t m = 0; m < b_var.datalen; m++) {
1084 int8_tArray b_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1085 memcpy((uint8_t*)(b_conv_12_arr + 4), b_var.data[m].compact_form, 64);
1086 b_arr_ptr[m] = b_conv_12_arr;
1090 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(uint32_t arg) {
1091 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1093 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1094 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1095 CHECK(val->result_ok);
1096 long res_ref = (long)(&(*val->contents.result)) | 1;
1099 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1100 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1101 CHECK(!val->result_ok);
1102 return *val->contents.err;
1104 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_result_ok(uint32_t arg) {
1105 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1107 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1108 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1109 CHECK(val->result_ok);
1110 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1111 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1114 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1115 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1116 CHECK(!val->result_ok);
1117 return *val->contents.err;
1119 typedef struct LDKBaseSign_JCalls {
1120 atomic_size_t refcnt;
1121 uint32_t get_per_commitment_point_meth;
1122 uint32_t release_commitment_secret_meth;
1123 uint32_t channel_keys_id_meth;
1124 uint32_t sign_counterparty_commitment_meth;
1125 uint32_t sign_holder_commitment_and_htlcs_meth;
1126 uint32_t sign_justice_transaction_meth;
1127 uint32_t sign_counterparty_htlc_transaction_meth;
1128 uint32_t sign_closing_transaction_meth;
1129 uint32_t sign_channel_announcement_meth;
1130 uint32_t ready_channel_meth;
1131 } LDKBaseSign_JCalls;
1132 static void LDKBaseSign_JCalls_free(void* this_arg) {
1133 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1134 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1135 js_free(j_calls->get_per_commitment_point_meth);
1136 js_free(j_calls->release_commitment_secret_meth);
1137 js_free(j_calls->channel_keys_id_meth);
1138 js_free(j_calls->sign_counterparty_commitment_meth);
1139 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1140 js_free(j_calls->sign_justice_transaction_meth);
1141 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1142 js_free(j_calls->sign_closing_transaction_meth);
1143 js_free(j_calls->sign_channel_announcement_meth);
1144 js_free(j_calls->ready_channel_meth);
1148 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1149 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1150 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1151 LDKPublicKey ret_ref;
1152 CHECK(*((uint32_t*)ret) == 33);
1153 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1156 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1157 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1158 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1159 LDKThirtyTwoBytes ret_ref;
1160 CHECK(*((uint32_t*)ret) == 32);
1161 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1164 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1165 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1166 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1167 LDKThirtyTwoBytes ret_ref;
1168 CHECK(*((uint32_t*)ret) == 32);
1169 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1172 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1173 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1174 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1175 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1176 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1177 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1178 long commitment_tx_ref = (long)commitment_tx_var.inner;
1179 if (commitment_tx_var.is_owned) {
1180 commitment_tx_ref |= 1;
1182 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1183 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1184 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1187 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1188 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1189 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1190 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1191 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1192 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1193 long commitment_tx_ref = (long)commitment_tx_var.inner;
1194 if (commitment_tx_var.is_owned) {
1195 commitment_tx_ref |= 1;
1197 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1198 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1199 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1202 LDKCResult_SignatureNoneZ sign_justice_transaction_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) {
1203 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1204 LDKTransaction justice_tx_var = justice_tx;
1205 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1206 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1207 Transaction_free(justice_tx_var);
1208 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1209 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1210 LDKHTLCOutputInCommitment htlc_var = *htlc;
1211 htlc_var = HTLCOutputInCommitment_clone(htlc);
1212 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1213 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1214 long htlc_ref = (long)htlc_var.inner;
1215 if (htlc_var.is_owned) {
1218 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_5(j_calls->sign_justice_transaction_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
1219 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1220 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1223 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) {
1224 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1225 LDKTransaction htlc_tx_var = htlc_tx;
1226 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1227 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1228 Transaction_free(htlc_tx_var);
1229 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1230 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1231 LDKHTLCOutputInCommitment htlc_var = *htlc;
1232 htlc_var = HTLCOutputInCommitment_clone(htlc);
1233 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1234 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1235 long htlc_ref = (long)htlc_var.inner;
1236 if (htlc_var.is_owned) {
1239 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_5(j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
1240 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1241 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1244 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
1245 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1246 LDKTransaction closing_tx_var = closing_tx;
1247 int8_tArray closing_tx_arr = init_arr(closing_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1248 memcpy((uint8_t*)(closing_tx_arr + 4), closing_tx_var.data, closing_tx_var.datalen);
1249 Transaction_free(closing_tx_var);
1250 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_arr);
1251 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1252 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1255 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1256 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1257 LDKUnsignedChannelAnnouncement msg_var = *msg;
1258 msg_var = UnsignedChannelAnnouncement_clone(msg);
1259 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1260 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1261 long msg_ref = (long)msg_var.inner;
1262 if (msg_var.is_owned) {
1265 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
1266 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1267 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1270 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1271 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1272 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1273 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1274 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1275 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1276 long channel_parameters_ref = (long)channel_parameters_var.inner;
1277 if (channel_parameters_var.is_owned) {
1278 channel_parameters_ref |= 1;
1280 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
1282 static void* LDKBaseSign_JCalls_clone(const void* this_arg) {
1283 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1284 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1285 return (void*) this_arg;
1287 static inline LDKBaseSign LDKBaseSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1288 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
1289 atomic_init(&calls->refcnt, 1);
1290 //TODO: Assign calls->o from o
1292 LDKChannelPublicKeys pubkeys_conv;
1293 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1294 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1295 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1298 .this_arg = (void*) calls,
1299 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
1300 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
1301 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
1302 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
1303 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
1304 .sign_justice_transaction = sign_justice_transaction_LDKBaseSign_jcall,
1305 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
1306 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
1307 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
1308 .ready_channel = ready_channel_LDKBaseSign_jcall,
1309 .free = LDKBaseSign_JCalls_free,
1310 .pubkeys = pubkeys_conv,
1311 .set_pubkeys = NULL,
1315 long __attribute__((visibility("default"))) TS_LDKBaseSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1316 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
1317 *res_ptr = LDKBaseSign_init(o, pubkeys);
1318 return (long)res_ptr;
1320 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
1321 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1322 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1323 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1327 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
1328 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1329 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1330 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1334 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
1335 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1336 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1337 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1341 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
1342 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1343 LDKCommitmentTransaction commitment_tx_conv;
1344 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1345 commitment_tx_conv.is_owned = false;
1346 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1347 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1348 return (long)ret_conv;
1351 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
1352 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1353 LDKHolderCommitmentTransaction commitment_tx_conv;
1354 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1355 commitment_tx_conv.is_owned = false;
1356 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1357 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1358 return (long)ret_conv;
1361 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_justice_transaction(uint32_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, uint32_t htlc) {
1362 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1363 LDKTransaction justice_tx_ref;
1364 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1365 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1366 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1367 justice_tx_ref.data_is_owned = true;
1368 unsigned char per_commitment_key_arr[32];
1369 CHECK(*((uint32_t*)per_commitment_key) == 32);
1370 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1371 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1372 LDKHTLCOutputInCommitment htlc_conv;
1373 htlc_conv.inner = (void*)(htlc & (~1));
1374 htlc_conv.is_owned = false;
1375 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1376 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
1377 return (long)ret_conv;
1380 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) {
1381 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1382 LDKTransaction htlc_tx_ref;
1383 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
1384 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1385 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
1386 htlc_tx_ref.data_is_owned = true;
1387 LDKPublicKey per_commitment_point_ref;
1388 CHECK(*((uint32_t*)per_commitment_point) == 33);
1389 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
1390 LDKHTLCOutputInCommitment htlc_conv;
1391 htlc_conv.inner = (void*)(htlc & (~1));
1392 htlc_conv.is_owned = false;
1393 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1394 *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);
1395 return (long)ret_conv;
1398 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, int8_tArray closing_tx) {
1399 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1400 LDKTransaction closing_tx_ref;
1401 closing_tx_ref.datalen = *((uint32_t*)closing_tx);
1402 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
1403 memcpy(closing_tx_ref.data, (uint8_t*)(closing_tx + 4), closing_tx_ref.datalen);
1404 closing_tx_ref.data_is_owned = true;
1405 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1406 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
1407 return (long)ret_conv;
1410 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
1411 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1412 LDKUnsignedChannelAnnouncement msg_conv;
1413 msg_conv.inner = (void*)(msg & (~1));
1414 msg_conv.is_owned = false;
1415 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1416 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1417 return (long)ret_conv;
1420 void __attribute__((visibility("default"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
1421 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1422 LDKChannelTransactionParameters channel_parameters_conv;
1423 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1424 channel_parameters_conv.is_owned = false;
1425 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1428 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
1429 if (this_arg->set_pubkeys != NULL)
1430 this_arg->set_pubkeys(this_arg);
1431 return this_arg->pubkeys;
1433 uint32_t __attribute__((visibility("default"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
1434 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1435 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
1436 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1437 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1438 long ret_ref = (long)ret_var.inner;
1439 if (ret_var.is_owned) {
1445 typedef struct LDKSign_JCalls {
1446 atomic_size_t refcnt;
1447 LDKBaseSign_JCalls* BaseSign;
1448 uint32_t write_meth;
1450 static void LDKSign_JCalls_free(void* this_arg) {
1451 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1452 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1453 js_free(j_calls->write_meth);
1457 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
1458 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1459 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
1460 LDKCVec_u8Z ret_ref;
1461 ret_ref.datalen = *((uint32_t*)ret);
1462 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
1463 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
1466 static void* LDKSign_JCalls_clone(const void* this_arg) {
1467 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1468 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1469 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
1470 return (void*) this_arg;
1472 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* BaseSign, uint32_t pubkeys) {
1473 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
1474 atomic_init(&calls->refcnt, 1);
1475 //TODO: Assign calls->o from o
1477 LDKChannelPublicKeys pubkeys_conv;
1478 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1479 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1480 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1483 .this_arg = (void*) calls,
1484 .write = write_LDKSign_jcall,
1485 .clone = LDKSign_JCalls_clone,
1486 .free = LDKSign_JCalls_free,
1487 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
1489 calls->BaseSign = ret.BaseSign.this_arg;
1492 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* BaseSign, uint32_t pubkeys) {
1493 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
1494 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
1495 return (long)res_ptr;
1497 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
1498 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
1499 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1500 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1501 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
1502 CVec_u8Z_free(ret_var);
1506 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
1507 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
1508 LDKThirtyTwoBytes a_ref;
1509 CHECK(*((uint32_t*)a) == 32);
1510 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
1512 LDKChannelMonitor b_conv;
1513 b_conv.inner = (void*)(b & (~1));
1514 b_conv.is_owned = (b & 1) || (b == 0);
1515 b_conv = ChannelMonitor_clone(&b_conv);
1519 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t ptr) {
1520 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
1521 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1522 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
1525 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t ptr) {
1526 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
1527 LDKChannelMonitor b_var = tuple->b;
1528 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1529 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1530 long b_ref = (long)b_var.inner & ~1;
1533 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
1534 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
1536 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
1537 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
1538 CHECK(val->result_ok);
1539 long res_ref = (long)(&(*val->contents.result)) | 1;
1542 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
1543 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
1544 CHECK(!val->result_ok);
1545 LDKDecodeError err_var = (*val->contents.err);
1546 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1547 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1548 long err_ref = (long)err_var.inner & ~1;
1551 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) {
1552 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1553 ret->datalen = *((uint32_t*)elems);
1554 if (ret->datalen == 0) {
1557 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1558 uint32_t *java_elems = (uint32_t*)(elems + 4);
1559 for (size_t i = 0; i < ret->datalen; i++) {
1560 uint32_t arr_elem = java_elems[i];
1561 LDKRouteHop arr_elem_conv;
1562 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1563 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1564 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1565 ret->data[i] = arr_elem_conv;
1570 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1571 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1572 for (size_t i = 0; i < ret.datalen; i++) {
1573 ret.data[i] = RouteHop_clone(&orig->data[i]);
1577 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1578 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1579 for (size_t i = 0; i < ret.datalen; i++) {
1580 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1584 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_result_ok(uint32_t arg) {
1585 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1587 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
1588 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1589 CHECK(val->result_ok);
1590 LDKRoute res_var = (*val->contents.result);
1591 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1592 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1593 long res_ref = (long)res_var.inner & ~1;
1596 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
1597 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1598 CHECK(!val->result_ok);
1599 LDKDecodeError err_var = (*val->contents.err);
1600 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1601 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1602 long err_ref = (long)err_var.inner & ~1;
1605 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
1606 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1608 case LDKCOption_u64Z_Some: {
1609 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
1611 case LDKCOption_u64Z_None: {
1612 return 0 /* LDKCOption_u64Z - None */;
1617 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) {
1618 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1619 ret->datalen = *((uint32_t*)elems);
1620 if (ret->datalen == 0) {
1623 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1624 uint32_t *java_elems = (uint32_t*)(elems + 4);
1625 for (size_t i = 0; i < ret->datalen; i++) {
1626 uint32_t arr_elem = java_elems[i];
1627 LDKChannelDetails arr_elem_conv;
1628 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1629 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1630 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1631 ret->data[i] = arr_elem_conv;
1636 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1637 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1638 for (size_t i = 0; i < ret.datalen; i++) {
1639 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1643 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintZ_new(uint32_tArray elems) {
1644 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
1645 ret->datalen = *((uint32_t*)elems);
1646 if (ret->datalen == 0) {
1649 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
1650 uint32_t *java_elems = (uint32_t*)(elems + 4);
1651 for (size_t i = 0; i < ret->datalen; i++) {
1652 uint32_t arr_elem = java_elems[i];
1653 LDKRouteHint arr_elem_conv;
1654 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1655 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1656 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
1657 ret->data[i] = arr_elem_conv;
1662 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1663 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1664 for (size_t i = 0; i < ret.datalen; i++) {
1665 ret.data[i] = RouteHint_clone(&orig->data[i]);
1669 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_result_ok(uint32_t arg) {
1670 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1672 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
1673 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1674 CHECK(val->result_ok);
1675 LDKRoute res_var = (*val->contents.result);
1676 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1677 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1678 long res_ref = (long)res_var.inner & ~1;
1681 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
1682 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1683 CHECK(!val->result_ok);
1684 LDKLightningError err_var = (*val->contents.err);
1685 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1686 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1687 long err_ref = (long)err_var.inner & ~1;
1690 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
1691 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1693 case LDKErrorAction_DisconnectPeer: {
1694 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1695 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1696 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1697 long msg_ref = (long)msg_var.inner & ~1;
1698 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
1700 case LDKErrorAction_IgnoreError: {
1701 return 0 /* LDKErrorAction - IgnoreError */;
1703 case LDKErrorAction_SendErrorMessage: {
1704 LDKErrorMessage msg_var = obj->send_error_message.msg;
1705 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1706 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1707 long msg_ref = (long)msg_var.inner & ~1;
1708 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
1713 uint32_t __attribute__((visibility("default"))) TS_LDKHTLCFailChannelUpdate_ref_from_ptr(uint32_t ptr) {
1714 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
1716 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1717 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1718 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1719 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1720 long msg_ref = (long)msg_var.inner & ~1;
1721 return 0 /* LDKHTLCFailChannelUpdate - ChannelUpdateMessage */; (void) msg_ref;
1723 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1724 return 0 /* LDKHTLCFailChannelUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
1726 case LDKHTLCFailChannelUpdate_NodeFailure: {
1727 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1728 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
1729 return 0 /* LDKHTLCFailChannelUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
1734 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
1735 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1737 case LDKMessageSendEvent_SendAcceptChannel: {
1738 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1739 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
1740 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1741 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1742 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1743 long msg_ref = (long)msg_var.inner & ~1;
1744 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
1746 case LDKMessageSendEvent_SendOpenChannel: {
1747 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1748 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
1749 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1750 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1751 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1752 long msg_ref = (long)msg_var.inner & ~1;
1753 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
1755 case LDKMessageSendEvent_SendFundingCreated: {
1756 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1757 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
1758 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1759 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1760 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1761 long msg_ref = (long)msg_var.inner & ~1;
1762 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
1764 case LDKMessageSendEvent_SendFundingSigned: {
1765 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1766 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
1767 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1768 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1769 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1770 long msg_ref = (long)msg_var.inner & ~1;
1771 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
1773 case LDKMessageSendEvent_SendFundingLocked: {
1774 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1775 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
1776 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1777 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1778 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1779 long msg_ref = (long)msg_var.inner & ~1;
1780 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
1782 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1783 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1784 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
1785 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1786 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1787 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1788 long msg_ref = (long)msg_var.inner & ~1;
1789 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
1791 case LDKMessageSendEvent_UpdateHTLCs: {
1792 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1793 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
1794 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1795 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1796 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1797 long updates_ref = (long)updates_var.inner & ~1;
1798 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
1800 case LDKMessageSendEvent_SendRevokeAndACK: {
1801 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1802 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
1803 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1804 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1805 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1806 long msg_ref = (long)msg_var.inner & ~1;
1807 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
1809 case LDKMessageSendEvent_SendClosingSigned: {
1810 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1811 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
1812 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1813 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1814 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1815 long msg_ref = (long)msg_var.inner & ~1;
1816 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
1818 case LDKMessageSendEvent_SendShutdown: {
1819 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1820 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
1821 LDKShutdown msg_var = obj->send_shutdown.msg;
1822 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1823 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1824 long msg_ref = (long)msg_var.inner & ~1;
1825 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
1827 case LDKMessageSendEvent_SendChannelReestablish: {
1828 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1829 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
1830 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1831 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1832 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1833 long msg_ref = (long)msg_var.inner & ~1;
1834 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
1836 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1837 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1838 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1839 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1840 long msg_ref = (long)msg_var.inner & ~1;
1841 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1842 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1843 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1844 long update_msg_ref = (long)update_msg_var.inner & ~1;
1845 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
1847 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1848 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1849 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1850 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1851 long msg_ref = (long)msg_var.inner & ~1;
1852 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
1854 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1855 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1856 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1857 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1858 long msg_ref = (long)msg_var.inner & ~1;
1859 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
1861 case LDKMessageSendEvent_HandleError: {
1862 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1863 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
1864 long action_ref = ((long)&obj->handle_error.action) | 1;
1865 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
1867 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1868 long update_ref = ((long)&obj->payment_failure_network_update.update) | 1;
1869 return 0 /* LDKMessageSendEvent - PaymentFailureNetworkUpdate */; (void) update_ref;
1871 case LDKMessageSendEvent_SendChannelRangeQuery: {
1872 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1873 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
1874 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1875 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1876 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1877 long msg_ref = (long)msg_var.inner & ~1;
1878 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
1880 case LDKMessageSendEvent_SendShortIdsQuery: {
1881 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1882 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
1883 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1884 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1885 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1886 long msg_ref = (long)msg_var.inner & ~1;
1887 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
1889 case LDKMessageSendEvent_SendReplyChannelRange: {
1890 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1891 memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33);
1892 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1893 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1894 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1895 long msg_ref = (long)msg_var.inner & ~1;
1896 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
1901 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MessageSendEventZ_new(uint32_tArray elems) {
1902 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1903 ret->datalen = *((uint32_t*)elems);
1904 if (ret->datalen == 0) {
1907 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1908 uint32_t *java_elems = (uint32_t*)(elems + 4);
1909 for (size_t i = 0; i < ret->datalen; i++) {
1910 uint32_t arr_elem = java_elems[i];
1911 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1912 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1913 ret->data[i] = arr_elem_conv;
1918 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1919 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1920 for (size_t i = 0; i < ret.datalen; i++) {
1921 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1925 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
1926 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
1928 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
1929 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
1930 CHECK(val->result_ok);
1931 return *val->contents.result;
1933 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
1934 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
1935 CHECK(!val->result_ok);
1936 LDKLightningError err_var = (*val->contents.err);
1937 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1938 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1939 long err_ref = (long)err_var.inner & ~1;
1942 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
1943 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
1944 LDKChannelAnnouncement a_conv;
1945 a_conv.inner = (void*)(a & (~1));
1946 a_conv.is_owned = (a & 1) || (a == 0);
1947 a_conv = ChannelAnnouncement_clone(&a_conv);
1949 LDKChannelUpdate b_conv;
1950 b_conv.inner = (void*)(b & (~1));
1951 b_conv.is_owned = (b & 1) || (b == 0);
1952 b_conv = ChannelUpdate_clone(&b_conv);
1954 LDKChannelUpdate c_conv;
1955 c_conv.inner = (void*)(c & (~1));
1956 c_conv.is_owned = (c & 1) || (c == 0);
1957 c_conv = ChannelUpdate_clone(&c_conv);
1961 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t ptr) {
1962 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1963 LDKChannelAnnouncement a_var = tuple->a;
1964 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1965 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1966 long a_ref = (long)a_var.inner & ~1;
1969 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t ptr) {
1970 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1971 LDKChannelUpdate b_var = tuple->b;
1972 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1973 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1974 long b_ref = (long)b_var.inner & ~1;
1977 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t ptr) {
1978 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1979 LDKChannelUpdate c_var = tuple->c;
1980 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1981 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1982 long c_ref = (long)c_var.inner & ~1;
1985 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
1986 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
1987 ret->datalen = *((uint32_t*)elems);
1988 if (ret->datalen == 0) {
1991 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
1992 uint32_t *java_elems = (uint32_t*)(elems + 4);
1993 for (size_t i = 0; i < ret->datalen; i++) {
1994 uint32_t arr_elem = java_elems[i];
1995 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
1996 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
1997 ret->data[i] = arr_elem_conv;
2002 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
2003 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
2004 for (size_t i = 0; i < ret.datalen; i++) {
2005 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
2009 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
2010 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
2011 ret->datalen = *((uint32_t*)elems);
2012 if (ret->datalen == 0) {
2015 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
2016 uint32_t *java_elems = (uint32_t*)(elems + 4);
2017 for (size_t i = 0; i < ret->datalen; i++) {
2018 uint32_t arr_elem = java_elems[i];
2019 LDKNodeAnnouncement arr_elem_conv;
2020 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2021 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2022 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
2023 ret->data[i] = arr_elem_conv;
2028 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
2029 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
2030 for (size_t i = 0; i < ret.datalen; i++) {
2031 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
2035 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
2036 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
2038 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
2039 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
2040 CHECK(val->result_ok);
2041 return *val->contents.result;
2043 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
2044 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
2045 CHECK(!val->result_ok);
2046 LDKLightningError err_var = (*val->contents.err);
2047 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2048 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2049 long err_ref = (long)err_var.inner & ~1;
2052 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
2053 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
2055 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
2056 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
2057 CHECK(val->result_ok);
2058 LDKCVec_u8Z res_var = (*val->contents.result);
2059 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2060 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
2063 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
2064 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
2065 CHECK(!val->result_ok);
2066 LDKPeerHandleError err_var = (*val->contents.err);
2067 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2068 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2069 long err_ref = (long)err_var.inner & ~1;
2072 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
2073 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
2075 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
2076 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
2077 CHECK(val->result_ok);
2078 return *val->contents.result;
2080 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
2081 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
2082 CHECK(!val->result_ok);
2083 LDKPeerHandleError err_var = (*val->contents.err);
2084 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2085 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2086 long err_ref = (long)err_var.inner & ~1;
2089 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
2090 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
2092 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
2093 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
2094 CHECK(val->result_ok);
2095 return *val->contents.result;
2097 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
2098 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
2099 CHECK(!val->result_ok);
2100 LDKPeerHandleError err_var = (*val->contents.err);
2101 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2102 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2103 long err_ref = (long)err_var.inner & ~1;
2106 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_result_ok(uint32_t arg) {
2107 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
2109 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
2110 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2111 CHECK(val->result_ok);
2112 long res_ref = ((long)&(*val->contents.result)) | 1;
2113 return (long)res_ref;
2115 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
2116 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2117 CHECK(!val->result_ok);
2118 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
2121 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
2122 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
2124 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
2125 long some_ref = (long)(&obj->some) | 1;
2126 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) some_ref;
2128 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
2129 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
2134 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
2135 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
2137 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
2138 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
2139 CHECK(val->result_ok);
2140 LDKDirectionalChannelInfo res_var = (*val->contents.result);
2141 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2142 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2143 long res_ref = (long)res_var.inner & ~1;
2146 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
2147 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
2148 CHECK(!val->result_ok);
2149 LDKDecodeError err_var = (*val->contents.err);
2150 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2151 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2152 long err_ref = (long)err_var.inner & ~1;
2155 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
2156 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
2158 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
2159 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
2160 CHECK(val->result_ok);
2161 LDKChannelInfo res_var = (*val->contents.result);
2162 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2163 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2164 long res_ref = (long)res_var.inner & ~1;
2167 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
2168 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
2169 CHECK(!val->result_ok);
2170 LDKDecodeError err_var = (*val->contents.err);
2171 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2172 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2173 long err_ref = (long)err_var.inner & ~1;
2176 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
2177 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
2179 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
2180 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
2181 CHECK(val->result_ok);
2182 LDKRoutingFees res_var = (*val->contents.result);
2183 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2184 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2185 long res_ref = (long)res_var.inner & ~1;
2188 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
2189 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
2190 CHECK(!val->result_ok);
2191 LDKDecodeError err_var = (*val->contents.err);
2192 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2193 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2194 long err_ref = (long)err_var.inner & ~1;
2197 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
2198 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
2200 case LDKNetAddress_IPv4: {
2201 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
2202 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
2203 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
2205 case LDKNetAddress_IPv6: {
2206 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
2207 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
2208 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
2210 case LDKNetAddress_OnionV2: {
2211 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
2212 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
2213 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
2215 case LDKNetAddress_OnionV3: {
2216 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2217 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
2218 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
2223 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
2224 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2225 ret->datalen = *((uint32_t*)elems);
2226 if (ret->datalen == 0) {
2229 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2230 uint32_t *java_elems = (uint32_t*)(elems + 4);
2231 for (size_t i = 0; i < ret->datalen; i++) {
2232 uint32_t arr_elem = java_elems[i];
2233 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
2234 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
2235 ret->data[i] = arr_elem_conv;
2240 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2241 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2242 for (size_t i = 0; i < ret.datalen; i++) {
2243 ret.data[i] = NetAddress_clone(&orig->data[i]);
2247 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
2248 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
2250 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
2251 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
2252 CHECK(val->result_ok);
2253 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
2254 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2255 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2256 long res_ref = (long)res_var.inner & ~1;
2259 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
2260 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
2261 CHECK(!val->result_ok);
2262 LDKDecodeError err_var = (*val->contents.err);
2263 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2264 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2265 long err_ref = (long)err_var.inner & ~1;
2268 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
2269 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
2270 ret->datalen = *((uint32_t*)elems);
2271 if (ret->datalen == 0) {
2274 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
2275 int64_t *java_elems = (int64_t*)(elems + 4);
2276 for (size_t i = 0; i < ret->datalen; i++) {
2277 ret->data[i] = java_elems[i];
2282 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2283 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2284 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2287 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
2288 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
2290 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
2291 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
2292 CHECK(val->result_ok);
2293 LDKNodeInfo res_var = (*val->contents.result);
2294 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2295 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2296 long res_ref = (long)res_var.inner & ~1;
2299 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
2300 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
2301 CHECK(!val->result_ok);
2302 LDKDecodeError err_var = (*val->contents.err);
2303 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2304 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2305 long err_ref = (long)err_var.inner & ~1;
2308 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
2309 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
2311 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
2312 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
2313 CHECK(val->result_ok);
2314 LDKNetworkGraph res_var = (*val->contents.result);
2315 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2316 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2317 long res_ref = (long)res_var.inner & ~1;
2320 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
2321 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
2322 CHECK(!val->result_ok);
2323 LDKDecodeError err_var = (*val->contents.err);
2324 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2325 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2326 long err_ref = (long)err_var.inner & ~1;
2329 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
2330 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
2332 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
2333 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2334 CHECK(val->result_ok);
2335 LDKInitFeatures res_var = (*val->contents.result);
2336 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2337 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2338 long res_ref = (long)res_var.inner & ~1;
2341 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
2342 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2343 CHECK(!val->result_ok);
2344 LDKDecodeError err_var = (*val->contents.err);
2345 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2346 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2347 long err_ref = (long)err_var.inner & ~1;
2350 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
2351 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
2353 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
2354 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2355 CHECK(val->result_ok);
2356 LDKNodeFeatures res_var = (*val->contents.result);
2357 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2358 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2359 long res_ref = (long)res_var.inner & ~1;
2362 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
2363 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2364 CHECK(!val->result_ok);
2365 LDKDecodeError err_var = (*val->contents.err);
2366 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2367 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2368 long err_ref = (long)err_var.inner & ~1;
2371 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
2372 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
2374 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
2375 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2376 CHECK(val->result_ok);
2377 LDKChannelFeatures res_var = (*val->contents.result);
2378 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2379 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2380 long res_ref = (long)res_var.inner & ~1;
2383 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
2384 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2385 CHECK(!val->result_ok);
2386 LDKDecodeError err_var = (*val->contents.err);
2387 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2388 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2389 long err_ref = (long)err_var.inner & ~1;
2392 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
2393 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
2395 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
2396 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2397 CHECK(val->result_ok);
2398 LDKInvoiceFeatures res_var = (*val->contents.result);
2399 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2400 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2401 long res_ref = (long)res_var.inner & ~1;
2404 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) {
2405 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2406 CHECK(!val->result_ok);
2407 LDKDecodeError err_var = (*val->contents.err);
2408 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2409 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2410 long err_ref = (long)err_var.inner & ~1;
2413 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) {
2414 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
2416 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_ok(uint32_t arg) {
2417 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
2418 CHECK(val->result_ok);
2419 long res_ref = ((long)&(*val->contents.result)) | 1;
2422 int8_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_err(uint32_t arg) {
2423 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
2424 CHECK(!val->result_ok);
2425 return *val->contents.err;
2427 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_result_ok(uint32_t arg) {
2428 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
2430 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_ok(uint32_t arg) {
2431 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
2432 CHECK(val->result_ok);
2433 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
2434 *res_conv = (*val->contents.result);
2435 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
2436 return (long)res_conv;
2438 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_err(uint32_t arg) {
2439 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
2440 CHECK(!val->result_ok);
2441 LDKDecodeError err_var = (*val->contents.err);
2442 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2443 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2444 long err_ref = (long)err_var.inner & ~1;
2447 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
2448 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
2449 ret->datalen = *((uint32_t*)elems);
2450 if (ret->datalen == 0) {
2453 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
2454 uint32_t *java_elems = (uint32_t*)(elems + 4);
2455 for (size_t i = 0; i < ret->datalen; i++) {
2456 uint32_t arr_elem = java_elems[i];
2457 LDKUpdateAddHTLC arr_elem_conv;
2458 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2459 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2460 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
2461 ret->data[i] = arr_elem_conv;
2466 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
2467 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
2468 for (size_t i = 0; i < ret.datalen; i++) {
2469 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
2473 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
2474 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
2475 ret->datalen = *((uint32_t*)elems);
2476 if (ret->datalen == 0) {
2479 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
2480 uint32_t *java_elems = (uint32_t*)(elems + 4);
2481 for (size_t i = 0; i < ret->datalen; i++) {
2482 uint32_t arr_elem = java_elems[i];
2483 LDKUpdateFulfillHTLC arr_elem_conv;
2484 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2485 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2486 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
2487 ret->data[i] = arr_elem_conv;
2492 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
2493 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
2494 for (size_t i = 0; i < ret.datalen; i++) {
2495 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
2499 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
2500 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
2501 ret->datalen = *((uint32_t*)elems);
2502 if (ret->datalen == 0) {
2505 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
2506 uint32_t *java_elems = (uint32_t*)(elems + 4);
2507 for (size_t i = 0; i < ret->datalen; i++) {
2508 uint32_t arr_elem = java_elems[i];
2509 LDKUpdateFailHTLC arr_elem_conv;
2510 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2511 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2512 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
2513 ret->data[i] = arr_elem_conv;
2518 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
2519 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
2520 for (size_t i = 0; i < ret.datalen; i++) {
2521 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
2525 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
2526 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
2527 ret->datalen = *((uint32_t*)elems);
2528 if (ret->datalen == 0) {
2531 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
2532 uint32_t *java_elems = (uint32_t*)(elems + 4);
2533 for (size_t i = 0; i < ret->datalen; i++) {
2534 uint32_t arr_elem = java_elems[i];
2535 LDKUpdateFailMalformedHTLC arr_elem_conv;
2536 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2537 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2538 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
2539 ret->data[i] = arr_elem_conv;
2544 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
2545 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
2546 for (size_t i = 0; i < ret.datalen; i++) {
2547 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
2551 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
2552 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
2554 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
2555 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
2556 CHECK(val->result_ok);
2557 LDKAcceptChannel res_var = (*val->contents.result);
2558 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2559 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2560 long res_ref = (long)res_var.inner & ~1;
2563 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
2564 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
2565 CHECK(!val->result_ok);
2566 LDKDecodeError err_var = (*val->contents.err);
2567 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2568 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2569 long err_ref = (long)err_var.inner & ~1;
2572 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
2573 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
2575 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
2576 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
2577 CHECK(val->result_ok);
2578 LDKAnnouncementSignatures res_var = (*val->contents.result);
2579 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2580 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2581 long res_ref = (long)res_var.inner & ~1;
2584 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
2585 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
2586 CHECK(!val->result_ok);
2587 LDKDecodeError err_var = (*val->contents.err);
2588 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2589 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2590 long err_ref = (long)err_var.inner & ~1;
2593 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
2594 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
2596 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
2597 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
2598 CHECK(val->result_ok);
2599 LDKChannelReestablish res_var = (*val->contents.result);
2600 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2601 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2602 long res_ref = (long)res_var.inner & ~1;
2605 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
2606 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
2607 CHECK(!val->result_ok);
2608 LDKDecodeError err_var = (*val->contents.err);
2609 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2610 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2611 long err_ref = (long)err_var.inner & ~1;
2614 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
2615 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
2617 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
2618 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
2619 CHECK(val->result_ok);
2620 LDKClosingSigned res_var = (*val->contents.result);
2621 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2622 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2623 long res_ref = (long)res_var.inner & ~1;
2626 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
2627 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
2628 CHECK(!val->result_ok);
2629 LDKDecodeError err_var = (*val->contents.err);
2630 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2631 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2632 long err_ref = (long)err_var.inner & ~1;
2635 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
2636 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
2638 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
2639 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
2640 CHECK(val->result_ok);
2641 LDKCommitmentSigned res_var = (*val->contents.result);
2642 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2643 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2644 long res_ref = (long)res_var.inner & ~1;
2647 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
2648 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
2649 CHECK(!val->result_ok);
2650 LDKDecodeError err_var = (*val->contents.err);
2651 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2652 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2653 long err_ref = (long)err_var.inner & ~1;
2656 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
2657 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
2659 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
2660 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
2661 CHECK(val->result_ok);
2662 LDKFundingCreated res_var = (*val->contents.result);
2663 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2664 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2665 long res_ref = (long)res_var.inner & ~1;
2668 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
2669 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
2670 CHECK(!val->result_ok);
2671 LDKDecodeError err_var = (*val->contents.err);
2672 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2673 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2674 long err_ref = (long)err_var.inner & ~1;
2677 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
2678 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
2680 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
2681 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
2682 CHECK(val->result_ok);
2683 LDKFundingSigned res_var = (*val->contents.result);
2684 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2685 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2686 long res_ref = (long)res_var.inner & ~1;
2689 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
2690 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
2691 CHECK(!val->result_ok);
2692 LDKDecodeError err_var = (*val->contents.err);
2693 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2694 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2695 long err_ref = (long)err_var.inner & ~1;
2698 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
2699 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
2701 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
2702 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
2703 CHECK(val->result_ok);
2704 LDKFundingLocked res_var = (*val->contents.result);
2705 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2706 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2707 long res_ref = (long)res_var.inner & ~1;
2710 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
2711 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
2712 CHECK(!val->result_ok);
2713 LDKDecodeError err_var = (*val->contents.err);
2714 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2715 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2716 long err_ref = (long)err_var.inner & ~1;
2719 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_result_ok(uint32_t arg) {
2720 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
2722 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
2723 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
2724 CHECK(val->result_ok);
2725 LDKInit res_var = (*val->contents.result);
2726 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2727 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2728 long res_ref = (long)res_var.inner & ~1;
2731 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
2732 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
2733 CHECK(!val->result_ok);
2734 LDKDecodeError err_var = (*val->contents.err);
2735 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2736 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2737 long err_ref = (long)err_var.inner & ~1;
2740 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
2741 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
2743 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
2744 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
2745 CHECK(val->result_ok);
2746 LDKOpenChannel res_var = (*val->contents.result);
2747 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2748 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2749 long res_ref = (long)res_var.inner & ~1;
2752 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
2753 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
2754 CHECK(!val->result_ok);
2755 LDKDecodeError err_var = (*val->contents.err);
2756 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2757 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2758 long err_ref = (long)err_var.inner & ~1;
2761 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
2762 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
2764 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
2765 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
2766 CHECK(val->result_ok);
2767 LDKRevokeAndACK res_var = (*val->contents.result);
2768 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2769 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2770 long res_ref = (long)res_var.inner & ~1;
2773 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
2774 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
2775 CHECK(!val->result_ok);
2776 LDKDecodeError err_var = (*val->contents.err);
2777 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2778 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2779 long err_ref = (long)err_var.inner & ~1;
2782 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
2783 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
2785 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
2786 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
2787 CHECK(val->result_ok);
2788 LDKShutdown res_var = (*val->contents.result);
2789 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2790 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2791 long res_ref = (long)res_var.inner & ~1;
2794 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
2795 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
2796 CHECK(!val->result_ok);
2797 LDKDecodeError err_var = (*val->contents.err);
2798 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2799 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2800 long err_ref = (long)err_var.inner & ~1;
2803 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
2804 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
2806 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
2807 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
2808 CHECK(val->result_ok);
2809 LDKUpdateFailHTLC res_var = (*val->contents.result);
2810 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2811 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2812 long res_ref = (long)res_var.inner & ~1;
2815 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
2816 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
2817 CHECK(!val->result_ok);
2818 LDKDecodeError err_var = (*val->contents.err);
2819 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2820 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2821 long err_ref = (long)err_var.inner & ~1;
2824 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
2825 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
2827 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
2828 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
2829 CHECK(val->result_ok);
2830 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
2831 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2832 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2833 long res_ref = (long)res_var.inner & ~1;
2836 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
2837 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
2838 CHECK(!val->result_ok);
2839 LDKDecodeError err_var = (*val->contents.err);
2840 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2841 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2842 long err_ref = (long)err_var.inner & ~1;
2845 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
2846 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
2848 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
2849 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
2850 CHECK(val->result_ok);
2851 LDKUpdateFee res_var = (*val->contents.result);
2852 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2853 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2854 long res_ref = (long)res_var.inner & ~1;
2857 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
2858 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
2859 CHECK(!val->result_ok);
2860 LDKDecodeError err_var = (*val->contents.err);
2861 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2862 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2863 long err_ref = (long)err_var.inner & ~1;
2866 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
2867 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
2869 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
2870 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
2871 CHECK(val->result_ok);
2872 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
2873 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2874 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2875 long res_ref = (long)res_var.inner & ~1;
2878 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
2879 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
2880 CHECK(!val->result_ok);
2881 LDKDecodeError err_var = (*val->contents.err);
2882 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2883 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2884 long err_ref = (long)err_var.inner & ~1;
2887 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
2888 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
2890 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
2891 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
2892 CHECK(val->result_ok);
2893 LDKUpdateAddHTLC res_var = (*val->contents.result);
2894 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2895 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2896 long res_ref = (long)res_var.inner & ~1;
2899 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
2900 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
2901 CHECK(!val->result_ok);
2902 LDKDecodeError err_var = (*val->contents.err);
2903 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2904 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2905 long err_ref = (long)err_var.inner & ~1;
2908 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_result_ok(uint32_t arg) {
2909 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
2911 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
2912 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
2913 CHECK(val->result_ok);
2914 LDKPing res_var = (*val->contents.result);
2915 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2916 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2917 long res_ref = (long)res_var.inner & ~1;
2920 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
2921 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
2922 CHECK(!val->result_ok);
2923 LDKDecodeError err_var = (*val->contents.err);
2924 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2925 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2926 long err_ref = (long)err_var.inner & ~1;
2929 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_result_ok(uint32_t arg) {
2930 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
2932 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
2933 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
2934 CHECK(val->result_ok);
2935 LDKPong res_var = (*val->contents.result);
2936 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2937 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2938 long res_ref = (long)res_var.inner & ~1;
2941 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
2942 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
2943 CHECK(!val->result_ok);
2944 LDKDecodeError err_var = (*val->contents.err);
2945 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2946 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2947 long err_ref = (long)err_var.inner & ~1;
2950 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
2951 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
2953 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
2954 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
2955 CHECK(val->result_ok);
2956 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
2957 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2958 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2959 long res_ref = (long)res_var.inner & ~1;
2962 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
2963 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
2964 CHECK(!val->result_ok);
2965 LDKDecodeError err_var = (*val->contents.err);
2966 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2967 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2968 long err_ref = (long)err_var.inner & ~1;
2971 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
2972 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
2974 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
2975 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
2976 CHECK(val->result_ok);
2977 LDKChannelAnnouncement res_var = (*val->contents.result);
2978 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2979 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2980 long res_ref = (long)res_var.inner & ~1;
2983 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
2984 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
2985 CHECK(!val->result_ok);
2986 LDKDecodeError err_var = (*val->contents.err);
2987 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2988 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2989 long err_ref = (long)err_var.inner & ~1;
2992 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
2993 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
2995 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
2996 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
2997 CHECK(val->result_ok);
2998 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
2999 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3000 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3001 long res_ref = (long)res_var.inner & ~1;
3004 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
3005 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
3006 CHECK(!val->result_ok);
3007 LDKDecodeError err_var = (*val->contents.err);
3008 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3009 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3010 long err_ref = (long)err_var.inner & ~1;
3013 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3014 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
3016 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3017 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
3018 CHECK(val->result_ok);
3019 LDKChannelUpdate res_var = (*val->contents.result);
3020 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3021 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3022 long res_ref = (long)res_var.inner & ~1;
3025 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
3026 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
3027 CHECK(!val->result_ok);
3028 LDKDecodeError err_var = (*val->contents.err);
3029 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3030 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3031 long err_ref = (long)err_var.inner & ~1;
3034 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
3035 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
3037 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
3038 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3039 CHECK(val->result_ok);
3040 LDKErrorMessage res_var = (*val->contents.result);
3041 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3042 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3043 long res_ref = (long)res_var.inner & ~1;
3046 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
3047 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3048 CHECK(!val->result_ok);
3049 LDKDecodeError err_var = (*val->contents.err);
3050 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3051 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3052 long err_ref = (long)err_var.inner & ~1;
3055 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3056 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3058 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3059 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3060 CHECK(val->result_ok);
3061 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
3062 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3063 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3064 long res_ref = (long)res_var.inner & ~1;
3067 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3068 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3069 CHECK(!val->result_ok);
3070 LDKDecodeError err_var = (*val->contents.err);
3071 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3072 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3073 long err_ref = (long)err_var.inner & ~1;
3076 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3077 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3079 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3080 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
3081 CHECK(val->result_ok);
3082 LDKNodeAnnouncement res_var = (*val->contents.result);
3083 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3084 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3085 long res_ref = (long)res_var.inner & ~1;
3088 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3089 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
3090 CHECK(!val->result_ok);
3091 LDKDecodeError err_var = (*val->contents.err);
3092 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3093 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3094 long err_ref = (long)err_var.inner & ~1;
3097 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
3098 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
3100 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
3101 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3102 CHECK(val->result_ok);
3103 LDKQueryShortChannelIds res_var = (*val->contents.result);
3104 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3105 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3106 long res_ref = (long)res_var.inner & ~1;
3109 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
3110 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3111 CHECK(!val->result_ok);
3112 LDKDecodeError err_var = (*val->contents.err);
3113 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3114 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3115 long err_ref = (long)err_var.inner & ~1;
3118 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
3119 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
3121 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
3122 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3123 CHECK(val->result_ok);
3124 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
3125 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3126 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3127 long res_ref = (long)res_var.inner & ~1;
3130 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
3131 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3132 CHECK(!val->result_ok);
3133 LDKDecodeError err_var = (*val->contents.err);
3134 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3135 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3136 long err_ref = (long)err_var.inner & ~1;
3139 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
3140 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
3142 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
3143 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3144 CHECK(val->result_ok);
3145 LDKQueryChannelRange res_var = (*val->contents.result);
3146 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3147 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3148 long res_ref = (long)res_var.inner & ~1;
3151 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
3152 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3153 CHECK(!val->result_ok);
3154 LDKDecodeError err_var = (*val->contents.err);
3155 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3156 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3157 long err_ref = (long)err_var.inner & ~1;
3160 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
3161 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
3163 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
3164 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3165 CHECK(val->result_ok);
3166 LDKReplyChannelRange res_var = (*val->contents.result);
3167 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3168 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3169 long res_ref = (long)res_var.inner & ~1;
3172 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
3173 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3174 CHECK(!val->result_ok);
3175 LDKDecodeError err_var = (*val->contents.err);
3176 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3177 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3178 long err_ref = (long)err_var.inner & ~1;
3181 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
3182 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
3184 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
3185 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3186 CHECK(val->result_ok);
3187 LDKGossipTimestampFilter res_var = (*val->contents.result);
3188 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3189 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3190 long res_ref = (long)res_var.inner & ~1;
3193 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
3194 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3195 CHECK(!val->result_ok);
3196 LDKDecodeError err_var = (*val->contents.err);
3197 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3198 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3199 long err_ref = (long)err_var.inner & ~1;
3202 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
3203 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
3205 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
3206 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
3207 CHECK(val->result_ok);
3208 long res_ref = ((long)&(*val->contents.result)) | 1;
3211 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
3212 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
3213 CHECK(!val->result_ok);
3214 LDKDecodeError err_var = (*val->contents.err);
3215 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3216 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3217 long err_ref = (long)err_var.inner & ~1;
3220 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_result_ok(uint32_t arg) {
3221 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
3223 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
3224 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3225 CHECK(val->result_ok);
3226 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3227 *ret = Sign_clone(&(*val->contents.result));
3230 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
3231 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3232 CHECK(!val->result_ok);
3233 LDKDecodeError err_var = (*val->contents.err);
3234 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3235 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3236 long err_ref = (long)err_var.inner & ~1;
3239 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3240 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3241 for (size_t i = 0; i < ret.datalen; i++) {
3242 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3246 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(uint32_t arg) {
3247 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
3249 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
3250 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3251 CHECK(val->result_ok);
3252 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
3253 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
3254 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
3255 for (size_t m = 0; m < res_var.datalen; m++) {
3256 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
3257 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3258 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
3259 res_arr_ptr[m] = res_conv_12_arr;
3263 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
3264 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3265 CHECK(!val->result_ok);
3266 return *val->contents.err;
3268 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_result_ok(uint32_t arg) {
3269 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
3271 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
3272 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3273 CHECK(val->result_ok);
3274 LDKInMemorySigner res_var = (*val->contents.result);
3275 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3276 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3277 long res_ref = (long)res_var.inner & ~1;
3280 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
3281 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3282 CHECK(!val->result_ok);
3283 LDKDecodeError err_var = (*val->contents.err);
3284 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3285 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3286 long err_ref = (long)err_var.inner & ~1;
3289 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_TxOutZ_new(uint32_tArray elems) {
3290 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
3291 ret->datalen = *((uint32_t*)elems);
3292 if (ret->datalen == 0) {
3295 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
3296 uint32_t *java_elems = (uint32_t*)(elems + 4);
3297 for (size_t i = 0; i < ret->datalen; i++) {
3298 uint32_t arr_elem = java_elems[i];
3299 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
3300 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
3301 ret->data[i] = arr_elem_conv;
3306 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
3307 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
3308 for (size_t i = 0; i < ret.datalen; i++) {
3309 ret.data[i] = TxOut_clone(&orig->data[i]);
3313 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_result_ok(uint32_t arg) {
3314 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
3316 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
3317 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3318 CHECK(val->result_ok);
3319 LDKTransaction res_var = (*val->contents.result);
3320 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3321 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
3324 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
3325 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3326 CHECK(!val->result_ok);
3327 return *val->contents.err;
3329 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_result_ok(uint32_t arg) {
3330 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
3332 void __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_ok(uint32_t arg) {
3333 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
3334 CHECK(val->result_ok);
3335 return *val->contents.result;
3337 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_err(uint32_t arg) {
3338 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
3339 CHECK(!val->result_ok);
3340 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
3343 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_BlockHashChannelMonitorZZ_new(uint32_tArray elems) {
3344 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
3345 ret->datalen = *((uint32_t*)elems);
3346 if (ret->datalen == 0) {
3349 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
3350 uint32_t *java_elems = (uint32_t*)(elems + 4);
3351 for (size_t i = 0; i < ret->datalen; i++) {
3352 uint32_t arr_elem = java_elems[i];
3353 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
3354 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
3355 ret->data[i] = arr_elem_conv;
3360 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_result_ok(uint32_t arg) {
3361 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
3363 uint32_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(uint32_t arg) {
3364 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3365 CHECK(val->result_ok);
3366 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
3367 uint32_tArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3368 uint32_t *res_arr_ptr = (uint32_t*)(res_arr + 4);
3369 for (size_t m = 0; m < res_var.datalen; m++) {
3370 long res_conv_38_ref = (long)(&res_var.data[m]) | 1;
3371 res_arr_ptr[m] = res_conv_38_ref;
3375 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(uint32_t arg) {
3376 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3377 CHECK(!val->result_ok);
3378 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
3381 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
3382 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3384 case LDKAPIError_APIMisuseError: {
3385 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
3386 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3387 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
3388 return 0 /* LDKAPIError - APIMisuseError */; (void) err_arr;
3390 case LDKAPIError_FeeRateTooHigh: {
3391 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
3392 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3393 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
3394 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_arr; (void) obj->fee_rate_too_high.feerate;
3396 case LDKAPIError_RouteError: {
3397 LDKStr err_str = obj->route_error.err;
3398 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3399 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
3401 case LDKAPIError_ChannelUnavailable: {
3402 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
3403 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3404 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
3405 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_arr;
3407 case LDKAPIError_MonitorUpdateFailed: {
3408 return 0 /* LDKAPIError - MonitorUpdateFailed */;
3413 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
3414 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
3416 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
3417 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3418 CHECK(val->result_ok);
3419 return *val->contents.result;
3421 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
3422 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3423 CHECK(!val->result_ok);
3424 long err_ref = ((long)&(*val->contents.err)) | 1;
3427 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) {
3428 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
3429 ret->datalen = *((uint32_t*)elems);
3430 if (ret->datalen == 0) {
3433 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
3434 uint32_t *java_elems = (uint32_t*)(elems + 4);
3435 for (size_t i = 0; i < ret->datalen; i++) {
3436 uint32_t arr_elem = java_elems[i];
3437 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
3438 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
3439 ret->data[i] = arr_elem_conv;
3444 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
3445 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
3446 for (size_t i = 0; i < ret.datalen; i++) {
3447 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3451 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) {
3452 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
3453 ret->datalen = *((uint32_t*)elems);
3454 if (ret->datalen == 0) {
3457 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3458 uint32_t *java_elems = (uint32_t*)(elems + 4);
3459 for (size_t i = 0; i < ret->datalen; i++) {
3460 uint32_t arr_elem = java_elems[i];
3461 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
3462 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3463 ret->data[i] = arr_elem_conv;
3468 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3469 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3470 for (size_t i = 0; i < ret.datalen; i++) {
3471 ret.data[i] = APIError_clone(&orig->data[i]);
3475 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
3476 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3478 case LDKPaymentSendFailure_ParameterError: {
3479 long parameter_error_ref = ((long)&obj->parameter_error) | 1;
3480 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
3482 case LDKPaymentSendFailure_PathParameterError: {
3483 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3484 uint32_tArray path_parameter_error_arr = init_arr(path_parameter_error_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3485 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
3486 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3487 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3488 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3489 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3490 path_parameter_error_arr_ptr[w] = (long)path_parameter_error_conv_22_conv;
3492 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
3494 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3495 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3496 uint32_tArray all_failed_retry_safe_arr = init_arr(all_failed_retry_safe_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3497 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
3498 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3499 long all_failed_retry_safe_conv_10_ref = ((long)&all_failed_retry_safe_var.data[k]) | 1;
3500 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3502 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
3504 case LDKPaymentSendFailure_PartialFailure: {
3505 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3506 uint32_tArray partial_failure_arr = init_arr(partial_failure_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3507 uint32_t *partial_failure_arr_ptr = (uint32_t*)(partial_failure_arr + 4);
3508 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3509 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3510 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3511 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3512 partial_failure_arr_ptr[w] = (long)partial_failure_conv_22_conv;
3514 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) partial_failure_arr;
3519 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
3520 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3522 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
3523 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3524 CHECK(val->result_ok);
3525 return *val->contents.result;
3527 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
3528 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3529 CHECK(!val->result_ok);
3530 long err_ref = ((long)&(*val->contents.err)) | 1;
3533 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
3534 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3535 ret->datalen = *((uint32_t*)elems);
3536 if (ret->datalen == 0) {
3539 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3540 uint32_t *java_elems = (uint32_t*)(elems + 4);
3541 for (size_t i = 0; i < ret->datalen; i++) {
3542 uint32_t arr_elem = java_elems[i];
3543 LDKChannelMonitor arr_elem_conv;
3544 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3545 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3546 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3547 ret->data[i] = arr_elem_conv;
3552 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3553 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3554 for (size_t i = 0; i < ret.datalen; i++) {
3555 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3559 typedef struct LDKWatch_JCalls {
3560 atomic_size_t refcnt;
3561 uint32_t watch_channel_meth;
3562 uint32_t update_channel_meth;
3563 uint32_t release_pending_monitor_events_meth;
3565 static void LDKWatch_JCalls_free(void* this_arg) {
3566 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3567 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3568 js_free(j_calls->watch_channel_meth);
3569 js_free(j_calls->update_channel_meth);
3570 js_free(j_calls->release_pending_monitor_events_meth);
3574 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3575 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3576 LDKOutPoint funding_txo_var = funding_txo;
3577 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3578 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3579 long funding_txo_ref = (long)funding_txo_var.inner;
3580 if (funding_txo_var.is_owned) {
3581 funding_txo_ref |= 1;
3583 LDKChannelMonitor monitor_var = monitor;
3584 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3585 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3586 long monitor_ref = (long)monitor_var.inner;
3587 if (monitor_var.is_owned) {
3590 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3591 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3592 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3595 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3596 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3597 LDKOutPoint funding_txo_var = funding_txo;
3598 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3599 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3600 long funding_txo_ref = (long)funding_txo_var.inner;
3601 if (funding_txo_var.is_owned) {
3602 funding_txo_ref |= 1;
3604 LDKChannelMonitorUpdate update_var = update;
3605 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3606 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3607 long update_ref = (long)update_var.inner;
3608 if (update_var.is_owned) {
3611 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
3612 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3613 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3616 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3617 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3618 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
3619 LDKCVec_MonitorEventZ ret_constr;
3620 ret_constr.datalen = *((uint32_t*)ret);
3621 if (ret_constr.datalen > 0)
3622 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3624 ret_constr.data = NULL;
3625 uint32_t* ret_vals = (uint32_t*)(ret + 4);
3626 for (size_t o = 0; o < ret_constr.datalen; o++) {
3627 uint32_t ret_conv_14 = ret_vals[o];
3628 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3629 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
3630 ret_constr.data[o] = ret_conv_14_conv;
3634 static void* LDKWatch_JCalls_clone(const void* this_arg) {
3635 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3636 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3637 return (void*) this_arg;
3639 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
3640 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3641 atomic_init(&calls->refcnt, 1);
3642 //TODO: Assign calls->o from o
3645 .this_arg = (void*) calls,
3646 .watch_channel = watch_channel_LDKWatch_jcall,
3647 .update_channel = update_channel_LDKWatch_jcall,
3648 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3649 .free = LDKWatch_JCalls_free,
3653 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
3654 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3655 *res_ptr = LDKWatch_init(o);
3656 return (long)res_ptr;
3658 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
3659 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3660 LDKOutPoint funding_txo_conv;
3661 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3662 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3663 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3664 LDKChannelMonitor monitor_conv;
3665 monitor_conv.inner = (void*)(monitor & (~1));
3666 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3667 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3668 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3669 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3670 return (long)ret_conv;
3673 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
3674 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3675 LDKOutPoint funding_txo_conv;
3676 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3677 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3678 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3679 LDKChannelMonitorUpdate update_conv;
3680 update_conv.inner = (void*)(update & (~1));
3681 update_conv.is_owned = (update & 1) || (update == 0);
3682 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3683 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3684 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3685 return (long)ret_conv;
3688 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
3689 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3690 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3691 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3692 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3693 for (size_t o = 0; o < ret_var.datalen; o++) {
3694 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3695 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3696 long ret_conv_14_ref = (long)ret_conv_14_copy;
3697 ret_arr_ptr[o] = ret_conv_14_ref;
3703 typedef struct LDKBroadcasterInterface_JCalls {
3704 atomic_size_t refcnt;
3705 uint32_t broadcast_transaction_meth;
3706 } LDKBroadcasterInterface_JCalls;
3707 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3708 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3709 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3710 js_free(j_calls->broadcast_transaction_meth);
3714 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3715 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3716 LDKTransaction tx_var = tx;
3717 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3718 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
3719 Transaction_free(tx_var);
3720 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
3722 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
3723 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3724 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3725 return (void*) this_arg;
3727 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
3728 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3729 atomic_init(&calls->refcnt, 1);
3730 //TODO: Assign calls->o from o
3732 LDKBroadcasterInterface ret = {
3733 .this_arg = (void*) calls,
3734 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3735 .free = LDKBroadcasterInterface_JCalls_free,
3739 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
3740 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3741 *res_ptr = LDKBroadcasterInterface_init(o);
3742 return (long)res_ptr;
3744 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
3745 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3746 LDKTransaction tx_ref;
3747 tx_ref.datalen = *((uint32_t*)tx);
3748 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3749 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
3750 tx_ref.data_is_owned = true;
3751 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3754 typedef struct LDKKeysInterface_JCalls {
3755 atomic_size_t refcnt;
3756 uint32_t get_node_secret_meth;
3757 uint32_t get_destination_script_meth;
3758 uint32_t get_shutdown_pubkey_meth;
3759 uint32_t get_channel_signer_meth;
3760 uint32_t get_secure_random_bytes_meth;
3761 uint32_t read_chan_signer_meth;
3762 } LDKKeysInterface_JCalls;
3763 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3764 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3765 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3766 js_free(j_calls->get_node_secret_meth);
3767 js_free(j_calls->get_destination_script_meth);
3768 js_free(j_calls->get_shutdown_pubkey_meth);
3769 js_free(j_calls->get_channel_signer_meth);
3770 js_free(j_calls->get_secure_random_bytes_meth);
3771 js_free(j_calls->read_chan_signer_meth);
3775 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3776 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3777 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
3778 LDKSecretKey ret_ref;
3779 CHECK(*((uint32_t*)ret) == 32);
3780 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
3783 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3784 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3785 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
3786 LDKCVec_u8Z ret_ref;
3787 ret_ref.datalen = *((uint32_t*)ret);
3788 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3789 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
3792 LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
3793 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3794 int8_tArray ret = js_invoke_function_0(j_calls->get_shutdown_pubkey_meth);
3795 LDKPublicKey ret_ref;
3796 CHECK(*((uint32_t*)ret) == 33);
3797 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
3800 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3801 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3802 LDKSign* ret = (LDKSign*)js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3803 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
3804 ret_conv = Sign_clone(ret);
3807 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3808 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3809 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
3810 LDKThirtyTwoBytes ret_ref;
3811 CHECK(*((uint32_t*)ret) == 32);
3812 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
3815 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3816 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3817 LDKu8slice reader_var = reader;
3818 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3819 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
3820 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
3821 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
3822 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
3825 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
3826 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3827 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3828 return (void*) this_arg;
3830 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
3831 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3832 atomic_init(&calls->refcnt, 1);
3833 //TODO: Assign calls->o from o
3835 LDKKeysInterface ret = {
3836 .this_arg = (void*) calls,
3837 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
3838 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
3839 .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
3840 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
3841 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
3842 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
3843 .free = LDKKeysInterface_JCalls_free,
3847 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
3848 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3849 *res_ptr = LDKKeysInterface_init(o);
3850 return (long)res_ptr;
3852 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
3853 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3854 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3855 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
3859 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
3860 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3861 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3862 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3863 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3864 CVec_u8Z_free(ret_var);
3868 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_pubkey(uint32_t this_arg) {
3869 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3870 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
3871 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form, 33);
3875 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
3876 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3877 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3878 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3882 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
3883 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3884 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3885 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
3889 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
3890 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3891 LDKu8slice reader_ref;
3892 reader_ref.datalen = *((uint32_t*)reader);
3893 reader_ref.data = (int8_t*)(reader + 4);
3894 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3895 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3896 return (long)ret_conv;
3899 typedef struct LDKFeeEstimator_JCalls {
3900 atomic_size_t refcnt;
3901 uint32_t get_est_sat_per_1000_weight_meth;
3902 } LDKFeeEstimator_JCalls;
3903 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3904 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3905 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3906 js_free(j_calls->get_est_sat_per_1000_weight_meth);
3910 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3911 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3912 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
3913 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3915 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
3916 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3917 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3918 return (void*) this_arg;
3920 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
3921 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3922 atomic_init(&calls->refcnt, 1);
3923 //TODO: Assign calls->o from o
3925 LDKFeeEstimator ret = {
3926 .this_arg = (void*) calls,
3927 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3928 .free = LDKFeeEstimator_JCalls_free,
3932 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
3933 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3934 *res_ptr = LDKFeeEstimator_init(o);
3935 return (long)res_ptr;
3937 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
3938 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
3939 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
3940 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3944 typedef struct LDKLogger_JCalls {
3945 atomic_size_t refcnt;
3948 static void LDKLogger_JCalls_free(void* this_arg) {
3949 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3950 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3951 js_free(j_calls->log_meth);
3955 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
3956 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3957 const char* record_str = record;
3958 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
3959 js_invoke_function_1(j_calls->log_meth, record_conv);
3961 static void* LDKLogger_JCalls_clone(const void* this_arg) {
3962 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3963 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3964 return (void*) this_arg;
3966 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
3967 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3968 atomic_init(&calls->refcnt, 1);
3969 //TODO: Assign calls->o from o
3972 .this_arg = (void*) calls,
3973 .log = log_LDKLogger_jcall,
3974 .free = LDKLogger_JCalls_free,
3978 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
3979 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3980 *res_ptr = LDKLogger_init(o);
3981 return (long)res_ptr;
3983 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
3984 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
3985 LDKThirtyTwoBytes a_ref;
3986 CHECK(*((uint32_t*)a) == 32);
3987 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3989 LDKChannelManager b_conv;
3990 b_conv.inner = (void*)(b & (~1));
3991 b_conv.is_owned = (b & 1) || (b == 0);
3992 // Warning: we need a move here but no clone is available for LDKChannelManager
3996 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_a(uint32_t ptr) {
3997 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3998 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3999 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
4002 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_b(uint32_t ptr) {
4003 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4004 LDKChannelManager b_var = tuple->b;
4005 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4006 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4007 long b_ref = (long)b_var.inner & ~1;
4010 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
4011 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
4013 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
4014 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4015 CHECK(val->result_ok);
4016 long res_ref = (long)(&(*val->contents.result)) | 1;
4019 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
4020 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4021 CHECK(!val->result_ok);
4022 LDKDecodeError err_var = (*val->contents.err);
4023 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4024 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4025 long err_ref = (long)err_var.inner & ~1;
4028 typedef struct LDKMessageSendEventsProvider_JCalls {
4029 atomic_size_t refcnt;
4030 uint32_t get_and_clear_pending_msg_events_meth;
4031 } LDKMessageSendEventsProvider_JCalls;
4032 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
4033 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4034 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4035 js_free(j_calls->get_and_clear_pending_msg_events_meth);
4039 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
4040 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4041 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
4042 LDKCVec_MessageSendEventZ ret_constr;
4043 ret_constr.datalen = *((uint32_t*)ret);
4044 if (ret_constr.datalen > 0)
4045 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4047 ret_constr.data = NULL;
4048 uint32_t* ret_vals = (uint32_t*)(ret + 4);
4049 for (size_t s = 0; s < ret_constr.datalen; s++) {
4050 uint32_t ret_conv_18 = ret_vals[s];
4051 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
4052 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
4053 ret_constr.data[s] = ret_conv_18_conv;
4057 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
4058 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4059 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4060 return (void*) this_arg;
4062 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
4063 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
4064 atomic_init(&calls->refcnt, 1);
4065 //TODO: Assign calls->o from o
4067 LDKMessageSendEventsProvider ret = {
4068 .this_arg = (void*) calls,
4069 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
4070 .free = LDKMessageSendEventsProvider_JCalls_free,
4074 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
4075 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
4076 *res_ptr = LDKMessageSendEventsProvider_init(o);
4077 return (long)res_ptr;
4079 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
4080 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
4081 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
4082 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4083 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
4084 for (size_t s = 0; s < ret_var.datalen; s++) {
4085 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
4086 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
4087 long ret_conv_18_ref = (long)ret_conv_18_copy;
4088 ret_arr_ptr[s] = ret_conv_18_ref;
4094 typedef struct LDKEventsProvider_JCalls {
4095 atomic_size_t refcnt;
4096 uint32_t get_and_clear_pending_events_meth;
4097 } LDKEventsProvider_JCalls;
4098 static void LDKEventsProvider_JCalls_free(void* this_arg) {
4099 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4100 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4101 js_free(j_calls->get_and_clear_pending_events_meth);
4105 LDKCVec_EventZ get_and_clear_pending_events_LDKEventsProvider_jcall(const void* this_arg) {
4106 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4107 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_events_meth);
4108 LDKCVec_EventZ ret_constr;
4109 ret_constr.datalen = *((uint32_t*)ret);
4110 if (ret_constr.datalen > 0)
4111 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4113 ret_constr.data = NULL;
4114 uint32_t* ret_vals = (uint32_t*)(ret + 4);
4115 for (size_t h = 0; h < ret_constr.datalen; h++) {
4116 uint32_t ret_conv_7 = ret_vals[h];
4117 LDKEvent ret_conv_7_conv = *(LDKEvent*)(((uint64_t)ret_conv_7) & ~1);
4118 ret_conv_7_conv = Event_clone((LDKEvent*)(((uint64_t)ret_conv_7) & ~1));
4119 ret_constr.data[h] = ret_conv_7_conv;
4123 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
4124 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4125 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4126 return (void*) this_arg;
4128 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
4129 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
4130 atomic_init(&calls->refcnt, 1);
4131 //TODO: Assign calls->o from o
4133 LDKEventsProvider ret = {
4134 .this_arg = (void*) calls,
4135 .get_and_clear_pending_events = get_and_clear_pending_events_LDKEventsProvider_jcall,
4136 .free = LDKEventsProvider_JCalls_free,
4140 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
4141 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
4142 *res_ptr = LDKEventsProvider_init(o);
4143 return (long)res_ptr;
4145 uint32_tArray __attribute__((visibility("default"))) TS_EventsProvider_get_and_clear_pending_events(uint32_t this_arg) {
4146 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
4147 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
4148 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4149 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
4150 for (size_t h = 0; h < ret_var.datalen; h++) {
4151 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
4152 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
4153 long ret_conv_7_ref = (long)ret_conv_7_copy;
4154 ret_arr_ptr[h] = ret_conv_7_ref;
4160 typedef struct LDKAccess_JCalls {
4161 atomic_size_t refcnt;
4162 uint32_t get_utxo_meth;
4164 static void LDKAccess_JCalls_free(void* this_arg) {
4165 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4166 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4167 js_free(j_calls->get_utxo_meth);
4171 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4172 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4173 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4174 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
4175 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4176 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
4177 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
4180 static void* LDKAccess_JCalls_clone(const void* this_arg) {
4181 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4182 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4183 return (void*) this_arg;
4185 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
4186 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4187 atomic_init(&calls->refcnt, 1);
4188 //TODO: Assign calls->o from o
4191 .this_arg = (void*) calls,
4192 .get_utxo = get_utxo_LDKAccess_jcall,
4193 .free = LDKAccess_JCalls_free,
4197 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
4198 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4199 *res_ptr = LDKAccess_init(o);
4200 return (long)res_ptr;
4202 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4203 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
4204 unsigned char genesis_hash_arr[32];
4205 CHECK(*((uint32_t*)genesis_hash) == 32);
4206 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
4207 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4208 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4209 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4210 return (long)ret_conv;
4213 typedef struct LDKListen_JCalls {
4214 atomic_size_t refcnt;
4215 uint32_t block_connected_meth;
4216 uint32_t block_disconnected_meth;
4218 static void LDKListen_JCalls_free(void* this_arg) {
4219 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4220 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4221 js_free(j_calls->block_connected_meth);
4222 js_free(j_calls->block_disconnected_meth);
4226 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
4227 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4228 LDKu8slice block_var = block;
4229 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4230 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
4231 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
4233 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
4234 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4235 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
4236 memcpy((uint8_t*)(header_arr + 4), *header, 80);
4237 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
4239 static void* LDKListen_JCalls_clone(const void* this_arg) {
4240 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4241 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4242 return (void*) this_arg;
4244 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
4245 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
4246 atomic_init(&calls->refcnt, 1);
4247 //TODO: Assign calls->o from o
4250 .this_arg = (void*) calls,
4251 .block_connected = block_connected_LDKListen_jcall,
4252 .block_disconnected = block_disconnected_LDKListen_jcall,
4253 .free = LDKListen_JCalls_free,
4257 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
4258 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
4259 *res_ptr = LDKListen_init(o);
4260 return (long)res_ptr;
4262 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
4263 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
4264 LDKu8slice block_ref;
4265 block_ref.datalen = *((uint32_t*)block);
4266 block_ref.data = (int8_t*)(block + 4);
4267 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
4270 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
4271 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
4272 unsigned char header_arr[80];
4273 CHECK(*((uint32_t*)header) == 80);
4274 memcpy(header_arr, (uint8_t*)(header + 4), 80);
4275 unsigned char (*header_ref)[80] = &header_arr;
4276 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
4279 typedef struct LDKFilter_JCalls {
4280 atomic_size_t refcnt;
4281 uint32_t register_tx_meth;
4282 uint32_t register_output_meth;
4284 static void LDKFilter_JCalls_free(void* this_arg) {
4285 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4286 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4287 js_free(j_calls->register_tx_meth);
4288 js_free(j_calls->register_output_meth);
4292 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
4293 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4294 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4295 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
4296 LDKu8slice script_pubkey_var = script_pubkey;
4297 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4298 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
4299 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
4301 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
4302 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4303 LDKWatchedOutput output_var = output;
4304 CHECK((((long)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4305 CHECK((((long)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4306 long output_ref = (long)output_var.inner;
4307 if (output_var.is_owned) {
4310 LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)js_invoke_function_1(j_calls->register_output_meth, output_ref);
4311 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
4312 // Warning: we may need a move here but no clone is available for LDKCOption_C2Tuple_usizeTransactionZZ
4315 static void* LDKFilter_JCalls_clone(const void* this_arg) {
4316 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4317 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4318 return (void*) this_arg;
4320 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
4321 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
4322 atomic_init(&calls->refcnt, 1);
4323 //TODO: Assign calls->o from o
4326 .this_arg = (void*) calls,
4327 .register_tx = register_tx_LDKFilter_jcall,
4328 .register_output = register_output_LDKFilter_jcall,
4329 .free = LDKFilter_JCalls_free,
4333 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
4334 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
4335 *res_ptr = LDKFilter_init(o);
4336 return (long)res_ptr;
4338 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
4339 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
4340 unsigned char txid_arr[32];
4341 CHECK(*((uint32_t*)txid) == 32);
4342 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
4343 unsigned char (*txid_ref)[32] = &txid_arr;
4344 LDKu8slice script_pubkey_ref;
4345 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
4346 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
4347 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
4350 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
4351 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
4352 LDKWatchedOutput output_conv;
4353 output_conv.inner = (void*)(output & (~1));
4354 output_conv.is_owned = (output & 1) || (output == 0);
4355 // Warning: we need a move here but no clone is available for LDKWatchedOutput
4356 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
4357 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
4358 long ret_ref = (long)ret_copy;
4362 typedef struct LDKPersist_JCalls {
4363 atomic_size_t refcnt;
4364 uint32_t persist_new_channel_meth;
4365 uint32_t update_persisted_channel_meth;
4366 } LDKPersist_JCalls;
4367 static void LDKPersist_JCalls_free(void* this_arg) {
4368 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4369 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4370 js_free(j_calls->persist_new_channel_meth);
4371 js_free(j_calls->update_persisted_channel_meth);
4375 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
4376 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4377 LDKOutPoint id_var = id;
4378 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4379 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4380 long id_ref = (long)id_var.inner;
4381 if (id_var.is_owned) {
4384 LDKChannelMonitor data_var = *data;
4385 data_var = ChannelMonitor_clone(data);
4386 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4387 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4388 long data_ref = (long)data_var.inner;
4389 if (data_var.is_owned) {
4392 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
4393 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4394 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
4397 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
4398 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4399 LDKOutPoint id_var = id;
4400 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4401 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4402 long id_ref = (long)id_var.inner;
4403 if (id_var.is_owned) {
4406 LDKChannelMonitorUpdate update_var = *update;
4407 update_var = ChannelMonitorUpdate_clone(update);
4408 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4409 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4410 long update_ref = (long)update_var.inner;
4411 if (update_var.is_owned) {
4414 LDKChannelMonitor data_var = *data;
4415 data_var = ChannelMonitor_clone(data);
4416 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4417 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4418 long data_ref = (long)data_var.inner;
4419 if (data_var.is_owned) {
4422 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
4423 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4424 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
4427 static void* LDKPersist_JCalls_clone(const void* this_arg) {
4428 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4429 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4430 return (void*) this_arg;
4432 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
4433 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
4434 atomic_init(&calls->refcnt, 1);
4435 //TODO: Assign calls->o from o
4438 .this_arg = (void*) calls,
4439 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
4440 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
4441 .free = LDKPersist_JCalls_free,
4445 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
4446 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
4447 *res_ptr = LDKPersist_init(o);
4448 return (long)res_ptr;
4450 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t id, uint32_t data) {
4451 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
4452 LDKOutPoint id_conv;
4453 id_conv.inner = (void*)(id & (~1));
4454 id_conv.is_owned = (id & 1) || (id == 0);
4455 id_conv = OutPoint_clone(&id_conv);
4456 LDKChannelMonitor data_conv;
4457 data_conv.inner = (void*)(data & (~1));
4458 data_conv.is_owned = false;
4459 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4460 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
4461 return (long)ret_conv;
4464 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
4465 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
4466 LDKOutPoint id_conv;
4467 id_conv.inner = (void*)(id & (~1));
4468 id_conv.is_owned = (id & 1) || (id == 0);
4469 id_conv = OutPoint_clone(&id_conv);
4470 LDKChannelMonitorUpdate update_conv;
4471 update_conv.inner = (void*)(update & (~1));
4472 update_conv.is_owned = false;
4473 LDKChannelMonitor data_conv;
4474 data_conv.inner = (void*)(data & (~1));
4475 data_conv.is_owned = false;
4476 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4477 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
4478 return (long)ret_conv;
4481 typedef struct LDKChannelMessageHandler_JCalls {
4482 atomic_size_t refcnt;
4483 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4484 uint32_t handle_open_channel_meth;
4485 uint32_t handle_accept_channel_meth;
4486 uint32_t handle_funding_created_meth;
4487 uint32_t handle_funding_signed_meth;
4488 uint32_t handle_funding_locked_meth;
4489 uint32_t handle_shutdown_meth;
4490 uint32_t handle_closing_signed_meth;
4491 uint32_t handle_update_add_htlc_meth;
4492 uint32_t handle_update_fulfill_htlc_meth;
4493 uint32_t handle_update_fail_htlc_meth;
4494 uint32_t handle_update_fail_malformed_htlc_meth;
4495 uint32_t handle_commitment_signed_meth;
4496 uint32_t handle_revoke_and_ack_meth;
4497 uint32_t handle_update_fee_meth;
4498 uint32_t handle_announcement_signatures_meth;
4499 uint32_t peer_disconnected_meth;
4500 uint32_t peer_connected_meth;
4501 uint32_t handle_channel_reestablish_meth;
4502 uint32_t handle_channel_update_meth;
4503 uint32_t handle_error_meth;
4504 } LDKChannelMessageHandler_JCalls;
4505 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
4506 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4507 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4508 js_free(j_calls->handle_open_channel_meth);
4509 js_free(j_calls->handle_accept_channel_meth);
4510 js_free(j_calls->handle_funding_created_meth);
4511 js_free(j_calls->handle_funding_signed_meth);
4512 js_free(j_calls->handle_funding_locked_meth);
4513 js_free(j_calls->handle_shutdown_meth);
4514 js_free(j_calls->handle_closing_signed_meth);
4515 js_free(j_calls->handle_update_add_htlc_meth);
4516 js_free(j_calls->handle_update_fulfill_htlc_meth);
4517 js_free(j_calls->handle_update_fail_htlc_meth);
4518 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
4519 js_free(j_calls->handle_commitment_signed_meth);
4520 js_free(j_calls->handle_revoke_and_ack_meth);
4521 js_free(j_calls->handle_update_fee_meth);
4522 js_free(j_calls->handle_announcement_signatures_meth);
4523 js_free(j_calls->peer_disconnected_meth);
4524 js_free(j_calls->peer_connected_meth);
4525 js_free(j_calls->handle_channel_reestablish_meth);
4526 js_free(j_calls->handle_channel_update_meth);
4527 js_free(j_calls->handle_error_meth);
4531 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
4532 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4533 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4534 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4535 LDKInitFeatures their_features_var = their_features;
4536 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4537 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4538 long their_features_ref = (long)their_features_var.inner;
4539 if (their_features_var.is_owned) {
4540 their_features_ref |= 1;
4542 LDKOpenChannel msg_var = *msg;
4543 msg_var = OpenChannel_clone(msg);
4544 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4545 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4546 long msg_ref = (long)msg_var.inner;
4547 if (msg_var.is_owned) {
4550 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4552 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
4553 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4554 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4555 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4556 LDKInitFeatures their_features_var = their_features;
4557 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4558 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4559 long their_features_ref = (long)their_features_var.inner;
4560 if (their_features_var.is_owned) {
4561 their_features_ref |= 1;
4563 LDKAcceptChannel msg_var = *msg;
4564 msg_var = AcceptChannel_clone(msg);
4565 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4566 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4567 long msg_ref = (long)msg_var.inner;
4568 if (msg_var.is_owned) {
4571 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4573 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
4574 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4575 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4576 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4577 LDKFundingCreated msg_var = *msg;
4578 msg_var = FundingCreated_clone(msg);
4579 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4580 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4581 long msg_ref = (long)msg_var.inner;
4582 if (msg_var.is_owned) {
4585 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
4587 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
4588 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4589 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4590 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4591 LDKFundingSigned msg_var = *msg;
4592 msg_var = FundingSigned_clone(msg);
4593 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4594 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4595 long msg_ref = (long)msg_var.inner;
4596 if (msg_var.is_owned) {
4599 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
4601 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
4602 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4603 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4604 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4605 LDKFundingLocked msg_var = *msg;
4606 msg_var = FundingLocked_clone(msg);
4607 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4608 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4609 long msg_ref = (long)msg_var.inner;
4610 if (msg_var.is_owned) {
4613 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
4615 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
4616 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4617 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4618 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4619 LDKInitFeatures their_features_var = *their_features;
4620 their_features_var = InitFeatures_clone(their_features);
4621 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4622 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4623 long their_features_ref = (long)their_features_var.inner;
4624 if (their_features_var.is_owned) {
4625 their_features_ref |= 1;
4627 LDKShutdown msg_var = *msg;
4628 msg_var = Shutdown_clone(msg);
4629 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4630 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4631 long msg_ref = (long)msg_var.inner;
4632 if (msg_var.is_owned) {
4635 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
4637 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
4638 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4639 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4640 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4641 LDKClosingSigned msg_var = *msg;
4642 msg_var = ClosingSigned_clone(msg);
4643 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4644 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4645 long msg_ref = (long)msg_var.inner;
4646 if (msg_var.is_owned) {
4649 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
4651 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
4652 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4653 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4654 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4655 LDKUpdateAddHTLC msg_var = *msg;
4656 msg_var = UpdateAddHTLC_clone(msg);
4657 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4658 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4659 long msg_ref = (long)msg_var.inner;
4660 if (msg_var.is_owned) {
4663 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
4665 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
4666 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4667 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4668 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4669 LDKUpdateFulfillHTLC msg_var = *msg;
4670 msg_var = UpdateFulfillHTLC_clone(msg);
4671 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4672 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4673 long msg_ref = (long)msg_var.inner;
4674 if (msg_var.is_owned) {
4677 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
4679 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
4680 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4681 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4682 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4683 LDKUpdateFailHTLC msg_var = *msg;
4684 msg_var = UpdateFailHTLC_clone(msg);
4685 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4686 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4687 long msg_ref = (long)msg_var.inner;
4688 if (msg_var.is_owned) {
4691 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
4693 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
4694 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4695 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4696 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4697 LDKUpdateFailMalformedHTLC msg_var = *msg;
4698 msg_var = UpdateFailMalformedHTLC_clone(msg);
4699 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4700 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4701 long msg_ref = (long)msg_var.inner;
4702 if (msg_var.is_owned) {
4705 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
4707 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
4708 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4709 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4710 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4711 LDKCommitmentSigned msg_var = *msg;
4712 msg_var = CommitmentSigned_clone(msg);
4713 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4714 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4715 long msg_ref = (long)msg_var.inner;
4716 if (msg_var.is_owned) {
4719 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
4721 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
4722 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4723 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4724 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4725 LDKRevokeAndACK msg_var = *msg;
4726 msg_var = RevokeAndACK_clone(msg);
4727 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4728 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4729 long msg_ref = (long)msg_var.inner;
4730 if (msg_var.is_owned) {
4733 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
4735 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
4736 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4737 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4738 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4739 LDKUpdateFee msg_var = *msg;
4740 msg_var = UpdateFee_clone(msg);
4741 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4742 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4743 long msg_ref = (long)msg_var.inner;
4744 if (msg_var.is_owned) {
4747 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
4749 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
4750 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4751 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4752 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4753 LDKAnnouncementSignatures msg_var = *msg;
4754 msg_var = AnnouncementSignatures_clone(msg);
4755 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4756 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4757 long msg_ref = (long)msg_var.inner;
4758 if (msg_var.is_owned) {
4761 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
4763 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
4764 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4765 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4766 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4767 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
4769 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
4770 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4771 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4772 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4773 LDKInit msg_var = *msg;
4774 msg_var = Init_clone(msg);
4775 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4776 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4777 long msg_ref = (long)msg_var.inner;
4778 if (msg_var.is_owned) {
4781 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
4783 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
4784 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4785 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4786 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4787 LDKChannelReestablish msg_var = *msg;
4788 msg_var = ChannelReestablish_clone(msg);
4789 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4790 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4791 long msg_ref = (long)msg_var.inner;
4792 if (msg_var.is_owned) {
4795 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
4797 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
4798 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4799 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4800 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4801 LDKChannelUpdate msg_var = *msg;
4802 msg_var = ChannelUpdate_clone(msg);
4803 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4804 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4805 long msg_ref = (long)msg_var.inner;
4806 if (msg_var.is_owned) {
4809 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
4811 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
4812 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4813 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4814 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4815 LDKErrorMessage msg_var = *msg;
4816 msg_var = ErrorMessage_clone(msg);
4817 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4818 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4819 long msg_ref = (long)msg_var.inner;
4820 if (msg_var.is_owned) {
4823 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
4825 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
4826 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4827 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4828 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4829 return (void*) this_arg;
4831 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
4832 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
4833 atomic_init(&calls->refcnt, 1);
4834 //TODO: Assign calls->o from o
4836 LDKChannelMessageHandler ret = {
4837 .this_arg = (void*) calls,
4838 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
4839 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
4840 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
4841 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
4842 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
4843 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
4844 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
4845 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
4846 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
4847 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
4848 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
4849 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
4850 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
4851 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
4852 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
4853 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
4854 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
4855 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
4856 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
4857 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
4858 .free = LDKChannelMessageHandler_JCalls_free,
4859 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
4861 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
4864 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
4865 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
4866 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
4867 return (long)res_ptr;
4869 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) {
4870 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4871 LDKPublicKey their_node_id_ref;
4872 CHECK(*((uint32_t*)their_node_id) == 33);
4873 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4874 LDKInitFeatures their_features_conv;
4875 their_features_conv.inner = (void*)(their_features & (~1));
4876 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4877 their_features_conv = InitFeatures_clone(&their_features_conv);
4878 LDKOpenChannel msg_conv;
4879 msg_conv.inner = (void*)(msg & (~1));
4880 msg_conv.is_owned = false;
4881 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4884 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) {
4885 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4886 LDKPublicKey their_node_id_ref;
4887 CHECK(*((uint32_t*)their_node_id) == 33);
4888 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4889 LDKInitFeatures their_features_conv;
4890 their_features_conv.inner = (void*)(their_features & (~1));
4891 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4892 their_features_conv = InitFeatures_clone(&their_features_conv);
4893 LDKAcceptChannel msg_conv;
4894 msg_conv.inner = (void*)(msg & (~1));
4895 msg_conv.is_owned = false;
4896 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4899 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4900 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4901 LDKPublicKey their_node_id_ref;
4902 CHECK(*((uint32_t*)their_node_id) == 33);
4903 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4904 LDKFundingCreated msg_conv;
4905 msg_conv.inner = (void*)(msg & (~1));
4906 msg_conv.is_owned = false;
4907 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4910 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4911 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4912 LDKPublicKey their_node_id_ref;
4913 CHECK(*((uint32_t*)their_node_id) == 33);
4914 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4915 LDKFundingSigned msg_conv;
4916 msg_conv.inner = (void*)(msg & (~1));
4917 msg_conv.is_owned = false;
4918 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4921 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4922 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4923 LDKPublicKey their_node_id_ref;
4924 CHECK(*((uint32_t*)their_node_id) == 33);
4925 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4926 LDKFundingLocked msg_conv;
4927 msg_conv.inner = (void*)(msg & (~1));
4928 msg_conv.is_owned = false;
4929 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4932 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
4933 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4934 LDKPublicKey their_node_id_ref;
4935 CHECK(*((uint32_t*)their_node_id) == 33);
4936 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4937 LDKInitFeatures their_features_conv;
4938 their_features_conv.inner = (void*)(their_features & (~1));
4939 their_features_conv.is_owned = false;
4940 LDKShutdown msg_conv;
4941 msg_conv.inner = (void*)(msg & (~1));
4942 msg_conv.is_owned = false;
4943 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
4946 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4947 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4948 LDKPublicKey their_node_id_ref;
4949 CHECK(*((uint32_t*)their_node_id) == 33);
4950 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4951 LDKClosingSigned msg_conv;
4952 msg_conv.inner = (void*)(msg & (~1));
4953 msg_conv.is_owned = false;
4954 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4957 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4958 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4959 LDKPublicKey their_node_id_ref;
4960 CHECK(*((uint32_t*)their_node_id) == 33);
4961 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4962 LDKUpdateAddHTLC msg_conv;
4963 msg_conv.inner = (void*)(msg & (~1));
4964 msg_conv.is_owned = false;
4965 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4968 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4969 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4970 LDKPublicKey their_node_id_ref;
4971 CHECK(*((uint32_t*)their_node_id) == 33);
4972 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4973 LDKUpdateFulfillHTLC msg_conv;
4974 msg_conv.inner = (void*)(msg & (~1));
4975 msg_conv.is_owned = false;
4976 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4979 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4980 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4981 LDKPublicKey their_node_id_ref;
4982 CHECK(*((uint32_t*)their_node_id) == 33);
4983 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4984 LDKUpdateFailHTLC msg_conv;
4985 msg_conv.inner = (void*)(msg & (~1));
4986 msg_conv.is_owned = false;
4987 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4990 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4991 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4992 LDKPublicKey their_node_id_ref;
4993 CHECK(*((uint32_t*)their_node_id) == 33);
4994 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4995 LDKUpdateFailMalformedHTLC msg_conv;
4996 msg_conv.inner = (void*)(msg & (~1));
4997 msg_conv.is_owned = false;
4998 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5001 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5002 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5003 LDKPublicKey their_node_id_ref;
5004 CHECK(*((uint32_t*)their_node_id) == 33);
5005 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5006 LDKCommitmentSigned msg_conv;
5007 msg_conv.inner = (void*)(msg & (~1));
5008 msg_conv.is_owned = false;
5009 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5012 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5013 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5014 LDKPublicKey their_node_id_ref;
5015 CHECK(*((uint32_t*)their_node_id) == 33);
5016 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5017 LDKRevokeAndACK msg_conv;
5018 msg_conv.inner = (void*)(msg & (~1));
5019 msg_conv.is_owned = false;
5020 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5023 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5024 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5025 LDKPublicKey their_node_id_ref;
5026 CHECK(*((uint32_t*)their_node_id) == 33);
5027 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5028 LDKUpdateFee msg_conv;
5029 msg_conv.inner = (void*)(msg & (~1));
5030 msg_conv.is_owned = false;
5031 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5034 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5035 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5036 LDKPublicKey their_node_id_ref;
5037 CHECK(*((uint32_t*)their_node_id) == 33);
5038 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5039 LDKAnnouncementSignatures msg_conv;
5040 msg_conv.inner = (void*)(msg & (~1));
5041 msg_conv.is_owned = false;
5042 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5045 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
5046 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5047 LDKPublicKey their_node_id_ref;
5048 CHECK(*((uint32_t*)their_node_id) == 33);
5049 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5050 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
5053 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5054 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5055 LDKPublicKey their_node_id_ref;
5056 CHECK(*((uint32_t*)their_node_id) == 33);
5057 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5059 msg_conv.inner = (void*)(msg & (~1));
5060 msg_conv.is_owned = false;
5061 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5064 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5065 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5066 LDKPublicKey their_node_id_ref;
5067 CHECK(*((uint32_t*)their_node_id) == 33);
5068 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5069 LDKChannelReestablish msg_conv;
5070 msg_conv.inner = (void*)(msg & (~1));
5071 msg_conv.is_owned = false;
5072 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5075 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5076 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5077 LDKPublicKey their_node_id_ref;
5078 CHECK(*((uint32_t*)their_node_id) == 33);
5079 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5080 LDKChannelUpdate msg_conv;
5081 msg_conv.inner = (void*)(msg & (~1));
5082 msg_conv.is_owned = false;
5083 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5086 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5087 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5088 LDKPublicKey their_node_id_ref;
5089 CHECK(*((uint32_t*)their_node_id) == 33);
5090 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5091 LDKErrorMessage msg_conv;
5092 msg_conv.inner = (void*)(msg & (~1));
5093 msg_conv.is_owned = false;
5094 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5097 typedef struct LDKRoutingMessageHandler_JCalls {
5098 atomic_size_t refcnt;
5099 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5100 uint32_t handle_node_announcement_meth;
5101 uint32_t handle_channel_announcement_meth;
5102 uint32_t handle_channel_update_meth;
5103 uint32_t handle_htlc_fail_channel_update_meth;
5104 uint32_t get_next_channel_announcements_meth;
5105 uint32_t get_next_node_announcements_meth;
5106 uint32_t sync_routing_table_meth;
5107 uint32_t handle_reply_channel_range_meth;
5108 uint32_t handle_reply_short_channel_ids_end_meth;
5109 uint32_t handle_query_channel_range_meth;
5110 uint32_t handle_query_short_channel_ids_meth;
5111 } LDKRoutingMessageHandler_JCalls;
5112 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
5113 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5114 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5115 js_free(j_calls->handle_node_announcement_meth);
5116 js_free(j_calls->handle_channel_announcement_meth);
5117 js_free(j_calls->handle_channel_update_meth);
5118 js_free(j_calls->handle_htlc_fail_channel_update_meth);
5119 js_free(j_calls->get_next_channel_announcements_meth);
5120 js_free(j_calls->get_next_node_announcements_meth);
5121 js_free(j_calls->sync_routing_table_meth);
5122 js_free(j_calls->handle_reply_channel_range_meth);
5123 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
5124 js_free(j_calls->handle_query_channel_range_meth);
5125 js_free(j_calls->handle_query_short_channel_ids_meth);
5129 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
5130 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5131 LDKNodeAnnouncement msg_var = *msg;
5132 msg_var = NodeAnnouncement_clone(msg);
5133 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5134 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5135 long msg_ref = (long)msg_var.inner;
5136 if (msg_var.is_owned) {
5139 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
5140 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5141 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
5144 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
5145 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5146 LDKChannelAnnouncement msg_var = *msg;
5147 msg_var = ChannelAnnouncement_clone(msg);
5148 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5149 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5150 long msg_ref = (long)msg_var.inner;
5151 if (msg_var.is_owned) {
5154 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
5155 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5156 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
5159 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
5160 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5161 LDKChannelUpdate msg_var = *msg;
5162 msg_var = ChannelUpdate_clone(msg);
5163 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5164 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5165 long msg_ref = (long)msg_var.inner;
5166 if (msg_var.is_owned) {
5169 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
5170 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5171 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
5174 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
5175 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5176 long ret_update = (long)update;
5177 js_invoke_function_1(j_calls->handle_htlc_fail_channel_update_meth, ret_update);
5179 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
5180 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5181 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
5182 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
5183 ret_constr.datalen = *((uint32_t*)ret);
5184 if (ret_constr.datalen > 0)
5185 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5187 ret_constr.data = NULL;
5188 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5189 for (size_t l = 0; l < ret_constr.datalen; l++) {
5190 uint32_t ret_conv_63 = ret_vals[l];
5191 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
5192 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
5193 ret_constr.data[l] = ret_conv_63_conv;
5197 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
5198 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5199 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5200 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
5201 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
5202 LDKCVec_NodeAnnouncementZ ret_constr;
5203 ret_constr.datalen = *((uint32_t*)ret);
5204 if (ret_constr.datalen > 0)
5205 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5207 ret_constr.data = NULL;
5208 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5209 for (size_t s = 0; s < ret_constr.datalen; s++) {
5210 uint32_t ret_conv_18 = ret_vals[s];
5211 LDKNodeAnnouncement ret_conv_18_conv;
5212 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
5213 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
5214 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
5215 ret_constr.data[s] = ret_conv_18_conv;
5219 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
5220 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5221 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5222 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5223 LDKInit init_var = *init;
5224 init_var = Init_clone(init);
5225 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5226 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5227 long init_ref = (long)init_var.inner;
5228 if (init_var.is_owned) {
5231 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
5233 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
5234 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5235 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5236 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5237 LDKReplyChannelRange msg_var = msg;
5238 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5239 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5240 long msg_ref = (long)msg_var.inner;
5241 if (msg_var.is_owned) {
5244 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
5245 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5246 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
5249 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
5250 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5251 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5252 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5253 LDKReplyShortChannelIdsEnd msg_var = msg;
5254 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5255 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5256 long msg_ref = (long)msg_var.inner;
5257 if (msg_var.is_owned) {
5260 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
5261 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5262 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
5265 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
5266 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5267 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5268 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5269 LDKQueryChannelRange msg_var = msg;
5270 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5271 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5272 long msg_ref = (long)msg_var.inner;
5273 if (msg_var.is_owned) {
5276 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
5277 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5278 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
5281 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
5282 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5283 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5284 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5285 LDKQueryShortChannelIds msg_var = msg;
5286 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5287 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5288 long msg_ref = (long)msg_var.inner;
5289 if (msg_var.is_owned) {
5292 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
5293 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5294 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
5297 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
5298 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5299 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5300 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5301 return (void*) this_arg;
5303 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
5304 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
5305 atomic_init(&calls->refcnt, 1);
5306 //TODO: Assign calls->o from o
5308 LDKRoutingMessageHandler ret = {
5309 .this_arg = (void*) calls,
5310 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
5311 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
5312 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
5313 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
5314 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
5315 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
5316 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
5317 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
5318 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
5319 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
5320 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
5321 .free = LDKRoutingMessageHandler_JCalls_free,
5322 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
5324 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5327 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
5328 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
5329 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
5330 return (long)res_ptr;
5332 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
5333 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5334 LDKNodeAnnouncement msg_conv;
5335 msg_conv.inner = (void*)(msg & (~1));
5336 msg_conv.is_owned = false;
5337 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5338 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
5339 return (long)ret_conv;
5342 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
5343 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5344 LDKChannelAnnouncement msg_conv;
5345 msg_conv.inner = (void*)(msg & (~1));
5346 msg_conv.is_owned = false;
5347 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5348 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5349 return (long)ret_conv;
5352 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
5353 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5354 LDKChannelUpdate msg_conv;
5355 msg_conv.inner = (void*)(msg & (~1));
5356 msg_conv.is_owned = false;
5357 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5358 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
5359 return (long)ret_conv;
5362 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_htlc_fail_channel_update(uint32_t this_arg, uint32_t update) {
5363 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5364 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
5365 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
5368 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
5369 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5370 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
5371 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5372 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5373 for (size_t l = 0; l < ret_var.datalen; l++) {
5374 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5375 *ret_conv_63_ref = ret_var.data[l];
5376 ret_arr_ptr[l] = (long)ret_conv_63_ref;
5382 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
5383 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5384 LDKPublicKey starting_point_ref;
5385 CHECK(*((uint32_t*)starting_point) == 33);
5386 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
5387 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
5388 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5389 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5390 for (size_t s = 0; s < ret_var.datalen; s++) {
5391 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
5392 CHECK((((long)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5393 CHECK((((long)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5394 long ret_conv_18_ref = (long)ret_conv_18_var.inner;
5395 if (ret_conv_18_var.is_owned) {
5396 ret_conv_18_ref |= 1;
5398 ret_arr_ptr[s] = ret_conv_18_ref;
5404 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
5405 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5406 LDKPublicKey their_node_id_ref;
5407 CHECK(*((uint32_t*)their_node_id) == 33);
5408 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5410 init_conv.inner = (void*)(init & (~1));
5411 init_conv.is_owned = false;
5412 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
5415 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5416 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5417 LDKPublicKey their_node_id_ref;
5418 CHECK(*((uint32_t*)their_node_id) == 33);
5419 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5420 LDKReplyChannelRange msg_conv;
5421 msg_conv.inner = (void*)(msg & (~1));
5422 msg_conv.is_owned = (msg & 1) || (msg == 0);
5423 msg_conv = ReplyChannelRange_clone(&msg_conv);
5424 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5425 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5426 return (long)ret_conv;
5429 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) {
5430 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5431 LDKPublicKey their_node_id_ref;
5432 CHECK(*((uint32_t*)their_node_id) == 33);
5433 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5434 LDKReplyShortChannelIdsEnd msg_conv;
5435 msg_conv.inner = (void*)(msg & (~1));
5436 msg_conv.is_owned = (msg & 1) || (msg == 0);
5437 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
5438 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5439 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5440 return (long)ret_conv;
5443 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5444 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5445 LDKPublicKey their_node_id_ref;
5446 CHECK(*((uint32_t*)their_node_id) == 33);
5447 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5448 LDKQueryChannelRange msg_conv;
5449 msg_conv.inner = (void*)(msg & (~1));
5450 msg_conv.is_owned = (msg & 1) || (msg == 0);
5451 msg_conv = QueryChannelRange_clone(&msg_conv);
5452 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5453 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5454 return (long)ret_conv;
5457 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5458 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5459 LDKPublicKey their_node_id_ref;
5460 CHECK(*((uint32_t*)their_node_id) == 33);
5461 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5462 LDKQueryShortChannelIds msg_conv;
5463 msg_conv.inner = (void*)(msg & (~1));
5464 msg_conv.is_owned = (msg & 1) || (msg == 0);
5465 msg_conv = QueryShortChannelIds_clone(&msg_conv);
5466 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5467 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5468 return (long)ret_conv;
5471 typedef struct LDKSocketDescriptor_JCalls {
5472 atomic_size_t refcnt;
5473 uint32_t send_data_meth;
5474 uint32_t disconnect_socket_meth;
5477 } LDKSocketDescriptor_JCalls;
5478 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
5479 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5480 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5481 js_free(j_calls->send_data_meth);
5482 js_free(j_calls->disconnect_socket_meth);
5483 js_free(j_calls->eq_meth);
5484 js_free(j_calls->hash_meth);
5488 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
5489 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5490 LDKu8slice data_var = data;
5491 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5492 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
5493 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
5495 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
5496 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5497 js_invoke_function_0(j_calls->disconnect_socket_meth);
5499 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
5500 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5501 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5502 *other_arg_clone = SocketDescriptor_clone(other_arg);
5503 return js_invoke_function_1(j_calls->eq_meth, (long)other_arg_clone);
5505 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
5506 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5507 return js_invoke_function_0(j_calls->hash_meth);
5509 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
5510 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5511 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5512 return (void*) this_arg;
5514 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
5515 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
5516 atomic_init(&calls->refcnt, 1);
5517 //TODO: Assign calls->o from o
5519 LDKSocketDescriptor ret = {
5520 .this_arg = (void*) calls,
5521 .send_data = send_data_LDKSocketDescriptor_jcall,
5522 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
5523 .eq = eq_LDKSocketDescriptor_jcall,
5524 .hash = hash_LDKSocketDescriptor_jcall,
5525 .clone = LDKSocketDescriptor_JCalls_clone,
5526 .free = LDKSocketDescriptor_JCalls_free,
5530 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
5531 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5532 *res_ptr = LDKSocketDescriptor_init(o);
5533 return (long)res_ptr;
5535 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
5536 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
5537 LDKu8slice data_ref;
5538 data_ref.datalen = *((uint32_t*)data);
5539 data_ref.data = (int8_t*)(data + 4);
5540 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
5544 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
5545 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
5546 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
5549 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
5550 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
5551 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
5555 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
5556 LDKTransaction _res_ref;
5557 _res_ref.datalen = *((uint32_t*)_res);
5558 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5559 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
5560 _res_ref.data_is_owned = true;
5561 Transaction_free(_res_ref);
5564 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
5565 if ((_res & 1) != 0) return;
5566 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
5568 TxOut_free(_res_conv);
5571 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
5572 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
5573 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5574 *ret_ref = TxOut_clone(orig_conv);
5575 return (long)ret_ref;
5578 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
5579 LDKChannelConfig o_conv;
5580 o_conv.inner = (void*)(o & (~1));
5581 o_conv.is_owned = (o & 1) || (o == 0);
5582 o_conv = ChannelConfig_clone(&o_conv);
5583 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
5584 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
5585 return (long)ret_conv;
5588 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
5589 LDKDecodeError e_conv;
5590 e_conv.inner = (void*)(e & (~1));
5591 e_conv.is_owned = (e & 1) || (e == 0);
5592 e_conv = DecodeError_clone(&e_conv);
5593 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
5594 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
5595 return (long)ret_conv;
5598 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
5599 if ((_res & 1) != 0) return;
5600 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
5602 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
5605 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
5606 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
5607 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
5608 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
5609 return (long)ret_conv;
5612 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
5614 o_conv.inner = (void*)(o & (~1));
5615 o_conv.is_owned = (o & 1) || (o == 0);
5616 o_conv = OutPoint_clone(&o_conv);
5617 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
5618 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
5619 return (long)ret_conv;
5622 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
5623 LDKDecodeError e_conv;
5624 e_conv.inner = (void*)(e & (~1));
5625 e_conv.is_owned = (e & 1) || (e == 0);
5626 e_conv = DecodeError_clone(&e_conv);
5627 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
5628 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
5629 return (long)ret_conv;
5632 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
5633 if ((_res & 1) != 0) return;
5634 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
5636 CResult_OutPointDecodeErrorZ_free(_res_conv);
5639 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
5640 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
5641 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
5642 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
5643 return (long)ret_conv;
5646 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
5648 CHECK(*((uint32_t*)o) == 32);
5649 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
5650 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
5651 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
5652 return (long)ret_conv;
5655 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
5656 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5657 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
5658 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
5659 return (long)ret_conv;
5662 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
5663 if ((_res & 1) != 0) return;
5664 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
5666 CResult_SecretKeyErrorZ_free(_res_conv);
5669 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
5671 CHECK(*((uint32_t*)o) == 33);
5672 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
5673 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
5674 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
5675 return (long)ret_conv;
5678 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
5679 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5680 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
5681 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
5682 return (long)ret_conv;
5685 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
5686 if ((_res & 1) != 0) return;
5687 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
5689 CResult_PublicKeyErrorZ_free(_res_conv);
5692 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
5693 LDKTxCreationKeys o_conv;
5694 o_conv.inner = (void*)(o & (~1));
5695 o_conv.is_owned = (o & 1) || (o == 0);
5696 o_conv = TxCreationKeys_clone(&o_conv);
5697 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5698 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
5699 return (long)ret_conv;
5702 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
5703 LDKDecodeError e_conv;
5704 e_conv.inner = (void*)(e & (~1));
5705 e_conv.is_owned = (e & 1) || (e == 0);
5706 e_conv = DecodeError_clone(&e_conv);
5707 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5708 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
5709 return (long)ret_conv;
5712 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
5713 if ((_res & 1) != 0) return;
5714 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
5716 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
5719 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
5720 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
5721 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5722 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
5723 return (long)ret_conv;
5726 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
5727 LDKChannelPublicKeys o_conv;
5728 o_conv.inner = (void*)(o & (~1));
5729 o_conv.is_owned = (o & 1) || (o == 0);
5730 o_conv = ChannelPublicKeys_clone(&o_conv);
5731 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5732 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
5733 return (long)ret_conv;
5736 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
5737 LDKDecodeError e_conv;
5738 e_conv.inner = (void*)(e & (~1));
5739 e_conv.is_owned = (e & 1) || (e == 0);
5740 e_conv = DecodeError_clone(&e_conv);
5741 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5742 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
5743 return (long)ret_conv;
5746 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
5747 if ((_res & 1) != 0) return;
5748 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
5750 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
5753 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
5754 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
5755 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5756 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
5757 return (long)ret_conv;
5760 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
5761 LDKTxCreationKeys o_conv;
5762 o_conv.inner = (void*)(o & (~1));
5763 o_conv.is_owned = (o & 1) || (o == 0);
5764 o_conv = TxCreationKeys_clone(&o_conv);
5765 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
5766 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
5767 return (long)ret_conv;
5770 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
5771 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5772 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
5773 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
5774 return (long)ret_conv;
5777 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
5778 if ((_res & 1) != 0) return;
5779 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
5781 CResult_TxCreationKeysErrorZ_free(_res_conv);
5784 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
5785 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
5786 *ret_copy = COption_u32Z_some(o);
5787 long ret_ref = (long)ret_copy;
5791 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
5792 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
5793 *ret_copy = COption_u32Z_none();
5794 long ret_ref = (long)ret_copy;
5798 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
5799 if ((_res & 1) != 0) return;
5800 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
5802 COption_u32Z_free(_res_conv);
5805 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
5806 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
5807 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
5808 *ret_copy = COption_u32Z_clone(orig_conv);
5809 long ret_ref = (long)ret_copy;
5813 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
5814 LDKHTLCOutputInCommitment o_conv;
5815 o_conv.inner = (void*)(o & (~1));
5816 o_conv.is_owned = (o & 1) || (o == 0);
5817 o_conv = HTLCOutputInCommitment_clone(&o_conv);
5818 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5819 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
5820 return (long)ret_conv;
5823 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
5824 LDKDecodeError e_conv;
5825 e_conv.inner = (void*)(e & (~1));
5826 e_conv.is_owned = (e & 1) || (e == 0);
5827 e_conv = DecodeError_clone(&e_conv);
5828 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5829 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
5830 return (long)ret_conv;
5833 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
5834 if ((_res & 1) != 0) return;
5835 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
5837 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
5840 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
5841 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
5842 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5843 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
5844 return (long)ret_conv;
5847 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
5848 LDKCounterpartyChannelTransactionParameters o_conv;
5849 o_conv.inner = (void*)(o & (~1));
5850 o_conv.is_owned = (o & 1) || (o == 0);
5851 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
5852 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5853 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
5854 return (long)ret_conv;
5857 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
5858 LDKDecodeError e_conv;
5859 e_conv.inner = (void*)(e & (~1));
5860 e_conv.is_owned = (e & 1) || (e == 0);
5861 e_conv = DecodeError_clone(&e_conv);
5862 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5863 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
5864 return (long)ret_conv;
5867 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
5868 if ((_res & 1) != 0) return;
5869 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
5871 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
5874 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
5875 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
5876 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5877 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
5878 return (long)ret_conv;
5881 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
5882 LDKChannelTransactionParameters o_conv;
5883 o_conv.inner = (void*)(o & (~1));
5884 o_conv.is_owned = (o & 1) || (o == 0);
5885 o_conv = ChannelTransactionParameters_clone(&o_conv);
5886 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5887 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
5888 return (long)ret_conv;
5891 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
5892 LDKDecodeError e_conv;
5893 e_conv.inner = (void*)(e & (~1));
5894 e_conv.is_owned = (e & 1) || (e == 0);
5895 e_conv = DecodeError_clone(&e_conv);
5896 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5897 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
5898 return (long)ret_conv;
5901 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
5902 if ((_res & 1) != 0) return;
5903 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
5905 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
5908 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
5909 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
5910 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5911 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
5912 return (long)ret_conv;
5915 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
5916 LDKCVec_SignatureZ _res_constr;
5917 _res_constr.datalen = *((uint32_t*)_res);
5918 if (_res_constr.datalen > 0)
5919 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5921 _res_constr.data = NULL;
5922 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
5923 for (size_t m = 0; m < _res_constr.datalen; m++) {
5924 int8_tArray _res_conv_12 = _res_vals[m];
5925 LDKSignature _res_conv_12_ref;
5926 CHECK(*((uint32_t*)_res_conv_12) == 64);
5927 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
5928 _res_constr.data[m] = _res_conv_12_ref;
5930 CVec_SignatureZ_free(_res_constr);
5933 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5934 LDKHolderCommitmentTransaction o_conv;
5935 o_conv.inner = (void*)(o & (~1));
5936 o_conv.is_owned = (o & 1) || (o == 0);
5937 o_conv = HolderCommitmentTransaction_clone(&o_conv);
5938 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5939 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
5940 return (long)ret_conv;
5943 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5944 LDKDecodeError e_conv;
5945 e_conv.inner = (void*)(e & (~1));
5946 e_conv.is_owned = (e & 1) || (e == 0);
5947 e_conv = DecodeError_clone(&e_conv);
5948 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5949 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
5950 return (long)ret_conv;
5953 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5954 if ((_res & 1) != 0) return;
5955 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5957 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
5960 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5961 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
5962 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5963 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
5964 return (long)ret_conv;
5967 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5968 LDKBuiltCommitmentTransaction o_conv;
5969 o_conv.inner = (void*)(o & (~1));
5970 o_conv.is_owned = (o & 1) || (o == 0);
5971 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
5972 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5973 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
5974 return (long)ret_conv;
5977 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5978 LDKDecodeError e_conv;
5979 e_conv.inner = (void*)(e & (~1));
5980 e_conv.is_owned = (e & 1) || (e == 0);
5981 e_conv = DecodeError_clone(&e_conv);
5982 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5983 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
5984 return (long)ret_conv;
5987 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5988 if ((_res & 1) != 0) return;
5989 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5991 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
5994 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5995 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
5996 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5997 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
5998 return (long)ret_conv;
6001 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
6002 LDKCommitmentTransaction o_conv;
6003 o_conv.inner = (void*)(o & (~1));
6004 o_conv.is_owned = (o & 1) || (o == 0);
6005 o_conv = CommitmentTransaction_clone(&o_conv);
6006 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6007 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
6008 return (long)ret_conv;
6011 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
6012 LDKDecodeError e_conv;
6013 e_conv.inner = (void*)(e & (~1));
6014 e_conv.is_owned = (e & 1) || (e == 0);
6015 e_conv = DecodeError_clone(&e_conv);
6016 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6017 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
6018 return (long)ret_conv;
6021 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
6022 if ((_res & 1) != 0) return;
6023 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6025 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
6028 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
6029 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
6030 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6031 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
6032 return (long)ret_conv;
6035 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
6036 LDKTrustedCommitmentTransaction o_conv;
6037 o_conv.inner = (void*)(o & (~1));
6038 o_conv.is_owned = (o & 1) || (o == 0);
6039 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
6040 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6041 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
6042 return (long)ret_conv;
6045 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
6046 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6047 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
6048 return (long)ret_conv;
6051 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
6052 if ((_res & 1) != 0) return;
6053 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
6055 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
6058 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
6059 LDKCVec_SignatureZ o_constr;
6060 o_constr.datalen = *((uint32_t*)o);
6061 if (o_constr.datalen > 0)
6062 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6064 o_constr.data = NULL;
6065 int8_tArray* o_vals = (int8_tArray*)(o + 4);
6066 for (size_t m = 0; m < o_constr.datalen; m++) {
6067 int8_tArray o_conv_12 = o_vals[m];
6068 LDKSignature o_conv_12_ref;
6069 CHECK(*((uint32_t*)o_conv_12) == 64);
6070 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
6071 o_constr.data[m] = o_conv_12_ref;
6073 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6074 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
6075 return (long)ret_conv;
6078 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
6079 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6080 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
6081 return (long)ret_conv;
6084 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
6085 if ((_res & 1) != 0) return;
6086 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
6088 CResult_CVec_SignatureZNoneZ_free(_res_conv);
6091 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
6092 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
6093 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6094 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
6095 return (long)ret_conv;
6098 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
6099 LDKChannelMonitorUpdate o_conv;
6100 o_conv.inner = (void*)(o & (~1));
6101 o_conv.is_owned = (o & 1) || (o == 0);
6102 o_conv = ChannelMonitorUpdate_clone(&o_conv);
6103 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6104 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
6105 return (long)ret_conv;
6108 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
6109 LDKDecodeError e_conv;
6110 e_conv.inner = (void*)(e & (~1));
6111 e_conv.is_owned = (e & 1) || (e == 0);
6112 e_conv = DecodeError_clone(&e_conv);
6113 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6114 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
6115 return (long)ret_conv;
6118 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
6119 if ((_res & 1) != 0) return;
6120 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
6122 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
6125 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
6126 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
6127 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6128 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
6129 return (long)ret_conv;
6132 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
6133 LDKHTLCUpdate o_conv;
6134 o_conv.inner = (void*)(o & (~1));
6135 o_conv.is_owned = (o & 1) || (o == 0);
6136 o_conv = HTLCUpdate_clone(&o_conv);
6137 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6138 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
6139 return (long)ret_conv;
6142 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
6143 LDKDecodeError e_conv;
6144 e_conv.inner = (void*)(e & (~1));
6145 e_conv.is_owned = (e & 1) || (e == 0);
6146 e_conv = DecodeError_clone(&e_conv);
6147 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6148 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
6149 return (long)ret_conv;
6152 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
6153 if ((_res & 1) != 0) return;
6154 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
6156 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
6159 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
6160 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
6161 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6162 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
6163 return (long)ret_conv;
6166 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
6167 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6168 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
6169 return (long)ret_conv;
6172 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
6173 LDKMonitorUpdateError e_conv;
6174 e_conv.inner = (void*)(e & (~1));
6175 e_conv.is_owned = (e & 1) || (e == 0);
6176 e_conv = MonitorUpdateError_clone(&e_conv);
6177 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6178 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
6179 return (long)ret_conv;
6182 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
6183 if ((_res & 1) != 0) return;
6184 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
6186 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
6189 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
6190 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
6191 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6192 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
6193 return (long)ret_conv;
6196 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
6198 a_conv.inner = (void*)(a & (~1));
6199 a_conv.is_owned = (a & 1) || (a == 0);
6200 a_conv = OutPoint_clone(&a_conv);
6202 b_ref.datalen = *((uint32_t*)b);
6203 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
6204 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6205 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6206 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
6207 return (long)ret_ref;
6210 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
6211 if ((_res & 1) != 0) return;
6212 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
6214 C2Tuple_OutPointScriptZ_free(_res_conv);
6217 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
6219 b_ref.datalen = *((uint32_t*)b);
6220 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
6221 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6222 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6223 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
6224 return (long)ret_ref;
6227 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
6228 if ((_res & 1) != 0) return;
6229 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
6231 C2Tuple_u32ScriptZ_free(_res_conv);
6234 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
6235 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
6236 _res_constr.datalen = *((uint32_t*)_res);
6237 if (_res_constr.datalen > 0)
6238 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
6240 _res_constr.data = NULL;
6241 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6242 for (size_t e = 0; e < _res_constr.datalen; e++) {
6243 uint32_t _res_conv_30 = _res_vals[e];
6244 LDKC2Tuple_u32ScriptZ _res_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_30) & ~1);
6245 FREE((void*)_res_conv_30);
6246 _res_constr.data[e] = _res_conv_30_conv;
6248 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
6251 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
6252 LDKThirtyTwoBytes a_ref;
6253 CHECK(*((uint32_t*)a) == 32);
6254 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6255 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
6256 b_constr.datalen = *((uint32_t*)b);
6257 if (b_constr.datalen > 0)
6258 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
6260 b_constr.data = NULL;
6261 uint32_t* b_vals = (uint32_t*)(b + 4);
6262 for (size_t e = 0; e < b_constr.datalen; e++) {
6263 uint32_t b_conv_30 = b_vals[e];
6264 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
6265 // Warning: we may need a move here but no clone is available for LDKC2Tuple_u32ScriptZ
6266 b_constr.data[e] = b_conv_30_conv;
6268 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
6269 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
6270 return (long)ret_ref;
6273 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
6274 if ((_res & 1) != 0) return;
6275 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
6277 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
6280 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
6281 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
6282 _res_constr.datalen = *((uint32_t*)_res);
6283 if (_res_constr.datalen > 0)
6284 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
6286 _res_constr.data = NULL;
6287 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6288 for (size_t c = 0; c < _res_constr.datalen; c++) {
6289 uint32_t _res_conv_54 = _res_vals[c];
6290 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_54_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_54) & ~1);
6291 FREE((void*)_res_conv_54);
6292 _res_constr.data[c] = _res_conv_54_conv;
6294 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
6297 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
6298 LDKCVec_MonitorEventZ _res_constr;
6299 _res_constr.datalen = *((uint32_t*)_res);
6300 if (_res_constr.datalen > 0)
6301 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
6303 _res_constr.data = NULL;
6304 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6305 for (size_t o = 0; o < _res_constr.datalen; o++) {
6306 uint32_t _res_conv_14 = _res_vals[o];
6307 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
6308 FREE((void*)_res_conv_14);
6309 _res_constr.data[o] = _res_conv_14_conv;
6311 CVec_MonitorEventZ_free(_res_constr);
6314 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
6315 LDKCVec_EventZ _res_constr;
6316 _res_constr.datalen = *((uint32_t*)_res);
6317 if (_res_constr.datalen > 0)
6318 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
6320 _res_constr.data = NULL;
6321 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6322 for (size_t h = 0; h < _res_constr.datalen; h++) {
6323 uint32_t _res_conv_7 = _res_vals[h];
6324 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
6325 FREE((void*)_res_conv_7);
6326 _res_constr.data[h] = _res_conv_7_conv;
6328 CVec_EventZ_free(_res_constr);
6331 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
6332 LDKCVec_TransactionZ _res_constr;
6333 _res_constr.datalen = *((uint32_t*)_res);
6334 if (_res_constr.datalen > 0)
6335 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
6337 _res_constr.data = NULL;
6338 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
6339 for (size_t m = 0; m < _res_constr.datalen; m++) {
6340 int8_tArray _res_conv_12 = _res_vals[m];
6341 LDKTransaction _res_conv_12_ref;
6342 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
6343 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
6344 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
6345 _res_conv_12_ref.data_is_owned = true;
6346 _res_constr.data[m] = _res_conv_12_ref;
6348 CVec_TransactionZ_free(_res_constr);
6351 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
6352 LDKTransaction b_ref;
6353 b_ref.datalen = *((uint32_t*)b);
6354 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
6355 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6356 b_ref.data_is_owned = true;
6357 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6358 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
6359 return (long)ret_ref;
6362 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
6363 if ((_res & 1) != 0) return;
6364 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
6366 C2Tuple_usizeTransactionZ_free(_res_conv);
6369 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
6370 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
6371 _res_constr.datalen = *((uint32_t*)_res);
6372 if (_res_constr.datalen > 0)
6373 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6375 _res_constr.data = NULL;
6376 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6377 for (size_t e = 0; e < _res_constr.datalen; e++) {
6378 uint32_t _res_conv_30 = _res_vals[e];
6379 LDKC2Tuple_usizeTransactionZ _res_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_30) & ~1);
6380 FREE((void*)_res_conv_30);
6381 _res_constr.data[e] = _res_conv_30_conv;
6383 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
6386 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
6387 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
6388 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6389 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
6390 return (long)ret_ref;
6393 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
6394 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
6396 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6397 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
6398 return (long)ret_ref;
6401 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
6402 if ((_res & 1) != 0) return;
6403 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
6405 C2Tuple_u32TxOutZ_free(_res_conv);
6408 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
6409 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
6410 _res_constr.datalen = *((uint32_t*)_res);
6411 if (_res_constr.datalen > 0)
6412 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
6414 _res_constr.data = NULL;
6415 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6416 for (size_t z = 0; z < _res_constr.datalen; z++) {
6417 uint32_t _res_conv_25 = _res_vals[z];
6418 LDKC2Tuple_u32TxOutZ _res_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_25) & ~1);
6419 FREE((void*)_res_conv_25);
6420 _res_constr.data[z] = _res_conv_25_conv;
6422 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
6425 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
6426 LDKThirtyTwoBytes a_ref;
6427 CHECK(*((uint32_t*)a) == 32);
6428 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6429 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
6430 b_constr.datalen = *((uint32_t*)b);
6431 if (b_constr.datalen > 0)
6432 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
6434 b_constr.data = NULL;
6435 uint32_t* b_vals = (uint32_t*)(b + 4);
6436 for (size_t z = 0; z < b_constr.datalen; z++) {
6437 uint32_t b_conv_25 = b_vals[z];
6438 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
6439 b_conv_25_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1));
6440 b_constr.data[z] = b_conv_25_conv;
6442 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
6443 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
6444 return (long)ret_ref;
6447 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
6448 if ((_res & 1) != 0) return;
6449 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
6451 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
6454 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
6455 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
6456 _res_constr.datalen = *((uint32_t*)_res);
6457 if (_res_constr.datalen > 0)
6458 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
6460 _res_constr.data = NULL;
6461 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6462 for (size_t x = 0; x < _res_constr.datalen; x++) {
6463 uint32_t _res_conv_49 = _res_vals[x];
6464 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_49) & ~1);
6465 FREE((void*)_res_conv_49);
6466 _res_constr.data[x] = _res_conv_49_conv;
6468 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
6471 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
6472 LDKCVec_TxidZ _res_constr;
6473 _res_constr.datalen = *((uint32_t*)_res);
6474 if (_res_constr.datalen > 0)
6475 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
6477 _res_constr.data = NULL;
6478 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
6479 for (size_t m = 0; m < _res_constr.datalen; m++) {
6480 int8_tArray _res_conv_12 = _res_vals[m];
6481 LDKThirtyTwoBytes _res_conv_12_ref;
6482 CHECK(*((uint32_t*)_res_conv_12) == 32);
6483 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), 32);
6484 _res_constr.data[m] = _res_conv_12_ref;
6486 CVec_TxidZ_free(_res_constr);
6489 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
6490 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6491 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
6492 return (long)ret_conv;
6495 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
6496 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
6497 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6498 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
6499 return (long)ret_conv;
6502 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
6503 if ((_res & 1) != 0) return;
6504 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
6506 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
6509 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
6510 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
6511 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6512 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
6513 return (long)ret_conv;
6516 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
6517 LDKThirtyTwoBytes a_ref;
6518 CHECK(*((uint32_t*)a) == 32);
6519 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6520 LDKChannelMonitor b_conv;
6521 b_conv.inner = (void*)(b & (~1));
6522 b_conv.is_owned = (b & 1) || (b == 0);
6523 b_conv = ChannelMonitor_clone(&b_conv);
6524 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6525 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
6526 return (long)ret_ref;
6529 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
6530 if ((_res & 1) != 0) return;
6531 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
6533 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
6536 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
6537 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
6539 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
6540 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
6541 return (long)ret_conv;
6544 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
6545 LDKDecodeError e_conv;
6546 e_conv.inner = (void*)(e & (~1));
6547 e_conv.is_owned = (e & 1) || (e == 0);
6548 e_conv = DecodeError_clone(&e_conv);
6549 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
6550 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
6551 return (long)ret_conv;
6554 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
6555 if ((_res & 1) != 0) return;
6556 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
6558 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
6561 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
6562 LDKCVec_RouteHopZ _res_constr;
6563 _res_constr.datalen = *((uint32_t*)_res);
6564 if (_res_constr.datalen > 0)
6565 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
6567 _res_constr.data = NULL;
6568 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6569 for (size_t k = 0; k < _res_constr.datalen; k++) {
6570 uint32_t _res_conv_10 = _res_vals[k];
6571 LDKRouteHop _res_conv_10_conv;
6572 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
6573 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
6574 _res_constr.data[k] = _res_conv_10_conv;
6576 CVec_RouteHopZ_free(_res_constr);
6579 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
6580 LDKCVec_CVec_RouteHopZZ _res_constr;
6581 _res_constr.datalen = *((uint32_t*)_res);
6582 if (_res_constr.datalen > 0)
6583 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
6585 _res_constr.data = NULL;
6586 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
6587 for (size_t m = 0; m < _res_constr.datalen; m++) {
6588 uint32_tArray _res_conv_12 = _res_vals[m];
6589 LDKCVec_RouteHopZ _res_conv_12_constr;
6590 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
6591 if (_res_conv_12_constr.datalen > 0)
6592 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
6594 _res_conv_12_constr.data = NULL;
6595 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
6596 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
6597 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
6598 LDKRouteHop _res_conv_12_conv_10_conv;
6599 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
6600 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
6601 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
6603 _res_constr.data[m] = _res_conv_12_constr;
6605 CVec_CVec_RouteHopZZ_free(_res_constr);
6608 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
6610 o_conv.inner = (void*)(o & (~1));
6611 o_conv.is_owned = (o & 1) || (o == 0);
6612 o_conv = Route_clone(&o_conv);
6613 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
6614 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
6615 return (long)ret_conv;
6618 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
6619 LDKDecodeError e_conv;
6620 e_conv.inner = (void*)(e & (~1));
6621 e_conv.is_owned = (e & 1) || (e == 0);
6622 e_conv = DecodeError_clone(&e_conv);
6623 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
6624 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
6625 return (long)ret_conv;
6628 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
6629 if ((_res & 1) != 0) return;
6630 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
6632 CResult_RouteDecodeErrorZ_free(_res_conv);
6635 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
6636 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
6637 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
6638 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
6639 return (long)ret_conv;
6642 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
6643 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
6644 *ret_copy = COption_u64Z_some(o);
6645 long ret_ref = (long)ret_copy;
6649 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
6650 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
6651 *ret_copy = COption_u64Z_none();
6652 long ret_ref = (long)ret_copy;
6656 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
6657 if ((_res & 1) != 0) return;
6658 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
6660 COption_u64Z_free(_res_conv);
6663 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
6664 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
6665 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
6666 *ret_copy = COption_u64Z_clone(orig_conv);
6667 long ret_ref = (long)ret_copy;
6671 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
6672 LDKCVec_ChannelDetailsZ _res_constr;
6673 _res_constr.datalen = *((uint32_t*)_res);
6674 if (_res_constr.datalen > 0)
6675 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6677 _res_constr.data = NULL;
6678 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6679 for (size_t q = 0; q < _res_constr.datalen; q++) {
6680 uint32_t _res_conv_16 = _res_vals[q];
6681 LDKChannelDetails _res_conv_16_conv;
6682 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
6683 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
6684 _res_constr.data[q] = _res_conv_16_conv;
6686 CVec_ChannelDetailsZ_free(_res_constr);
6689 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
6690 LDKCVec_RouteHintZ _res_constr;
6691 _res_constr.datalen = *((uint32_t*)_res);
6692 if (_res_constr.datalen > 0)
6693 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
6695 _res_constr.data = NULL;
6696 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6697 for (size_t l = 0; l < _res_constr.datalen; l++) {
6698 uint32_t _res_conv_11 = _res_vals[l];
6699 LDKRouteHint _res_conv_11_conv;
6700 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
6701 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
6702 _res_constr.data[l] = _res_conv_11_conv;
6704 CVec_RouteHintZ_free(_res_constr);
6707 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
6709 o_conv.inner = (void*)(o & (~1));
6710 o_conv.is_owned = (o & 1) || (o == 0);
6711 o_conv = Route_clone(&o_conv);
6712 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6713 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
6714 return (long)ret_conv;
6717 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
6718 LDKLightningError e_conv;
6719 e_conv.inner = (void*)(e & (~1));
6720 e_conv.is_owned = (e & 1) || (e == 0);
6721 e_conv = LightningError_clone(&e_conv);
6722 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6723 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
6724 return (long)ret_conv;
6727 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
6728 if ((_res & 1) != 0) return;
6729 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
6731 CResult_RouteLightningErrorZ_free(_res_conv);
6734 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
6735 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
6736 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6737 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
6738 return (long)ret_conv;
6741 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
6742 LDKCVec_MessageSendEventZ _res_constr;
6743 _res_constr.datalen = *((uint32_t*)_res);
6744 if (_res_constr.datalen > 0)
6745 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
6747 _res_constr.data = NULL;
6748 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6749 for (size_t s = 0; s < _res_constr.datalen; s++) {
6750 uint32_t _res_conv_18 = _res_vals[s];
6751 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
6752 FREE((void*)_res_conv_18);
6753 _res_constr.data[s] = _res_conv_18_conv;
6755 CVec_MessageSendEventZ_free(_res_constr);
6758 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
6759 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6760 *ret_conv = CResult_boolLightningErrorZ_ok(o);
6761 return (long)ret_conv;
6764 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
6765 LDKLightningError e_conv;
6766 e_conv.inner = (void*)(e & (~1));
6767 e_conv.is_owned = (e & 1) || (e == 0);
6768 e_conv = LightningError_clone(&e_conv);
6769 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6770 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
6771 return (long)ret_conv;
6774 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
6775 if ((_res & 1) != 0) return;
6776 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
6778 CResult_boolLightningErrorZ_free(_res_conv);
6781 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
6782 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
6783 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6784 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
6785 return (long)ret_conv;
6788 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
6789 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
6790 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6791 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
6792 return (long)ret_ref;
6795 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
6796 LDKChannelAnnouncement a_conv;
6797 a_conv.inner = (void*)(a & (~1));
6798 a_conv.is_owned = (a & 1) || (a == 0);
6799 a_conv = ChannelAnnouncement_clone(&a_conv);
6800 LDKChannelUpdate b_conv;
6801 b_conv.inner = (void*)(b & (~1));
6802 b_conv.is_owned = (b & 1) || (b == 0);
6803 b_conv = ChannelUpdate_clone(&b_conv);
6804 LDKChannelUpdate c_conv;
6805 c_conv.inner = (void*)(c & (~1));
6806 c_conv.is_owned = (c & 1) || (c == 0);
6807 c_conv = ChannelUpdate_clone(&c_conv);
6808 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6809 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
6810 return (long)ret_ref;
6813 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
6814 if ((_res & 1) != 0) return;
6815 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
6817 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
6820 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
6821 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
6822 _res_constr.datalen = *((uint32_t*)_res);
6823 if (_res_constr.datalen > 0)
6824 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6826 _res_constr.data = NULL;
6827 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6828 for (size_t l = 0; l < _res_constr.datalen; l++) {
6829 uint32_t _res_conv_63 = _res_vals[l];
6830 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
6831 FREE((void*)_res_conv_63);
6832 _res_constr.data[l] = _res_conv_63_conv;
6834 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
6837 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
6838 LDKCVec_NodeAnnouncementZ _res_constr;
6839 _res_constr.datalen = *((uint32_t*)_res);
6840 if (_res_constr.datalen > 0)
6841 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6843 _res_constr.data = NULL;
6844 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6845 for (size_t s = 0; s < _res_constr.datalen; s++) {
6846 uint32_t _res_conv_18 = _res_vals[s];
6847 LDKNodeAnnouncement _res_conv_18_conv;
6848 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
6849 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
6850 _res_constr.data[s] = _res_conv_18_conv;
6852 CVec_NodeAnnouncementZ_free(_res_constr);
6855 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
6856 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6857 *ret_conv = CResult_NoneLightningErrorZ_ok();
6858 return (long)ret_conv;
6861 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
6862 LDKLightningError e_conv;
6863 e_conv.inner = (void*)(e & (~1));
6864 e_conv.is_owned = (e & 1) || (e == 0);
6865 e_conv = LightningError_clone(&e_conv);
6866 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6867 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
6868 return (long)ret_conv;
6871 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
6872 if ((_res & 1) != 0) return;
6873 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
6875 CResult_NoneLightningErrorZ_free(_res_conv);
6878 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
6879 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
6880 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6881 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
6882 return (long)ret_conv;
6885 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
6886 LDKCVec_PublicKeyZ _res_constr;
6887 _res_constr.datalen = *((uint32_t*)_res);
6888 if (_res_constr.datalen > 0)
6889 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
6891 _res_constr.data = NULL;
6892 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
6893 for (size_t m = 0; m < _res_constr.datalen; m++) {
6894 int8_tArray _res_conv_12 = _res_vals[m];
6895 LDKPublicKey _res_conv_12_ref;
6896 CHECK(*((uint32_t*)_res_conv_12) == 33);
6897 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
6898 _res_constr.data[m] = _res_conv_12_ref;
6900 CVec_PublicKeyZ_free(_res_constr);
6903 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
6904 LDKCVec_u8Z _res_ref;
6905 _res_ref.datalen = *((uint32_t*)_res);
6906 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
6907 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
6908 CVec_u8Z_free(_res_ref);
6911 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
6913 o_ref.datalen = *((uint32_t*)o);
6914 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
6915 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
6916 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6917 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
6918 return (long)ret_conv;
6921 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
6922 LDKPeerHandleError e_conv;
6923 e_conv.inner = (void*)(e & (~1));
6924 e_conv.is_owned = (e & 1) || (e == 0);
6925 e_conv = PeerHandleError_clone(&e_conv);
6926 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6927 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
6928 return (long)ret_conv;
6931 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
6932 if ((_res & 1) != 0) return;
6933 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6935 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
6938 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
6939 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
6940 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6941 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
6942 return (long)ret_conv;
6945 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
6946 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6947 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
6948 return (long)ret_conv;
6951 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
6952 LDKPeerHandleError e_conv;
6953 e_conv.inner = (void*)(e & (~1));
6954 e_conv.is_owned = (e & 1) || (e == 0);
6955 e_conv = PeerHandleError_clone(&e_conv);
6956 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6957 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
6958 return (long)ret_conv;
6961 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
6962 if ((_res & 1) != 0) return;
6963 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6965 CResult_NonePeerHandleErrorZ_free(_res_conv);
6968 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
6969 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
6970 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6971 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
6972 return (long)ret_conv;
6975 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
6976 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6977 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
6978 return (long)ret_conv;
6981 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
6982 LDKPeerHandleError e_conv;
6983 e_conv.inner = (void*)(e & (~1));
6984 e_conv.is_owned = (e & 1) || (e == 0);
6985 e_conv = PeerHandleError_clone(&e_conv);
6986 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6987 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
6988 return (long)ret_conv;
6991 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
6992 if ((_res & 1) != 0) return;
6993 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6995 CResult_boolPeerHandleErrorZ_free(_res_conv);
6998 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
6999 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
7000 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
7001 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
7002 return (long)ret_conv;
7005 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
7006 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
7008 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7009 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
7010 return (long)ret_conv;
7013 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
7014 LDKAccessError e_conv = LDKAccessError_from_js(e);
7015 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7016 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
7017 return (long)ret_conv;
7020 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
7021 if ((_res & 1) != 0) return;
7022 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
7024 CResult_TxOutAccessErrorZ_free(_res_conv);
7027 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
7028 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
7029 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7030 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
7031 return (long)ret_conv;
7034 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
7035 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
7037 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7038 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
7039 long ret_ref = (long)ret_copy;
7043 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
7044 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7045 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
7046 long ret_ref = (long)ret_copy;
7050 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
7051 if ((_res & 1) != 0) return;
7052 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
7054 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
7057 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
7058 LDKCVec_SpendableOutputDescriptorZ _res_constr;
7059 _res_constr.datalen = *((uint32_t*)_res);
7060 if (_res_constr.datalen > 0)
7061 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
7063 _res_constr.data = NULL;
7064 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7065 for (size_t b = 0; b < _res_constr.datalen; b++) {
7066 uint32_t _res_conv_27 = _res_vals[b];
7067 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
7068 FREE((void*)_res_conv_27);
7069 _res_constr.data[b] = _res_conv_27_conv;
7071 CVec_SpendableOutputDescriptorZ_free(_res_constr);
7074 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
7075 LDKDirectionalChannelInfo o_conv;
7076 o_conv.inner = (void*)(o & (~1));
7077 o_conv.is_owned = (o & 1) || (o == 0);
7078 o_conv = DirectionalChannelInfo_clone(&o_conv);
7079 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7080 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
7081 return (long)ret_conv;
7084 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
7085 LDKDecodeError e_conv;
7086 e_conv.inner = (void*)(e & (~1));
7087 e_conv.is_owned = (e & 1) || (e == 0);
7088 e_conv = DecodeError_clone(&e_conv);
7089 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7090 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
7091 return (long)ret_conv;
7094 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
7095 if ((_res & 1) != 0) return;
7096 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7098 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
7101 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
7102 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
7103 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7104 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
7105 return (long)ret_conv;
7108 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
7109 LDKChannelInfo o_conv;
7110 o_conv.inner = (void*)(o & (~1));
7111 o_conv.is_owned = (o & 1) || (o == 0);
7112 o_conv = ChannelInfo_clone(&o_conv);
7113 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7114 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
7115 return (long)ret_conv;
7118 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
7119 LDKDecodeError e_conv;
7120 e_conv.inner = (void*)(e & (~1));
7121 e_conv.is_owned = (e & 1) || (e == 0);
7122 e_conv = DecodeError_clone(&e_conv);
7123 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7124 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
7125 return (long)ret_conv;
7128 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
7129 if ((_res & 1) != 0) return;
7130 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7132 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
7135 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
7136 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
7137 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7138 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
7139 return (long)ret_conv;
7142 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
7143 LDKRoutingFees o_conv;
7144 o_conv.inner = (void*)(o & (~1));
7145 o_conv.is_owned = (o & 1) || (o == 0);
7146 o_conv = RoutingFees_clone(&o_conv);
7147 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7148 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
7149 return (long)ret_conv;
7152 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
7153 LDKDecodeError e_conv;
7154 e_conv.inner = (void*)(e & (~1));
7155 e_conv.is_owned = (e & 1) || (e == 0);
7156 e_conv = DecodeError_clone(&e_conv);
7157 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7158 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
7159 return (long)ret_conv;
7162 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
7163 if ((_res & 1) != 0) return;
7164 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7166 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
7169 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
7170 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
7171 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7172 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
7173 return (long)ret_conv;
7176 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
7177 LDKCVec_NetAddressZ _res_constr;
7178 _res_constr.datalen = *((uint32_t*)_res);
7179 if (_res_constr.datalen > 0)
7180 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
7182 _res_constr.data = NULL;
7183 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7184 for (size_t m = 0; m < _res_constr.datalen; m++) {
7185 uint32_t _res_conv_12 = _res_vals[m];
7186 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
7187 FREE((void*)_res_conv_12);
7188 _res_constr.data[m] = _res_conv_12_conv;
7190 CVec_NetAddressZ_free(_res_constr);
7193 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
7194 LDKNodeAnnouncementInfo o_conv;
7195 o_conv.inner = (void*)(o & (~1));
7196 o_conv.is_owned = (o & 1) || (o == 0);
7197 o_conv = NodeAnnouncementInfo_clone(&o_conv);
7198 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7199 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
7200 return (long)ret_conv;
7203 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
7204 LDKDecodeError e_conv;
7205 e_conv.inner = (void*)(e & (~1));
7206 e_conv.is_owned = (e & 1) || (e == 0);
7207 e_conv = DecodeError_clone(&e_conv);
7208 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7209 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
7210 return (long)ret_conv;
7213 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
7214 if ((_res & 1) != 0) return;
7215 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7217 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
7220 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
7221 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
7222 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7223 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
7224 return (long)ret_conv;
7227 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
7228 LDKCVec_u64Z _res_constr;
7229 _res_constr.datalen = *((uint32_t*)_res);
7230 if (_res_constr.datalen > 0)
7231 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
7233 _res_constr.data = NULL;
7234 int64_t* _res_vals = (int64_t*)(_res + 4);
7235 for (size_t i = 0; i < _res_constr.datalen; i++) {
7236 int64_t _res_conv_8 = _res_vals[i];
7237 _res_constr.data[i] = _res_conv_8;
7239 CVec_u64Z_free(_res_constr);
7242 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
7244 o_conv.inner = (void*)(o & (~1));
7245 o_conv.is_owned = (o & 1) || (o == 0);
7246 o_conv = NodeInfo_clone(&o_conv);
7247 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7248 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
7249 return (long)ret_conv;
7252 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
7253 LDKDecodeError e_conv;
7254 e_conv.inner = (void*)(e & (~1));
7255 e_conv.is_owned = (e & 1) || (e == 0);
7256 e_conv = DecodeError_clone(&e_conv);
7257 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7258 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
7259 return (long)ret_conv;
7262 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
7263 if ((_res & 1) != 0) return;
7264 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7266 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
7269 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
7270 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
7271 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7272 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
7273 return (long)ret_conv;
7276 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
7277 LDKNetworkGraph o_conv;
7278 o_conv.inner = (void*)(o & (~1));
7279 o_conv.is_owned = (o & 1) || (o == 0);
7280 o_conv = NetworkGraph_clone(&o_conv);
7281 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7282 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
7283 return (long)ret_conv;
7286 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
7287 LDKDecodeError e_conv;
7288 e_conv.inner = (void*)(e & (~1));
7289 e_conv.is_owned = (e & 1) || (e == 0);
7290 e_conv = DecodeError_clone(&e_conv);
7291 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7292 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
7293 return (long)ret_conv;
7296 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
7297 if ((_res & 1) != 0) return;
7298 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
7300 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
7303 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
7304 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
7305 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7306 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
7307 return (long)ret_conv;
7310 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
7311 LDKInitFeatures o_conv;
7312 o_conv.inner = (void*)(o & (~1));
7313 o_conv.is_owned = (o & 1) || (o == 0);
7314 o_conv = InitFeatures_clone(&o_conv);
7315 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
7316 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
7317 return (long)ret_conv;
7320 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
7321 LDKDecodeError e_conv;
7322 e_conv.inner = (void*)(e & (~1));
7323 e_conv.is_owned = (e & 1) || (e == 0);
7324 e_conv = DecodeError_clone(&e_conv);
7325 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
7326 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
7327 return (long)ret_conv;
7330 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
7331 if ((_res & 1) != 0) return;
7332 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7334 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
7337 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
7338 LDKNodeFeatures o_conv;
7339 o_conv.inner = (void*)(o & (~1));
7340 o_conv.is_owned = (o & 1) || (o == 0);
7341 o_conv = NodeFeatures_clone(&o_conv);
7342 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
7343 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
7344 return (long)ret_conv;
7347 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
7348 LDKDecodeError e_conv;
7349 e_conv.inner = (void*)(e & (~1));
7350 e_conv.is_owned = (e & 1) || (e == 0);
7351 e_conv = DecodeError_clone(&e_conv);
7352 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
7353 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
7354 return (long)ret_conv;
7357 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
7358 if ((_res & 1) != 0) return;
7359 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7361 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
7364 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
7365 LDKChannelFeatures o_conv;
7366 o_conv.inner = (void*)(o & (~1));
7367 o_conv.is_owned = (o & 1) || (o == 0);
7368 o_conv = ChannelFeatures_clone(&o_conv);
7369 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7370 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
7371 return (long)ret_conv;
7374 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
7375 LDKDecodeError e_conv;
7376 e_conv.inner = (void*)(e & (~1));
7377 e_conv.is_owned = (e & 1) || (e == 0);
7378 e_conv = DecodeError_clone(&e_conv);
7379 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7380 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
7381 return (long)ret_conv;
7384 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
7385 if ((_res & 1) != 0) return;
7386 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7388 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
7391 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
7392 LDKInvoiceFeatures o_conv;
7393 o_conv.inner = (void*)(o & (~1));
7394 o_conv.is_owned = (o & 1) || (o == 0);
7395 o_conv = InvoiceFeatures_clone(&o_conv);
7396 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
7397 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
7398 return (long)ret_conv;
7401 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
7402 LDKDecodeError e_conv;
7403 e_conv.inner = (void*)(e & (~1));
7404 e_conv.is_owned = (e & 1) || (e == 0);
7405 e_conv = DecodeError_clone(&e_conv);
7406 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
7407 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
7408 return (long)ret_conv;
7411 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
7412 if ((_res & 1) != 0) return;
7413 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7415 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
7418 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
7419 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
7421 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7422 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
7423 return (long)ret_conv;
7426 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_err(int8_t e) {
7427 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7428 *ret_conv = CResult_NetAddressu8Z_err(e);
7429 return (long)ret_conv;
7432 void __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_free(uint32_t _res) {
7433 if ((_res & 1) != 0) return;
7434 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
7436 CResult_NetAddressu8Z_free(_res_conv);
7439 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_clone(uint32_t orig) {
7440 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
7441 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7442 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
7443 return (long)ret_conv;
7446 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
7447 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
7449 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7450 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
7451 return (long)ret_conv;
7454 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_err(uint32_t e) {
7455 LDKDecodeError e_conv;
7456 e_conv.inner = (void*)(e & (~1));
7457 e_conv.is_owned = (e & 1) || (e == 0);
7458 e_conv = DecodeError_clone(&e_conv);
7459 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7460 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
7461 return (long)ret_conv;
7464 void __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_free(uint32_t _res) {
7465 if ((_res & 1) != 0) return;
7466 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
7468 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
7471 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(uint32_t orig) {
7472 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
7473 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7474 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
7475 return (long)ret_conv;
7478 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
7479 LDKCVec_UpdateAddHTLCZ _res_constr;
7480 _res_constr.datalen = *((uint32_t*)_res);
7481 if (_res_constr.datalen > 0)
7482 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
7484 _res_constr.data = NULL;
7485 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7486 for (size_t p = 0; p < _res_constr.datalen; p++) {
7487 uint32_t _res_conv_15 = _res_vals[p];
7488 LDKUpdateAddHTLC _res_conv_15_conv;
7489 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
7490 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
7491 _res_constr.data[p] = _res_conv_15_conv;
7493 CVec_UpdateAddHTLCZ_free(_res_constr);
7496 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
7497 LDKCVec_UpdateFulfillHTLCZ _res_constr;
7498 _res_constr.datalen = *((uint32_t*)_res);
7499 if (_res_constr.datalen > 0)
7500 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
7502 _res_constr.data = NULL;
7503 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7504 for (size_t t = 0; t < _res_constr.datalen; t++) {
7505 uint32_t _res_conv_19 = _res_vals[t];
7506 LDKUpdateFulfillHTLC _res_conv_19_conv;
7507 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
7508 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
7509 _res_constr.data[t] = _res_conv_19_conv;
7511 CVec_UpdateFulfillHTLCZ_free(_res_constr);
7514 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
7515 LDKCVec_UpdateFailHTLCZ _res_constr;
7516 _res_constr.datalen = *((uint32_t*)_res);
7517 if (_res_constr.datalen > 0)
7518 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
7520 _res_constr.data = NULL;
7521 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7522 for (size_t q = 0; q < _res_constr.datalen; q++) {
7523 uint32_t _res_conv_16 = _res_vals[q];
7524 LDKUpdateFailHTLC _res_conv_16_conv;
7525 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7526 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7527 _res_constr.data[q] = _res_conv_16_conv;
7529 CVec_UpdateFailHTLCZ_free(_res_constr);
7532 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
7533 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
7534 _res_constr.datalen = *((uint32_t*)_res);
7535 if (_res_constr.datalen > 0)
7536 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
7538 _res_constr.data = NULL;
7539 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7540 for (size_t z = 0; z < _res_constr.datalen; z++) {
7541 uint32_t _res_conv_25 = _res_vals[z];
7542 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
7543 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
7544 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
7545 _res_constr.data[z] = _res_conv_25_conv;
7547 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
7550 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
7551 LDKAcceptChannel o_conv;
7552 o_conv.inner = (void*)(o & (~1));
7553 o_conv.is_owned = (o & 1) || (o == 0);
7554 o_conv = AcceptChannel_clone(&o_conv);
7555 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7556 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
7557 return (long)ret_conv;
7560 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
7561 LDKDecodeError e_conv;
7562 e_conv.inner = (void*)(e & (~1));
7563 e_conv.is_owned = (e & 1) || (e == 0);
7564 e_conv = DecodeError_clone(&e_conv);
7565 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7566 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
7567 return (long)ret_conv;
7570 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
7571 if ((_res & 1) != 0) return;
7572 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
7574 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
7577 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
7578 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
7579 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7580 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
7581 return (long)ret_conv;
7584 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
7585 LDKAnnouncementSignatures o_conv;
7586 o_conv.inner = (void*)(o & (~1));
7587 o_conv.is_owned = (o & 1) || (o == 0);
7588 o_conv = AnnouncementSignatures_clone(&o_conv);
7589 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7590 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
7591 return (long)ret_conv;
7594 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
7595 LDKDecodeError e_conv;
7596 e_conv.inner = (void*)(e & (~1));
7597 e_conv.is_owned = (e & 1) || (e == 0);
7598 e_conv = DecodeError_clone(&e_conv);
7599 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7600 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
7601 return (long)ret_conv;
7604 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
7605 if ((_res & 1) != 0) return;
7606 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7608 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
7611 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
7612 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
7613 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7614 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
7615 return (long)ret_conv;
7618 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
7619 LDKChannelReestablish o_conv;
7620 o_conv.inner = (void*)(o & (~1));
7621 o_conv.is_owned = (o & 1) || (o == 0);
7622 o_conv = ChannelReestablish_clone(&o_conv);
7623 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7624 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
7625 return (long)ret_conv;
7628 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
7629 LDKDecodeError e_conv;
7630 e_conv.inner = (void*)(e & (~1));
7631 e_conv.is_owned = (e & 1) || (e == 0);
7632 e_conv = DecodeError_clone(&e_conv);
7633 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7634 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
7635 return (long)ret_conv;
7638 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
7639 if ((_res & 1) != 0) return;
7640 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
7642 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
7645 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
7646 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
7647 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7648 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
7649 return (long)ret_conv;
7652 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
7653 LDKClosingSigned o_conv;
7654 o_conv.inner = (void*)(o & (~1));
7655 o_conv.is_owned = (o & 1) || (o == 0);
7656 o_conv = ClosingSigned_clone(&o_conv);
7657 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7658 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
7659 return (long)ret_conv;
7662 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
7663 LDKDecodeError e_conv;
7664 e_conv.inner = (void*)(e & (~1));
7665 e_conv.is_owned = (e & 1) || (e == 0);
7666 e_conv = DecodeError_clone(&e_conv);
7667 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7668 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
7669 return (long)ret_conv;
7672 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
7673 if ((_res & 1) != 0) return;
7674 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7676 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
7679 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
7680 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
7681 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7682 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
7683 return (long)ret_conv;
7686 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
7687 LDKCommitmentSigned o_conv;
7688 o_conv.inner = (void*)(o & (~1));
7689 o_conv.is_owned = (o & 1) || (o == 0);
7690 o_conv = CommitmentSigned_clone(&o_conv);
7691 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7692 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
7693 return (long)ret_conv;
7696 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
7697 LDKDecodeError e_conv;
7698 e_conv.inner = (void*)(e & (~1));
7699 e_conv.is_owned = (e & 1) || (e == 0);
7700 e_conv = DecodeError_clone(&e_conv);
7701 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7702 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
7703 return (long)ret_conv;
7706 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
7707 if ((_res & 1) != 0) return;
7708 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7710 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
7713 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
7714 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
7715 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7716 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
7717 return (long)ret_conv;
7720 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
7721 LDKFundingCreated o_conv;
7722 o_conv.inner = (void*)(o & (~1));
7723 o_conv.is_owned = (o & 1) || (o == 0);
7724 o_conv = FundingCreated_clone(&o_conv);
7725 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7726 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
7727 return (long)ret_conv;
7730 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
7731 LDKDecodeError e_conv;
7732 e_conv.inner = (void*)(e & (~1));
7733 e_conv.is_owned = (e & 1) || (e == 0);
7734 e_conv = DecodeError_clone(&e_conv);
7735 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7736 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
7737 return (long)ret_conv;
7740 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
7741 if ((_res & 1) != 0) return;
7742 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7744 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
7747 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
7748 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
7749 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7750 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
7751 return (long)ret_conv;
7754 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
7755 LDKFundingSigned o_conv;
7756 o_conv.inner = (void*)(o & (~1));
7757 o_conv.is_owned = (o & 1) || (o == 0);
7758 o_conv = FundingSigned_clone(&o_conv);
7759 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7760 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
7761 return (long)ret_conv;
7764 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
7765 LDKDecodeError e_conv;
7766 e_conv.inner = (void*)(e & (~1));
7767 e_conv.is_owned = (e & 1) || (e == 0);
7768 e_conv = DecodeError_clone(&e_conv);
7769 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7770 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
7771 return (long)ret_conv;
7774 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
7775 if ((_res & 1) != 0) return;
7776 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7778 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
7781 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
7782 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
7783 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7784 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
7785 return (long)ret_conv;
7788 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
7789 LDKFundingLocked o_conv;
7790 o_conv.inner = (void*)(o & (~1));
7791 o_conv.is_owned = (o & 1) || (o == 0);
7792 o_conv = FundingLocked_clone(&o_conv);
7793 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7794 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
7795 return (long)ret_conv;
7798 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
7799 LDKDecodeError e_conv;
7800 e_conv.inner = (void*)(e & (~1));
7801 e_conv.is_owned = (e & 1) || (e == 0);
7802 e_conv = DecodeError_clone(&e_conv);
7803 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7804 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
7805 return (long)ret_conv;
7808 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
7809 if ((_res & 1) != 0) return;
7810 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7812 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
7815 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
7816 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
7817 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7818 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
7819 return (long)ret_conv;
7822 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
7824 o_conv.inner = (void*)(o & (~1));
7825 o_conv.is_owned = (o & 1) || (o == 0);
7826 o_conv = Init_clone(&o_conv);
7827 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7828 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
7829 return (long)ret_conv;
7832 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
7833 LDKDecodeError e_conv;
7834 e_conv.inner = (void*)(e & (~1));
7835 e_conv.is_owned = (e & 1) || (e == 0);
7836 e_conv = DecodeError_clone(&e_conv);
7837 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7838 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
7839 return (long)ret_conv;
7842 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
7843 if ((_res & 1) != 0) return;
7844 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
7846 CResult_InitDecodeErrorZ_free(_res_conv);
7849 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
7850 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
7851 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7852 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
7853 return (long)ret_conv;
7856 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
7857 LDKOpenChannel o_conv;
7858 o_conv.inner = (void*)(o & (~1));
7859 o_conv.is_owned = (o & 1) || (o == 0);
7860 o_conv = OpenChannel_clone(&o_conv);
7861 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
7862 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
7863 return (long)ret_conv;
7866 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
7867 LDKDecodeError e_conv;
7868 e_conv.inner = (void*)(e & (~1));
7869 e_conv.is_owned = (e & 1) || (e == 0);
7870 e_conv = DecodeError_clone(&e_conv);
7871 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
7872 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
7873 return (long)ret_conv;
7876 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
7877 if ((_res & 1) != 0) return;
7878 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
7880 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
7883 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
7884 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
7885 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
7886 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
7887 return (long)ret_conv;
7890 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
7891 LDKRevokeAndACK o_conv;
7892 o_conv.inner = (void*)(o & (~1));
7893 o_conv.is_owned = (o & 1) || (o == 0);
7894 o_conv = RevokeAndACK_clone(&o_conv);
7895 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
7896 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
7897 return (long)ret_conv;
7900 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
7901 LDKDecodeError e_conv;
7902 e_conv.inner = (void*)(e & (~1));
7903 e_conv.is_owned = (e & 1) || (e == 0);
7904 e_conv = DecodeError_clone(&e_conv);
7905 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
7906 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
7907 return (long)ret_conv;
7910 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
7911 if ((_res & 1) != 0) return;
7912 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
7914 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
7917 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
7918 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
7919 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
7920 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
7921 return (long)ret_conv;
7924 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
7926 o_conv.inner = (void*)(o & (~1));
7927 o_conv.is_owned = (o & 1) || (o == 0);
7928 o_conv = Shutdown_clone(&o_conv);
7929 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
7930 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
7931 return (long)ret_conv;
7934 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
7935 LDKDecodeError e_conv;
7936 e_conv.inner = (void*)(e & (~1));
7937 e_conv.is_owned = (e & 1) || (e == 0);
7938 e_conv = DecodeError_clone(&e_conv);
7939 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
7940 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
7941 return (long)ret_conv;
7944 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
7945 if ((_res & 1) != 0) return;
7946 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
7948 CResult_ShutdownDecodeErrorZ_free(_res_conv);
7951 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
7952 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
7953 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
7954 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
7955 return (long)ret_conv;
7958 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
7959 LDKUpdateFailHTLC o_conv;
7960 o_conv.inner = (void*)(o & (~1));
7961 o_conv.is_owned = (o & 1) || (o == 0);
7962 o_conv = UpdateFailHTLC_clone(&o_conv);
7963 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
7964 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
7965 return (long)ret_conv;
7968 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_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_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
7974 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
7975 return (long)ret_conv;
7978 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
7979 if ((_res & 1) != 0) return;
7980 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
7982 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
7985 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
7986 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
7987 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
7988 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
7989 return (long)ret_conv;
7992 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
7993 LDKUpdateFailMalformedHTLC o_conv;
7994 o_conv.inner = (void*)(o & (~1));
7995 o_conv.is_owned = (o & 1) || (o == 0);
7996 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
7997 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
7998 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
7999 return (long)ret_conv;
8002 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
8003 LDKDecodeError e_conv;
8004 e_conv.inner = (void*)(e & (~1));
8005 e_conv.is_owned = (e & 1) || (e == 0);
8006 e_conv = DecodeError_clone(&e_conv);
8007 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8008 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
8009 return (long)ret_conv;
8012 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
8013 if ((_res & 1) != 0) return;
8014 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8016 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
8019 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
8020 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
8021 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8022 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
8023 return (long)ret_conv;
8026 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
8027 LDKUpdateFee o_conv;
8028 o_conv.inner = (void*)(o & (~1));
8029 o_conv.is_owned = (o & 1) || (o == 0);
8030 o_conv = UpdateFee_clone(&o_conv);
8031 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8032 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
8033 return (long)ret_conv;
8036 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
8037 LDKDecodeError e_conv;
8038 e_conv.inner = (void*)(e & (~1));
8039 e_conv.is_owned = (e & 1) || (e == 0);
8040 e_conv = DecodeError_clone(&e_conv);
8041 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8042 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
8043 return (long)ret_conv;
8046 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
8047 if ((_res & 1) != 0) return;
8048 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8050 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
8053 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
8054 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
8055 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8056 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
8057 return (long)ret_conv;
8060 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
8061 LDKUpdateFulfillHTLC o_conv;
8062 o_conv.inner = (void*)(o & (~1));
8063 o_conv.is_owned = (o & 1) || (o == 0);
8064 o_conv = UpdateFulfillHTLC_clone(&o_conv);
8065 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8066 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
8067 return (long)ret_conv;
8070 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
8071 LDKDecodeError e_conv;
8072 e_conv.inner = (void*)(e & (~1));
8073 e_conv.is_owned = (e & 1) || (e == 0);
8074 e_conv = DecodeError_clone(&e_conv);
8075 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8076 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
8077 return (long)ret_conv;
8080 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
8081 if ((_res & 1) != 0) return;
8082 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8084 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
8087 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
8088 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
8089 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8090 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
8091 return (long)ret_conv;
8094 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
8095 LDKUpdateAddHTLC o_conv;
8096 o_conv.inner = (void*)(o & (~1));
8097 o_conv.is_owned = (o & 1) || (o == 0);
8098 o_conv = UpdateAddHTLC_clone(&o_conv);
8099 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8100 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
8101 return (long)ret_conv;
8104 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
8105 LDKDecodeError e_conv;
8106 e_conv.inner = (void*)(e & (~1));
8107 e_conv.is_owned = (e & 1) || (e == 0);
8108 e_conv = DecodeError_clone(&e_conv);
8109 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8110 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
8111 return (long)ret_conv;
8114 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
8115 if ((_res & 1) != 0) return;
8116 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8118 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
8121 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
8122 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
8123 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8124 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
8125 return (long)ret_conv;
8128 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
8130 o_conv.inner = (void*)(o & (~1));
8131 o_conv.is_owned = (o & 1) || (o == 0);
8132 o_conv = Ping_clone(&o_conv);
8133 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8134 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
8135 return (long)ret_conv;
8138 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
8139 LDKDecodeError e_conv;
8140 e_conv.inner = (void*)(e & (~1));
8141 e_conv.is_owned = (e & 1) || (e == 0);
8142 e_conv = DecodeError_clone(&e_conv);
8143 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8144 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
8145 return (long)ret_conv;
8148 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
8149 if ((_res & 1) != 0) return;
8150 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
8152 CResult_PingDecodeErrorZ_free(_res_conv);
8155 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
8156 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
8157 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8158 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
8159 return (long)ret_conv;
8162 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
8164 o_conv.inner = (void*)(o & (~1));
8165 o_conv.is_owned = (o & 1) || (o == 0);
8166 o_conv = Pong_clone(&o_conv);
8167 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8168 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
8169 return (long)ret_conv;
8172 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_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_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8178 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
8179 return (long)ret_conv;
8182 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
8183 if ((_res & 1) != 0) return;
8184 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
8186 CResult_PongDecodeErrorZ_free(_res_conv);
8189 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
8190 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
8191 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8192 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
8193 return (long)ret_conv;
8196 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
8197 LDKUnsignedChannelAnnouncement o_conv;
8198 o_conv.inner = (void*)(o & (~1));
8199 o_conv.is_owned = (o & 1) || (o == 0);
8200 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
8201 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8202 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
8203 return (long)ret_conv;
8206 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
8207 LDKDecodeError e_conv;
8208 e_conv.inner = (void*)(e & (~1));
8209 e_conv.is_owned = (e & 1) || (e == 0);
8210 e_conv = DecodeError_clone(&e_conv);
8211 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8212 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
8213 return (long)ret_conv;
8216 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
8217 if ((_res & 1) != 0) return;
8218 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8220 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
8223 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8224 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
8225 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8226 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
8227 return (long)ret_conv;
8230 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
8231 LDKChannelAnnouncement o_conv;
8232 o_conv.inner = (void*)(o & (~1));
8233 o_conv.is_owned = (o & 1) || (o == 0);
8234 o_conv = ChannelAnnouncement_clone(&o_conv);
8235 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8236 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
8237 return (long)ret_conv;
8240 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
8241 LDKDecodeError e_conv;
8242 e_conv.inner = (void*)(e & (~1));
8243 e_conv.is_owned = (e & 1) || (e == 0);
8244 e_conv = DecodeError_clone(&e_conv);
8245 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8246 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
8247 return (long)ret_conv;
8250 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
8251 if ((_res & 1) != 0) return;
8252 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8254 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
8257 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8258 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
8259 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8260 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
8261 return (long)ret_conv;
8264 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
8265 LDKUnsignedChannelUpdate o_conv;
8266 o_conv.inner = (void*)(o & (~1));
8267 o_conv.is_owned = (o & 1) || (o == 0);
8268 o_conv = UnsignedChannelUpdate_clone(&o_conv);
8269 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8270 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
8271 return (long)ret_conv;
8274 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
8275 LDKDecodeError e_conv;
8276 e_conv.inner = (void*)(e & (~1));
8277 e_conv.is_owned = (e & 1) || (e == 0);
8278 e_conv = DecodeError_clone(&e_conv);
8279 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8280 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
8281 return (long)ret_conv;
8284 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
8285 if ((_res & 1) != 0) return;
8286 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8288 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
8291 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
8292 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
8293 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8294 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
8295 return (long)ret_conv;
8298 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
8299 LDKChannelUpdate o_conv;
8300 o_conv.inner = (void*)(o & (~1));
8301 o_conv.is_owned = (o & 1) || (o == 0);
8302 o_conv = ChannelUpdate_clone(&o_conv);
8303 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8304 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
8305 return (long)ret_conv;
8308 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
8309 LDKDecodeError e_conv;
8310 e_conv.inner = (void*)(e & (~1));
8311 e_conv.is_owned = (e & 1) || (e == 0);
8312 e_conv = DecodeError_clone(&e_conv);
8313 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8314 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
8315 return (long)ret_conv;
8318 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
8319 if ((_res & 1) != 0) return;
8320 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8322 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
8325 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
8326 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
8327 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8328 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
8329 return (long)ret_conv;
8332 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
8333 LDKErrorMessage o_conv;
8334 o_conv.inner = (void*)(o & (~1));
8335 o_conv.is_owned = (o & 1) || (o == 0);
8336 o_conv = ErrorMessage_clone(&o_conv);
8337 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8338 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
8339 return (long)ret_conv;
8342 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
8343 LDKDecodeError e_conv;
8344 e_conv.inner = (void*)(e & (~1));
8345 e_conv.is_owned = (e & 1) || (e == 0);
8346 e_conv = DecodeError_clone(&e_conv);
8347 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8348 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
8349 return (long)ret_conv;
8352 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
8353 if ((_res & 1) != 0) return;
8354 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
8356 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
8359 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
8360 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
8361 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8362 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
8363 return (long)ret_conv;
8366 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
8367 LDKUnsignedNodeAnnouncement o_conv;
8368 o_conv.inner = (void*)(o & (~1));
8369 o_conv.is_owned = (o & 1) || (o == 0);
8370 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
8371 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8372 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
8373 return (long)ret_conv;
8376 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
8377 LDKDecodeError e_conv;
8378 e_conv.inner = (void*)(e & (~1));
8379 e_conv.is_owned = (e & 1) || (e == 0);
8380 e_conv = DecodeError_clone(&e_conv);
8381 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8382 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
8383 return (long)ret_conv;
8386 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
8387 if ((_res & 1) != 0) return;
8388 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8390 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
8393 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8394 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
8395 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8396 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
8397 return (long)ret_conv;
8400 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
8401 LDKNodeAnnouncement o_conv;
8402 o_conv.inner = (void*)(o & (~1));
8403 o_conv.is_owned = (o & 1) || (o == 0);
8404 o_conv = NodeAnnouncement_clone(&o_conv);
8405 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8406 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
8407 return (long)ret_conv;
8410 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
8411 LDKDecodeError e_conv;
8412 e_conv.inner = (void*)(e & (~1));
8413 e_conv.is_owned = (e & 1) || (e == 0);
8414 e_conv = DecodeError_clone(&e_conv);
8415 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8416 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
8417 return (long)ret_conv;
8420 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
8421 if ((_res & 1) != 0) return;
8422 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8424 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
8427 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8428 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
8429 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8430 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
8431 return (long)ret_conv;
8434 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
8435 LDKQueryShortChannelIds o_conv;
8436 o_conv.inner = (void*)(o & (~1));
8437 o_conv.is_owned = (o & 1) || (o == 0);
8438 o_conv = QueryShortChannelIds_clone(&o_conv);
8439 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8440 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
8441 return (long)ret_conv;
8444 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
8445 LDKDecodeError e_conv;
8446 e_conv.inner = (void*)(e & (~1));
8447 e_conv.is_owned = (e & 1) || (e == 0);
8448 e_conv = DecodeError_clone(&e_conv);
8449 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8450 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
8451 return (long)ret_conv;
8454 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
8455 if ((_res & 1) != 0) return;
8456 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
8458 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
8461 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
8462 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
8463 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8464 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
8465 return (long)ret_conv;
8468 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
8469 LDKReplyShortChannelIdsEnd o_conv;
8470 o_conv.inner = (void*)(o & (~1));
8471 o_conv.is_owned = (o & 1) || (o == 0);
8472 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
8473 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8474 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
8475 return (long)ret_conv;
8478 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
8479 LDKDecodeError e_conv;
8480 e_conv.inner = (void*)(e & (~1));
8481 e_conv.is_owned = (e & 1) || (e == 0);
8482 e_conv = DecodeError_clone(&e_conv);
8483 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8484 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
8485 return (long)ret_conv;
8488 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
8489 if ((_res & 1) != 0) return;
8490 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
8492 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
8495 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
8496 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
8497 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8498 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
8499 return (long)ret_conv;
8502 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
8503 LDKQueryChannelRange o_conv;
8504 o_conv.inner = (void*)(o & (~1));
8505 o_conv.is_owned = (o & 1) || (o == 0);
8506 o_conv = QueryChannelRange_clone(&o_conv);
8507 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8508 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
8509 return (long)ret_conv;
8512 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
8513 LDKDecodeError e_conv;
8514 e_conv.inner = (void*)(e & (~1));
8515 e_conv.is_owned = (e & 1) || (e == 0);
8516 e_conv = DecodeError_clone(&e_conv);
8517 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8518 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
8519 return (long)ret_conv;
8522 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
8523 if ((_res & 1) != 0) return;
8524 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8526 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
8529 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
8530 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
8531 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8532 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
8533 return (long)ret_conv;
8536 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
8537 LDKReplyChannelRange o_conv;
8538 o_conv.inner = (void*)(o & (~1));
8539 o_conv.is_owned = (o & 1) || (o == 0);
8540 o_conv = ReplyChannelRange_clone(&o_conv);
8541 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8542 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
8543 return (long)ret_conv;
8546 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
8547 LDKDecodeError e_conv;
8548 e_conv.inner = (void*)(e & (~1));
8549 e_conv.is_owned = (e & 1) || (e == 0);
8550 e_conv = DecodeError_clone(&e_conv);
8551 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8552 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
8553 return (long)ret_conv;
8556 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
8557 if ((_res & 1) != 0) return;
8558 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8560 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
8563 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
8564 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
8565 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8566 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
8567 return (long)ret_conv;
8570 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
8571 LDKGossipTimestampFilter o_conv;
8572 o_conv.inner = (void*)(o & (~1));
8573 o_conv.is_owned = (o & 1) || (o == 0);
8574 o_conv = GossipTimestampFilter_clone(&o_conv);
8575 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8576 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
8577 return (long)ret_conv;
8580 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
8581 LDKDecodeError e_conv;
8582 e_conv.inner = (void*)(e & (~1));
8583 e_conv.is_owned = (e & 1) || (e == 0);
8584 e_conv = DecodeError_clone(&e_conv);
8585 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8586 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
8587 return (long)ret_conv;
8590 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
8591 if ((_res & 1) != 0) return;
8592 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
8594 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
8597 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
8598 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
8599 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8600 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
8601 return (long)ret_conv;
8604 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8605 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
8607 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8608 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
8609 return (long)ret_conv;
8612 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8613 LDKDecodeError e_conv;
8614 e_conv.inner = (void*)(e & (~1));
8615 e_conv.is_owned = (e & 1) || (e == 0);
8616 e_conv = DecodeError_clone(&e_conv);
8617 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8618 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
8619 return (long)ret_conv;
8622 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8623 if ((_res & 1) != 0) return;
8624 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8626 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
8629 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8630 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
8631 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8632 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
8633 return (long)ret_conv;
8636 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
8637 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
8638 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8639 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
8640 return (long)ret_ref;
8643 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
8645 CHECK(*((uint32_t*)a) == 64);
8646 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
8647 LDKCVec_SignatureZ b_constr;
8648 b_constr.datalen = *((uint32_t*)b);
8649 if (b_constr.datalen > 0)
8650 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8652 b_constr.data = NULL;
8653 int8_tArray* b_vals = (int8_tArray*)(b + 4);
8654 for (size_t m = 0; m < b_constr.datalen; m++) {
8655 int8_tArray b_conv_12 = b_vals[m];
8656 LDKSignature b_conv_12_ref;
8657 CHECK(*((uint32_t*)b_conv_12) == 64);
8658 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
8659 b_constr.data[m] = b_conv_12_ref;
8661 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8662 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
8663 return (long)ret_ref;
8666 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
8667 if ((_res & 1) != 0) return;
8668 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
8670 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
8673 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
8674 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
8676 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8677 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
8678 return (long)ret_conv;
8681 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
8682 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8683 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
8684 return (long)ret_conv;
8687 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
8688 if ((_res & 1) != 0) return;
8689 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
8691 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
8694 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
8695 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
8696 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8697 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
8698 return (long)ret_conv;
8701 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
8703 CHECK(*((uint32_t*)o) == 64);
8704 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
8705 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8706 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
8707 return (long)ret_conv;
8710 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
8711 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8712 *ret_conv = CResult_SignatureNoneZ_err();
8713 return (long)ret_conv;
8716 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
8717 if ((_res & 1) != 0) return;
8718 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
8720 CResult_SignatureNoneZ_free(_res_conv);
8723 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
8724 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
8725 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8726 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
8727 return (long)ret_conv;
8730 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
8731 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
8732 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8733 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
8734 return (long)ret_conv;
8737 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
8738 LDKDecodeError e_conv;
8739 e_conv.inner = (void*)(e & (~1));
8740 e_conv.is_owned = (e & 1) || (e == 0);
8741 e_conv = DecodeError_clone(&e_conv);
8742 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8743 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
8744 return (long)ret_conv;
8747 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
8748 if ((_res & 1) != 0) return;
8749 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
8751 CResult_SignDecodeErrorZ_free(_res_conv);
8754 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
8755 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
8756 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8757 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
8758 return (long)ret_conv;
8761 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
8762 LDKCVec_CVec_u8ZZ _res_constr;
8763 _res_constr.datalen = *((uint32_t*)_res);
8764 if (_res_constr.datalen > 0)
8765 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8767 _res_constr.data = NULL;
8768 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
8769 for (size_t m = 0; m < _res_constr.datalen; m++) {
8770 int8_tArray _res_conv_12 = _res_vals[m];
8771 LDKCVec_u8Z _res_conv_12_ref;
8772 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
8773 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
8774 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
8775 _res_constr.data[m] = _res_conv_12_ref;
8777 CVec_CVec_u8ZZ_free(_res_constr);
8780 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
8781 LDKCVec_CVec_u8ZZ o_constr;
8782 o_constr.datalen = *((uint32_t*)o);
8783 if (o_constr.datalen > 0)
8784 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8786 o_constr.data = NULL;
8787 int8_tArray* o_vals = (int8_tArray*)(o + 4);
8788 for (size_t m = 0; m < o_constr.datalen; m++) {
8789 int8_tArray o_conv_12 = o_vals[m];
8790 LDKCVec_u8Z o_conv_12_ref;
8791 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
8792 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
8793 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
8794 o_constr.data[m] = o_conv_12_ref;
8796 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8797 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
8798 return (long)ret_conv;
8801 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
8802 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8803 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
8804 return (long)ret_conv;
8807 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
8808 if ((_res & 1) != 0) return;
8809 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
8811 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
8814 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
8815 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
8816 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8817 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
8818 return (long)ret_conv;
8821 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
8822 LDKInMemorySigner o_conv;
8823 o_conv.inner = (void*)(o & (~1));
8824 o_conv.is_owned = (o & 1) || (o == 0);
8825 o_conv = InMemorySigner_clone(&o_conv);
8826 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8827 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
8828 return (long)ret_conv;
8831 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
8832 LDKDecodeError e_conv;
8833 e_conv.inner = (void*)(e & (~1));
8834 e_conv.is_owned = (e & 1) || (e == 0);
8835 e_conv = DecodeError_clone(&e_conv);
8836 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8837 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
8838 return (long)ret_conv;
8841 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
8842 if ((_res & 1) != 0) return;
8843 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
8845 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
8848 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
8849 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
8850 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8851 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
8852 return (long)ret_conv;
8855 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
8856 LDKCVec_TxOutZ _res_constr;
8857 _res_constr.datalen = *((uint32_t*)_res);
8858 if (_res_constr.datalen > 0)
8859 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
8861 _res_constr.data = NULL;
8862 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8863 for (size_t h = 0; h < _res_constr.datalen; h++) {
8864 uint32_t _res_conv_7 = _res_vals[h];
8865 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
8866 FREE((void*)_res_conv_7);
8867 _res_constr.data[h] = _res_conv_7_conv;
8869 CVec_TxOutZ_free(_res_constr);
8872 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
8873 LDKTransaction o_ref;
8874 o_ref.datalen = *((uint32_t*)o);
8875 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
8876 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
8877 o_ref.data_is_owned = true;
8878 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8879 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
8880 return (long)ret_conv;
8883 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
8884 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8885 *ret_conv = CResult_TransactionNoneZ_err();
8886 return (long)ret_conv;
8889 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
8890 if ((_res & 1) != 0) return;
8891 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
8893 CResult_TransactionNoneZ_free(_res_conv);
8896 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
8897 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8898 *ret_conv = CResult_NoneErrorZ_ok();
8899 return (long)ret_conv;
8902 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
8903 LDKIOError e_conv = LDKIOError_from_js(e);
8904 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8905 *ret_conv = CResult_NoneErrorZ_err(e_conv);
8906 return (long)ret_conv;
8909 void __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
8910 if ((_res & 1) != 0) return;
8911 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
8913 CResult_NoneErrorZ_free(_res_conv);
8916 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_BlockHashChannelMonitorZZ_free(uint32_tArray _res) {
8917 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
8918 _res_constr.datalen = *((uint32_t*)_res);
8919 if (_res_constr.datalen > 0)
8920 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
8922 _res_constr.data = NULL;
8923 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8924 for (size_t m = 0; m < _res_constr.datalen; m++) {
8925 uint32_t _res_conv_38 = _res_vals[m];
8926 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_38_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_38) & ~1);
8927 FREE((void*)_res_conv_38);
8928 _res_constr.data[m] = _res_conv_38_conv;
8930 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
8933 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(uint32_tArray o) {
8934 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
8935 o_constr.datalen = *((uint32_t*)o);
8936 if (o_constr.datalen > 0)
8937 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
8939 o_constr.data = NULL;
8940 uint32_t* o_vals = (uint32_t*)(o + 4);
8941 for (size_t m = 0; m < o_constr.datalen; m++) {
8942 uint32_t o_conv_38 = o_vals[m];
8943 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_38_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_38) & ~1);
8944 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
8945 o_constr.data[m] = o_conv_38_conv;
8947 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
8948 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
8949 return (long)ret_conv;
8952 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(uint32_t e) {
8953 LDKIOError e_conv = LDKIOError_from_js(e);
8954 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
8955 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
8956 return (long)ret_conv;
8959 void __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(uint32_t _res) {
8960 if ((_res & 1) != 0) return;
8961 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
8963 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
8966 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
8967 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8968 *ret_conv = CResult_NoneAPIErrorZ_ok();
8969 return (long)ret_conv;
8972 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
8973 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
8975 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8976 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
8977 return (long)ret_conv;
8980 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
8981 if ((_res & 1) != 0) return;
8982 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
8984 CResult_NoneAPIErrorZ_free(_res_conv);
8987 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
8988 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
8989 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8990 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
8991 return (long)ret_conv;
8994 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
8995 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
8996 _res_constr.datalen = *((uint32_t*)_res);
8997 if (_res_constr.datalen > 0)
8998 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
9000 _res_constr.data = NULL;
9001 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9002 for (size_t w = 0; w < _res_constr.datalen; w++) {
9003 uint32_t _res_conv_22 = _res_vals[w];
9004 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
9005 FREE((void*)_res_conv_22);
9006 _res_constr.data[w] = _res_conv_22_conv;
9008 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
9011 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
9012 LDKCVec_APIErrorZ _res_constr;
9013 _res_constr.datalen = *((uint32_t*)_res);
9014 if (_res_constr.datalen > 0)
9015 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
9017 _res_constr.data = NULL;
9018 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9019 for (size_t k = 0; k < _res_constr.datalen; k++) {
9020 uint32_t _res_conv_10 = _res_vals[k];
9021 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
9022 FREE((void*)_res_conv_10);
9023 _res_constr.data[k] = _res_conv_10_conv;
9025 CVec_APIErrorZ_free(_res_constr);
9028 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
9029 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9030 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
9031 return (long)ret_conv;
9034 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
9035 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
9037 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9038 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
9039 return (long)ret_conv;
9042 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
9043 if ((_res & 1) != 0) return;
9044 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
9046 CResult_NonePaymentSendFailureZ_free(_res_conv);
9049 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
9050 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
9051 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9052 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
9053 return (long)ret_conv;
9056 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
9057 LDKCVec_ChannelMonitorZ _res_constr;
9058 _res_constr.datalen = *((uint32_t*)_res);
9059 if (_res_constr.datalen > 0)
9060 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
9062 _res_constr.data = NULL;
9063 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9064 for (size_t q = 0; q < _res_constr.datalen; q++) {
9065 uint32_t _res_conv_16 = _res_vals[q];
9066 LDKChannelMonitor _res_conv_16_conv;
9067 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9068 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9069 _res_constr.data[q] = _res_conv_16_conv;
9071 CVec_ChannelMonitorZ_free(_res_constr);
9074 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
9075 LDKThirtyTwoBytes a_ref;
9076 CHECK(*((uint32_t*)a) == 32);
9077 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9078 LDKChannelManager b_conv;
9079 b_conv.inner = (void*)(b & (~1));
9080 b_conv.is_owned = (b & 1) || (b == 0);
9081 // Warning: we need a move here but no clone is available for LDKChannelManager
9082 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
9083 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
9084 return (long)ret_ref;
9087 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
9088 if ((_res & 1) != 0) return;
9089 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
9091 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
9094 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
9095 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
9097 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9098 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
9099 return (long)ret_conv;
9102 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
9103 LDKDecodeError e_conv;
9104 e_conv.inner = (void*)(e & (~1));
9105 e_conv.is_owned = (e & 1) || (e == 0);
9106 e_conv = DecodeError_clone(&e_conv);
9107 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9108 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
9109 return (long)ret_conv;
9112 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
9113 if ((_res & 1) != 0) return;
9114 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9116 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
9119 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
9120 if ((this_ptr & 1) != 0) return;
9121 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
9122 FREE((void*)this_ptr);
9123 Event_free(this_ptr_conv);
9126 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
9127 LDKEvent* orig_conv = (LDKEvent*)orig;
9128 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
9129 *ret_copy = Event_clone(orig_conv);
9130 long ret_ref = (long)ret_copy;
9134 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
9135 LDKEvent* obj_conv = (LDKEvent*)obj;
9136 LDKCVec_u8Z ret_var = Event_write(obj_conv);
9137 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9138 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9139 CVec_u8Z_free(ret_var);
9143 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
9144 if ((this_ptr & 1) != 0) return;
9145 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
9146 FREE((void*)this_ptr);
9147 MessageSendEvent_free(this_ptr_conv);
9150 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
9151 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
9152 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
9153 *ret_copy = MessageSendEvent_clone(orig_conv);
9154 long ret_ref = (long)ret_copy;
9158 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
9159 if ((this_ptr & 1) != 0) return;
9160 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
9161 FREE((void*)this_ptr);
9162 MessageSendEventsProvider_free(this_ptr_conv);
9165 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
9166 if ((this_ptr & 1) != 0) return;
9167 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
9168 FREE((void*)this_ptr);
9169 EventsProvider_free(this_ptr_conv);
9172 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
9173 if ((this_ptr & 1) != 0) return;
9174 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
9175 FREE((void*)this_ptr);
9176 APIError_free(this_ptr_conv);
9179 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
9180 LDKAPIError* orig_conv = (LDKAPIError*)orig;
9181 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
9182 *ret_copy = APIError_clone(orig_conv);
9183 long ret_ref = (long)ret_copy;
9187 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
9188 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
9189 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
9193 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
9194 uint32_t ret_conv = LDKLevel_to_js(Level_max());
9198 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
9199 if ((this_ptr & 1) != 0) return;
9200 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
9201 FREE((void*)this_ptr);
9202 Logger_free(this_ptr_conv);
9205 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
9206 LDKChannelHandshakeConfig this_obj_conv;
9207 this_obj_conv.inner = (void*)(this_obj & (~1));
9208 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9209 ChannelHandshakeConfig_free(this_obj_conv);
9212 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
9213 LDKChannelHandshakeConfig this_ptr_conv;
9214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9215 this_ptr_conv.is_owned = false;
9216 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
9220 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
9221 LDKChannelHandshakeConfig this_ptr_conv;
9222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9223 this_ptr_conv.is_owned = false;
9224 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
9227 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
9228 LDKChannelHandshakeConfig this_ptr_conv;
9229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9230 this_ptr_conv.is_owned = false;
9231 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
9235 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
9236 LDKChannelHandshakeConfig this_ptr_conv;
9237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9238 this_ptr_conv.is_owned = false;
9239 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
9242 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
9243 LDKChannelHandshakeConfig this_ptr_conv;
9244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9245 this_ptr_conv.is_owned = false;
9246 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
9250 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
9251 LDKChannelHandshakeConfig this_ptr_conv;
9252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9253 this_ptr_conv.is_owned = false;
9254 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
9257 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) {
9258 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
9259 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9260 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9261 long ret_ref = (long)ret_var.inner;
9262 if (ret_var.is_owned) {
9268 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
9269 LDKChannelHandshakeConfig orig_conv;
9270 orig_conv.inner = (void*)(orig & (~1));
9271 orig_conv.is_owned = false;
9272 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
9273 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9274 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9275 long ret_ref = (long)ret_var.inner;
9276 if (ret_var.is_owned) {
9282 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
9283 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
9284 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9285 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9286 long ret_ref = (long)ret_var.inner;
9287 if (ret_var.is_owned) {
9293 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
9294 LDKChannelHandshakeLimits this_obj_conv;
9295 this_obj_conv.inner = (void*)(this_obj & (~1));
9296 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9297 ChannelHandshakeLimits_free(this_obj_conv);
9300 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
9301 LDKChannelHandshakeLimits this_ptr_conv;
9302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9303 this_ptr_conv.is_owned = false;
9304 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
9308 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
9309 LDKChannelHandshakeLimits this_ptr_conv;
9310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9311 this_ptr_conv.is_owned = false;
9312 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
9315 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
9316 LDKChannelHandshakeLimits this_ptr_conv;
9317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9318 this_ptr_conv.is_owned = false;
9319 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
9323 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
9324 LDKChannelHandshakeLimits this_ptr_conv;
9325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9326 this_ptr_conv.is_owned = false;
9327 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
9330 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
9331 LDKChannelHandshakeLimits this_ptr_conv;
9332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9333 this_ptr_conv.is_owned = false;
9334 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
9338 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
9339 LDKChannelHandshakeLimits this_ptr_conv;
9340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9341 this_ptr_conv.is_owned = false;
9342 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
9345 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
9346 LDKChannelHandshakeLimits this_ptr_conv;
9347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9348 this_ptr_conv.is_owned = false;
9349 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
9353 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
9354 LDKChannelHandshakeLimits this_ptr_conv;
9355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9356 this_ptr_conv.is_owned = false;
9357 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
9360 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
9361 LDKChannelHandshakeLimits this_ptr_conv;
9362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9363 this_ptr_conv.is_owned = false;
9364 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
9368 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
9369 LDKChannelHandshakeLimits this_ptr_conv;
9370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9371 this_ptr_conv.is_owned = false;
9372 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
9375 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_dust_limit_satoshis(uint32_t this_ptr) {
9376 LDKChannelHandshakeLimits this_ptr_conv;
9377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9378 this_ptr_conv.is_owned = false;
9379 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
9383 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
9384 LDKChannelHandshakeLimits this_ptr_conv;
9385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9386 this_ptr_conv.is_owned = false;
9387 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
9390 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_dust_limit_satoshis(uint32_t this_ptr) {
9391 LDKChannelHandshakeLimits this_ptr_conv;
9392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9393 this_ptr_conv.is_owned = false;
9394 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
9398 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
9399 LDKChannelHandshakeLimits this_ptr_conv;
9400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9401 this_ptr_conv.is_owned = false;
9402 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
9405 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
9406 LDKChannelHandshakeLimits this_ptr_conv;
9407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9408 this_ptr_conv.is_owned = false;
9409 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
9413 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
9414 LDKChannelHandshakeLimits this_ptr_conv;
9415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9416 this_ptr_conv.is_owned = false;
9417 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
9420 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
9421 LDKChannelHandshakeLimits this_ptr_conv;
9422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9423 this_ptr_conv.is_owned = false;
9424 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
9428 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
9429 LDKChannelHandshakeLimits this_ptr_conv;
9430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9431 this_ptr_conv.is_owned = false;
9432 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
9435 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
9436 LDKChannelHandshakeLimits this_ptr_conv;
9437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9438 this_ptr_conv.is_owned = false;
9439 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
9443 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
9444 LDKChannelHandshakeLimits this_ptr_conv;
9445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9446 this_ptr_conv.is_owned = false;
9447 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
9450 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, int64_t min_dust_limit_satoshis_arg, int64_t max_dust_limit_satoshis_arg, int32_t max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
9451 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, min_dust_limit_satoshis_arg, max_dust_limit_satoshis_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
9452 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9453 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9454 long ret_ref = (long)ret_var.inner;
9455 if (ret_var.is_owned) {
9461 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
9462 LDKChannelHandshakeLimits orig_conv;
9463 orig_conv.inner = (void*)(orig & (~1));
9464 orig_conv.is_owned = false;
9465 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
9466 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9467 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9468 long ret_ref = (long)ret_var.inner;
9469 if (ret_var.is_owned) {
9475 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
9476 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
9477 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9478 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9479 long ret_ref = (long)ret_var.inner;
9480 if (ret_var.is_owned) {
9486 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
9487 LDKChannelConfig this_obj_conv;
9488 this_obj_conv.inner = (void*)(this_obj & (~1));
9489 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9490 ChannelConfig_free(this_obj_conv);
9493 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_fee_proportional_millionths(uint32_t this_ptr) {
9494 LDKChannelConfig this_ptr_conv;
9495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9496 this_ptr_conv.is_owned = false;
9497 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
9501 void __attribute__((visibility("default"))) TS_ChannelConfig_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
9502 LDKChannelConfig this_ptr_conv;
9503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9504 this_ptr_conv.is_owned = false;
9505 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
9508 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
9509 LDKChannelConfig this_ptr_conv;
9510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9511 this_ptr_conv.is_owned = false;
9512 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
9516 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
9517 LDKChannelConfig this_ptr_conv;
9518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9519 this_ptr_conv.is_owned = false;
9520 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
9523 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
9524 LDKChannelConfig this_ptr_conv;
9525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9526 this_ptr_conv.is_owned = false;
9527 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
9531 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
9532 LDKChannelConfig this_ptr_conv;
9533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9534 this_ptr_conv.is_owned = false;
9535 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
9538 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
9539 LDKChannelConfig this_ptr_conv;
9540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9541 this_ptr_conv.is_owned = false;
9542 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
9546 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
9547 LDKChannelConfig this_ptr_conv;
9548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9549 this_ptr_conv.is_owned = false;
9550 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
9553 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_new(int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
9554 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
9555 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9556 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9557 long ret_ref = (long)ret_var.inner;
9558 if (ret_var.is_owned) {
9564 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
9565 LDKChannelConfig orig_conv;
9566 orig_conv.inner = (void*)(orig & (~1));
9567 orig_conv.is_owned = false;
9568 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
9569 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9570 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9571 long ret_ref = (long)ret_var.inner;
9572 if (ret_var.is_owned) {
9578 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
9579 LDKChannelConfig ret_var = ChannelConfig_default();
9580 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9581 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9582 long ret_ref = (long)ret_var.inner;
9583 if (ret_var.is_owned) {
9589 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
9590 LDKChannelConfig obj_conv;
9591 obj_conv.inner = (void*)(obj & (~1));
9592 obj_conv.is_owned = false;
9593 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
9594 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9595 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9596 CVec_u8Z_free(ret_var);
9600 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
9602 ser_ref.datalen = *((uint32_t*)ser);
9603 ser_ref.data = (int8_t*)(ser + 4);
9604 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9605 *ret_conv = ChannelConfig_read(ser_ref);
9606 return (long)ret_conv;
9609 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
9610 LDKUserConfig this_obj_conv;
9611 this_obj_conv.inner = (void*)(this_obj & (~1));
9612 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9613 UserConfig_free(this_obj_conv);
9616 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
9617 LDKUserConfig this_ptr_conv;
9618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9619 this_ptr_conv.is_owned = false;
9620 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
9621 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9622 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9623 long ret_ref = (long)ret_var.inner;
9624 if (ret_var.is_owned) {
9630 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
9631 LDKUserConfig this_ptr_conv;
9632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9633 this_ptr_conv.is_owned = false;
9634 LDKChannelHandshakeConfig val_conv;
9635 val_conv.inner = (void*)(val & (~1));
9636 val_conv.is_owned = (val & 1) || (val == 0);
9637 val_conv = ChannelHandshakeConfig_clone(&val_conv);
9638 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
9641 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
9642 LDKUserConfig this_ptr_conv;
9643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9644 this_ptr_conv.is_owned = false;
9645 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
9646 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9647 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9648 long ret_ref = (long)ret_var.inner;
9649 if (ret_var.is_owned) {
9655 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
9656 LDKUserConfig this_ptr_conv;
9657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9658 this_ptr_conv.is_owned = false;
9659 LDKChannelHandshakeLimits val_conv;
9660 val_conv.inner = (void*)(val & (~1));
9661 val_conv.is_owned = (val & 1) || (val == 0);
9662 val_conv = ChannelHandshakeLimits_clone(&val_conv);
9663 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
9666 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
9667 LDKUserConfig this_ptr_conv;
9668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9669 this_ptr_conv.is_owned = false;
9670 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
9671 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9672 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9673 long ret_ref = (long)ret_var.inner;
9674 if (ret_var.is_owned) {
9680 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
9681 LDKUserConfig this_ptr_conv;
9682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9683 this_ptr_conv.is_owned = false;
9684 LDKChannelConfig val_conv;
9685 val_conv.inner = (void*)(val & (~1));
9686 val_conv.is_owned = (val & 1) || (val == 0);
9687 val_conv = ChannelConfig_clone(&val_conv);
9688 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
9691 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) {
9692 LDKChannelHandshakeConfig own_channel_config_arg_conv;
9693 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
9694 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
9695 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
9696 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
9697 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
9698 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
9699 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
9700 LDKChannelConfig channel_options_arg_conv;
9701 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
9702 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
9703 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
9704 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
9705 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9706 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9707 long ret_ref = (long)ret_var.inner;
9708 if (ret_var.is_owned) {
9714 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
9715 LDKUserConfig orig_conv;
9716 orig_conv.inner = (void*)(orig & (~1));
9717 orig_conv.is_owned = false;
9718 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
9719 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9720 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9721 long ret_ref = (long)ret_var.inner;
9722 if (ret_var.is_owned) {
9728 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
9729 LDKUserConfig ret_var = UserConfig_default();
9730 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9731 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9732 long ret_ref = (long)ret_var.inner;
9733 if (ret_var.is_owned) {
9739 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
9740 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
9741 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
9745 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
9746 if ((this_ptr & 1) != 0) return;
9747 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
9748 FREE((void*)this_ptr);
9749 Access_free(this_ptr_conv);
9752 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
9753 if ((this_ptr & 1) != 0) return;
9754 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
9755 FREE((void*)this_ptr);
9756 Listen_free(this_ptr_conv);
9759 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
9760 if ((this_ptr & 1) != 0) return;
9761 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
9762 FREE((void*)this_ptr);
9763 Watch_free(this_ptr_conv);
9766 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
9767 if ((this_ptr & 1) != 0) return;
9768 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
9769 FREE((void*)this_ptr);
9770 Filter_free(this_ptr_conv);
9773 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
9774 LDKWatchedOutput this_obj_conv;
9775 this_obj_conv.inner = (void*)(this_obj & (~1));
9776 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9777 WatchedOutput_free(this_obj_conv);
9780 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
9781 LDKWatchedOutput this_ptr_conv;
9782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9783 this_ptr_conv.is_owned = false;
9784 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9785 memcpy((uint8_t*)(ret_arr + 4), WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
9789 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
9790 LDKWatchedOutput this_ptr_conv;
9791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9792 this_ptr_conv.is_owned = false;
9793 LDKThirtyTwoBytes val_ref;
9794 CHECK(*((uint32_t*)val) == 32);
9795 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
9796 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
9799 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
9800 LDKWatchedOutput this_ptr_conv;
9801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9802 this_ptr_conv.is_owned = false;
9803 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
9804 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9805 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9806 long ret_ref = (long)ret_var.inner;
9807 if (ret_var.is_owned) {
9813 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
9814 LDKWatchedOutput this_ptr_conv;
9815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9816 this_ptr_conv.is_owned = false;
9817 LDKOutPoint val_conv;
9818 val_conv.inner = (void*)(val & (~1));
9819 val_conv.is_owned = (val & 1) || (val == 0);
9820 val_conv = OutPoint_clone(&val_conv);
9821 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
9824 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
9825 LDKWatchedOutput this_ptr_conv;
9826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9827 this_ptr_conv.is_owned = false;
9828 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
9829 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9830 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9834 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
9835 LDKWatchedOutput this_ptr_conv;
9836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9837 this_ptr_conv.is_owned = false;
9838 LDKCVec_u8Z val_ref;
9839 val_ref.datalen = *((uint32_t*)val);
9840 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
9841 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
9842 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
9845 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
9846 LDKThirtyTwoBytes block_hash_arg_ref;
9847 CHECK(*((uint32_t*)block_hash_arg) == 32);
9848 memcpy(block_hash_arg_ref.data, (uint8_t*)(block_hash_arg + 4), 32);
9849 LDKOutPoint outpoint_arg_conv;
9850 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
9851 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
9852 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
9853 LDKCVec_u8Z script_pubkey_arg_ref;
9854 script_pubkey_arg_ref.datalen = *((uint32_t*)script_pubkey_arg);
9855 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
9856 memcpy(script_pubkey_arg_ref.data, (uint8_t*)(script_pubkey_arg + 4), script_pubkey_arg_ref.datalen);
9857 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
9858 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9859 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9860 long ret_ref = (long)ret_var.inner;
9861 if (ret_var.is_owned) {
9867 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
9868 if ((this_ptr & 1) != 0) return;
9869 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
9870 FREE((void*)this_ptr);
9871 BroadcasterInterface_free(this_ptr_conv);
9874 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
9875 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
9876 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
9880 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
9881 if ((this_ptr & 1) != 0) return;
9882 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
9883 FREE((void*)this_ptr);
9884 FeeEstimator_free(this_ptr_conv);
9887 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
9888 LDKChainMonitor this_obj_conv;
9889 this_obj_conv.inner = (void*)(this_obj & (~1));
9890 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9891 ChainMonitor_free(this_obj_conv);
9894 void __attribute__((visibility("default"))) TS_ChainMonitor_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
9895 LDKChainMonitor this_arg_conv;
9896 this_arg_conv.inner = (void*)(this_arg & (~1));
9897 this_arg_conv.is_owned = false;
9898 unsigned char header_arr[80];
9899 CHECK(*((uint32_t*)header) == 80);
9900 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9901 unsigned char (*header_ref)[80] = &header_arr;
9902 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9903 txdata_constr.datalen = *((uint32_t*)txdata);
9904 if (txdata_constr.datalen > 0)
9905 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9907 txdata_constr.data = NULL;
9908 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
9909 for (size_t e = 0; e < txdata_constr.datalen; e++) {
9910 uint32_t txdata_conv_30 = txdata_vals[e];
9911 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
9912 // Warning: we may need a move here but no clone is available for LDKC2Tuple_usizeTransactionZ
9913 txdata_constr.data[e] = txdata_conv_30_conv;
9915 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
9918 void __attribute__((visibility("default"))) TS_ChainMonitor_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
9919 LDKChainMonitor this_arg_conv;
9920 this_arg_conv.inner = (void*)(this_arg & (~1));
9921 this_arg_conv.is_owned = false;
9922 unsigned char header_arr[80];
9923 CHECK(*((uint32_t*)header) == 80);
9924 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9925 unsigned char (*header_ref)[80] = &header_arr;
9926 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9927 txdata_constr.datalen = *((uint32_t*)txdata);
9928 if (txdata_constr.datalen > 0)
9929 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9931 txdata_constr.data = NULL;
9932 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
9933 for (size_t e = 0; e < txdata_constr.datalen; e++) {
9934 uint32_t txdata_conv_30 = txdata_vals[e];
9935 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
9936 // Warning: we may need a move here but no clone is available for LDKC2Tuple_usizeTransactionZ
9937 txdata_constr.data[e] = txdata_conv_30_conv;
9939 ChainMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height);
9942 void __attribute__((visibility("default"))) TS_ChainMonitor_update_best_block(uint32_t this_arg, int8_tArray header, int32_t height) {
9943 LDKChainMonitor this_arg_conv;
9944 this_arg_conv.inner = (void*)(this_arg & (~1));
9945 this_arg_conv.is_owned = false;
9946 unsigned char header_arr[80];
9947 CHECK(*((uint32_t*)header) == 80);
9948 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9949 unsigned char (*header_ref)[80] = &header_arr;
9950 ChainMonitor_update_best_block(&this_arg_conv, header_ref, height);
9953 void __attribute__((visibility("default"))) TS_ChainMonitor_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t disconnected_height) {
9954 LDKChainMonitor this_arg_conv;
9955 this_arg_conv.inner = (void*)(this_arg & (~1));
9956 this_arg_conv.is_owned = false;
9957 unsigned char header_arr[80];
9958 CHECK(*((uint32_t*)header) == 80);
9959 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9960 unsigned char (*header_ref)[80] = &header_arr;
9961 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
9964 void __attribute__((visibility("default"))) TS_ChainMonitor_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
9965 LDKChainMonitor this_arg_conv;
9966 this_arg_conv.inner = (void*)(this_arg & (~1));
9967 this_arg_conv.is_owned = false;
9968 unsigned char txid_arr[32];
9969 CHECK(*((uint32_t*)txid) == 32);
9970 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
9971 unsigned char (*txid_ref)[32] = &txid_arr;
9972 ChainMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref);
9975 ptrArray __attribute__((visibility("default"))) TS_ChainMonitor_get_relevant_txids(uint32_t this_arg) {
9976 LDKChainMonitor this_arg_conv;
9977 this_arg_conv.inner = (void*)(this_arg & (~1));
9978 this_arg_conv.is_owned = false;
9979 LDKCVec_TxidZ ret_var = ChainMonitor_get_relevant_txids(&this_arg_conv);
9980 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
9981 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
9982 for (size_t m = 0; m < ret_var.datalen; m++) {
9983 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9984 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
9985 ret_arr_ptr[m] = ret_conv_12_arr;
9991 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
9992 LDKFilter *chain_source_conv_ptr = NULL;
9993 if (chain_source != 0) {
9994 LDKFilter chain_source_conv;
9995 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
9996 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
9997 *chain_source_conv_ptr = chain_source_conv;
9999 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10000 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10001 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
10002 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
10003 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
10004 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10005 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10006 long ret_ref = (long)ret_var.inner;
10007 if (ret_var.is_owned) {
10013 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
10014 LDKChainMonitor this_arg_conv;
10015 this_arg_conv.inner = (void*)(this_arg & (~1));
10016 this_arg_conv.is_owned = false;
10017 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
10018 *ret = ChainMonitor_as_Watch(&this_arg_conv);
10022 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
10023 LDKChainMonitor this_arg_conv;
10024 this_arg_conv.inner = (void*)(this_arg & (~1));
10025 this_arg_conv.is_owned = false;
10026 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
10027 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
10031 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
10032 LDKChannelMonitorUpdate this_obj_conv;
10033 this_obj_conv.inner = (void*)(this_obj & (~1));
10034 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10035 ChannelMonitorUpdate_free(this_obj_conv);
10038 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
10039 LDKChannelMonitorUpdate this_ptr_conv;
10040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10041 this_ptr_conv.is_owned = false;
10042 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
10046 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
10047 LDKChannelMonitorUpdate this_ptr_conv;
10048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10049 this_ptr_conv.is_owned = false;
10050 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
10053 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
10054 LDKChannelMonitorUpdate orig_conv;
10055 orig_conv.inner = (void*)(orig & (~1));
10056 orig_conv.is_owned = false;
10057 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
10058 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10059 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10060 long ret_ref = (long)ret_var.inner;
10061 if (ret_var.is_owned) {
10067 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
10068 LDKChannelMonitorUpdate obj_conv;
10069 obj_conv.inner = (void*)(obj & (~1));
10070 obj_conv.is_owned = false;
10071 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
10072 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10073 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10074 CVec_u8Z_free(ret_var);
10078 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
10079 LDKu8slice ser_ref;
10080 ser_ref.datalen = *((uint32_t*)ser);
10081 ser_ref.data = (int8_t*)(ser + 4);
10082 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10083 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
10084 return (long)ret_conv;
10087 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
10088 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
10089 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
10093 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) {
10094 LDKMonitorUpdateError this_obj_conv;
10095 this_obj_conv.inner = (void*)(this_obj & (~1));
10096 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10097 MonitorUpdateError_free(this_obj_conv);
10100 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
10101 LDKMonitorUpdateError orig_conv;
10102 orig_conv.inner = (void*)(orig & (~1));
10103 orig_conv.is_owned = false;
10104 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
10105 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10106 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10107 long ret_ref = (long)ret_var.inner;
10108 if (ret_var.is_owned) {
10114 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
10115 if ((this_ptr & 1) != 0) return;
10116 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
10117 FREE((void*)this_ptr);
10118 MonitorEvent_free(this_ptr_conv);
10121 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
10122 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
10123 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
10124 *ret_copy = MonitorEvent_clone(orig_conv);
10125 long ret_ref = (long)ret_copy;
10129 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
10130 LDKHTLCUpdate this_obj_conv;
10131 this_obj_conv.inner = (void*)(this_obj & (~1));
10132 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10133 HTLCUpdate_free(this_obj_conv);
10136 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
10137 LDKHTLCUpdate orig_conv;
10138 orig_conv.inner = (void*)(orig & (~1));
10139 orig_conv.is_owned = false;
10140 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
10141 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10142 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10143 long ret_ref = (long)ret_var.inner;
10144 if (ret_var.is_owned) {
10150 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
10151 LDKHTLCUpdate obj_conv;
10152 obj_conv.inner = (void*)(obj & (~1));
10153 obj_conv.is_owned = false;
10154 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
10155 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10156 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10157 CVec_u8Z_free(ret_var);
10161 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
10162 LDKu8slice ser_ref;
10163 ser_ref.datalen = *((uint32_t*)ser);
10164 ser_ref.data = (int8_t*)(ser + 4);
10165 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10166 *ret_conv = HTLCUpdate_read(ser_ref);
10167 return (long)ret_conv;
10170 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
10171 LDKChannelMonitor this_obj_conv;
10172 this_obj_conv.inner = (void*)(this_obj & (~1));
10173 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10174 ChannelMonitor_free(this_obj_conv);
10177 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
10178 LDKChannelMonitor orig_conv;
10179 orig_conv.inner = (void*)(orig & (~1));
10180 orig_conv.is_owned = false;
10181 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
10182 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10183 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10184 long ret_ref = (long)ret_var.inner;
10185 if (ret_var.is_owned) {
10191 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
10192 LDKChannelMonitor obj_conv;
10193 obj_conv.inner = (void*)(obj & (~1));
10194 obj_conv.is_owned = false;
10195 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
10196 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10197 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10198 CVec_u8Z_free(ret_var);
10202 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) {
10203 LDKChannelMonitor this_arg_conv;
10204 this_arg_conv.inner = (void*)(this_arg & (~1));
10205 this_arg_conv.is_owned = false;
10206 LDKChannelMonitorUpdate updates_conv;
10207 updates_conv.inner = (void*)(updates & (~1));
10208 updates_conv.is_owned = false;
10209 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10210 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10211 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
10212 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10213 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
10214 return (long)ret_conv;
10217 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
10218 LDKChannelMonitor this_arg_conv;
10219 this_arg_conv.inner = (void*)(this_arg & (~1));
10220 this_arg_conv.is_owned = false;
10221 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
10225 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
10226 LDKChannelMonitor this_arg_conv;
10227 this_arg_conv.inner = (void*)(this_arg & (~1));
10228 this_arg_conv.is_owned = false;
10229 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10230 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
10231 return (long)ret_ref;
10234 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
10235 LDKChannelMonitor this_arg_conv;
10236 this_arg_conv.inner = (void*)(this_arg & (~1));
10237 this_arg_conv.is_owned = false;
10238 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
10239 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10240 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10241 for (size_t c = 0; c < ret_var.datalen; c++) {
10242 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_54_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10243 *ret_conv_54_ref = ret_var.data[c];
10244 ret_arr_ptr[c] = (long)ret_conv_54_ref;
10246 FREE(ret_var.data);
10250 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
10251 LDKChannelMonitor this_arg_conv;
10252 this_arg_conv.inner = (void*)(this_arg & (~1));
10253 this_arg_conv.is_owned = false;
10254 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
10255 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
10258 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
10259 LDKChannelMonitor this_arg_conv;
10260 this_arg_conv.inner = (void*)(this_arg & (~1));
10261 this_arg_conv.is_owned = false;
10262 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
10263 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10264 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10265 for (size_t o = 0; o < ret_var.datalen; o++) {
10266 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
10267 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
10268 long ret_conv_14_ref = (long)ret_conv_14_copy;
10269 ret_arr_ptr[o] = ret_conv_14_ref;
10271 FREE(ret_var.data);
10275 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
10276 LDKChannelMonitor this_arg_conv;
10277 this_arg_conv.inner = (void*)(this_arg & (~1));
10278 this_arg_conv.is_owned = false;
10279 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
10280 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10281 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10282 for (size_t h = 0; h < ret_var.datalen; h++) {
10283 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10284 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
10285 long ret_conv_7_ref = (long)ret_conv_7_copy;
10286 ret_arr_ptr[h] = ret_conv_7_ref;
10288 FREE(ret_var.data);
10292 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
10293 LDKChannelMonitor this_arg_conv;
10294 this_arg_conv.inner = (void*)(this_arg & (~1));
10295 this_arg_conv.is_owned = false;
10296 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
10297 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
10298 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
10299 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
10300 for (size_t m = 0; m < ret_var.datalen; m++) {
10301 LDKTransaction ret_conv_12_var = ret_var.data[m];
10302 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10303 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
10304 Transaction_free(ret_conv_12_var);
10305 ret_arr_ptr[m] = ret_conv_12_arr;
10307 FREE(ret_var.data);
10311 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) {
10312 LDKChannelMonitor this_arg_conv;
10313 this_arg_conv.inner = (void*)(this_arg & (~1));
10314 this_arg_conv.is_owned = false;
10315 unsigned char header_arr[80];
10316 CHECK(*((uint32_t*)header) == 80);
10317 memcpy(header_arr, (uint8_t*)(header + 4), 80);
10318 unsigned char (*header_ref)[80] = &header_arr;
10319 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10320 txdata_constr.datalen = *((uint32_t*)txdata);
10321 if (txdata_constr.datalen > 0)
10322 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10324 txdata_constr.data = NULL;
10325 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
10326 for (size_t e = 0; e < txdata_constr.datalen; e++) {
10327 uint32_t txdata_conv_30 = txdata_vals[e];
10328 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
10329 // Warning: we may need a move here but no clone is available for LDKC2Tuple_usizeTransactionZ
10330 txdata_constr.data[e] = txdata_conv_30_conv;
10332 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10333 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10334 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10335 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);
10336 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10337 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10338 for (size_t x = 0; x < ret_var.datalen; x++) {
10339 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10340 *ret_conv_49_ref = ret_var.data[x];
10341 ret_arr_ptr[x] = (long)ret_conv_49_ref;
10343 FREE(ret_var.data);
10347 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) {
10348 LDKChannelMonitor this_arg_conv;
10349 this_arg_conv.inner = (void*)(this_arg & (~1));
10350 this_arg_conv.is_owned = false;
10351 unsigned char header_arr[80];
10352 CHECK(*((uint32_t*)header) == 80);
10353 memcpy(header_arr, (uint8_t*)(header + 4), 80);
10354 unsigned char (*header_ref)[80] = &header_arr;
10355 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10356 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10357 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10358 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
10361 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) {
10362 LDKChannelMonitor this_arg_conv;
10363 this_arg_conv.inner = (void*)(this_arg & (~1));
10364 this_arg_conv.is_owned = false;
10365 unsigned char header_arr[80];
10366 CHECK(*((uint32_t*)header) == 80);
10367 memcpy(header_arr, (uint8_t*)(header + 4), 80);
10368 unsigned char (*header_ref)[80] = &header_arr;
10369 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10370 txdata_constr.datalen = *((uint32_t*)txdata);
10371 if (txdata_constr.datalen > 0)
10372 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10374 txdata_constr.data = NULL;
10375 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
10376 for (size_t e = 0; e < txdata_constr.datalen; e++) {
10377 uint32_t txdata_conv_30 = txdata_vals[e];
10378 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
10379 // Warning: we may need a move here but no clone is available for LDKC2Tuple_usizeTransactionZ
10380 txdata_constr.data[e] = txdata_conv_30_conv;
10382 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10383 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10384 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10385 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);
10386 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10387 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10388 for (size_t x = 0; x < ret_var.datalen; x++) {
10389 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10390 *ret_conv_49_ref = ret_var.data[x];
10391 ret_arr_ptr[x] = (long)ret_conv_49_ref;
10393 FREE(ret_var.data);
10397 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) {
10398 LDKChannelMonitor this_arg_conv;
10399 this_arg_conv.inner = (void*)(this_arg & (~1));
10400 this_arg_conv.is_owned = false;
10401 unsigned char txid_arr[32];
10402 CHECK(*((uint32_t*)txid) == 32);
10403 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
10404 unsigned char (*txid_ref)[32] = &txid_arr;
10405 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10406 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10407 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10408 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
10411 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_update_best_block(uint32_t this_arg, int8_tArray header, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
10412 LDKChannelMonitor this_arg_conv;
10413 this_arg_conv.inner = (void*)(this_arg & (~1));
10414 this_arg_conv.is_owned = false;
10415 unsigned char header_arr[80];
10416 CHECK(*((uint32_t*)header) == 80);
10417 memcpy(header_arr, (uint8_t*)(header + 4), 80);
10418 unsigned char (*header_ref)[80] = &header_arr;
10419 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10420 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10421 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10422 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_update_best_block(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
10423 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10424 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10425 for (size_t x = 0; x < ret_var.datalen; x++) {
10426 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10427 *ret_conv_49_ref = ret_var.data[x];
10428 ret_arr_ptr[x] = (long)ret_conv_49_ref;
10430 FREE(ret_var.data);
10434 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
10435 LDKChannelMonitor this_arg_conv;
10436 this_arg_conv.inner = (void*)(this_arg & (~1));
10437 this_arg_conv.is_owned = false;
10438 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
10439 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
10440 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
10441 for (size_t m = 0; m < ret_var.datalen; m++) {
10442 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10443 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
10444 ret_arr_ptr[m] = ret_conv_12_arr;
10446 FREE(ret_var.data);
10450 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
10451 if ((this_ptr & 1) != 0) return;
10452 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
10453 FREE((void*)this_ptr);
10454 Persist_free(this_ptr_conv);
10457 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
10458 LDKu8slice ser_ref;
10459 ser_ref.datalen = *((uint32_t*)ser);
10460 ser_ref.data = (int8_t*)(ser + 4);
10461 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
10462 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10463 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
10464 return (long)ret_conv;
10467 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
10468 LDKOutPoint this_obj_conv;
10469 this_obj_conv.inner = (void*)(this_obj & (~1));
10470 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10471 OutPoint_free(this_obj_conv);
10474 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
10475 LDKOutPoint this_ptr_conv;
10476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10477 this_ptr_conv.is_owned = false;
10478 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10479 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
10483 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
10484 LDKOutPoint this_ptr_conv;
10485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10486 this_ptr_conv.is_owned = false;
10487 LDKThirtyTwoBytes val_ref;
10488 CHECK(*((uint32_t*)val) == 32);
10489 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10490 OutPoint_set_txid(&this_ptr_conv, val_ref);
10493 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
10494 LDKOutPoint this_ptr_conv;
10495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10496 this_ptr_conv.is_owned = false;
10497 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
10501 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
10502 LDKOutPoint this_ptr_conv;
10503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10504 this_ptr_conv.is_owned = false;
10505 OutPoint_set_index(&this_ptr_conv, val);
10508 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
10509 LDKThirtyTwoBytes txid_arg_ref;
10510 CHECK(*((uint32_t*)txid_arg) == 32);
10511 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
10512 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
10513 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10514 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10515 long ret_ref = (long)ret_var.inner;
10516 if (ret_var.is_owned) {
10522 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
10523 LDKOutPoint orig_conv;
10524 orig_conv.inner = (void*)(orig & (~1));
10525 orig_conv.is_owned = false;
10526 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
10527 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10528 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10529 long ret_ref = (long)ret_var.inner;
10530 if (ret_var.is_owned) {
10536 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
10537 LDKOutPoint this_arg_conv;
10538 this_arg_conv.inner = (void*)(this_arg & (~1));
10539 this_arg_conv.is_owned = false;
10540 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10541 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
10545 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
10546 LDKOutPoint obj_conv;
10547 obj_conv.inner = (void*)(obj & (~1));
10548 obj_conv.is_owned = false;
10549 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
10550 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10551 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10552 CVec_u8Z_free(ret_var);
10556 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
10557 LDKu8slice ser_ref;
10558 ser_ref.datalen = *((uint32_t*)ser);
10559 ser_ref.data = (int8_t*)(ser + 4);
10560 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10561 *ret_conv = OutPoint_read(ser_ref);
10562 return (long)ret_conv;
10565 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
10566 LDKDelayedPaymentOutputDescriptor this_obj_conv;
10567 this_obj_conv.inner = (void*)(this_obj & (~1));
10568 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10569 DelayedPaymentOutputDescriptor_free(this_obj_conv);
10572 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
10573 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10575 this_ptr_conv.is_owned = false;
10576 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
10577 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10578 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10579 long ret_ref = (long)ret_var.inner;
10580 if (ret_var.is_owned) {
10586 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
10587 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10589 this_ptr_conv.is_owned = false;
10590 LDKOutPoint val_conv;
10591 val_conv.inner = (void*)(val & (~1));
10592 val_conv.is_owned = (val & 1) || (val == 0);
10593 val_conv = OutPoint_clone(&val_conv);
10594 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
10597 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
10598 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10600 this_ptr_conv.is_owned = false;
10601 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10602 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
10606 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
10607 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10609 this_ptr_conv.is_owned = false;
10610 LDKPublicKey val_ref;
10611 CHECK(*((uint32_t*)val) == 33);
10612 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10613 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
10616 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
10617 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10619 this_ptr_conv.is_owned = false;
10620 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
10624 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
10625 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10627 this_ptr_conv.is_owned = false;
10628 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
10631 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
10632 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10634 this_ptr_conv.is_owned = false;
10635 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
10637 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
10640 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
10641 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10643 this_ptr_conv.is_owned = false;
10644 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10645 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
10649 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
10650 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10652 this_ptr_conv.is_owned = false;
10653 LDKPublicKey val_ref;
10654 CHECK(*((uint32_t*)val) == 33);
10655 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10656 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
10659 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
10660 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10662 this_ptr_conv.is_owned = false;
10663 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10664 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
10668 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
10669 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10671 this_ptr_conv.is_owned = false;
10672 LDKThirtyTwoBytes val_ref;
10673 CHECK(*((uint32_t*)val) == 32);
10674 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10675 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
10678 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
10679 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10681 this_ptr_conv.is_owned = false;
10682 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
10686 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
10687 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10689 this_ptr_conv.is_owned = false;
10690 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
10693 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) {
10694 LDKOutPoint outpoint_arg_conv;
10695 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
10696 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
10697 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
10698 LDKPublicKey per_commitment_point_arg_ref;
10699 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
10700 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
10701 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
10702 FREE((void*)output_arg);
10703 LDKPublicKey revocation_pubkey_arg_ref;
10704 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
10705 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
10706 LDKThirtyTwoBytes channel_keys_id_arg_ref;
10707 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
10708 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
10709 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);
10710 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10711 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10712 long ret_ref = (long)ret_var.inner;
10713 if (ret_var.is_owned) {
10719 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
10720 LDKDelayedPaymentOutputDescriptor orig_conv;
10721 orig_conv.inner = (void*)(orig & (~1));
10722 orig_conv.is_owned = false;
10723 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
10724 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10725 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10726 long ret_ref = (long)ret_var.inner;
10727 if (ret_var.is_owned) {
10733 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
10734 LDKStaticPaymentOutputDescriptor this_obj_conv;
10735 this_obj_conv.inner = (void*)(this_obj & (~1));
10736 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10737 StaticPaymentOutputDescriptor_free(this_obj_conv);
10740 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
10741 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10743 this_ptr_conv.is_owned = false;
10744 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
10745 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10746 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10747 long ret_ref = (long)ret_var.inner;
10748 if (ret_var.is_owned) {
10754 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
10755 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10757 this_ptr_conv.is_owned = false;
10758 LDKOutPoint val_conv;
10759 val_conv.inner = (void*)(val & (~1));
10760 val_conv.is_owned = (val & 1) || (val == 0);
10761 val_conv = OutPoint_clone(&val_conv);
10762 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
10765 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
10766 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10768 this_ptr_conv.is_owned = false;
10769 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
10771 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
10774 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
10775 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10777 this_ptr_conv.is_owned = false;
10778 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10779 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
10783 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
10784 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10786 this_ptr_conv.is_owned = false;
10787 LDKThirtyTwoBytes val_ref;
10788 CHECK(*((uint32_t*)val) == 32);
10789 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10790 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
10793 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
10794 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10796 this_ptr_conv.is_owned = false;
10797 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
10801 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
10802 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10804 this_ptr_conv.is_owned = false;
10805 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
10808 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) {
10809 LDKOutPoint outpoint_arg_conv;
10810 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
10811 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
10812 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
10813 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
10814 FREE((void*)output_arg);
10815 LDKThirtyTwoBytes channel_keys_id_arg_ref;
10816 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
10817 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
10818 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
10819 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10820 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10821 long ret_ref = (long)ret_var.inner;
10822 if (ret_var.is_owned) {
10828 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
10829 LDKStaticPaymentOutputDescriptor orig_conv;
10830 orig_conv.inner = (void*)(orig & (~1));
10831 orig_conv.is_owned = false;
10832 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
10833 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10834 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10835 long ret_ref = (long)ret_var.inner;
10836 if (ret_var.is_owned) {
10842 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
10843 if ((this_ptr & 1) != 0) return;
10844 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
10845 FREE((void*)this_ptr);
10846 SpendableOutputDescriptor_free(this_ptr_conv);
10849 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
10850 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
10851 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
10852 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
10853 long ret_ref = (long)ret_copy;
10857 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
10858 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
10859 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
10860 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10861 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10862 CVec_u8Z_free(ret_var);
10866 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
10867 LDKu8slice ser_ref;
10868 ser_ref.datalen = *((uint32_t*)ser);
10869 ser_ref.data = (int8_t*)(ser + 4);
10870 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10871 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
10872 return (long)ret_conv;
10875 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
10876 if ((this_ptr & 1) != 0) return;
10877 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
10878 FREE((void*)this_ptr);
10879 BaseSign_free(this_ptr_conv);
10882 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
10883 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
10884 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
10885 *ret = Sign_clone(orig_conv);
10889 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
10890 if ((this_ptr & 1) != 0) return;
10891 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
10892 FREE((void*)this_ptr);
10893 Sign_free(this_ptr_conv);
10896 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
10897 if ((this_ptr & 1) != 0) return;
10898 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
10899 FREE((void*)this_ptr);
10900 KeysInterface_free(this_ptr_conv);
10903 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
10904 LDKInMemorySigner this_obj_conv;
10905 this_obj_conv.inner = (void*)(this_obj & (~1));
10906 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10907 InMemorySigner_free(this_obj_conv);
10910 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
10911 LDKInMemorySigner this_ptr_conv;
10912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10913 this_ptr_conv.is_owned = false;
10914 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10915 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
10919 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
10920 LDKInMemorySigner this_ptr_conv;
10921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10922 this_ptr_conv.is_owned = false;
10923 LDKSecretKey val_ref;
10924 CHECK(*((uint32_t*)val) == 32);
10925 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10926 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
10929 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
10930 LDKInMemorySigner this_ptr_conv;
10931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10932 this_ptr_conv.is_owned = false;
10933 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10934 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
10938 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
10939 LDKInMemorySigner this_ptr_conv;
10940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10941 this_ptr_conv.is_owned = false;
10942 LDKSecretKey val_ref;
10943 CHECK(*((uint32_t*)val) == 32);
10944 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10945 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
10948 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
10949 LDKInMemorySigner this_ptr_conv;
10950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10951 this_ptr_conv.is_owned = false;
10952 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10953 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
10957 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
10958 LDKInMemorySigner this_ptr_conv;
10959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10960 this_ptr_conv.is_owned = false;
10961 LDKSecretKey val_ref;
10962 CHECK(*((uint32_t*)val) == 32);
10963 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10964 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
10967 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
10968 LDKInMemorySigner this_ptr_conv;
10969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10970 this_ptr_conv.is_owned = false;
10971 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10972 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
10976 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
10977 LDKInMemorySigner this_ptr_conv;
10978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10979 this_ptr_conv.is_owned = false;
10980 LDKSecretKey val_ref;
10981 CHECK(*((uint32_t*)val) == 32);
10982 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10983 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
10986 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
10987 LDKInMemorySigner this_ptr_conv;
10988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10989 this_ptr_conv.is_owned = false;
10990 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10991 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
10995 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
10996 LDKInMemorySigner this_ptr_conv;
10997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10998 this_ptr_conv.is_owned = false;
10999 LDKSecretKey val_ref;
11000 CHECK(*((uint32_t*)val) == 32);
11001 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
11002 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
11005 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
11006 LDKInMemorySigner this_ptr_conv;
11007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11008 this_ptr_conv.is_owned = false;
11009 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11010 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
11014 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
11015 LDKInMemorySigner this_ptr_conv;
11016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11017 this_ptr_conv.is_owned = false;
11018 LDKThirtyTwoBytes val_ref;
11019 CHECK(*((uint32_t*)val) == 32);
11020 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11021 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
11024 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
11025 LDKInMemorySigner orig_conv;
11026 orig_conv.inner = (void*)(orig & (~1));
11027 orig_conv.is_owned = false;
11028 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
11029 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11030 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11031 long ret_ref = (long)ret_var.inner;
11032 if (ret_var.is_owned) {
11038 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) {
11039 LDKSecretKey funding_key_ref;
11040 CHECK(*((uint32_t*)funding_key) == 32);
11041 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
11042 LDKSecretKey revocation_base_key_ref;
11043 CHECK(*((uint32_t*)revocation_base_key) == 32);
11044 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
11045 LDKSecretKey payment_key_ref;
11046 CHECK(*((uint32_t*)payment_key) == 32);
11047 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
11048 LDKSecretKey delayed_payment_base_key_ref;
11049 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
11050 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
11051 LDKSecretKey htlc_base_key_ref;
11052 CHECK(*((uint32_t*)htlc_base_key) == 32);
11053 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
11054 LDKThirtyTwoBytes commitment_seed_ref;
11055 CHECK(*((uint32_t*)commitment_seed) == 32);
11056 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
11057 LDKThirtyTwoBytes channel_keys_id_ref;
11058 CHECK(*((uint32_t*)channel_keys_id) == 32);
11059 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
11060 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);
11061 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11062 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11063 long ret_ref = (long)ret_var.inner;
11064 if (ret_var.is_owned) {
11070 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
11071 LDKInMemorySigner this_arg_conv;
11072 this_arg_conv.inner = (void*)(this_arg & (~1));
11073 this_arg_conv.is_owned = false;
11074 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
11075 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11076 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11077 long ret_ref = (long)ret_var.inner;
11078 if (ret_var.is_owned) {
11084 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
11085 LDKInMemorySigner this_arg_conv;
11086 this_arg_conv.inner = (void*)(this_arg & (~1));
11087 this_arg_conv.is_owned = false;
11088 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
11092 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
11093 LDKInMemorySigner this_arg_conv;
11094 this_arg_conv.inner = (void*)(this_arg & (~1));
11095 this_arg_conv.is_owned = false;
11096 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
11100 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
11101 LDKInMemorySigner this_arg_conv;
11102 this_arg_conv.inner = (void*)(this_arg & (~1));
11103 this_arg_conv.is_owned = false;
11104 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
11108 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
11109 LDKInMemorySigner this_arg_conv;
11110 this_arg_conv.inner = (void*)(this_arg & (~1));
11111 this_arg_conv.is_owned = false;
11112 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
11113 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11114 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11115 long ret_ref = (long)ret_var.inner;
11116 if (ret_var.is_owned) {
11122 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
11123 LDKInMemorySigner this_arg_conv;
11124 this_arg_conv.inner = (void*)(this_arg & (~1));
11125 this_arg_conv.is_owned = false;
11126 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
11127 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11128 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11129 long ret_ref = (long)ret_var.inner;
11130 if (ret_var.is_owned) {
11136 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) {
11137 LDKInMemorySigner this_arg_conv;
11138 this_arg_conv.inner = (void*)(this_arg & (~1));
11139 this_arg_conv.is_owned = false;
11140 LDKTransaction spend_tx_ref;
11141 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
11142 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
11143 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
11144 spend_tx_ref.data_is_owned = true;
11145 LDKStaticPaymentOutputDescriptor descriptor_conv;
11146 descriptor_conv.inner = (void*)(descriptor & (~1));
11147 descriptor_conv.is_owned = false;
11148 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11149 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
11150 return (long)ret_conv;
11153 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) {
11154 LDKInMemorySigner this_arg_conv;
11155 this_arg_conv.inner = (void*)(this_arg & (~1));
11156 this_arg_conv.is_owned = false;
11157 LDKTransaction spend_tx_ref;
11158 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
11159 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
11160 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
11161 spend_tx_ref.data_is_owned = true;
11162 LDKDelayedPaymentOutputDescriptor descriptor_conv;
11163 descriptor_conv.inner = (void*)(descriptor & (~1));
11164 descriptor_conv.is_owned = false;
11165 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11166 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
11167 return (long)ret_conv;
11170 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
11171 LDKInMemorySigner this_arg_conv;
11172 this_arg_conv.inner = (void*)(this_arg & (~1));
11173 this_arg_conv.is_owned = false;
11174 LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
11175 *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
11179 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
11180 LDKInMemorySigner this_arg_conv;
11181 this_arg_conv.inner = (void*)(this_arg & (~1));
11182 this_arg_conv.is_owned = false;
11183 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
11184 *ret = InMemorySigner_as_Sign(&this_arg_conv);
11188 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
11189 LDKInMemorySigner obj_conv;
11190 obj_conv.inner = (void*)(obj & (~1));
11191 obj_conv.is_owned = false;
11192 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
11193 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11194 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
11195 CVec_u8Z_free(ret_var);
11199 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
11200 LDKu8slice ser_ref;
11201 ser_ref.datalen = *((uint32_t*)ser);
11202 ser_ref.data = (int8_t*)(ser + 4);
11203 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11204 *ret_conv = InMemorySigner_read(ser_ref);
11205 return (long)ret_conv;
11208 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
11209 LDKKeysManager this_obj_conv;
11210 this_obj_conv.inner = (void*)(this_obj & (~1));
11211 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11212 KeysManager_free(this_obj_conv);
11215 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
11216 unsigned char seed_arr[32];
11217 CHECK(*((uint32_t*)seed) == 32);
11218 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
11219 unsigned char (*seed_ref)[32] = &seed_arr;
11220 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
11221 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11222 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11223 long ret_ref = (long)ret_var.inner;
11224 if (ret_var.is_owned) {
11230 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
11231 LDKKeysManager this_arg_conv;
11232 this_arg_conv.inner = (void*)(this_arg & (~1));
11233 this_arg_conv.is_owned = false;
11234 unsigned char params_arr[32];
11235 CHECK(*((uint32_t*)params) == 32);
11236 memcpy(params_arr, (uint8_t*)(params + 4), 32);
11237 unsigned char (*params_ref)[32] = ¶ms_arr;
11238 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
11239 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11240 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11241 long ret_ref = (long)ret_var.inner;
11242 if (ret_var.is_owned) {
11248 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) {
11249 LDKKeysManager this_arg_conv;
11250 this_arg_conv.inner = (void*)(this_arg & (~1));
11251 this_arg_conv.is_owned = false;
11252 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
11253 descriptors_constr.datalen = *((uint32_t*)descriptors);
11254 if (descriptors_constr.datalen > 0)
11255 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
11257 descriptors_constr.data = NULL;
11258 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
11259 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
11260 uint32_t descriptors_conv_27 = descriptors_vals[b];
11261 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
11262 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
11263 descriptors_constr.data[b] = descriptors_conv_27_conv;
11265 LDKCVec_TxOutZ outputs_constr;
11266 outputs_constr.datalen = *((uint32_t*)outputs);
11267 if (outputs_constr.datalen > 0)
11268 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
11270 outputs_constr.data = NULL;
11271 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
11272 for (size_t h = 0; h < outputs_constr.datalen; h++) {
11273 uint32_t outputs_conv_7 = outputs_vals[h];
11274 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
11275 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
11276 outputs_constr.data[h] = outputs_conv_7_conv;
11278 LDKCVec_u8Z change_destination_script_ref;
11279 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
11280 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
11281 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
11282 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11283 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
11284 return (long)ret_conv;
11287 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
11288 LDKKeysManager this_arg_conv;
11289 this_arg_conv.inner = (void*)(this_arg & (~1));
11290 this_arg_conv.is_owned = false;
11291 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
11292 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
11296 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
11297 LDKChannelManager this_obj_conv;
11298 this_obj_conv.inner = (void*)(this_obj & (~1));
11299 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11300 ChannelManager_free(this_obj_conv);
11303 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
11304 LDKChainParameters this_obj_conv;
11305 this_obj_conv.inner = (void*)(this_obj & (~1));
11306 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11307 ChainParameters_free(this_obj_conv);
11310 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
11311 LDKChainParameters this_ptr_conv;
11312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11313 this_ptr_conv.is_owned = false;
11314 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
11318 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
11319 LDKChainParameters this_ptr_conv;
11320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11321 this_ptr_conv.is_owned = false;
11322 LDKNetwork val_conv = LDKNetwork_from_js(val);
11323 ChainParameters_set_network(&this_ptr_conv, val_conv);
11326 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
11327 LDKChainParameters this_ptr_conv;
11328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11329 this_ptr_conv.is_owned = false;
11330 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
11331 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11332 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11333 long ret_ref = (long)ret_var.inner;
11334 if (ret_var.is_owned) {
11340 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
11341 LDKChainParameters this_ptr_conv;
11342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11343 this_ptr_conv.is_owned = false;
11344 LDKBestBlock val_conv;
11345 val_conv.inner = (void*)(val & (~1));
11346 val_conv.is_owned = (val & 1) || (val == 0);
11347 val_conv = BestBlock_clone(&val_conv);
11348 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
11351 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
11352 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
11353 LDKBestBlock best_block_arg_conv;
11354 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
11355 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
11356 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
11357 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
11358 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11359 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11360 long ret_ref = (long)ret_var.inner;
11361 if (ret_var.is_owned) {
11367 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
11368 LDKBestBlock this_obj_conv;
11369 this_obj_conv.inner = (void*)(this_obj & (~1));
11370 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11371 BestBlock_free(this_obj_conv);
11374 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
11375 LDKBestBlock orig_conv;
11376 orig_conv.inner = (void*)(orig & (~1));
11377 orig_conv.is_owned = false;
11378 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
11379 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11380 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11381 long ret_ref = (long)ret_var.inner;
11382 if (ret_var.is_owned) {
11388 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
11389 LDKNetwork network_conv = LDKNetwork_from_js(network);
11390 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
11391 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11392 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11393 long ret_ref = (long)ret_var.inner;
11394 if (ret_var.is_owned) {
11400 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
11401 LDKThirtyTwoBytes block_hash_ref;
11402 CHECK(*((uint32_t*)block_hash) == 32);
11403 memcpy(block_hash_ref.data, (uint8_t*)(block_hash + 4), 32);
11404 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
11405 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11406 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11407 long ret_ref = (long)ret_var.inner;
11408 if (ret_var.is_owned) {
11414 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
11415 LDKBestBlock this_arg_conv;
11416 this_arg_conv.inner = (void*)(this_arg & (~1));
11417 this_arg_conv.is_owned = false;
11418 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11419 memcpy((uint8_t*)(ret_arr + 4), BestBlock_block_hash(&this_arg_conv).data, 32);
11423 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
11424 LDKBestBlock this_arg_conv;
11425 this_arg_conv.inner = (void*)(this_arg & (~1));
11426 this_arg_conv.is_owned = false;
11427 int32_t ret_val = BestBlock_height(&this_arg_conv);
11431 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
11432 LDKChannelDetails this_obj_conv;
11433 this_obj_conv.inner = (void*)(this_obj & (~1));
11434 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11435 ChannelDetails_free(this_obj_conv);
11438 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
11439 LDKChannelDetails this_ptr_conv;
11440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11441 this_ptr_conv.is_owned = false;
11442 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11443 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
11447 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
11448 LDKChannelDetails this_ptr_conv;
11449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11450 this_ptr_conv.is_owned = false;
11451 LDKThirtyTwoBytes val_ref;
11452 CHECK(*((uint32_t*)val) == 32);
11453 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11454 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
11457 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
11458 LDKChannelDetails this_ptr_conv;
11459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11460 this_ptr_conv.is_owned = false;
11461 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11462 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
11463 long ret_ref = (long)ret_copy;
11467 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
11468 LDKChannelDetails this_ptr_conv;
11469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11470 this_ptr_conv.is_owned = false;
11471 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
11473 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
11476 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_remote_network_id(uint32_t this_ptr) {
11477 LDKChannelDetails this_ptr_conv;
11478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11479 this_ptr_conv.is_owned = false;
11480 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11481 memcpy((uint8_t*)(ret_arr + 4), ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form, 33);
11485 void __attribute__((visibility("default"))) TS_ChannelDetails_set_remote_network_id(uint32_t this_ptr, int8_tArray val) {
11486 LDKChannelDetails this_ptr_conv;
11487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11488 this_ptr_conv.is_owned = false;
11489 LDKPublicKey val_ref;
11490 CHECK(*((uint32_t*)val) == 33);
11491 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11492 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
11495 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty_features(uint32_t this_ptr) {
11496 LDKChannelDetails this_ptr_conv;
11497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11498 this_ptr_conv.is_owned = false;
11499 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
11500 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11501 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11502 long ret_ref = (long)ret_var.inner;
11503 if (ret_var.is_owned) {
11509 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty_features(uint32_t this_ptr, uint32_t val) {
11510 LDKChannelDetails this_ptr_conv;
11511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11512 this_ptr_conv.is_owned = false;
11513 LDKInitFeatures val_conv;
11514 val_conv.inner = (void*)(val & (~1));
11515 val_conv.is_owned = (val & 1) || (val == 0);
11516 val_conv = InitFeatures_clone(&val_conv);
11517 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
11520 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
11521 LDKChannelDetails this_ptr_conv;
11522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11523 this_ptr_conv.is_owned = false;
11524 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
11528 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
11529 LDKChannelDetails this_ptr_conv;
11530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11531 this_ptr_conv.is_owned = false;
11532 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
11535 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_id(uint32_t this_ptr) {
11536 LDKChannelDetails this_ptr_conv;
11537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11538 this_ptr_conv.is_owned = false;
11539 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
11543 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_id(uint32_t this_ptr, int64_t val) {
11544 LDKChannelDetails this_ptr_conv;
11545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11546 this_ptr_conv.is_owned = false;
11547 ChannelDetails_set_user_id(&this_ptr_conv, val);
11550 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
11551 LDKChannelDetails this_ptr_conv;
11552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11553 this_ptr_conv.is_owned = false;
11554 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
11558 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
11559 LDKChannelDetails this_ptr_conv;
11560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11561 this_ptr_conv.is_owned = false;
11562 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
11565 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
11566 LDKChannelDetails this_ptr_conv;
11567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11568 this_ptr_conv.is_owned = false;
11569 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
11573 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
11574 LDKChannelDetails this_ptr_conv;
11575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11576 this_ptr_conv.is_owned = false;
11577 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
11580 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_live(uint32_t this_ptr) {
11581 LDKChannelDetails this_ptr_conv;
11582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11583 this_ptr_conv.is_owned = false;
11584 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
11588 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_live(uint32_t this_ptr, jboolean val) {
11589 LDKChannelDetails this_ptr_conv;
11590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11591 this_ptr_conv.is_owned = false;
11592 ChannelDetails_set_is_live(&this_ptr_conv, val);
11595 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
11596 LDKChannelDetails orig_conv;
11597 orig_conv.inner = (void*)(orig & (~1));
11598 orig_conv.is_owned = false;
11599 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
11600 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11601 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11602 long ret_ref = (long)ret_var.inner;
11603 if (ret_var.is_owned) {
11609 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
11610 if ((this_ptr & 1) != 0) return;
11611 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
11612 FREE((void*)this_ptr);
11613 PaymentSendFailure_free(this_ptr_conv);
11616 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
11617 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
11618 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
11619 *ret_copy = PaymentSendFailure_clone(orig_conv);
11620 long ret_ref = (long)ret_copy;
11624 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) {
11625 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
11626 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
11627 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
11628 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
11629 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
11630 LDKUserConfig config_conv;
11631 config_conv.inner = (void*)(config & (~1));
11632 config_conv.is_owned = (config & 1) || (config == 0);
11633 config_conv = UserConfig_clone(&config_conv);
11634 LDKChainParameters params_conv;
11635 params_conv.inner = (void*)(params & (~1));
11636 params_conv.is_owned = (params & 1) || (params == 0);
11637 // Warning: we need a move here but no clone is available for LDKChainParameters
11638 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
11639 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11640 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11641 long ret_ref = (long)ret_var.inner;
11642 if (ret_var.is_owned) {
11648 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
11649 LDKChannelManager this_arg_conv;
11650 this_arg_conv.inner = (void*)(this_arg & (~1));
11651 this_arg_conv.is_owned = false;
11652 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
11653 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11654 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11655 long ret_ref = (long)ret_var.inner;
11656 if (ret_var.is_owned) {
11662 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_channel(uint32_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_id, uint32_t override_config) {
11663 LDKChannelManager this_arg_conv;
11664 this_arg_conv.inner = (void*)(this_arg & (~1));
11665 this_arg_conv.is_owned = false;
11666 LDKPublicKey their_network_key_ref;
11667 CHECK(*((uint32_t*)their_network_key) == 33);
11668 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
11669 LDKUserConfig override_config_conv;
11670 override_config_conv.inner = (void*)(override_config & (~1));
11671 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
11672 override_config_conv = UserConfig_clone(&override_config_conv);
11673 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11674 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
11675 return (long)ret_conv;
11678 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
11679 LDKChannelManager this_arg_conv;
11680 this_arg_conv.inner = (void*)(this_arg & (~1));
11681 this_arg_conv.is_owned = false;
11682 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
11683 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
11684 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
11685 for (size_t q = 0; q < ret_var.datalen; q++) {
11686 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
11687 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11688 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11689 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
11690 if (ret_conv_16_var.is_owned) {
11691 ret_conv_16_ref |= 1;
11693 ret_arr_ptr[q] = ret_conv_16_ref;
11695 FREE(ret_var.data);
11699 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
11700 LDKChannelManager this_arg_conv;
11701 this_arg_conv.inner = (void*)(this_arg & (~1));
11702 this_arg_conv.is_owned = false;
11703 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
11704 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
11705 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
11706 for (size_t q = 0; q < ret_var.datalen; q++) {
11707 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
11708 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11709 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11710 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
11711 if (ret_conv_16_var.is_owned) {
11712 ret_conv_16_ref |= 1;
11714 ret_arr_ptr[q] = ret_conv_16_ref;
11716 FREE(ret_var.data);
11720 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
11721 LDKChannelManager this_arg_conv;
11722 this_arg_conv.inner = (void*)(this_arg & (~1));
11723 this_arg_conv.is_owned = false;
11724 unsigned char channel_id_arr[32];
11725 CHECK(*((uint32_t*)channel_id) == 32);
11726 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
11727 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
11728 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11729 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
11730 return (long)ret_conv;
11733 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
11734 LDKChannelManager this_arg_conv;
11735 this_arg_conv.inner = (void*)(this_arg & (~1));
11736 this_arg_conv.is_owned = false;
11737 unsigned char channel_id_arr[32];
11738 CHECK(*((uint32_t*)channel_id) == 32);
11739 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
11740 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
11741 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11742 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
11743 return (long)ret_conv;
11746 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
11747 LDKChannelManager this_arg_conv;
11748 this_arg_conv.inner = (void*)(this_arg & (~1));
11749 this_arg_conv.is_owned = false;
11750 ChannelManager_force_close_all_channels(&this_arg_conv);
11753 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
11754 LDKChannelManager this_arg_conv;
11755 this_arg_conv.inner = (void*)(this_arg & (~1));
11756 this_arg_conv.is_owned = false;
11757 LDKRoute route_conv;
11758 route_conv.inner = (void*)(route & (~1));
11759 route_conv.is_owned = false;
11760 LDKThirtyTwoBytes payment_hash_ref;
11761 CHECK(*((uint32_t*)payment_hash) == 32);
11762 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
11763 LDKThirtyTwoBytes payment_secret_ref;
11764 CHECK(*((uint32_t*)payment_secret) == 32);
11765 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
11766 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11767 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
11768 return (long)ret_conv;
11771 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
11772 LDKChannelManager this_arg_conv;
11773 this_arg_conv.inner = (void*)(this_arg & (~1));
11774 this_arg_conv.is_owned = false;
11775 unsigned char temporary_channel_id_arr[32];
11776 CHECK(*((uint32_t*)temporary_channel_id) == 32);
11777 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
11778 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
11779 LDKTransaction funding_transaction_ref;
11780 funding_transaction_ref.datalen = *((uint32_t*)funding_transaction);
11781 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
11782 memcpy(funding_transaction_ref.data, (uint8_t*)(funding_transaction + 4), funding_transaction_ref.datalen);
11783 funding_transaction_ref.data_is_owned = true;
11784 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11785 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
11786 return (long)ret_conv;
11789 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
11790 LDKChannelManager this_arg_conv;
11791 this_arg_conv.inner = (void*)(this_arg & (~1));
11792 this_arg_conv.is_owned = false;
11793 LDKThreeBytes rgb_ref;
11794 CHECK(*((uint32_t*)rgb) == 3);
11795 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
11796 LDKThirtyTwoBytes alias_ref;
11797 CHECK(*((uint32_t*)alias) == 32);
11798 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
11799 LDKCVec_NetAddressZ addresses_constr;
11800 addresses_constr.datalen = *((uint32_t*)addresses);
11801 if (addresses_constr.datalen > 0)
11802 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11804 addresses_constr.data = NULL;
11805 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
11806 for (size_t m = 0; m < addresses_constr.datalen; m++) {
11807 uint32_t addresses_conv_12 = addresses_vals[m];
11808 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
11809 FREE((void*)addresses_conv_12);
11810 addresses_constr.data[m] = addresses_conv_12_conv;
11812 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
11815 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
11816 LDKChannelManager this_arg_conv;
11817 this_arg_conv.inner = (void*)(this_arg & (~1));
11818 this_arg_conv.is_owned = false;
11819 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
11822 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
11823 LDKChannelManager this_arg_conv;
11824 this_arg_conv.inner = (void*)(this_arg & (~1));
11825 this_arg_conv.is_owned = false;
11826 ChannelManager_timer_tick_occurred(&this_arg_conv);
11829 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
11830 LDKChannelManager this_arg_conv;
11831 this_arg_conv.inner = (void*)(this_arg & (~1));
11832 this_arg_conv.is_owned = false;
11833 unsigned char payment_hash_arr[32];
11834 CHECK(*((uint32_t*)payment_hash) == 32);
11835 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
11836 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
11837 LDKThirtyTwoBytes payment_secret_ref;
11838 CHECK(*((uint32_t*)payment_secret) == 32);
11839 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
11840 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
11844 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t expected_amount) {
11845 LDKChannelManager this_arg_conv;
11846 this_arg_conv.inner = (void*)(this_arg & (~1));
11847 this_arg_conv.is_owned = false;
11848 LDKThirtyTwoBytes payment_preimage_ref;
11849 CHECK(*((uint32_t*)payment_preimage) == 32);
11850 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
11851 LDKThirtyTwoBytes payment_secret_ref;
11852 CHECK(*((uint32_t*)payment_secret) == 32);
11853 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
11854 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
11858 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
11859 LDKChannelManager this_arg_conv;
11860 this_arg_conv.inner = (void*)(this_arg & (~1));
11861 this_arg_conv.is_owned = false;
11862 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11863 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
11867 void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
11868 LDKChannelManager this_arg_conv;
11869 this_arg_conv.inner = (void*)(this_arg & (~1));
11870 this_arg_conv.is_owned = false;
11871 LDKOutPoint funding_txo_conv;
11872 funding_txo_conv.inner = (void*)(funding_txo & (~1));
11873 funding_txo_conv.is_owned = false;
11874 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
11877 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
11878 LDKChannelManager this_arg_conv;
11879 this_arg_conv.inner = (void*)(this_arg & (~1));
11880 this_arg_conv.is_owned = false;
11881 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
11882 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
11886 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
11887 LDKChannelManager this_arg_conv;
11888 this_arg_conv.inner = (void*)(this_arg & (~1));
11889 this_arg_conv.is_owned = false;
11890 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
11891 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
11895 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
11896 LDKChannelManager this_arg_conv;
11897 this_arg_conv.inner = (void*)(this_arg & (~1));
11898 this_arg_conv.is_owned = false;
11899 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
11900 *ret = ChannelManager_as_Listen(&this_arg_conv);
11904 void __attribute__((visibility("default"))) TS_ChannelManager_transactions_confirmed(uint32_t this_arg, int8_tArray header, int32_t height, uint32_tArray txdata) {
11905 LDKChannelManager this_arg_conv;
11906 this_arg_conv.inner = (void*)(this_arg & (~1));
11907 this_arg_conv.is_owned = false;
11908 unsigned char header_arr[80];
11909 CHECK(*((uint32_t*)header) == 80);
11910 memcpy(header_arr, (uint8_t*)(header + 4), 80);
11911 unsigned char (*header_ref)[80] = &header_arr;
11912 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11913 txdata_constr.datalen = *((uint32_t*)txdata);
11914 if (txdata_constr.datalen > 0)
11915 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11917 txdata_constr.data = NULL;
11918 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
11919 for (size_t e = 0; e < txdata_constr.datalen; e++) {
11920 uint32_t txdata_conv_30 = txdata_vals[e];
11921 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
11922 // Warning: we may need a move here but no clone is available for LDKC2Tuple_usizeTransactionZ
11923 txdata_constr.data[e] = txdata_conv_30_conv;
11925 ChannelManager_transactions_confirmed(&this_arg_conv, header_ref, height, txdata_constr);
11928 void __attribute__((visibility("default"))) TS_ChannelManager_update_best_block(uint32_t this_arg, int8_tArray header, int32_t height) {
11929 LDKChannelManager this_arg_conv;
11930 this_arg_conv.inner = (void*)(this_arg & (~1));
11931 this_arg_conv.is_owned = false;
11932 unsigned char header_arr[80];
11933 CHECK(*((uint32_t*)header) == 80);
11934 memcpy(header_arr, (uint8_t*)(header + 4), 80);
11935 unsigned char (*header_ref)[80] = &header_arr;
11936 ChannelManager_update_best_block(&this_arg_conv, header_ref, height);
11939 ptrArray __attribute__((visibility("default"))) TS_ChannelManager_get_relevant_txids(uint32_t this_arg) {
11940 LDKChannelManager this_arg_conv;
11941 this_arg_conv.inner = (void*)(this_arg & (~1));
11942 this_arg_conv.is_owned = false;
11943 LDKCVec_TxidZ ret_var = ChannelManager_get_relevant_txids(&this_arg_conv);
11944 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
11945 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
11946 for (size_t m = 0; m < ret_var.datalen; m++) {
11947 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11948 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
11949 ret_arr_ptr[m] = ret_conv_12_arr;
11951 FREE(ret_var.data);
11955 void __attribute__((visibility("default"))) TS_ChannelManager_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
11956 LDKChannelManager this_arg_conv;
11957 this_arg_conv.inner = (void*)(this_arg & (~1));
11958 this_arg_conv.is_owned = false;
11959 unsigned char txid_arr[32];
11960 CHECK(*((uint32_t*)txid) == 32);
11961 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
11962 unsigned char (*txid_ref)[32] = &txid_arr;
11963 ChannelManager_transaction_unconfirmed(&this_arg_conv, txid_ref);
11966 jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
11967 LDKChannelManager this_arg_conv;
11968 this_arg_conv.inner = (void*)(this_arg & (~1));
11969 this_arg_conv.is_owned = false;
11970 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
11974 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
11975 LDKChannelManager this_arg_conv;
11976 this_arg_conv.inner = (void*)(this_arg & (~1));
11977 this_arg_conv.is_owned = false;
11978 ChannelManager_await_persistable_update(&this_arg_conv);
11981 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
11982 LDKChannelManager this_arg_conv;
11983 this_arg_conv.inner = (void*)(this_arg & (~1));
11984 this_arg_conv.is_owned = false;
11985 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
11986 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
11990 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
11991 LDKChannelManager obj_conv;
11992 obj_conv.inner = (void*)(obj & (~1));
11993 obj_conv.is_owned = false;
11994 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
11995 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11996 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
11997 CVec_u8Z_free(ret_var);
12001 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
12002 LDKChannelManagerReadArgs this_obj_conv;
12003 this_obj_conv.inner = (void*)(this_obj & (~1));
12004 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12005 ChannelManagerReadArgs_free(this_obj_conv);
12008 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
12009 LDKChannelManagerReadArgs this_ptr_conv;
12010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12011 this_ptr_conv.is_owned = false;
12012 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
12016 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
12017 LDKChannelManagerReadArgs this_ptr_conv;
12018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12019 this_ptr_conv.is_owned = false;
12020 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
12021 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
12024 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
12025 LDKChannelManagerReadArgs this_ptr_conv;
12026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12027 this_ptr_conv.is_owned = false;
12028 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
12032 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
12033 LDKChannelManagerReadArgs this_ptr_conv;
12034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12035 this_ptr_conv.is_owned = false;
12036 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
12037 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
12040 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
12041 LDKChannelManagerReadArgs this_ptr_conv;
12042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12043 this_ptr_conv.is_owned = false;
12044 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
12048 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
12049 LDKChannelManagerReadArgs this_ptr_conv;
12050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12051 this_ptr_conv.is_owned = false;
12052 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
12053 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
12056 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
12057 LDKChannelManagerReadArgs this_ptr_conv;
12058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12059 this_ptr_conv.is_owned = false;
12060 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
12064 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
12065 LDKChannelManagerReadArgs this_ptr_conv;
12066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12067 this_ptr_conv.is_owned = false;
12068 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
12069 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
12072 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
12073 LDKChannelManagerReadArgs this_ptr_conv;
12074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12075 this_ptr_conv.is_owned = false;
12076 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
12080 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
12081 LDKChannelManagerReadArgs this_ptr_conv;
12082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12083 this_ptr_conv.is_owned = false;
12084 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
12085 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
12088 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
12089 LDKChannelManagerReadArgs this_ptr_conv;
12090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12091 this_ptr_conv.is_owned = false;
12092 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
12093 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12094 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12095 long ret_ref = (long)ret_var.inner;
12096 if (ret_var.is_owned) {
12102 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
12103 LDKChannelManagerReadArgs this_ptr_conv;
12104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12105 this_ptr_conv.is_owned = false;
12106 LDKUserConfig val_conv;
12107 val_conv.inner = (void*)(val & (~1));
12108 val_conv.is_owned = (val & 1) || (val == 0);
12109 val_conv = UserConfig_clone(&val_conv);
12110 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
12113 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) {
12114 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
12115 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12116 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
12117 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
12118 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12119 LDKUserConfig default_config_conv;
12120 default_config_conv.inner = (void*)(default_config & (~1));
12121 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
12122 default_config_conv = UserConfig_clone(&default_config_conv);
12123 LDKCVec_ChannelMonitorZ channel_monitors_constr;
12124 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
12125 if (channel_monitors_constr.datalen > 0)
12126 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
12128 channel_monitors_constr.data = NULL;
12129 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
12130 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
12131 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
12132 LDKChannelMonitor channel_monitors_conv_16_conv;
12133 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
12134 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
12135 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
12137 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);
12138 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12139 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12140 long ret_ref = (long)ret_var.inner;
12141 if (ret_var.is_owned) {
12147 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
12148 LDKu8slice ser_ref;
12149 ser_ref.datalen = *((uint32_t*)ser);
12150 ser_ref.data = (int8_t*)(ser + 4);
12151 LDKChannelManagerReadArgs arg_conv;
12152 arg_conv.inner = (void*)(arg & (~1));
12153 arg_conv.is_owned = (arg & 1) || (arg == 0);
12154 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
12155 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
12156 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
12157 return (long)ret_conv;
12160 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
12161 LDKDecodeError this_obj_conv;
12162 this_obj_conv.inner = (void*)(this_obj & (~1));
12163 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12164 DecodeError_free(this_obj_conv);
12167 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
12168 LDKDecodeError orig_conv;
12169 orig_conv.inner = (void*)(orig & (~1));
12170 orig_conv.is_owned = false;
12171 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
12172 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12173 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12174 long ret_ref = (long)ret_var.inner;
12175 if (ret_var.is_owned) {
12181 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
12182 LDKInit this_obj_conv;
12183 this_obj_conv.inner = (void*)(this_obj & (~1));
12184 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12185 Init_free(this_obj_conv);
12188 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
12189 LDKInit this_ptr_conv;
12190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12191 this_ptr_conv.is_owned = false;
12192 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
12193 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12194 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12195 long ret_ref = (long)ret_var.inner;
12196 if (ret_var.is_owned) {
12202 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
12203 LDKInit this_ptr_conv;
12204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12205 this_ptr_conv.is_owned = false;
12206 LDKInitFeatures val_conv;
12207 val_conv.inner = (void*)(val & (~1));
12208 val_conv.is_owned = (val & 1) || (val == 0);
12209 val_conv = InitFeatures_clone(&val_conv);
12210 Init_set_features(&this_ptr_conv, val_conv);
12213 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
12214 LDKInitFeatures features_arg_conv;
12215 features_arg_conv.inner = (void*)(features_arg & (~1));
12216 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
12217 features_arg_conv = InitFeatures_clone(&features_arg_conv);
12218 LDKInit ret_var = Init_new(features_arg_conv);
12219 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12220 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12221 long ret_ref = (long)ret_var.inner;
12222 if (ret_var.is_owned) {
12228 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
12230 orig_conv.inner = (void*)(orig & (~1));
12231 orig_conv.is_owned = false;
12232 LDKInit ret_var = Init_clone(&orig_conv);
12233 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12234 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12235 long ret_ref = (long)ret_var.inner;
12236 if (ret_var.is_owned) {
12242 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
12243 LDKErrorMessage this_obj_conv;
12244 this_obj_conv.inner = (void*)(this_obj & (~1));
12245 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12246 ErrorMessage_free(this_obj_conv);
12249 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
12250 LDKErrorMessage this_ptr_conv;
12251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12252 this_ptr_conv.is_owned = false;
12253 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12254 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
12258 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12259 LDKErrorMessage this_ptr_conv;
12260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12261 this_ptr_conv.is_owned = false;
12262 LDKThirtyTwoBytes val_ref;
12263 CHECK(*((uint32_t*)val) == 32);
12264 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12265 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
12268 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
12269 LDKErrorMessage this_ptr_conv;
12270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12271 this_ptr_conv.is_owned = false;
12272 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
12273 jstring _conv = str_ref_to_ts(_str.chars, _str.len);
12277 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, int8_tArray val) {
12278 LDKErrorMessage this_ptr_conv;
12279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12280 this_ptr_conv.is_owned = false;
12281 LDKCVec_u8Z val_ref;
12282 val_ref.datalen = *((uint32_t*)val);
12283 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
12284 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
12285 ErrorMessage_set_data(&this_ptr_conv, val_ref);
12288 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
12289 LDKThirtyTwoBytes channel_id_arg_ref;
12290 CHECK(*((uint32_t*)channel_id_arg) == 32);
12291 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12292 LDKCVec_u8Z data_arg_ref;
12293 data_arg_ref.datalen = *((uint32_t*)data_arg);
12294 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
12295 memcpy(data_arg_ref.data, (uint8_t*)(data_arg + 4), data_arg_ref.datalen);
12296 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
12297 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12298 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12299 long ret_ref = (long)ret_var.inner;
12300 if (ret_var.is_owned) {
12306 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
12307 LDKErrorMessage orig_conv;
12308 orig_conv.inner = (void*)(orig & (~1));
12309 orig_conv.is_owned = false;
12310 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
12311 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12312 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12313 long ret_ref = (long)ret_var.inner;
12314 if (ret_var.is_owned) {
12320 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
12321 LDKPing this_obj_conv;
12322 this_obj_conv.inner = (void*)(this_obj & (~1));
12323 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12324 Ping_free(this_obj_conv);
12327 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
12328 LDKPing this_ptr_conv;
12329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12330 this_ptr_conv.is_owned = false;
12331 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
12335 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
12336 LDKPing this_ptr_conv;
12337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12338 this_ptr_conv.is_owned = false;
12339 Ping_set_ponglen(&this_ptr_conv, val);
12342 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
12343 LDKPing this_ptr_conv;
12344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12345 this_ptr_conv.is_owned = false;
12346 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
12350 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
12351 LDKPing this_ptr_conv;
12352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12353 this_ptr_conv.is_owned = false;
12354 Ping_set_byteslen(&this_ptr_conv, val);
12357 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
12358 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
12359 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12360 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12361 long ret_ref = (long)ret_var.inner;
12362 if (ret_var.is_owned) {
12368 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
12370 orig_conv.inner = (void*)(orig & (~1));
12371 orig_conv.is_owned = false;
12372 LDKPing ret_var = Ping_clone(&orig_conv);
12373 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12374 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12375 long ret_ref = (long)ret_var.inner;
12376 if (ret_var.is_owned) {
12382 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
12383 LDKPong this_obj_conv;
12384 this_obj_conv.inner = (void*)(this_obj & (~1));
12385 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12386 Pong_free(this_obj_conv);
12389 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
12390 LDKPong this_ptr_conv;
12391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12392 this_ptr_conv.is_owned = false;
12393 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
12397 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
12398 LDKPong this_ptr_conv;
12399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12400 this_ptr_conv.is_owned = false;
12401 Pong_set_byteslen(&this_ptr_conv, val);
12404 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
12405 LDKPong ret_var = Pong_new(byteslen_arg);
12406 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12407 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12408 long ret_ref = (long)ret_var.inner;
12409 if (ret_var.is_owned) {
12415 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
12417 orig_conv.inner = (void*)(orig & (~1));
12418 orig_conv.is_owned = false;
12419 LDKPong ret_var = Pong_clone(&orig_conv);
12420 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12421 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12422 long ret_ref = (long)ret_var.inner;
12423 if (ret_var.is_owned) {
12429 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
12430 LDKOpenChannel this_obj_conv;
12431 this_obj_conv.inner = (void*)(this_obj & (~1));
12432 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12433 OpenChannel_free(this_obj_conv);
12436 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
12437 LDKOpenChannel this_ptr_conv;
12438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12439 this_ptr_conv.is_owned = false;
12440 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12441 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
12445 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
12446 LDKOpenChannel this_ptr_conv;
12447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12448 this_ptr_conv.is_owned = false;
12449 LDKThirtyTwoBytes val_ref;
12450 CHECK(*((uint32_t*)val) == 32);
12451 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12452 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
12455 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
12456 LDKOpenChannel this_ptr_conv;
12457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12458 this_ptr_conv.is_owned = false;
12459 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12460 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
12464 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
12465 LDKOpenChannel this_ptr_conv;
12466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12467 this_ptr_conv.is_owned = false;
12468 LDKThirtyTwoBytes val_ref;
12469 CHECK(*((uint32_t*)val) == 32);
12470 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12471 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
12474 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
12475 LDKOpenChannel this_ptr_conv;
12476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12477 this_ptr_conv.is_owned = false;
12478 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
12482 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
12483 LDKOpenChannel this_ptr_conv;
12484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12485 this_ptr_conv.is_owned = false;
12486 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
12489 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
12490 LDKOpenChannel this_ptr_conv;
12491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12492 this_ptr_conv.is_owned = false;
12493 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
12497 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
12498 LDKOpenChannel this_ptr_conv;
12499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12500 this_ptr_conv.is_owned = false;
12501 OpenChannel_set_push_msat(&this_ptr_conv, val);
12504 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
12505 LDKOpenChannel this_ptr_conv;
12506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12507 this_ptr_conv.is_owned = false;
12508 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
12512 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
12513 LDKOpenChannel this_ptr_conv;
12514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12515 this_ptr_conv.is_owned = false;
12516 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
12519 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
12520 LDKOpenChannel this_ptr_conv;
12521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12522 this_ptr_conv.is_owned = false;
12523 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
12527 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
12528 LDKOpenChannel this_ptr_conv;
12529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12530 this_ptr_conv.is_owned = false;
12531 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
12534 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
12535 LDKOpenChannel this_ptr_conv;
12536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12537 this_ptr_conv.is_owned = false;
12538 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
12542 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
12543 LDKOpenChannel this_ptr_conv;
12544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12545 this_ptr_conv.is_owned = false;
12546 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
12549 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
12550 LDKOpenChannel this_ptr_conv;
12551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12552 this_ptr_conv.is_owned = false;
12553 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
12557 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
12558 LDKOpenChannel this_ptr_conv;
12559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12560 this_ptr_conv.is_owned = false;
12561 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
12564 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
12565 LDKOpenChannel this_ptr_conv;
12566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12567 this_ptr_conv.is_owned = false;
12568 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
12572 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
12573 LDKOpenChannel this_ptr_conv;
12574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12575 this_ptr_conv.is_owned = false;
12576 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
12579 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
12580 LDKOpenChannel this_ptr_conv;
12581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12582 this_ptr_conv.is_owned = false;
12583 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
12587 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
12588 LDKOpenChannel this_ptr_conv;
12589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12590 this_ptr_conv.is_owned = false;
12591 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
12594 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
12595 LDKOpenChannel this_ptr_conv;
12596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12597 this_ptr_conv.is_owned = false;
12598 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
12602 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
12603 LDKOpenChannel this_ptr_conv;
12604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12605 this_ptr_conv.is_owned = false;
12606 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
12609 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
12610 LDKOpenChannel this_ptr_conv;
12611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12612 this_ptr_conv.is_owned = false;
12613 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12614 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
12618 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
12619 LDKOpenChannel this_ptr_conv;
12620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12621 this_ptr_conv.is_owned = false;
12622 LDKPublicKey val_ref;
12623 CHECK(*((uint32_t*)val) == 33);
12624 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12625 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
12628 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
12629 LDKOpenChannel this_ptr_conv;
12630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12631 this_ptr_conv.is_owned = false;
12632 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12633 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
12637 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
12638 LDKOpenChannel this_ptr_conv;
12639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12640 this_ptr_conv.is_owned = false;
12641 LDKPublicKey val_ref;
12642 CHECK(*((uint32_t*)val) == 33);
12643 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12644 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
12647 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
12648 LDKOpenChannel this_ptr_conv;
12649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12650 this_ptr_conv.is_owned = false;
12651 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12652 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
12656 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
12657 LDKOpenChannel this_ptr_conv;
12658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12659 this_ptr_conv.is_owned = false;
12660 LDKPublicKey val_ref;
12661 CHECK(*((uint32_t*)val) == 33);
12662 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12663 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
12666 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
12667 LDKOpenChannel this_ptr_conv;
12668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12669 this_ptr_conv.is_owned = false;
12670 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12671 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
12675 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
12676 LDKOpenChannel this_ptr_conv;
12677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12678 this_ptr_conv.is_owned = false;
12679 LDKPublicKey val_ref;
12680 CHECK(*((uint32_t*)val) == 33);
12681 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12682 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12685 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
12686 LDKOpenChannel this_ptr_conv;
12687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12688 this_ptr_conv.is_owned = false;
12689 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12690 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
12694 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
12695 LDKOpenChannel this_ptr_conv;
12696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12697 this_ptr_conv.is_owned = false;
12698 LDKPublicKey val_ref;
12699 CHECK(*((uint32_t*)val) == 33);
12700 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12701 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
12704 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
12705 LDKOpenChannel this_ptr_conv;
12706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12707 this_ptr_conv.is_owned = false;
12708 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12709 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12713 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12714 LDKOpenChannel this_ptr_conv;
12715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12716 this_ptr_conv.is_owned = false;
12717 LDKPublicKey val_ref;
12718 CHECK(*((uint32_t*)val) == 33);
12719 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12720 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
12723 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
12724 LDKOpenChannel this_ptr_conv;
12725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12726 this_ptr_conv.is_owned = false;
12727 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
12731 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
12732 LDKOpenChannel this_ptr_conv;
12733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12734 this_ptr_conv.is_owned = false;
12735 OpenChannel_set_channel_flags(&this_ptr_conv, val);
12738 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
12739 LDKOpenChannel orig_conv;
12740 orig_conv.inner = (void*)(orig & (~1));
12741 orig_conv.is_owned = false;
12742 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
12743 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12744 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12745 long ret_ref = (long)ret_var.inner;
12746 if (ret_var.is_owned) {
12752 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
12753 LDKAcceptChannel this_obj_conv;
12754 this_obj_conv.inner = (void*)(this_obj & (~1));
12755 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12756 AcceptChannel_free(this_obj_conv);
12759 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
12760 LDKAcceptChannel this_ptr_conv;
12761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12762 this_ptr_conv.is_owned = false;
12763 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12764 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
12768 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
12769 LDKAcceptChannel this_ptr_conv;
12770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12771 this_ptr_conv.is_owned = false;
12772 LDKThirtyTwoBytes val_ref;
12773 CHECK(*((uint32_t*)val) == 32);
12774 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12775 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
12778 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
12779 LDKAcceptChannel this_ptr_conv;
12780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12781 this_ptr_conv.is_owned = false;
12782 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
12786 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
12787 LDKAcceptChannel this_ptr_conv;
12788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12789 this_ptr_conv.is_owned = false;
12790 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
12793 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
12794 LDKAcceptChannel this_ptr_conv;
12795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12796 this_ptr_conv.is_owned = false;
12797 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
12801 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
12802 LDKAcceptChannel this_ptr_conv;
12803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12804 this_ptr_conv.is_owned = false;
12805 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
12808 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
12809 LDKAcceptChannel this_ptr_conv;
12810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12811 this_ptr_conv.is_owned = false;
12812 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
12816 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
12817 LDKAcceptChannel this_ptr_conv;
12818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12819 this_ptr_conv.is_owned = false;
12820 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
12823 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
12824 LDKAcceptChannel this_ptr_conv;
12825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12826 this_ptr_conv.is_owned = false;
12827 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
12831 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
12832 LDKAcceptChannel this_ptr_conv;
12833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12834 this_ptr_conv.is_owned = false;
12835 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
12838 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
12839 LDKAcceptChannel this_ptr_conv;
12840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12841 this_ptr_conv.is_owned = false;
12842 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
12846 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
12847 LDKAcceptChannel this_ptr_conv;
12848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12849 this_ptr_conv.is_owned = false;
12850 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
12853 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
12854 LDKAcceptChannel this_ptr_conv;
12855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12856 this_ptr_conv.is_owned = false;
12857 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
12861 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
12862 LDKAcceptChannel this_ptr_conv;
12863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12864 this_ptr_conv.is_owned = false;
12865 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
12868 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
12869 LDKAcceptChannel this_ptr_conv;
12870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12871 this_ptr_conv.is_owned = false;
12872 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
12876 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
12877 LDKAcceptChannel this_ptr_conv;
12878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12879 this_ptr_conv.is_owned = false;
12880 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
12883 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
12884 LDKAcceptChannel this_ptr_conv;
12885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12886 this_ptr_conv.is_owned = false;
12887 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12888 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
12892 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
12893 LDKAcceptChannel this_ptr_conv;
12894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12895 this_ptr_conv.is_owned = false;
12896 LDKPublicKey val_ref;
12897 CHECK(*((uint32_t*)val) == 33);
12898 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12899 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
12902 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
12903 LDKAcceptChannel this_ptr_conv;
12904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12905 this_ptr_conv.is_owned = false;
12906 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12907 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
12911 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
12912 LDKAcceptChannel this_ptr_conv;
12913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12914 this_ptr_conv.is_owned = false;
12915 LDKPublicKey val_ref;
12916 CHECK(*((uint32_t*)val) == 33);
12917 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12918 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
12921 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
12922 LDKAcceptChannel this_ptr_conv;
12923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12924 this_ptr_conv.is_owned = false;
12925 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12926 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
12930 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
12931 LDKAcceptChannel this_ptr_conv;
12932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12933 this_ptr_conv.is_owned = false;
12934 LDKPublicKey val_ref;
12935 CHECK(*((uint32_t*)val) == 33);
12936 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12937 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
12940 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
12941 LDKAcceptChannel this_ptr_conv;
12942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12943 this_ptr_conv.is_owned = false;
12944 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12945 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
12949 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
12950 LDKAcceptChannel this_ptr_conv;
12951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12952 this_ptr_conv.is_owned = false;
12953 LDKPublicKey val_ref;
12954 CHECK(*((uint32_t*)val) == 33);
12955 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12956 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12959 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
12960 LDKAcceptChannel this_ptr_conv;
12961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12962 this_ptr_conv.is_owned = false;
12963 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12964 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
12968 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
12969 LDKAcceptChannel this_ptr_conv;
12970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12971 this_ptr_conv.is_owned = false;
12972 LDKPublicKey val_ref;
12973 CHECK(*((uint32_t*)val) == 33);
12974 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12975 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
12978 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
12979 LDKAcceptChannel this_ptr_conv;
12980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12981 this_ptr_conv.is_owned = false;
12982 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12983 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12987 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12988 LDKAcceptChannel this_ptr_conv;
12989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12990 this_ptr_conv.is_owned = false;
12991 LDKPublicKey val_ref;
12992 CHECK(*((uint32_t*)val) == 33);
12993 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12994 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
12997 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
12998 LDKAcceptChannel orig_conv;
12999 orig_conv.inner = (void*)(orig & (~1));
13000 orig_conv.is_owned = false;
13001 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
13002 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13003 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13004 long ret_ref = (long)ret_var.inner;
13005 if (ret_var.is_owned) {
13011 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
13012 LDKFundingCreated this_obj_conv;
13013 this_obj_conv.inner = (void*)(this_obj & (~1));
13014 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13015 FundingCreated_free(this_obj_conv);
13018 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
13019 LDKFundingCreated this_ptr_conv;
13020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13021 this_ptr_conv.is_owned = false;
13022 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13023 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
13027 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
13028 LDKFundingCreated this_ptr_conv;
13029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13030 this_ptr_conv.is_owned = false;
13031 LDKThirtyTwoBytes val_ref;
13032 CHECK(*((uint32_t*)val) == 32);
13033 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13034 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
13037 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
13038 LDKFundingCreated this_ptr_conv;
13039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13040 this_ptr_conv.is_owned = false;
13041 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13042 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
13046 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
13047 LDKFundingCreated this_ptr_conv;
13048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13049 this_ptr_conv.is_owned = false;
13050 LDKThirtyTwoBytes val_ref;
13051 CHECK(*((uint32_t*)val) == 32);
13052 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13053 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
13056 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
13057 LDKFundingCreated this_ptr_conv;
13058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13059 this_ptr_conv.is_owned = false;
13060 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
13064 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
13065 LDKFundingCreated this_ptr_conv;
13066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13067 this_ptr_conv.is_owned = false;
13068 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
13071 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
13072 LDKFundingCreated this_ptr_conv;
13073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13074 this_ptr_conv.is_owned = false;
13075 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13076 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
13080 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
13081 LDKFundingCreated this_ptr_conv;
13082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13083 this_ptr_conv.is_owned = false;
13084 LDKSignature val_ref;
13085 CHECK(*((uint32_t*)val) == 64);
13086 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13087 FundingCreated_set_signature(&this_ptr_conv, val_ref);
13090 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) {
13091 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
13092 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
13093 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
13094 LDKThirtyTwoBytes funding_txid_arg_ref;
13095 CHECK(*((uint32_t*)funding_txid_arg) == 32);
13096 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
13097 LDKSignature signature_arg_ref;
13098 CHECK(*((uint32_t*)signature_arg) == 64);
13099 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
13100 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
13101 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13102 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13103 long ret_ref = (long)ret_var.inner;
13104 if (ret_var.is_owned) {
13110 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
13111 LDKFundingCreated orig_conv;
13112 orig_conv.inner = (void*)(orig & (~1));
13113 orig_conv.is_owned = false;
13114 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
13115 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13116 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13117 long ret_ref = (long)ret_var.inner;
13118 if (ret_var.is_owned) {
13124 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
13125 LDKFundingSigned this_obj_conv;
13126 this_obj_conv.inner = (void*)(this_obj & (~1));
13127 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13128 FundingSigned_free(this_obj_conv);
13131 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
13132 LDKFundingSigned this_ptr_conv;
13133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13134 this_ptr_conv.is_owned = false;
13135 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13136 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
13140 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13141 LDKFundingSigned this_ptr_conv;
13142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13143 this_ptr_conv.is_owned = false;
13144 LDKThirtyTwoBytes val_ref;
13145 CHECK(*((uint32_t*)val) == 32);
13146 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13147 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
13150 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
13151 LDKFundingSigned this_ptr_conv;
13152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13153 this_ptr_conv.is_owned = false;
13154 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13155 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
13159 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
13160 LDKFundingSigned this_ptr_conv;
13161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13162 this_ptr_conv.is_owned = false;
13163 LDKSignature val_ref;
13164 CHECK(*((uint32_t*)val) == 64);
13165 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13166 FundingSigned_set_signature(&this_ptr_conv, val_ref);
13169 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
13170 LDKThirtyTwoBytes channel_id_arg_ref;
13171 CHECK(*((uint32_t*)channel_id_arg) == 32);
13172 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13173 LDKSignature signature_arg_ref;
13174 CHECK(*((uint32_t*)signature_arg) == 64);
13175 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
13176 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
13177 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13178 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13179 long ret_ref = (long)ret_var.inner;
13180 if (ret_var.is_owned) {
13186 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
13187 LDKFundingSigned orig_conv;
13188 orig_conv.inner = (void*)(orig & (~1));
13189 orig_conv.is_owned = false;
13190 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
13191 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13192 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13193 long ret_ref = (long)ret_var.inner;
13194 if (ret_var.is_owned) {
13200 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
13201 LDKFundingLocked this_obj_conv;
13202 this_obj_conv.inner = (void*)(this_obj & (~1));
13203 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13204 FundingLocked_free(this_obj_conv);
13207 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
13208 LDKFundingLocked this_ptr_conv;
13209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13210 this_ptr_conv.is_owned = false;
13211 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13212 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
13216 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13217 LDKFundingLocked this_ptr_conv;
13218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13219 this_ptr_conv.is_owned = false;
13220 LDKThirtyTwoBytes val_ref;
13221 CHECK(*((uint32_t*)val) == 32);
13222 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13223 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
13226 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
13227 LDKFundingLocked this_ptr_conv;
13228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13229 this_ptr_conv.is_owned = false;
13230 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13231 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
13235 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
13236 LDKFundingLocked this_ptr_conv;
13237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13238 this_ptr_conv.is_owned = false;
13239 LDKPublicKey val_ref;
13240 CHECK(*((uint32_t*)val) == 33);
13241 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13242 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
13245 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
13246 LDKThirtyTwoBytes channel_id_arg_ref;
13247 CHECK(*((uint32_t*)channel_id_arg) == 32);
13248 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13249 LDKPublicKey next_per_commitment_point_arg_ref;
13250 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
13251 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
13252 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
13253 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13254 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13255 long ret_ref = (long)ret_var.inner;
13256 if (ret_var.is_owned) {
13262 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
13263 LDKFundingLocked orig_conv;
13264 orig_conv.inner = (void*)(orig & (~1));
13265 orig_conv.is_owned = false;
13266 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
13267 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13268 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13269 long ret_ref = (long)ret_var.inner;
13270 if (ret_var.is_owned) {
13276 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
13277 LDKShutdown this_obj_conv;
13278 this_obj_conv.inner = (void*)(this_obj & (~1));
13279 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13280 Shutdown_free(this_obj_conv);
13283 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
13284 LDKShutdown this_ptr_conv;
13285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13286 this_ptr_conv.is_owned = false;
13287 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13288 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
13292 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13293 LDKShutdown this_ptr_conv;
13294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13295 this_ptr_conv.is_owned = false;
13296 LDKThirtyTwoBytes val_ref;
13297 CHECK(*((uint32_t*)val) == 32);
13298 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13299 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
13302 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
13303 LDKShutdown this_ptr_conv;
13304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13305 this_ptr_conv.is_owned = false;
13306 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
13307 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13308 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13312 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
13313 LDKShutdown this_ptr_conv;
13314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13315 this_ptr_conv.is_owned = false;
13316 LDKCVec_u8Z val_ref;
13317 val_ref.datalen = *((uint32_t*)val);
13318 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13319 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
13320 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
13323 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
13324 LDKThirtyTwoBytes channel_id_arg_ref;
13325 CHECK(*((uint32_t*)channel_id_arg) == 32);
13326 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13327 LDKCVec_u8Z scriptpubkey_arg_ref;
13328 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
13329 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13330 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
13331 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
13332 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13333 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13334 long ret_ref = (long)ret_var.inner;
13335 if (ret_var.is_owned) {
13341 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
13342 LDKShutdown orig_conv;
13343 orig_conv.inner = (void*)(orig & (~1));
13344 orig_conv.is_owned = false;
13345 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
13346 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13347 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13348 long ret_ref = (long)ret_var.inner;
13349 if (ret_var.is_owned) {
13355 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
13356 LDKClosingSigned this_obj_conv;
13357 this_obj_conv.inner = (void*)(this_obj & (~1));
13358 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13359 ClosingSigned_free(this_obj_conv);
13362 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
13363 LDKClosingSigned this_ptr_conv;
13364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13365 this_ptr_conv.is_owned = false;
13366 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13367 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
13371 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13372 LDKClosingSigned this_ptr_conv;
13373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13374 this_ptr_conv.is_owned = false;
13375 LDKThirtyTwoBytes val_ref;
13376 CHECK(*((uint32_t*)val) == 32);
13377 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13378 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
13381 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
13382 LDKClosingSigned this_ptr_conv;
13383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13384 this_ptr_conv.is_owned = false;
13385 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
13389 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
13390 LDKClosingSigned this_ptr_conv;
13391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13392 this_ptr_conv.is_owned = false;
13393 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
13396 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
13397 LDKClosingSigned this_ptr_conv;
13398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13399 this_ptr_conv.is_owned = false;
13400 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13401 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
13405 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
13406 LDKClosingSigned this_ptr_conv;
13407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13408 this_ptr_conv.is_owned = false;
13409 LDKSignature val_ref;
13410 CHECK(*((uint32_t*)val) == 64);
13411 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13412 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
13415 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
13416 LDKThirtyTwoBytes channel_id_arg_ref;
13417 CHECK(*((uint32_t*)channel_id_arg) == 32);
13418 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13419 LDKSignature signature_arg_ref;
13420 CHECK(*((uint32_t*)signature_arg) == 64);
13421 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
13422 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
13423 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13424 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13425 long ret_ref = (long)ret_var.inner;
13426 if (ret_var.is_owned) {
13432 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
13433 LDKClosingSigned orig_conv;
13434 orig_conv.inner = (void*)(orig & (~1));
13435 orig_conv.is_owned = false;
13436 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
13437 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13438 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13439 long ret_ref = (long)ret_var.inner;
13440 if (ret_var.is_owned) {
13446 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
13447 LDKUpdateAddHTLC this_obj_conv;
13448 this_obj_conv.inner = (void*)(this_obj & (~1));
13449 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13450 UpdateAddHTLC_free(this_obj_conv);
13453 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
13454 LDKUpdateAddHTLC this_ptr_conv;
13455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13456 this_ptr_conv.is_owned = false;
13457 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13458 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
13462 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13463 LDKUpdateAddHTLC this_ptr_conv;
13464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13465 this_ptr_conv.is_owned = false;
13466 LDKThirtyTwoBytes val_ref;
13467 CHECK(*((uint32_t*)val) == 32);
13468 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13469 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
13472 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
13473 LDKUpdateAddHTLC this_ptr_conv;
13474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13475 this_ptr_conv.is_owned = false;
13476 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
13480 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
13481 LDKUpdateAddHTLC this_ptr_conv;
13482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13483 this_ptr_conv.is_owned = false;
13484 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
13487 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
13488 LDKUpdateAddHTLC this_ptr_conv;
13489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13490 this_ptr_conv.is_owned = false;
13491 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
13495 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
13496 LDKUpdateAddHTLC this_ptr_conv;
13497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13498 this_ptr_conv.is_owned = false;
13499 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
13502 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
13503 LDKUpdateAddHTLC this_ptr_conv;
13504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13505 this_ptr_conv.is_owned = false;
13506 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13507 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
13511 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
13512 LDKUpdateAddHTLC this_ptr_conv;
13513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13514 this_ptr_conv.is_owned = false;
13515 LDKThirtyTwoBytes val_ref;
13516 CHECK(*((uint32_t*)val) == 32);
13517 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13518 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
13521 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
13522 LDKUpdateAddHTLC this_ptr_conv;
13523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13524 this_ptr_conv.is_owned = false;
13525 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
13529 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
13530 LDKUpdateAddHTLC this_ptr_conv;
13531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13532 this_ptr_conv.is_owned = false;
13533 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
13536 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
13537 LDKUpdateAddHTLC orig_conv;
13538 orig_conv.inner = (void*)(orig & (~1));
13539 orig_conv.is_owned = false;
13540 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
13541 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13542 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13543 long ret_ref = (long)ret_var.inner;
13544 if (ret_var.is_owned) {
13550 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
13551 LDKUpdateFulfillHTLC this_obj_conv;
13552 this_obj_conv.inner = (void*)(this_obj & (~1));
13553 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13554 UpdateFulfillHTLC_free(this_obj_conv);
13557 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
13558 LDKUpdateFulfillHTLC this_ptr_conv;
13559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13560 this_ptr_conv.is_owned = false;
13561 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13562 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
13566 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13567 LDKUpdateFulfillHTLC this_ptr_conv;
13568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13569 this_ptr_conv.is_owned = false;
13570 LDKThirtyTwoBytes val_ref;
13571 CHECK(*((uint32_t*)val) == 32);
13572 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13573 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
13576 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
13577 LDKUpdateFulfillHTLC this_ptr_conv;
13578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13579 this_ptr_conv.is_owned = false;
13580 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
13584 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
13585 LDKUpdateFulfillHTLC this_ptr_conv;
13586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13587 this_ptr_conv.is_owned = false;
13588 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
13591 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
13592 LDKUpdateFulfillHTLC this_ptr_conv;
13593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13594 this_ptr_conv.is_owned = false;
13595 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13596 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
13600 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
13601 LDKUpdateFulfillHTLC this_ptr_conv;
13602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13603 this_ptr_conv.is_owned = false;
13604 LDKThirtyTwoBytes val_ref;
13605 CHECK(*((uint32_t*)val) == 32);
13606 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13607 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
13610 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
13611 LDKThirtyTwoBytes channel_id_arg_ref;
13612 CHECK(*((uint32_t*)channel_id_arg) == 32);
13613 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13614 LDKThirtyTwoBytes payment_preimage_arg_ref;
13615 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
13616 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
13617 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
13618 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13619 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13620 long ret_ref = (long)ret_var.inner;
13621 if (ret_var.is_owned) {
13627 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
13628 LDKUpdateFulfillHTLC orig_conv;
13629 orig_conv.inner = (void*)(orig & (~1));
13630 orig_conv.is_owned = false;
13631 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
13632 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13633 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13634 long ret_ref = (long)ret_var.inner;
13635 if (ret_var.is_owned) {
13641 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
13642 LDKUpdateFailHTLC this_obj_conv;
13643 this_obj_conv.inner = (void*)(this_obj & (~1));
13644 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13645 UpdateFailHTLC_free(this_obj_conv);
13648 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
13649 LDKUpdateFailHTLC this_ptr_conv;
13650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13651 this_ptr_conv.is_owned = false;
13652 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13653 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
13657 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13658 LDKUpdateFailHTLC this_ptr_conv;
13659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13660 this_ptr_conv.is_owned = false;
13661 LDKThirtyTwoBytes val_ref;
13662 CHECK(*((uint32_t*)val) == 32);
13663 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13664 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
13667 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
13668 LDKUpdateFailHTLC this_ptr_conv;
13669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13670 this_ptr_conv.is_owned = false;
13671 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
13675 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
13676 LDKUpdateFailHTLC this_ptr_conv;
13677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13678 this_ptr_conv.is_owned = false;
13679 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
13682 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
13683 LDKUpdateFailHTLC orig_conv;
13684 orig_conv.inner = (void*)(orig & (~1));
13685 orig_conv.is_owned = false;
13686 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
13687 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13688 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13689 long ret_ref = (long)ret_var.inner;
13690 if (ret_var.is_owned) {
13696 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
13697 LDKUpdateFailMalformedHTLC this_obj_conv;
13698 this_obj_conv.inner = (void*)(this_obj & (~1));
13699 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13700 UpdateFailMalformedHTLC_free(this_obj_conv);
13703 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
13704 LDKUpdateFailMalformedHTLC this_ptr_conv;
13705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13706 this_ptr_conv.is_owned = false;
13707 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13708 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
13712 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13713 LDKUpdateFailMalformedHTLC this_ptr_conv;
13714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13715 this_ptr_conv.is_owned = false;
13716 LDKThirtyTwoBytes val_ref;
13717 CHECK(*((uint32_t*)val) == 32);
13718 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13719 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
13722 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
13723 LDKUpdateFailMalformedHTLC this_ptr_conv;
13724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13725 this_ptr_conv.is_owned = false;
13726 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
13730 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
13731 LDKUpdateFailMalformedHTLC this_ptr_conv;
13732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13733 this_ptr_conv.is_owned = false;
13734 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
13737 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
13738 LDKUpdateFailMalformedHTLC this_ptr_conv;
13739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13740 this_ptr_conv.is_owned = false;
13741 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
13745 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
13746 LDKUpdateFailMalformedHTLC this_ptr_conv;
13747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13748 this_ptr_conv.is_owned = false;
13749 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
13752 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
13753 LDKUpdateFailMalformedHTLC orig_conv;
13754 orig_conv.inner = (void*)(orig & (~1));
13755 orig_conv.is_owned = false;
13756 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
13757 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13758 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13759 long ret_ref = (long)ret_var.inner;
13760 if (ret_var.is_owned) {
13766 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_obj) {
13767 LDKCommitmentSigned this_obj_conv;
13768 this_obj_conv.inner = (void*)(this_obj & (~1));
13769 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13770 CommitmentSigned_free(this_obj_conv);
13773 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
13774 LDKCommitmentSigned this_ptr_conv;
13775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13776 this_ptr_conv.is_owned = false;
13777 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13778 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
13782 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13783 LDKCommitmentSigned this_ptr_conv;
13784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13785 this_ptr_conv.is_owned = false;
13786 LDKThirtyTwoBytes val_ref;
13787 CHECK(*((uint32_t*)val) == 32);
13788 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13789 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
13792 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
13793 LDKCommitmentSigned this_ptr_conv;
13794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13795 this_ptr_conv.is_owned = false;
13796 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13797 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
13801 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
13802 LDKCommitmentSigned this_ptr_conv;
13803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13804 this_ptr_conv.is_owned = false;
13805 LDKSignature val_ref;
13806 CHECK(*((uint32_t*)val) == 64);
13807 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13808 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
13811 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
13812 LDKCommitmentSigned this_ptr_conv;
13813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13814 this_ptr_conv.is_owned = false;
13815 LDKCVec_SignatureZ val_constr;
13816 val_constr.datalen = *((uint32_t*)val);
13817 if (val_constr.datalen > 0)
13818 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13820 val_constr.data = NULL;
13821 int8_tArray* val_vals = (int8_tArray*)(val + 4);
13822 for (size_t m = 0; m < val_constr.datalen; m++) {
13823 int8_tArray val_conv_12 = val_vals[m];
13824 LDKSignature val_conv_12_ref;
13825 CHECK(*((uint32_t*)val_conv_12) == 64);
13826 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
13827 val_constr.data[m] = val_conv_12_ref;
13829 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
13832 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
13833 LDKThirtyTwoBytes channel_id_arg_ref;
13834 CHECK(*((uint32_t*)channel_id_arg) == 32);
13835 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13836 LDKSignature signature_arg_ref;
13837 CHECK(*((uint32_t*)signature_arg) == 64);
13838 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
13839 LDKCVec_SignatureZ htlc_signatures_arg_constr;
13840 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
13841 if (htlc_signatures_arg_constr.datalen > 0)
13842 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13844 htlc_signatures_arg_constr.data = NULL;
13845 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
13846 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
13847 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
13848 LDKSignature htlc_signatures_arg_conv_12_ref;
13849 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
13850 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
13851 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
13853 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
13854 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13855 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13856 long ret_ref = (long)ret_var.inner;
13857 if (ret_var.is_owned) {
13863 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
13864 LDKCommitmentSigned orig_conv;
13865 orig_conv.inner = (void*)(orig & (~1));
13866 orig_conv.is_owned = false;
13867 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
13868 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13869 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13870 long ret_ref = (long)ret_var.inner;
13871 if (ret_var.is_owned) {
13877 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
13878 LDKRevokeAndACK this_obj_conv;
13879 this_obj_conv.inner = (void*)(this_obj & (~1));
13880 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13881 RevokeAndACK_free(this_obj_conv);
13884 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
13885 LDKRevokeAndACK this_ptr_conv;
13886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13887 this_ptr_conv.is_owned = false;
13888 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13889 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
13893 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13894 LDKRevokeAndACK this_ptr_conv;
13895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13896 this_ptr_conv.is_owned = false;
13897 LDKThirtyTwoBytes val_ref;
13898 CHECK(*((uint32_t*)val) == 32);
13899 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13900 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
13903 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
13904 LDKRevokeAndACK this_ptr_conv;
13905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13906 this_ptr_conv.is_owned = false;
13907 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13908 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
13912 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
13913 LDKRevokeAndACK this_ptr_conv;
13914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13915 this_ptr_conv.is_owned = false;
13916 LDKThirtyTwoBytes val_ref;
13917 CHECK(*((uint32_t*)val) == 32);
13918 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13919 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
13922 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
13923 LDKRevokeAndACK this_ptr_conv;
13924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13925 this_ptr_conv.is_owned = false;
13926 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13927 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
13931 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
13932 LDKRevokeAndACK this_ptr_conv;
13933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13934 this_ptr_conv.is_owned = false;
13935 LDKPublicKey val_ref;
13936 CHECK(*((uint32_t*)val) == 33);
13937 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13938 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
13941 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) {
13942 LDKThirtyTwoBytes channel_id_arg_ref;
13943 CHECK(*((uint32_t*)channel_id_arg) == 32);
13944 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13945 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
13946 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
13947 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
13948 LDKPublicKey next_per_commitment_point_arg_ref;
13949 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
13950 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
13951 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
13952 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13953 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13954 long ret_ref = (long)ret_var.inner;
13955 if (ret_var.is_owned) {
13961 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
13962 LDKRevokeAndACK orig_conv;
13963 orig_conv.inner = (void*)(orig & (~1));
13964 orig_conv.is_owned = false;
13965 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
13966 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13967 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13968 long ret_ref = (long)ret_var.inner;
13969 if (ret_var.is_owned) {
13975 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
13976 LDKUpdateFee this_obj_conv;
13977 this_obj_conv.inner = (void*)(this_obj & (~1));
13978 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13979 UpdateFee_free(this_obj_conv);
13982 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
13983 LDKUpdateFee this_ptr_conv;
13984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13985 this_ptr_conv.is_owned = false;
13986 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13987 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
13991 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13992 LDKUpdateFee this_ptr_conv;
13993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13994 this_ptr_conv.is_owned = false;
13995 LDKThirtyTwoBytes val_ref;
13996 CHECK(*((uint32_t*)val) == 32);
13997 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13998 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
14001 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
14002 LDKUpdateFee this_ptr_conv;
14003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14004 this_ptr_conv.is_owned = false;
14005 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
14009 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
14010 LDKUpdateFee this_ptr_conv;
14011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14012 this_ptr_conv.is_owned = false;
14013 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
14016 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
14017 LDKThirtyTwoBytes channel_id_arg_ref;
14018 CHECK(*((uint32_t*)channel_id_arg) == 32);
14019 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
14020 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
14021 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14022 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14023 long ret_ref = (long)ret_var.inner;
14024 if (ret_var.is_owned) {
14030 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
14031 LDKUpdateFee orig_conv;
14032 orig_conv.inner = (void*)(orig & (~1));
14033 orig_conv.is_owned = false;
14034 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
14035 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14036 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14037 long ret_ref = (long)ret_var.inner;
14038 if (ret_var.is_owned) {
14044 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
14045 LDKDataLossProtect this_obj_conv;
14046 this_obj_conv.inner = (void*)(this_obj & (~1));
14047 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14048 DataLossProtect_free(this_obj_conv);
14051 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
14052 LDKDataLossProtect this_ptr_conv;
14053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14054 this_ptr_conv.is_owned = false;
14055 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14056 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
14060 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
14061 LDKDataLossProtect this_ptr_conv;
14062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14063 this_ptr_conv.is_owned = false;
14064 LDKThirtyTwoBytes val_ref;
14065 CHECK(*((uint32_t*)val) == 32);
14066 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14067 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
14070 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
14071 LDKDataLossProtect this_ptr_conv;
14072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14073 this_ptr_conv.is_owned = false;
14074 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14075 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
14079 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
14080 LDKDataLossProtect this_ptr_conv;
14081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14082 this_ptr_conv.is_owned = false;
14083 LDKPublicKey val_ref;
14084 CHECK(*((uint32_t*)val) == 33);
14085 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14086 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
14089 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
14090 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
14091 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
14092 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
14093 LDKPublicKey my_current_per_commitment_point_arg_ref;
14094 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
14095 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
14096 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
14097 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14098 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14099 long ret_ref = (long)ret_var.inner;
14100 if (ret_var.is_owned) {
14106 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
14107 LDKDataLossProtect orig_conv;
14108 orig_conv.inner = (void*)(orig & (~1));
14109 orig_conv.is_owned = false;
14110 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
14111 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14112 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14113 long ret_ref = (long)ret_var.inner;
14114 if (ret_var.is_owned) {
14120 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
14121 LDKChannelReestablish this_obj_conv;
14122 this_obj_conv.inner = (void*)(this_obj & (~1));
14123 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14124 ChannelReestablish_free(this_obj_conv);
14127 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
14128 LDKChannelReestablish this_ptr_conv;
14129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14130 this_ptr_conv.is_owned = false;
14131 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14132 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
14136 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
14137 LDKChannelReestablish this_ptr_conv;
14138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14139 this_ptr_conv.is_owned = false;
14140 LDKThirtyTwoBytes val_ref;
14141 CHECK(*((uint32_t*)val) == 32);
14142 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14143 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
14146 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
14147 LDKChannelReestablish this_ptr_conv;
14148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14149 this_ptr_conv.is_owned = false;
14150 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
14154 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
14155 LDKChannelReestablish this_ptr_conv;
14156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14157 this_ptr_conv.is_owned = false;
14158 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
14161 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
14162 LDKChannelReestablish this_ptr_conv;
14163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14164 this_ptr_conv.is_owned = false;
14165 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
14169 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
14170 LDKChannelReestablish this_ptr_conv;
14171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14172 this_ptr_conv.is_owned = false;
14173 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
14176 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
14177 LDKChannelReestablish orig_conv;
14178 orig_conv.inner = (void*)(orig & (~1));
14179 orig_conv.is_owned = false;
14180 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
14181 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14182 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14183 long ret_ref = (long)ret_var.inner;
14184 if (ret_var.is_owned) {
14190 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
14191 LDKAnnouncementSignatures this_obj_conv;
14192 this_obj_conv.inner = (void*)(this_obj & (~1));
14193 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14194 AnnouncementSignatures_free(this_obj_conv);
14197 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
14198 LDKAnnouncementSignatures this_ptr_conv;
14199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14200 this_ptr_conv.is_owned = false;
14201 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14202 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
14206 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
14207 LDKAnnouncementSignatures this_ptr_conv;
14208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14209 this_ptr_conv.is_owned = false;
14210 LDKThirtyTwoBytes val_ref;
14211 CHECK(*((uint32_t*)val) == 32);
14212 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14213 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
14216 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
14217 LDKAnnouncementSignatures this_ptr_conv;
14218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14219 this_ptr_conv.is_owned = false;
14220 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
14224 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
14225 LDKAnnouncementSignatures this_ptr_conv;
14226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14227 this_ptr_conv.is_owned = false;
14228 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
14231 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
14232 LDKAnnouncementSignatures this_ptr_conv;
14233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14234 this_ptr_conv.is_owned = false;
14235 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14236 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
14240 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
14241 LDKAnnouncementSignatures this_ptr_conv;
14242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14243 this_ptr_conv.is_owned = false;
14244 LDKSignature val_ref;
14245 CHECK(*((uint32_t*)val) == 64);
14246 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14247 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
14250 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
14251 LDKAnnouncementSignatures this_ptr_conv;
14252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14253 this_ptr_conv.is_owned = false;
14254 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14255 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
14259 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
14260 LDKAnnouncementSignatures this_ptr_conv;
14261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14262 this_ptr_conv.is_owned = false;
14263 LDKSignature val_ref;
14264 CHECK(*((uint32_t*)val) == 64);
14265 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14266 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
14269 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) {
14270 LDKThirtyTwoBytes channel_id_arg_ref;
14271 CHECK(*((uint32_t*)channel_id_arg) == 32);
14272 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
14273 LDKSignature node_signature_arg_ref;
14274 CHECK(*((uint32_t*)node_signature_arg) == 64);
14275 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
14276 LDKSignature bitcoin_signature_arg_ref;
14277 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
14278 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
14279 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
14280 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14281 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14282 long ret_ref = (long)ret_var.inner;
14283 if (ret_var.is_owned) {
14289 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
14290 LDKAnnouncementSignatures orig_conv;
14291 orig_conv.inner = (void*)(orig & (~1));
14292 orig_conv.is_owned = false;
14293 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
14294 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14295 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14296 long ret_ref = (long)ret_var.inner;
14297 if (ret_var.is_owned) {
14303 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
14304 if ((this_ptr & 1) != 0) return;
14305 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
14306 FREE((void*)this_ptr);
14307 NetAddress_free(this_ptr_conv);
14310 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
14311 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
14312 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
14313 *ret_copy = NetAddress_clone(orig_conv);
14314 long ret_ref = (long)ret_copy;
14318 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
14319 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
14320 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
14321 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14322 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14323 CVec_u8Z_free(ret_var);
14327 uint32_t __attribute__((visibility("default"))) TS_Result_read(int8_tArray ser) {
14328 LDKu8slice ser_ref;
14329 ser_ref.datalen = *((uint32_t*)ser);
14330 ser_ref.data = (int8_t*)(ser + 4);
14331 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
14332 *ret_conv = Result_read(ser_ref);
14333 return (long)ret_conv;
14336 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
14337 LDKUnsignedNodeAnnouncement this_obj_conv;
14338 this_obj_conv.inner = (void*)(this_obj & (~1));
14339 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14340 UnsignedNodeAnnouncement_free(this_obj_conv);
14343 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
14344 LDKUnsignedNodeAnnouncement this_ptr_conv;
14345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14346 this_ptr_conv.is_owned = false;
14347 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
14348 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14349 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14350 long ret_ref = (long)ret_var.inner;
14351 if (ret_var.is_owned) {
14357 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
14358 LDKUnsignedNodeAnnouncement this_ptr_conv;
14359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14360 this_ptr_conv.is_owned = false;
14361 LDKNodeFeatures val_conv;
14362 val_conv.inner = (void*)(val & (~1));
14363 val_conv.is_owned = (val & 1) || (val == 0);
14364 val_conv = NodeFeatures_clone(&val_conv);
14365 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
14368 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
14369 LDKUnsignedNodeAnnouncement this_ptr_conv;
14370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14371 this_ptr_conv.is_owned = false;
14372 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
14376 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
14377 LDKUnsignedNodeAnnouncement this_ptr_conv;
14378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14379 this_ptr_conv.is_owned = false;
14380 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
14383 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
14384 LDKUnsignedNodeAnnouncement this_ptr_conv;
14385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14386 this_ptr_conv.is_owned = false;
14387 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14388 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
14392 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
14393 LDKUnsignedNodeAnnouncement this_ptr_conv;
14394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14395 this_ptr_conv.is_owned = false;
14396 LDKPublicKey val_ref;
14397 CHECK(*((uint32_t*)val) == 33);
14398 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14399 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
14402 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
14403 LDKUnsignedNodeAnnouncement this_ptr_conv;
14404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14405 this_ptr_conv.is_owned = false;
14406 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
14407 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
14411 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
14412 LDKUnsignedNodeAnnouncement this_ptr_conv;
14413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14414 this_ptr_conv.is_owned = false;
14415 LDKThreeBytes val_ref;
14416 CHECK(*((uint32_t*)val) == 3);
14417 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
14418 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
14421 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
14422 LDKUnsignedNodeAnnouncement this_ptr_conv;
14423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14424 this_ptr_conv.is_owned = false;
14425 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14426 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
14430 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
14431 LDKUnsignedNodeAnnouncement this_ptr_conv;
14432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14433 this_ptr_conv.is_owned = false;
14434 LDKThirtyTwoBytes val_ref;
14435 CHECK(*((uint32_t*)val) == 32);
14436 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14437 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
14440 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
14441 LDKUnsignedNodeAnnouncement this_ptr_conv;
14442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14443 this_ptr_conv.is_owned = false;
14444 LDKCVec_NetAddressZ val_constr;
14445 val_constr.datalen = *((uint32_t*)val);
14446 if (val_constr.datalen > 0)
14447 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14449 val_constr.data = NULL;
14450 uint32_t* val_vals = (uint32_t*)(val + 4);
14451 for (size_t m = 0; m < val_constr.datalen; m++) {
14452 uint32_t val_conv_12 = val_vals[m];
14453 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
14454 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
14455 val_constr.data[m] = val_conv_12_conv;
14457 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
14460 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
14461 LDKUnsignedNodeAnnouncement orig_conv;
14462 orig_conv.inner = (void*)(orig & (~1));
14463 orig_conv.is_owned = false;
14464 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
14465 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14466 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14467 long ret_ref = (long)ret_var.inner;
14468 if (ret_var.is_owned) {
14474 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
14475 LDKNodeAnnouncement this_obj_conv;
14476 this_obj_conv.inner = (void*)(this_obj & (~1));
14477 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14478 NodeAnnouncement_free(this_obj_conv);
14481 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
14482 LDKNodeAnnouncement this_ptr_conv;
14483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14484 this_ptr_conv.is_owned = false;
14485 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14486 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
14490 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
14491 LDKNodeAnnouncement this_ptr_conv;
14492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14493 this_ptr_conv.is_owned = false;
14494 LDKSignature val_ref;
14495 CHECK(*((uint32_t*)val) == 64);
14496 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14497 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
14500 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
14501 LDKNodeAnnouncement this_ptr_conv;
14502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14503 this_ptr_conv.is_owned = false;
14504 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
14505 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14506 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14507 long ret_ref = (long)ret_var.inner;
14508 if (ret_var.is_owned) {
14514 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
14515 LDKNodeAnnouncement this_ptr_conv;
14516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14517 this_ptr_conv.is_owned = false;
14518 LDKUnsignedNodeAnnouncement val_conv;
14519 val_conv.inner = (void*)(val & (~1));
14520 val_conv.is_owned = (val & 1) || (val == 0);
14521 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
14522 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
14525 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
14526 LDKSignature signature_arg_ref;
14527 CHECK(*((uint32_t*)signature_arg) == 64);
14528 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
14529 LDKUnsignedNodeAnnouncement contents_arg_conv;
14530 contents_arg_conv.inner = (void*)(contents_arg & (~1));
14531 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
14532 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
14533 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
14534 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14535 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14536 long ret_ref = (long)ret_var.inner;
14537 if (ret_var.is_owned) {
14543 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
14544 LDKNodeAnnouncement orig_conv;
14545 orig_conv.inner = (void*)(orig & (~1));
14546 orig_conv.is_owned = false;
14547 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
14548 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14549 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14550 long ret_ref = (long)ret_var.inner;
14551 if (ret_var.is_owned) {
14557 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
14558 LDKUnsignedChannelAnnouncement this_obj_conv;
14559 this_obj_conv.inner = (void*)(this_obj & (~1));
14560 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14561 UnsignedChannelAnnouncement_free(this_obj_conv);
14564 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
14565 LDKUnsignedChannelAnnouncement this_ptr_conv;
14566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14567 this_ptr_conv.is_owned = false;
14568 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
14569 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14570 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14571 long ret_ref = (long)ret_var.inner;
14572 if (ret_var.is_owned) {
14578 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
14579 LDKUnsignedChannelAnnouncement this_ptr_conv;
14580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14581 this_ptr_conv.is_owned = false;
14582 LDKChannelFeatures val_conv;
14583 val_conv.inner = (void*)(val & (~1));
14584 val_conv.is_owned = (val & 1) || (val == 0);
14585 val_conv = ChannelFeatures_clone(&val_conv);
14586 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
14589 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
14590 LDKUnsignedChannelAnnouncement this_ptr_conv;
14591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14592 this_ptr_conv.is_owned = false;
14593 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14594 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
14598 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14599 LDKUnsignedChannelAnnouncement this_ptr_conv;
14600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14601 this_ptr_conv.is_owned = false;
14602 LDKThirtyTwoBytes val_ref;
14603 CHECK(*((uint32_t*)val) == 32);
14604 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14605 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
14608 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
14609 LDKUnsignedChannelAnnouncement this_ptr_conv;
14610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14611 this_ptr_conv.is_owned = false;
14612 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
14616 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
14617 LDKUnsignedChannelAnnouncement this_ptr_conv;
14618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14619 this_ptr_conv.is_owned = false;
14620 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
14623 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
14624 LDKUnsignedChannelAnnouncement this_ptr_conv;
14625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14626 this_ptr_conv.is_owned = false;
14627 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14628 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
14632 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
14633 LDKUnsignedChannelAnnouncement this_ptr_conv;
14634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14635 this_ptr_conv.is_owned = false;
14636 LDKPublicKey val_ref;
14637 CHECK(*((uint32_t*)val) == 33);
14638 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14639 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
14642 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
14643 LDKUnsignedChannelAnnouncement this_ptr_conv;
14644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14645 this_ptr_conv.is_owned = false;
14646 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14647 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
14651 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
14652 LDKUnsignedChannelAnnouncement this_ptr_conv;
14653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14654 this_ptr_conv.is_owned = false;
14655 LDKPublicKey val_ref;
14656 CHECK(*((uint32_t*)val) == 33);
14657 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14658 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
14661 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
14662 LDKUnsignedChannelAnnouncement this_ptr_conv;
14663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14664 this_ptr_conv.is_owned = false;
14665 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14666 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
14670 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
14671 LDKUnsignedChannelAnnouncement this_ptr_conv;
14672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14673 this_ptr_conv.is_owned = false;
14674 LDKPublicKey val_ref;
14675 CHECK(*((uint32_t*)val) == 33);
14676 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14677 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
14680 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
14681 LDKUnsignedChannelAnnouncement this_ptr_conv;
14682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14683 this_ptr_conv.is_owned = false;
14684 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14685 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
14689 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
14690 LDKUnsignedChannelAnnouncement this_ptr_conv;
14691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14692 this_ptr_conv.is_owned = false;
14693 LDKPublicKey val_ref;
14694 CHECK(*((uint32_t*)val) == 33);
14695 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14696 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
14699 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
14700 LDKUnsignedChannelAnnouncement orig_conv;
14701 orig_conv.inner = (void*)(orig & (~1));
14702 orig_conv.is_owned = false;
14703 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
14704 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14705 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14706 long ret_ref = (long)ret_var.inner;
14707 if (ret_var.is_owned) {
14713 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
14714 LDKChannelAnnouncement this_obj_conv;
14715 this_obj_conv.inner = (void*)(this_obj & (~1));
14716 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14717 ChannelAnnouncement_free(this_obj_conv);
14720 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
14721 LDKChannelAnnouncement this_ptr_conv;
14722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14723 this_ptr_conv.is_owned = false;
14724 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14725 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
14729 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
14730 LDKChannelAnnouncement this_ptr_conv;
14731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14732 this_ptr_conv.is_owned = false;
14733 LDKSignature val_ref;
14734 CHECK(*((uint32_t*)val) == 64);
14735 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14736 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
14739 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
14740 LDKChannelAnnouncement this_ptr_conv;
14741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14742 this_ptr_conv.is_owned = false;
14743 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14744 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
14748 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
14749 LDKChannelAnnouncement this_ptr_conv;
14750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14751 this_ptr_conv.is_owned = false;
14752 LDKSignature val_ref;
14753 CHECK(*((uint32_t*)val) == 64);
14754 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14755 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
14758 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
14759 LDKChannelAnnouncement this_ptr_conv;
14760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14761 this_ptr_conv.is_owned = false;
14762 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14763 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
14767 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
14768 LDKChannelAnnouncement this_ptr_conv;
14769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14770 this_ptr_conv.is_owned = false;
14771 LDKSignature val_ref;
14772 CHECK(*((uint32_t*)val) == 64);
14773 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14774 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
14777 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
14778 LDKChannelAnnouncement this_ptr_conv;
14779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14780 this_ptr_conv.is_owned = false;
14781 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14782 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
14786 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
14787 LDKChannelAnnouncement this_ptr_conv;
14788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14789 this_ptr_conv.is_owned = false;
14790 LDKSignature val_ref;
14791 CHECK(*((uint32_t*)val) == 64);
14792 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14793 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
14796 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
14797 LDKChannelAnnouncement this_ptr_conv;
14798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14799 this_ptr_conv.is_owned = false;
14800 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
14801 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14802 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14803 long ret_ref = (long)ret_var.inner;
14804 if (ret_var.is_owned) {
14810 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
14811 LDKChannelAnnouncement this_ptr_conv;
14812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14813 this_ptr_conv.is_owned = false;
14814 LDKUnsignedChannelAnnouncement val_conv;
14815 val_conv.inner = (void*)(val & (~1));
14816 val_conv.is_owned = (val & 1) || (val == 0);
14817 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
14818 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
14821 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) {
14822 LDKSignature node_signature_1_arg_ref;
14823 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
14824 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
14825 LDKSignature node_signature_2_arg_ref;
14826 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
14827 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
14828 LDKSignature bitcoin_signature_1_arg_ref;
14829 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
14830 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
14831 LDKSignature bitcoin_signature_2_arg_ref;
14832 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
14833 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
14834 LDKUnsignedChannelAnnouncement contents_arg_conv;
14835 contents_arg_conv.inner = (void*)(contents_arg & (~1));
14836 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
14837 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
14838 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);
14839 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14840 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14841 long ret_ref = (long)ret_var.inner;
14842 if (ret_var.is_owned) {
14848 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
14849 LDKChannelAnnouncement orig_conv;
14850 orig_conv.inner = (void*)(orig & (~1));
14851 orig_conv.is_owned = false;
14852 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
14853 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14854 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14855 long ret_ref = (long)ret_var.inner;
14856 if (ret_var.is_owned) {
14862 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
14863 LDKUnsignedChannelUpdate this_obj_conv;
14864 this_obj_conv.inner = (void*)(this_obj & (~1));
14865 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14866 UnsignedChannelUpdate_free(this_obj_conv);
14869 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
14870 LDKUnsignedChannelUpdate this_ptr_conv;
14871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14872 this_ptr_conv.is_owned = false;
14873 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14874 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
14878 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14879 LDKUnsignedChannelUpdate this_ptr_conv;
14880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14881 this_ptr_conv.is_owned = false;
14882 LDKThirtyTwoBytes val_ref;
14883 CHECK(*((uint32_t*)val) == 32);
14884 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14885 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
14888 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
14889 LDKUnsignedChannelUpdate this_ptr_conv;
14890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14891 this_ptr_conv.is_owned = false;
14892 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
14896 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
14897 LDKUnsignedChannelUpdate this_ptr_conv;
14898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14899 this_ptr_conv.is_owned = false;
14900 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
14903 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
14904 LDKUnsignedChannelUpdate this_ptr_conv;
14905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14906 this_ptr_conv.is_owned = false;
14907 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
14911 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
14912 LDKUnsignedChannelUpdate this_ptr_conv;
14913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14914 this_ptr_conv.is_owned = false;
14915 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
14918 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
14919 LDKUnsignedChannelUpdate this_ptr_conv;
14920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14921 this_ptr_conv.is_owned = false;
14922 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
14926 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
14927 LDKUnsignedChannelUpdate this_ptr_conv;
14928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14929 this_ptr_conv.is_owned = false;
14930 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
14933 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
14934 LDKUnsignedChannelUpdate this_ptr_conv;
14935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14936 this_ptr_conv.is_owned = false;
14937 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
14941 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
14942 LDKUnsignedChannelUpdate this_ptr_conv;
14943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14944 this_ptr_conv.is_owned = false;
14945 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
14948 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
14949 LDKUnsignedChannelUpdate this_ptr_conv;
14950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14951 this_ptr_conv.is_owned = false;
14952 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
14956 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
14957 LDKUnsignedChannelUpdate this_ptr_conv;
14958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14959 this_ptr_conv.is_owned = false;
14960 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
14963 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
14964 LDKUnsignedChannelUpdate this_ptr_conv;
14965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14966 this_ptr_conv.is_owned = false;
14967 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
14971 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
14972 LDKUnsignedChannelUpdate this_ptr_conv;
14973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14974 this_ptr_conv.is_owned = false;
14975 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
14978 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
14979 LDKUnsignedChannelUpdate this_ptr_conv;
14980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14981 this_ptr_conv.is_owned = false;
14982 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
14986 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
14987 LDKUnsignedChannelUpdate this_ptr_conv;
14988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14989 this_ptr_conv.is_owned = false;
14990 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
14993 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
14994 LDKUnsignedChannelUpdate orig_conv;
14995 orig_conv.inner = (void*)(orig & (~1));
14996 orig_conv.is_owned = false;
14997 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
14998 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14999 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15000 long ret_ref = (long)ret_var.inner;
15001 if (ret_var.is_owned) {
15007 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
15008 LDKChannelUpdate this_obj_conv;
15009 this_obj_conv.inner = (void*)(this_obj & (~1));
15010 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15011 ChannelUpdate_free(this_obj_conv);
15014 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
15015 LDKChannelUpdate this_ptr_conv;
15016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15017 this_ptr_conv.is_owned = false;
15018 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
15019 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
15023 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
15024 LDKChannelUpdate this_ptr_conv;
15025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15026 this_ptr_conv.is_owned = false;
15027 LDKSignature val_ref;
15028 CHECK(*((uint32_t*)val) == 64);
15029 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
15030 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
15033 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
15034 LDKChannelUpdate this_ptr_conv;
15035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15036 this_ptr_conv.is_owned = false;
15037 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
15038 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15039 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15040 long ret_ref = (long)ret_var.inner;
15041 if (ret_var.is_owned) {
15047 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
15048 LDKChannelUpdate this_ptr_conv;
15049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15050 this_ptr_conv.is_owned = false;
15051 LDKUnsignedChannelUpdate val_conv;
15052 val_conv.inner = (void*)(val & (~1));
15053 val_conv.is_owned = (val & 1) || (val == 0);
15054 val_conv = UnsignedChannelUpdate_clone(&val_conv);
15055 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
15058 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
15059 LDKSignature signature_arg_ref;
15060 CHECK(*((uint32_t*)signature_arg) == 64);
15061 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
15062 LDKUnsignedChannelUpdate contents_arg_conv;
15063 contents_arg_conv.inner = (void*)(contents_arg & (~1));
15064 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
15065 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
15066 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
15067 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15068 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15069 long ret_ref = (long)ret_var.inner;
15070 if (ret_var.is_owned) {
15076 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
15077 LDKChannelUpdate orig_conv;
15078 orig_conv.inner = (void*)(orig & (~1));
15079 orig_conv.is_owned = false;
15080 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
15081 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15082 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15083 long ret_ref = (long)ret_var.inner;
15084 if (ret_var.is_owned) {
15090 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
15091 LDKQueryChannelRange this_obj_conv;
15092 this_obj_conv.inner = (void*)(this_obj & (~1));
15093 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15094 QueryChannelRange_free(this_obj_conv);
15097 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
15098 LDKQueryChannelRange this_ptr_conv;
15099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15100 this_ptr_conv.is_owned = false;
15101 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15102 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
15106 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
15107 LDKQueryChannelRange this_ptr_conv;
15108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15109 this_ptr_conv.is_owned = false;
15110 LDKThirtyTwoBytes val_ref;
15111 CHECK(*((uint32_t*)val) == 32);
15112 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15113 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
15116 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
15117 LDKQueryChannelRange this_ptr_conv;
15118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15119 this_ptr_conv.is_owned = false;
15120 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
15124 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
15125 LDKQueryChannelRange this_ptr_conv;
15126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15127 this_ptr_conv.is_owned = false;
15128 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
15131 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
15132 LDKQueryChannelRange this_ptr_conv;
15133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15134 this_ptr_conv.is_owned = false;
15135 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
15139 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
15140 LDKQueryChannelRange this_ptr_conv;
15141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15142 this_ptr_conv.is_owned = false;
15143 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
15146 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
15147 LDKThirtyTwoBytes chain_hash_arg_ref;
15148 CHECK(*((uint32_t*)chain_hash_arg) == 32);
15149 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
15150 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
15151 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15152 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15153 long ret_ref = (long)ret_var.inner;
15154 if (ret_var.is_owned) {
15160 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
15161 LDKQueryChannelRange orig_conv;
15162 orig_conv.inner = (void*)(orig & (~1));
15163 orig_conv.is_owned = false;
15164 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
15165 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15166 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15167 long ret_ref = (long)ret_var.inner;
15168 if (ret_var.is_owned) {
15174 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
15175 LDKReplyChannelRange this_obj_conv;
15176 this_obj_conv.inner = (void*)(this_obj & (~1));
15177 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15178 ReplyChannelRange_free(this_obj_conv);
15181 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
15182 LDKReplyChannelRange this_ptr_conv;
15183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15184 this_ptr_conv.is_owned = false;
15185 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15186 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
15190 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
15191 LDKReplyChannelRange this_ptr_conv;
15192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15193 this_ptr_conv.is_owned = false;
15194 LDKThirtyTwoBytes val_ref;
15195 CHECK(*((uint32_t*)val) == 32);
15196 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15197 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
15200 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
15201 LDKReplyChannelRange this_ptr_conv;
15202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15203 this_ptr_conv.is_owned = false;
15204 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
15208 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
15209 LDKReplyChannelRange this_ptr_conv;
15210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15211 this_ptr_conv.is_owned = false;
15212 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
15215 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
15216 LDKReplyChannelRange this_ptr_conv;
15217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15218 this_ptr_conv.is_owned = false;
15219 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
15223 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
15224 LDKReplyChannelRange this_ptr_conv;
15225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15226 this_ptr_conv.is_owned = false;
15227 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
15230 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
15231 LDKReplyChannelRange this_ptr_conv;
15232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15233 this_ptr_conv.is_owned = false;
15234 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
15238 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
15239 LDKReplyChannelRange this_ptr_conv;
15240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15241 this_ptr_conv.is_owned = false;
15242 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
15245 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
15246 LDKReplyChannelRange this_ptr_conv;
15247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15248 this_ptr_conv.is_owned = false;
15249 LDKCVec_u64Z val_constr;
15250 val_constr.datalen = *((uint32_t*)val);
15251 if (val_constr.datalen > 0)
15252 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15254 val_constr.data = NULL;
15255 int64_t* val_vals = (int64_t*)(val + 4);
15256 for (size_t i = 0; i < val_constr.datalen; i++) {
15257 int64_t val_conv_8 = val_vals[i];
15258 val_constr.data[i] = val_conv_8;
15260 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
15263 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) {
15264 LDKThirtyTwoBytes chain_hash_arg_ref;
15265 CHECK(*((uint32_t*)chain_hash_arg) == 32);
15266 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
15267 LDKCVec_u64Z short_channel_ids_arg_constr;
15268 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
15269 if (short_channel_ids_arg_constr.datalen > 0)
15270 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15272 short_channel_ids_arg_constr.data = NULL;
15273 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
15274 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
15275 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
15276 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
15278 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
15279 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15280 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15281 long ret_ref = (long)ret_var.inner;
15282 if (ret_var.is_owned) {
15288 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
15289 LDKReplyChannelRange orig_conv;
15290 orig_conv.inner = (void*)(orig & (~1));
15291 orig_conv.is_owned = false;
15292 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
15293 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15294 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15295 long ret_ref = (long)ret_var.inner;
15296 if (ret_var.is_owned) {
15302 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
15303 LDKQueryShortChannelIds this_obj_conv;
15304 this_obj_conv.inner = (void*)(this_obj & (~1));
15305 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15306 QueryShortChannelIds_free(this_obj_conv);
15309 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
15310 LDKQueryShortChannelIds this_ptr_conv;
15311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15312 this_ptr_conv.is_owned = false;
15313 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15314 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
15318 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
15319 LDKQueryShortChannelIds this_ptr_conv;
15320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15321 this_ptr_conv.is_owned = false;
15322 LDKThirtyTwoBytes val_ref;
15323 CHECK(*((uint32_t*)val) == 32);
15324 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15325 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
15328 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
15329 LDKQueryShortChannelIds this_ptr_conv;
15330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15331 this_ptr_conv.is_owned = false;
15332 LDKCVec_u64Z val_constr;
15333 val_constr.datalen = *((uint32_t*)val);
15334 if (val_constr.datalen > 0)
15335 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15337 val_constr.data = NULL;
15338 int64_t* val_vals = (int64_t*)(val + 4);
15339 for (size_t i = 0; i < val_constr.datalen; i++) {
15340 int64_t val_conv_8 = val_vals[i];
15341 val_constr.data[i] = val_conv_8;
15343 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
15346 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
15347 LDKThirtyTwoBytes chain_hash_arg_ref;
15348 CHECK(*((uint32_t*)chain_hash_arg) == 32);
15349 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
15350 LDKCVec_u64Z short_channel_ids_arg_constr;
15351 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
15352 if (short_channel_ids_arg_constr.datalen > 0)
15353 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15355 short_channel_ids_arg_constr.data = NULL;
15356 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
15357 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
15358 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
15359 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
15361 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
15362 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15363 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15364 long ret_ref = (long)ret_var.inner;
15365 if (ret_var.is_owned) {
15371 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
15372 LDKQueryShortChannelIds orig_conv;
15373 orig_conv.inner = (void*)(orig & (~1));
15374 orig_conv.is_owned = false;
15375 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
15376 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15377 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15378 long ret_ref = (long)ret_var.inner;
15379 if (ret_var.is_owned) {
15385 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
15386 LDKReplyShortChannelIdsEnd this_obj_conv;
15387 this_obj_conv.inner = (void*)(this_obj & (~1));
15388 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15389 ReplyShortChannelIdsEnd_free(this_obj_conv);
15392 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
15393 LDKReplyShortChannelIdsEnd this_ptr_conv;
15394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15395 this_ptr_conv.is_owned = false;
15396 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15397 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
15401 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
15402 LDKReplyShortChannelIdsEnd this_ptr_conv;
15403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15404 this_ptr_conv.is_owned = false;
15405 LDKThirtyTwoBytes val_ref;
15406 CHECK(*((uint32_t*)val) == 32);
15407 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15408 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
15411 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
15412 LDKReplyShortChannelIdsEnd this_ptr_conv;
15413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15414 this_ptr_conv.is_owned = false;
15415 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
15419 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
15420 LDKReplyShortChannelIdsEnd this_ptr_conv;
15421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15422 this_ptr_conv.is_owned = false;
15423 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
15426 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
15427 LDKThirtyTwoBytes chain_hash_arg_ref;
15428 CHECK(*((uint32_t*)chain_hash_arg) == 32);
15429 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
15430 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
15431 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15432 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15433 long ret_ref = (long)ret_var.inner;
15434 if (ret_var.is_owned) {
15440 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
15441 LDKReplyShortChannelIdsEnd orig_conv;
15442 orig_conv.inner = (void*)(orig & (~1));
15443 orig_conv.is_owned = false;
15444 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
15445 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15446 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15447 long ret_ref = (long)ret_var.inner;
15448 if (ret_var.is_owned) {
15454 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
15455 LDKGossipTimestampFilter this_obj_conv;
15456 this_obj_conv.inner = (void*)(this_obj & (~1));
15457 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15458 GossipTimestampFilter_free(this_obj_conv);
15461 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
15462 LDKGossipTimestampFilter this_ptr_conv;
15463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15464 this_ptr_conv.is_owned = false;
15465 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15466 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
15470 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
15471 LDKGossipTimestampFilter this_ptr_conv;
15472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15473 this_ptr_conv.is_owned = false;
15474 LDKThirtyTwoBytes val_ref;
15475 CHECK(*((uint32_t*)val) == 32);
15476 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15477 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
15480 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
15481 LDKGossipTimestampFilter this_ptr_conv;
15482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15483 this_ptr_conv.is_owned = false;
15484 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
15488 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
15489 LDKGossipTimestampFilter this_ptr_conv;
15490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15491 this_ptr_conv.is_owned = false;
15492 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
15495 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
15496 LDKGossipTimestampFilter this_ptr_conv;
15497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15498 this_ptr_conv.is_owned = false;
15499 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
15503 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
15504 LDKGossipTimestampFilter this_ptr_conv;
15505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15506 this_ptr_conv.is_owned = false;
15507 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
15510 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
15511 LDKThirtyTwoBytes chain_hash_arg_ref;
15512 CHECK(*((uint32_t*)chain_hash_arg) == 32);
15513 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
15514 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
15515 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15516 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15517 long ret_ref = (long)ret_var.inner;
15518 if (ret_var.is_owned) {
15524 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
15525 LDKGossipTimestampFilter orig_conv;
15526 orig_conv.inner = (void*)(orig & (~1));
15527 orig_conv.is_owned = false;
15528 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
15529 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15530 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15531 long ret_ref = (long)ret_var.inner;
15532 if (ret_var.is_owned) {
15538 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
15539 if ((this_ptr & 1) != 0) return;
15540 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
15541 FREE((void*)this_ptr);
15542 ErrorAction_free(this_ptr_conv);
15545 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
15546 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
15547 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
15548 *ret_copy = ErrorAction_clone(orig_conv);
15549 long ret_ref = (long)ret_copy;
15553 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
15554 LDKLightningError this_obj_conv;
15555 this_obj_conv.inner = (void*)(this_obj & (~1));
15556 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15557 LightningError_free(this_obj_conv);
15560 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
15561 LDKLightningError this_ptr_conv;
15562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15563 this_ptr_conv.is_owned = false;
15564 LDKStr _str = LightningError_get_err(&this_ptr_conv);
15565 jstring _conv = str_ref_to_ts(_str.chars, _str.len);
15569 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, int8_tArray val) {
15570 LDKLightningError this_ptr_conv;
15571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15572 this_ptr_conv.is_owned = false;
15573 LDKCVec_u8Z val_ref;
15574 val_ref.datalen = *((uint32_t*)val);
15575 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
15576 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
15577 LightningError_set_err(&this_ptr_conv, val_ref);
15580 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
15581 LDKLightningError this_ptr_conv;
15582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15583 this_ptr_conv.is_owned = false;
15584 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
15585 *ret_copy = LightningError_get_action(&this_ptr_conv);
15586 long ret_ref = (long)ret_copy;
15590 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
15591 LDKLightningError this_ptr_conv;
15592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15593 this_ptr_conv.is_owned = false;
15594 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
15596 LightningError_set_action(&this_ptr_conv, val_conv);
15599 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(int8_tArray err_arg, uint32_t action_arg) {
15600 LDKCVec_u8Z err_arg_ref;
15601 err_arg_ref.datalen = *((uint32_t*)err_arg);
15602 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
15603 memcpy(err_arg_ref.data, (uint8_t*)(err_arg + 4), err_arg_ref.datalen);
15604 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
15605 FREE((void*)action_arg);
15606 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
15607 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15608 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15609 long ret_ref = (long)ret_var.inner;
15610 if (ret_var.is_owned) {
15616 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
15617 LDKLightningError orig_conv;
15618 orig_conv.inner = (void*)(orig & (~1));
15619 orig_conv.is_owned = false;
15620 LDKLightningError ret_var = LightningError_clone(&orig_conv);
15621 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15622 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15623 long ret_ref = (long)ret_var.inner;
15624 if (ret_var.is_owned) {
15630 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
15631 LDKCommitmentUpdate this_obj_conv;
15632 this_obj_conv.inner = (void*)(this_obj & (~1));
15633 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15634 CommitmentUpdate_free(this_obj_conv);
15637 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
15638 LDKCommitmentUpdate this_ptr_conv;
15639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15640 this_ptr_conv.is_owned = false;
15641 LDKCVec_UpdateAddHTLCZ val_constr;
15642 val_constr.datalen = *((uint32_t*)val);
15643 if (val_constr.datalen > 0)
15644 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
15646 val_constr.data = NULL;
15647 uint32_t* val_vals = (uint32_t*)(val + 4);
15648 for (size_t p = 0; p < val_constr.datalen; p++) {
15649 uint32_t val_conv_15 = val_vals[p];
15650 LDKUpdateAddHTLC val_conv_15_conv;
15651 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
15652 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
15653 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
15654 val_constr.data[p] = val_conv_15_conv;
15656 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
15659 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
15660 LDKCommitmentUpdate this_ptr_conv;
15661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15662 this_ptr_conv.is_owned = false;
15663 LDKCVec_UpdateFulfillHTLCZ val_constr;
15664 val_constr.datalen = *((uint32_t*)val);
15665 if (val_constr.datalen > 0)
15666 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
15668 val_constr.data = NULL;
15669 uint32_t* val_vals = (uint32_t*)(val + 4);
15670 for (size_t t = 0; t < val_constr.datalen; t++) {
15671 uint32_t val_conv_19 = val_vals[t];
15672 LDKUpdateFulfillHTLC val_conv_19_conv;
15673 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
15674 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
15675 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
15676 val_constr.data[t] = val_conv_19_conv;
15678 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
15681 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
15682 LDKCommitmentUpdate this_ptr_conv;
15683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15684 this_ptr_conv.is_owned = false;
15685 LDKCVec_UpdateFailHTLCZ val_constr;
15686 val_constr.datalen = *((uint32_t*)val);
15687 if (val_constr.datalen > 0)
15688 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
15690 val_constr.data = NULL;
15691 uint32_t* val_vals = (uint32_t*)(val + 4);
15692 for (size_t q = 0; q < val_constr.datalen; q++) {
15693 uint32_t val_conv_16 = val_vals[q];
15694 LDKUpdateFailHTLC val_conv_16_conv;
15695 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
15696 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
15697 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
15698 val_constr.data[q] = val_conv_16_conv;
15700 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
15703 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
15704 LDKCommitmentUpdate this_ptr_conv;
15705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15706 this_ptr_conv.is_owned = false;
15707 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
15708 val_constr.datalen = *((uint32_t*)val);
15709 if (val_constr.datalen > 0)
15710 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
15712 val_constr.data = NULL;
15713 uint32_t* val_vals = (uint32_t*)(val + 4);
15714 for (size_t z = 0; z < val_constr.datalen; z++) {
15715 uint32_t val_conv_25 = val_vals[z];
15716 LDKUpdateFailMalformedHTLC val_conv_25_conv;
15717 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
15718 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
15719 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
15720 val_constr.data[z] = val_conv_25_conv;
15722 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
15725 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
15726 LDKCommitmentUpdate this_ptr_conv;
15727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15728 this_ptr_conv.is_owned = false;
15729 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
15730 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15731 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15732 long ret_ref = (long)ret_var.inner;
15733 if (ret_var.is_owned) {
15739 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
15740 LDKCommitmentUpdate this_ptr_conv;
15741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15742 this_ptr_conv.is_owned = false;
15743 LDKUpdateFee val_conv;
15744 val_conv.inner = (void*)(val & (~1));
15745 val_conv.is_owned = (val & 1) || (val == 0);
15746 val_conv = UpdateFee_clone(&val_conv);
15747 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
15750 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
15751 LDKCommitmentUpdate this_ptr_conv;
15752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15753 this_ptr_conv.is_owned = false;
15754 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
15755 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15756 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15757 long ret_ref = (long)ret_var.inner;
15758 if (ret_var.is_owned) {
15764 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
15765 LDKCommitmentUpdate this_ptr_conv;
15766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15767 this_ptr_conv.is_owned = false;
15768 LDKCommitmentSigned val_conv;
15769 val_conv.inner = (void*)(val & (~1));
15770 val_conv.is_owned = (val & 1) || (val == 0);
15771 val_conv = CommitmentSigned_clone(&val_conv);
15772 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
15775 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) {
15776 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
15777 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
15778 if (update_add_htlcs_arg_constr.datalen > 0)
15779 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
15781 update_add_htlcs_arg_constr.data = NULL;
15782 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
15783 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
15784 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
15785 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
15786 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
15787 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
15788 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
15789 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
15791 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
15792 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
15793 if (update_fulfill_htlcs_arg_constr.datalen > 0)
15794 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
15796 update_fulfill_htlcs_arg_constr.data = NULL;
15797 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
15798 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
15799 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
15800 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
15801 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
15802 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
15803 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
15804 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
15806 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
15807 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
15808 if (update_fail_htlcs_arg_constr.datalen > 0)
15809 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
15811 update_fail_htlcs_arg_constr.data = NULL;
15812 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
15813 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
15814 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
15815 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
15816 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
15817 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
15818 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
15819 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
15821 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
15822 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
15823 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
15824 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
15826 update_fail_malformed_htlcs_arg_constr.data = NULL;
15827 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
15828 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
15829 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
15830 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
15831 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
15832 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);
15833 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
15834 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
15836 LDKUpdateFee update_fee_arg_conv;
15837 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
15838 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
15839 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
15840 LDKCommitmentSigned commitment_signed_arg_conv;
15841 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
15842 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
15843 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
15844 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);
15845 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15846 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15847 long ret_ref = (long)ret_var.inner;
15848 if (ret_var.is_owned) {
15854 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
15855 LDKCommitmentUpdate orig_conv;
15856 orig_conv.inner = (void*)(orig & (~1));
15857 orig_conv.is_owned = false;
15858 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
15859 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15860 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15861 long ret_ref = (long)ret_var.inner;
15862 if (ret_var.is_owned) {
15868 void __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_free(uint32_t this_ptr) {
15869 if ((this_ptr & 1) != 0) return;
15870 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
15871 FREE((void*)this_ptr);
15872 HTLCFailChannelUpdate_free(this_ptr_conv);
15875 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_clone(uint32_t orig) {
15876 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
15877 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
15878 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
15879 long ret_ref = (long)ret_copy;
15883 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
15884 if ((this_ptr & 1) != 0) return;
15885 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
15886 FREE((void*)this_ptr);
15887 ChannelMessageHandler_free(this_ptr_conv);
15890 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
15891 if ((this_ptr & 1) != 0) return;
15892 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
15893 FREE((void*)this_ptr);
15894 RoutingMessageHandler_free(this_ptr_conv);
15897 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
15898 LDKAcceptChannel obj_conv;
15899 obj_conv.inner = (void*)(obj & (~1));
15900 obj_conv.is_owned = false;
15901 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
15902 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15903 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15904 CVec_u8Z_free(ret_var);
15908 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
15909 LDKu8slice ser_ref;
15910 ser_ref.datalen = *((uint32_t*)ser);
15911 ser_ref.data = (int8_t*)(ser + 4);
15912 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
15913 *ret_conv = AcceptChannel_read(ser_ref);
15914 return (long)ret_conv;
15917 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
15918 LDKAnnouncementSignatures obj_conv;
15919 obj_conv.inner = (void*)(obj & (~1));
15920 obj_conv.is_owned = false;
15921 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
15922 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15923 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15924 CVec_u8Z_free(ret_var);
15928 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
15929 LDKu8slice ser_ref;
15930 ser_ref.datalen = *((uint32_t*)ser);
15931 ser_ref.data = (int8_t*)(ser + 4);
15932 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
15933 *ret_conv = AnnouncementSignatures_read(ser_ref);
15934 return (long)ret_conv;
15937 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
15938 LDKChannelReestablish obj_conv;
15939 obj_conv.inner = (void*)(obj & (~1));
15940 obj_conv.is_owned = false;
15941 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
15942 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15943 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15944 CVec_u8Z_free(ret_var);
15948 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
15949 LDKu8slice ser_ref;
15950 ser_ref.datalen = *((uint32_t*)ser);
15951 ser_ref.data = (int8_t*)(ser + 4);
15952 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
15953 *ret_conv = ChannelReestablish_read(ser_ref);
15954 return (long)ret_conv;
15957 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
15958 LDKClosingSigned obj_conv;
15959 obj_conv.inner = (void*)(obj & (~1));
15960 obj_conv.is_owned = false;
15961 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
15962 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15963 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15964 CVec_u8Z_free(ret_var);
15968 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
15969 LDKu8slice ser_ref;
15970 ser_ref.datalen = *((uint32_t*)ser);
15971 ser_ref.data = (int8_t*)(ser + 4);
15972 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
15973 *ret_conv = ClosingSigned_read(ser_ref);
15974 return (long)ret_conv;
15977 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
15978 LDKCommitmentSigned obj_conv;
15979 obj_conv.inner = (void*)(obj & (~1));
15980 obj_conv.is_owned = false;
15981 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
15982 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15983 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15984 CVec_u8Z_free(ret_var);
15988 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
15989 LDKu8slice ser_ref;
15990 ser_ref.datalen = *((uint32_t*)ser);
15991 ser_ref.data = (int8_t*)(ser + 4);
15992 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
15993 *ret_conv = CommitmentSigned_read(ser_ref);
15994 return (long)ret_conv;
15997 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
15998 LDKFundingCreated obj_conv;
15999 obj_conv.inner = (void*)(obj & (~1));
16000 obj_conv.is_owned = false;
16001 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
16002 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16003 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16004 CVec_u8Z_free(ret_var);
16008 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
16009 LDKu8slice ser_ref;
16010 ser_ref.datalen = *((uint32_t*)ser);
16011 ser_ref.data = (int8_t*)(ser + 4);
16012 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
16013 *ret_conv = FundingCreated_read(ser_ref);
16014 return (long)ret_conv;
16017 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
16018 LDKFundingSigned obj_conv;
16019 obj_conv.inner = (void*)(obj & (~1));
16020 obj_conv.is_owned = false;
16021 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
16022 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16023 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16024 CVec_u8Z_free(ret_var);
16028 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
16029 LDKu8slice ser_ref;
16030 ser_ref.datalen = *((uint32_t*)ser);
16031 ser_ref.data = (int8_t*)(ser + 4);
16032 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
16033 *ret_conv = FundingSigned_read(ser_ref);
16034 return (long)ret_conv;
16037 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
16038 LDKFundingLocked obj_conv;
16039 obj_conv.inner = (void*)(obj & (~1));
16040 obj_conv.is_owned = false;
16041 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
16042 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16043 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16044 CVec_u8Z_free(ret_var);
16048 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
16049 LDKu8slice ser_ref;
16050 ser_ref.datalen = *((uint32_t*)ser);
16051 ser_ref.data = (int8_t*)(ser + 4);
16052 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
16053 *ret_conv = FundingLocked_read(ser_ref);
16054 return (long)ret_conv;
16057 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
16059 obj_conv.inner = (void*)(obj & (~1));
16060 obj_conv.is_owned = false;
16061 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
16062 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16063 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16064 CVec_u8Z_free(ret_var);
16068 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
16069 LDKu8slice ser_ref;
16070 ser_ref.datalen = *((uint32_t*)ser);
16071 ser_ref.data = (int8_t*)(ser + 4);
16072 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
16073 *ret_conv = Init_read(ser_ref);
16074 return (long)ret_conv;
16077 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
16078 LDKOpenChannel obj_conv;
16079 obj_conv.inner = (void*)(obj & (~1));
16080 obj_conv.is_owned = false;
16081 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
16082 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16083 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16084 CVec_u8Z_free(ret_var);
16088 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
16089 LDKu8slice ser_ref;
16090 ser_ref.datalen = *((uint32_t*)ser);
16091 ser_ref.data = (int8_t*)(ser + 4);
16092 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
16093 *ret_conv = OpenChannel_read(ser_ref);
16094 return (long)ret_conv;
16097 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
16098 LDKRevokeAndACK obj_conv;
16099 obj_conv.inner = (void*)(obj & (~1));
16100 obj_conv.is_owned = false;
16101 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
16102 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16103 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16104 CVec_u8Z_free(ret_var);
16108 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
16109 LDKu8slice ser_ref;
16110 ser_ref.datalen = *((uint32_t*)ser);
16111 ser_ref.data = (int8_t*)(ser + 4);
16112 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
16113 *ret_conv = RevokeAndACK_read(ser_ref);
16114 return (long)ret_conv;
16117 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
16118 LDKShutdown obj_conv;
16119 obj_conv.inner = (void*)(obj & (~1));
16120 obj_conv.is_owned = false;
16121 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
16122 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16123 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16124 CVec_u8Z_free(ret_var);
16128 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
16129 LDKu8slice ser_ref;
16130 ser_ref.datalen = *((uint32_t*)ser);
16131 ser_ref.data = (int8_t*)(ser + 4);
16132 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
16133 *ret_conv = Shutdown_read(ser_ref);
16134 return (long)ret_conv;
16137 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
16138 LDKUpdateFailHTLC obj_conv;
16139 obj_conv.inner = (void*)(obj & (~1));
16140 obj_conv.is_owned = false;
16141 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
16142 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16143 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16144 CVec_u8Z_free(ret_var);
16148 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
16149 LDKu8slice ser_ref;
16150 ser_ref.datalen = *((uint32_t*)ser);
16151 ser_ref.data = (int8_t*)(ser + 4);
16152 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
16153 *ret_conv = UpdateFailHTLC_read(ser_ref);
16154 return (long)ret_conv;
16157 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
16158 LDKUpdateFailMalformedHTLC obj_conv;
16159 obj_conv.inner = (void*)(obj & (~1));
16160 obj_conv.is_owned = false;
16161 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
16162 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16163 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16164 CVec_u8Z_free(ret_var);
16168 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
16169 LDKu8slice ser_ref;
16170 ser_ref.datalen = *((uint32_t*)ser);
16171 ser_ref.data = (int8_t*)(ser + 4);
16172 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
16173 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
16174 return (long)ret_conv;
16177 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
16178 LDKUpdateFee obj_conv;
16179 obj_conv.inner = (void*)(obj & (~1));
16180 obj_conv.is_owned = false;
16181 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
16182 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16183 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16184 CVec_u8Z_free(ret_var);
16188 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
16189 LDKu8slice ser_ref;
16190 ser_ref.datalen = *((uint32_t*)ser);
16191 ser_ref.data = (int8_t*)(ser + 4);
16192 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
16193 *ret_conv = UpdateFee_read(ser_ref);
16194 return (long)ret_conv;
16197 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
16198 LDKUpdateFulfillHTLC obj_conv;
16199 obj_conv.inner = (void*)(obj & (~1));
16200 obj_conv.is_owned = false;
16201 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
16202 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16203 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16204 CVec_u8Z_free(ret_var);
16208 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
16209 LDKu8slice ser_ref;
16210 ser_ref.datalen = *((uint32_t*)ser);
16211 ser_ref.data = (int8_t*)(ser + 4);
16212 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
16213 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
16214 return (long)ret_conv;
16217 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
16218 LDKUpdateAddHTLC obj_conv;
16219 obj_conv.inner = (void*)(obj & (~1));
16220 obj_conv.is_owned = false;
16221 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
16222 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16223 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16224 CVec_u8Z_free(ret_var);
16228 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
16229 LDKu8slice ser_ref;
16230 ser_ref.datalen = *((uint32_t*)ser);
16231 ser_ref.data = (int8_t*)(ser + 4);
16232 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
16233 *ret_conv = UpdateAddHTLC_read(ser_ref);
16234 return (long)ret_conv;
16237 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
16239 obj_conv.inner = (void*)(obj & (~1));
16240 obj_conv.is_owned = false;
16241 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
16242 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16243 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16244 CVec_u8Z_free(ret_var);
16248 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
16249 LDKu8slice ser_ref;
16250 ser_ref.datalen = *((uint32_t*)ser);
16251 ser_ref.data = (int8_t*)(ser + 4);
16252 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
16253 *ret_conv = Ping_read(ser_ref);
16254 return (long)ret_conv;
16257 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
16259 obj_conv.inner = (void*)(obj & (~1));
16260 obj_conv.is_owned = false;
16261 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
16262 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16263 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16264 CVec_u8Z_free(ret_var);
16268 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
16269 LDKu8slice ser_ref;
16270 ser_ref.datalen = *((uint32_t*)ser);
16271 ser_ref.data = (int8_t*)(ser + 4);
16272 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
16273 *ret_conv = Pong_read(ser_ref);
16274 return (long)ret_conv;
16277 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
16278 LDKUnsignedChannelAnnouncement obj_conv;
16279 obj_conv.inner = (void*)(obj & (~1));
16280 obj_conv.is_owned = false;
16281 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
16282 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16283 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16284 CVec_u8Z_free(ret_var);
16288 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
16289 LDKu8slice ser_ref;
16290 ser_ref.datalen = *((uint32_t*)ser);
16291 ser_ref.data = (int8_t*)(ser + 4);
16292 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
16293 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
16294 return (long)ret_conv;
16297 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
16298 LDKChannelAnnouncement obj_conv;
16299 obj_conv.inner = (void*)(obj & (~1));
16300 obj_conv.is_owned = false;
16301 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
16302 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16303 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16304 CVec_u8Z_free(ret_var);
16308 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
16309 LDKu8slice ser_ref;
16310 ser_ref.datalen = *((uint32_t*)ser);
16311 ser_ref.data = (int8_t*)(ser + 4);
16312 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
16313 *ret_conv = ChannelAnnouncement_read(ser_ref);
16314 return (long)ret_conv;
16317 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
16318 LDKUnsignedChannelUpdate obj_conv;
16319 obj_conv.inner = (void*)(obj & (~1));
16320 obj_conv.is_owned = false;
16321 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
16322 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16323 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16324 CVec_u8Z_free(ret_var);
16328 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
16329 LDKu8slice ser_ref;
16330 ser_ref.datalen = *((uint32_t*)ser);
16331 ser_ref.data = (int8_t*)(ser + 4);
16332 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
16333 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
16334 return (long)ret_conv;
16337 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
16338 LDKChannelUpdate obj_conv;
16339 obj_conv.inner = (void*)(obj & (~1));
16340 obj_conv.is_owned = false;
16341 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
16342 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16343 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16344 CVec_u8Z_free(ret_var);
16348 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
16349 LDKu8slice ser_ref;
16350 ser_ref.datalen = *((uint32_t*)ser);
16351 ser_ref.data = (int8_t*)(ser + 4);
16352 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
16353 *ret_conv = ChannelUpdate_read(ser_ref);
16354 return (long)ret_conv;
16357 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
16358 LDKErrorMessage obj_conv;
16359 obj_conv.inner = (void*)(obj & (~1));
16360 obj_conv.is_owned = false;
16361 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
16362 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16363 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16364 CVec_u8Z_free(ret_var);
16368 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
16369 LDKu8slice ser_ref;
16370 ser_ref.datalen = *((uint32_t*)ser);
16371 ser_ref.data = (int8_t*)(ser + 4);
16372 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
16373 *ret_conv = ErrorMessage_read(ser_ref);
16374 return (long)ret_conv;
16377 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
16378 LDKUnsignedNodeAnnouncement obj_conv;
16379 obj_conv.inner = (void*)(obj & (~1));
16380 obj_conv.is_owned = false;
16381 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
16382 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16383 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16384 CVec_u8Z_free(ret_var);
16388 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
16389 LDKu8slice ser_ref;
16390 ser_ref.datalen = *((uint32_t*)ser);
16391 ser_ref.data = (int8_t*)(ser + 4);
16392 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
16393 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
16394 return (long)ret_conv;
16397 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
16398 LDKNodeAnnouncement obj_conv;
16399 obj_conv.inner = (void*)(obj & (~1));
16400 obj_conv.is_owned = false;
16401 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
16402 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16403 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16404 CVec_u8Z_free(ret_var);
16408 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
16409 LDKu8slice ser_ref;
16410 ser_ref.datalen = *((uint32_t*)ser);
16411 ser_ref.data = (int8_t*)(ser + 4);
16412 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
16413 *ret_conv = NodeAnnouncement_read(ser_ref);
16414 return (long)ret_conv;
16417 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
16418 LDKu8slice ser_ref;
16419 ser_ref.datalen = *((uint32_t*)ser);
16420 ser_ref.data = (int8_t*)(ser + 4);
16421 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
16422 *ret_conv = QueryShortChannelIds_read(ser_ref);
16423 return (long)ret_conv;
16426 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
16427 LDKQueryShortChannelIds obj_conv;
16428 obj_conv.inner = (void*)(obj & (~1));
16429 obj_conv.is_owned = false;
16430 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
16431 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16432 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16433 CVec_u8Z_free(ret_var);
16437 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
16438 LDKu8slice ser_ref;
16439 ser_ref.datalen = *((uint32_t*)ser);
16440 ser_ref.data = (int8_t*)(ser + 4);
16441 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
16442 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
16443 return (long)ret_conv;
16446 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
16447 LDKReplyShortChannelIdsEnd obj_conv;
16448 obj_conv.inner = (void*)(obj & (~1));
16449 obj_conv.is_owned = false;
16450 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
16451 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16452 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16453 CVec_u8Z_free(ret_var);
16457 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
16458 LDKQueryChannelRange this_arg_conv;
16459 this_arg_conv.inner = (void*)(this_arg & (~1));
16460 this_arg_conv.is_owned = false;
16461 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
16465 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
16466 LDKu8slice ser_ref;
16467 ser_ref.datalen = *((uint32_t*)ser);
16468 ser_ref.data = (int8_t*)(ser + 4);
16469 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
16470 *ret_conv = QueryChannelRange_read(ser_ref);
16471 return (long)ret_conv;
16474 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
16475 LDKQueryChannelRange obj_conv;
16476 obj_conv.inner = (void*)(obj & (~1));
16477 obj_conv.is_owned = false;
16478 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
16479 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16480 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16481 CVec_u8Z_free(ret_var);
16485 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
16486 LDKu8slice ser_ref;
16487 ser_ref.datalen = *((uint32_t*)ser);
16488 ser_ref.data = (int8_t*)(ser + 4);
16489 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
16490 *ret_conv = ReplyChannelRange_read(ser_ref);
16491 return (long)ret_conv;
16494 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
16495 LDKReplyChannelRange obj_conv;
16496 obj_conv.inner = (void*)(obj & (~1));
16497 obj_conv.is_owned = false;
16498 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
16499 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16500 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16501 CVec_u8Z_free(ret_var);
16505 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
16506 LDKu8slice ser_ref;
16507 ser_ref.datalen = *((uint32_t*)ser);
16508 ser_ref.data = (int8_t*)(ser + 4);
16509 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
16510 *ret_conv = GossipTimestampFilter_read(ser_ref);
16511 return (long)ret_conv;
16514 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
16515 LDKGossipTimestampFilter obj_conv;
16516 obj_conv.inner = (void*)(obj & (~1));
16517 obj_conv.is_owned = false;
16518 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
16519 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16520 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16521 CVec_u8Z_free(ret_var);
16525 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
16526 LDKIgnoringMessageHandler this_obj_conv;
16527 this_obj_conv.inner = (void*)(this_obj & (~1));
16528 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16529 IgnoringMessageHandler_free(this_obj_conv);
16532 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
16533 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
16534 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16535 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16536 long ret_ref = (long)ret_var.inner;
16537 if (ret_var.is_owned) {
16543 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
16544 LDKIgnoringMessageHandler this_arg_conv;
16545 this_arg_conv.inner = (void*)(this_arg & (~1));
16546 this_arg_conv.is_owned = false;
16547 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16548 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
16552 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
16553 LDKIgnoringMessageHandler this_arg_conv;
16554 this_arg_conv.inner = (void*)(this_arg & (~1));
16555 this_arg_conv.is_owned = false;
16556 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
16557 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
16561 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
16562 LDKErroringMessageHandler this_obj_conv;
16563 this_obj_conv.inner = (void*)(this_obj & (~1));
16564 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16565 ErroringMessageHandler_free(this_obj_conv);
16568 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
16569 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
16570 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16571 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16572 long ret_ref = (long)ret_var.inner;
16573 if (ret_var.is_owned) {
16579 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
16580 LDKErroringMessageHandler this_arg_conv;
16581 this_arg_conv.inner = (void*)(this_arg & (~1));
16582 this_arg_conv.is_owned = false;
16583 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16584 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
16588 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
16589 LDKErroringMessageHandler this_arg_conv;
16590 this_arg_conv.inner = (void*)(this_arg & (~1));
16591 this_arg_conv.is_owned = false;
16592 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
16593 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
16597 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
16598 LDKMessageHandler this_obj_conv;
16599 this_obj_conv.inner = (void*)(this_obj & (~1));
16600 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16601 MessageHandler_free(this_obj_conv);
16604 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
16605 LDKMessageHandler this_ptr_conv;
16606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16607 this_ptr_conv.is_owned = false;
16608 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
16612 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
16613 LDKMessageHandler this_ptr_conv;
16614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16615 this_ptr_conv.is_owned = false;
16616 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
16617 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
16620 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
16621 LDKMessageHandler this_ptr_conv;
16622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16623 this_ptr_conv.is_owned = false;
16624 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
16628 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
16629 LDKMessageHandler this_ptr_conv;
16630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16631 this_ptr_conv.is_owned = false;
16632 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
16633 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
16636 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
16637 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
16638 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
16639 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
16640 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16641 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16642 long ret_ref = (long)ret_var.inner;
16643 if (ret_var.is_owned) {
16649 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
16650 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
16651 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
16652 *ret = SocketDescriptor_clone(orig_conv);
16656 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
16657 if ((this_ptr & 1) != 0) return;
16658 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
16659 FREE((void*)this_ptr);
16660 SocketDescriptor_free(this_ptr_conv);
16663 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
16664 LDKPeerHandleError this_obj_conv;
16665 this_obj_conv.inner = (void*)(this_obj & (~1));
16666 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16667 PeerHandleError_free(this_obj_conv);
16670 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
16671 LDKPeerHandleError this_ptr_conv;
16672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16673 this_ptr_conv.is_owned = false;
16674 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
16678 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
16679 LDKPeerHandleError this_ptr_conv;
16680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16681 this_ptr_conv.is_owned = false;
16682 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
16685 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
16686 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
16687 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16688 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16689 long ret_ref = (long)ret_var.inner;
16690 if (ret_var.is_owned) {
16696 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
16697 LDKPeerHandleError orig_conv;
16698 orig_conv.inner = (void*)(orig & (~1));
16699 orig_conv.is_owned = false;
16700 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
16701 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16702 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16703 long ret_ref = (long)ret_var.inner;
16704 if (ret_var.is_owned) {
16710 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
16711 LDKPeerManager this_obj_conv;
16712 this_obj_conv.inner = (void*)(this_obj & (~1));
16713 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16714 PeerManager_free(this_obj_conv);
16717 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) {
16718 LDKMessageHandler message_handler_conv;
16719 message_handler_conv.inner = (void*)(message_handler & (~1));
16720 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
16721 // Warning: we need a move here but no clone is available for LDKMessageHandler
16722 LDKSecretKey our_node_secret_ref;
16723 CHECK(*((uint32_t*)our_node_secret) == 32);
16724 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
16725 unsigned char ephemeral_random_data_arr[32];
16726 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
16727 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
16728 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
16729 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16730 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
16731 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16732 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16733 long ret_ref = (long)ret_var.inner;
16734 if (ret_var.is_owned) {
16740 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
16741 LDKPeerManager this_arg_conv;
16742 this_arg_conv.inner = (void*)(this_arg & (~1));
16743 this_arg_conv.is_owned = false;
16744 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
16745 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
16746 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
16747 for (size_t m = 0; m < ret_var.datalen; m++) {
16748 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16749 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
16750 ret_arr_ptr[m] = ret_conv_12_arr;
16752 FREE(ret_var.data);
16756 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
16757 LDKPeerManager this_arg_conv;
16758 this_arg_conv.inner = (void*)(this_arg & (~1));
16759 this_arg_conv.is_owned = false;
16760 LDKPublicKey their_node_id_ref;
16761 CHECK(*((uint32_t*)their_node_id) == 33);
16762 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
16763 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16764 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
16765 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
16766 return (long)ret_conv;
16769 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
16770 LDKPeerManager this_arg_conv;
16771 this_arg_conv.inner = (void*)(this_arg & (~1));
16772 this_arg_conv.is_owned = false;
16773 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16774 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16775 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
16776 return (long)ret_conv;
16779 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
16780 LDKPeerManager this_arg_conv;
16781 this_arg_conv.inner = (void*)(this_arg & (~1));
16782 this_arg_conv.is_owned = false;
16783 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16784 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16785 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
16786 return (long)ret_conv;
16789 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
16790 LDKPeerManager this_arg_conv;
16791 this_arg_conv.inner = (void*)(this_arg & (~1));
16792 this_arg_conv.is_owned = false;
16793 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
16794 LDKu8slice data_ref;
16795 data_ref.datalen = *((uint32_t*)data);
16796 data_ref.data = (int8_t*)(data + 4);
16797 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
16798 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
16799 return (long)ret_conv;
16802 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
16803 LDKPeerManager this_arg_conv;
16804 this_arg_conv.inner = (void*)(this_arg & (~1));
16805 this_arg_conv.is_owned = false;
16806 PeerManager_process_events(&this_arg_conv);
16809 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
16810 LDKPeerManager this_arg_conv;
16811 this_arg_conv.inner = (void*)(this_arg & (~1));
16812 this_arg_conv.is_owned = false;
16813 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16814 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
16817 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
16818 LDKPeerManager this_arg_conv;
16819 this_arg_conv.inner = (void*)(this_arg & (~1));
16820 this_arg_conv.is_owned = false;
16821 LDKPublicKey node_id_ref;
16822 CHECK(*((uint32_t*)node_id) == 33);
16823 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16824 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
16827 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
16828 LDKPeerManager this_arg_conv;
16829 this_arg_conv.inner = (void*)(this_arg & (~1));
16830 this_arg_conv.is_owned = false;
16831 PeerManager_timer_tick_occurred(&this_arg_conv);
16834 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
16835 unsigned char commitment_seed_arr[32];
16836 CHECK(*((uint32_t*)commitment_seed) == 32);
16837 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
16838 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
16839 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16840 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
16844 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
16845 LDKPublicKey per_commitment_point_ref;
16846 CHECK(*((uint32_t*)per_commitment_point) == 33);
16847 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16848 unsigned char base_secret_arr[32];
16849 CHECK(*((uint32_t*)base_secret) == 32);
16850 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
16851 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
16852 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
16853 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
16854 return (long)ret_conv;
16857 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
16858 LDKPublicKey per_commitment_point_ref;
16859 CHECK(*((uint32_t*)per_commitment_point) == 33);
16860 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16861 LDKPublicKey base_point_ref;
16862 CHECK(*((uint32_t*)base_point) == 33);
16863 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
16864 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
16865 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
16866 return (long)ret_conv;
16869 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
16870 unsigned char per_commitment_secret_arr[32];
16871 CHECK(*((uint32_t*)per_commitment_secret) == 32);
16872 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
16873 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
16874 unsigned char countersignatory_revocation_base_secret_arr[32];
16875 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
16876 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
16877 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
16878 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
16879 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
16880 return (long)ret_conv;
16883 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
16884 LDKPublicKey per_commitment_point_ref;
16885 CHECK(*((uint32_t*)per_commitment_point) == 33);
16886 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16887 LDKPublicKey countersignatory_revocation_base_point_ref;
16888 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
16889 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
16890 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
16891 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
16892 return (long)ret_conv;
16895 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
16896 LDKTxCreationKeys this_obj_conv;
16897 this_obj_conv.inner = (void*)(this_obj & (~1));
16898 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16899 TxCreationKeys_free(this_obj_conv);
16902 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
16903 LDKTxCreationKeys this_ptr_conv;
16904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16905 this_ptr_conv.is_owned = false;
16906 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16907 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16911 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16912 LDKTxCreationKeys this_ptr_conv;
16913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16914 this_ptr_conv.is_owned = false;
16915 LDKPublicKey val_ref;
16916 CHECK(*((uint32_t*)val) == 33);
16917 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16918 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
16921 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
16922 LDKTxCreationKeys this_ptr_conv;
16923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16924 this_ptr_conv.is_owned = false;
16925 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16926 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
16930 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
16931 LDKTxCreationKeys this_ptr_conv;
16932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16933 this_ptr_conv.is_owned = false;
16934 LDKPublicKey val_ref;
16935 CHECK(*((uint32_t*)val) == 33);
16936 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16937 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
16940 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
16941 LDKTxCreationKeys this_ptr_conv;
16942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16943 this_ptr_conv.is_owned = false;
16944 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16945 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
16949 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
16950 LDKTxCreationKeys this_ptr_conv;
16951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16952 this_ptr_conv.is_owned = false;
16953 LDKPublicKey val_ref;
16954 CHECK(*((uint32_t*)val) == 33);
16955 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16956 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
16959 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
16960 LDKTxCreationKeys this_ptr_conv;
16961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16962 this_ptr_conv.is_owned = false;
16963 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16964 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
16968 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
16969 LDKTxCreationKeys this_ptr_conv;
16970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16971 this_ptr_conv.is_owned = false;
16972 LDKPublicKey val_ref;
16973 CHECK(*((uint32_t*)val) == 33);
16974 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16975 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
16978 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
16979 LDKTxCreationKeys this_ptr_conv;
16980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16981 this_ptr_conv.is_owned = false;
16982 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16983 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
16987 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
16988 LDKTxCreationKeys this_ptr_conv;
16989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16990 this_ptr_conv.is_owned = false;
16991 LDKPublicKey val_ref;
16992 CHECK(*((uint32_t*)val) == 33);
16993 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16994 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
16997 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) {
16998 LDKPublicKey per_commitment_point_arg_ref;
16999 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
17000 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
17001 LDKPublicKey revocation_key_arg_ref;
17002 CHECK(*((uint32_t*)revocation_key_arg) == 33);
17003 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
17004 LDKPublicKey broadcaster_htlc_key_arg_ref;
17005 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
17006 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
17007 LDKPublicKey countersignatory_htlc_key_arg_ref;
17008 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
17009 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
17010 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
17011 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
17012 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
17013 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);
17014 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17015 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17016 long ret_ref = (long)ret_var.inner;
17017 if (ret_var.is_owned) {
17023 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
17024 LDKTxCreationKeys orig_conv;
17025 orig_conv.inner = (void*)(orig & (~1));
17026 orig_conv.is_owned = false;
17027 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
17028 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17029 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17030 long ret_ref = (long)ret_var.inner;
17031 if (ret_var.is_owned) {
17037 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
17038 LDKTxCreationKeys obj_conv;
17039 obj_conv.inner = (void*)(obj & (~1));
17040 obj_conv.is_owned = false;
17041 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
17042 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17043 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17044 CVec_u8Z_free(ret_var);
17048 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
17049 LDKu8slice ser_ref;
17050 ser_ref.datalen = *((uint32_t*)ser);
17051 ser_ref.data = (int8_t*)(ser + 4);
17052 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
17053 *ret_conv = TxCreationKeys_read(ser_ref);
17054 return (long)ret_conv;
17057 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
17058 LDKChannelPublicKeys this_obj_conv;
17059 this_obj_conv.inner = (void*)(this_obj & (~1));
17060 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17061 ChannelPublicKeys_free(this_obj_conv);
17064 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
17065 LDKChannelPublicKeys this_ptr_conv;
17066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17067 this_ptr_conv.is_owned = false;
17068 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17069 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
17073 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
17074 LDKChannelPublicKeys this_ptr_conv;
17075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17076 this_ptr_conv.is_owned = false;
17077 LDKPublicKey val_ref;
17078 CHECK(*((uint32_t*)val) == 33);
17079 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17080 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
17083 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
17084 LDKChannelPublicKeys this_ptr_conv;
17085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17086 this_ptr_conv.is_owned = false;
17087 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17088 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
17092 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
17093 LDKChannelPublicKeys this_ptr_conv;
17094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17095 this_ptr_conv.is_owned = false;
17096 LDKPublicKey val_ref;
17097 CHECK(*((uint32_t*)val) == 33);
17098 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17099 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
17102 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
17103 LDKChannelPublicKeys this_ptr_conv;
17104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17105 this_ptr_conv.is_owned = false;
17106 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17107 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
17111 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
17112 LDKChannelPublicKeys this_ptr_conv;
17113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17114 this_ptr_conv.is_owned = false;
17115 LDKPublicKey val_ref;
17116 CHECK(*((uint32_t*)val) == 33);
17117 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17118 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
17121 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
17122 LDKChannelPublicKeys this_ptr_conv;
17123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17124 this_ptr_conv.is_owned = false;
17125 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17126 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
17130 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
17131 LDKChannelPublicKeys this_ptr_conv;
17132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17133 this_ptr_conv.is_owned = false;
17134 LDKPublicKey val_ref;
17135 CHECK(*((uint32_t*)val) == 33);
17136 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17137 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
17140 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
17141 LDKChannelPublicKeys this_ptr_conv;
17142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17143 this_ptr_conv.is_owned = false;
17144 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17145 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
17149 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
17150 LDKChannelPublicKeys this_ptr_conv;
17151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17152 this_ptr_conv.is_owned = false;
17153 LDKPublicKey val_ref;
17154 CHECK(*((uint32_t*)val) == 33);
17155 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17156 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
17159 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) {
17160 LDKPublicKey funding_pubkey_arg_ref;
17161 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
17162 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
17163 LDKPublicKey revocation_basepoint_arg_ref;
17164 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
17165 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
17166 LDKPublicKey payment_point_arg_ref;
17167 CHECK(*((uint32_t*)payment_point_arg) == 33);
17168 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
17169 LDKPublicKey delayed_payment_basepoint_arg_ref;
17170 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
17171 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
17172 LDKPublicKey htlc_basepoint_arg_ref;
17173 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
17174 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
17175 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);
17176 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17177 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17178 long ret_ref = (long)ret_var.inner;
17179 if (ret_var.is_owned) {
17185 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
17186 LDKChannelPublicKeys orig_conv;
17187 orig_conv.inner = (void*)(orig & (~1));
17188 orig_conv.is_owned = false;
17189 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
17190 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17191 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17192 long ret_ref = (long)ret_var.inner;
17193 if (ret_var.is_owned) {
17199 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
17200 LDKChannelPublicKeys obj_conv;
17201 obj_conv.inner = (void*)(obj & (~1));
17202 obj_conv.is_owned = false;
17203 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
17204 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17205 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17206 CVec_u8Z_free(ret_var);
17210 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
17211 LDKu8slice ser_ref;
17212 ser_ref.datalen = *((uint32_t*)ser);
17213 ser_ref.data = (int8_t*)(ser + 4);
17214 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
17215 *ret_conv = ChannelPublicKeys_read(ser_ref);
17216 return (long)ret_conv;
17219 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) {
17220 LDKPublicKey per_commitment_point_ref;
17221 CHECK(*((uint32_t*)per_commitment_point) == 33);
17222 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
17223 LDKPublicKey broadcaster_delayed_payment_base_ref;
17224 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
17225 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
17226 LDKPublicKey broadcaster_htlc_base_ref;
17227 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
17228 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
17229 LDKPublicKey countersignatory_revocation_base_ref;
17230 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
17231 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
17232 LDKPublicKey countersignatory_htlc_base_ref;
17233 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
17234 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
17235 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
17236 *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);
17237 return (long)ret_conv;
17240 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
17241 LDKPublicKey per_commitment_point_ref;
17242 CHECK(*((uint32_t*)per_commitment_point) == 33);
17243 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
17244 LDKChannelPublicKeys broadcaster_keys_conv;
17245 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
17246 broadcaster_keys_conv.is_owned = false;
17247 LDKChannelPublicKeys countersignatory_keys_conv;
17248 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
17249 countersignatory_keys_conv.is_owned = false;
17250 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
17251 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
17252 return (long)ret_conv;
17255 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
17256 LDKPublicKey revocation_key_ref;
17257 CHECK(*((uint32_t*)revocation_key) == 33);
17258 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
17259 LDKPublicKey broadcaster_delayed_payment_key_ref;
17260 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
17261 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
17262 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
17263 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17264 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17265 CVec_u8Z_free(ret_var);
17269 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
17270 LDKHTLCOutputInCommitment this_obj_conv;
17271 this_obj_conv.inner = (void*)(this_obj & (~1));
17272 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17273 HTLCOutputInCommitment_free(this_obj_conv);
17276 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
17277 LDKHTLCOutputInCommitment this_ptr_conv;
17278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17279 this_ptr_conv.is_owned = false;
17280 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
17284 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
17285 LDKHTLCOutputInCommitment this_ptr_conv;
17286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17287 this_ptr_conv.is_owned = false;
17288 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
17291 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
17292 LDKHTLCOutputInCommitment this_ptr_conv;
17293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17294 this_ptr_conv.is_owned = false;
17295 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
17299 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
17300 LDKHTLCOutputInCommitment this_ptr_conv;
17301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17302 this_ptr_conv.is_owned = false;
17303 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
17306 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
17307 LDKHTLCOutputInCommitment this_ptr_conv;
17308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17309 this_ptr_conv.is_owned = false;
17310 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
17314 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
17315 LDKHTLCOutputInCommitment this_ptr_conv;
17316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17317 this_ptr_conv.is_owned = false;
17318 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
17321 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
17322 LDKHTLCOutputInCommitment this_ptr_conv;
17323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17324 this_ptr_conv.is_owned = false;
17325 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17326 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
17330 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
17331 LDKHTLCOutputInCommitment this_ptr_conv;
17332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17333 this_ptr_conv.is_owned = false;
17334 LDKThirtyTwoBytes val_ref;
17335 CHECK(*((uint32_t*)val) == 32);
17336 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17337 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
17340 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
17341 LDKHTLCOutputInCommitment this_ptr_conv;
17342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17343 this_ptr_conv.is_owned = false;
17344 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17345 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
17346 long ret_ref = (long)ret_copy;
17350 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
17351 LDKHTLCOutputInCommitment this_ptr_conv;
17352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17353 this_ptr_conv.is_owned = false;
17354 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
17356 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
17359 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) {
17360 LDKThirtyTwoBytes payment_hash_arg_ref;
17361 CHECK(*((uint32_t*)payment_hash_arg) == 32);
17362 memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
17363 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
17364 FREE((void*)transaction_output_index_arg);
17365 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
17366 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17367 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17368 long ret_ref = (long)ret_var.inner;
17369 if (ret_var.is_owned) {
17375 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
17376 LDKHTLCOutputInCommitment orig_conv;
17377 orig_conv.inner = (void*)(orig & (~1));
17378 orig_conv.is_owned = false;
17379 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
17380 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17381 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17382 long ret_ref = (long)ret_var.inner;
17383 if (ret_var.is_owned) {
17389 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
17390 LDKHTLCOutputInCommitment obj_conv;
17391 obj_conv.inner = (void*)(obj & (~1));
17392 obj_conv.is_owned = false;
17393 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
17394 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17395 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17396 CVec_u8Z_free(ret_var);
17400 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
17401 LDKu8slice ser_ref;
17402 ser_ref.datalen = *((uint32_t*)ser);
17403 ser_ref.data = (int8_t*)(ser + 4);
17404 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
17405 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
17406 return (long)ret_conv;
17409 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
17410 LDKHTLCOutputInCommitment htlc_conv;
17411 htlc_conv.inner = (void*)(htlc & (~1));
17412 htlc_conv.is_owned = false;
17413 LDKTxCreationKeys keys_conv;
17414 keys_conv.inner = (void*)(keys & (~1));
17415 keys_conv.is_owned = false;
17416 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
17417 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17418 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17419 CVec_u8Z_free(ret_var);
17423 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
17424 LDKPublicKey broadcaster_ref;
17425 CHECK(*((uint32_t*)broadcaster) == 33);
17426 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
17427 LDKPublicKey countersignatory_ref;
17428 CHECK(*((uint32_t*)countersignatory) == 33);
17429 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
17430 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
17431 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17432 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17433 CVec_u8Z_free(ret_var);
17437 int8_tArray __attribute__((visibility("default"))) TS_build_htlc_transaction(int8_tArray prev_hash, int32_t feerate_per_kw, int16_t contest_delay, uint32_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
17438 unsigned char prev_hash_arr[32];
17439 CHECK(*((uint32_t*)prev_hash) == 32);
17440 memcpy(prev_hash_arr, (uint8_t*)(prev_hash + 4), 32);
17441 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
17442 LDKHTLCOutputInCommitment htlc_conv;
17443 htlc_conv.inner = (void*)(htlc & (~1));
17444 htlc_conv.is_owned = false;
17445 LDKPublicKey broadcaster_delayed_payment_key_ref;
17446 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
17447 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
17448 LDKPublicKey revocation_key_ref;
17449 CHECK(*((uint32_t*)revocation_key) == 33);
17450 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
17451 LDKTransaction ret_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
17452 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17453 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17454 Transaction_free(ret_var);
17458 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
17459 LDKChannelTransactionParameters this_obj_conv;
17460 this_obj_conv.inner = (void*)(this_obj & (~1));
17461 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17462 ChannelTransactionParameters_free(this_obj_conv);
17465 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
17466 LDKChannelTransactionParameters this_ptr_conv;
17467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17468 this_ptr_conv.is_owned = false;
17469 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
17470 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17471 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17472 long ret_ref = (long)ret_var.inner;
17473 if (ret_var.is_owned) {
17479 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
17480 LDKChannelTransactionParameters this_ptr_conv;
17481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17482 this_ptr_conv.is_owned = false;
17483 LDKChannelPublicKeys val_conv;
17484 val_conv.inner = (void*)(val & (~1));
17485 val_conv.is_owned = (val & 1) || (val == 0);
17486 val_conv = ChannelPublicKeys_clone(&val_conv);
17487 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
17490 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
17491 LDKChannelTransactionParameters this_ptr_conv;
17492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17493 this_ptr_conv.is_owned = false;
17494 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
17498 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
17499 LDKChannelTransactionParameters this_ptr_conv;
17500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17501 this_ptr_conv.is_owned = false;
17502 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
17505 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
17506 LDKChannelTransactionParameters this_ptr_conv;
17507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17508 this_ptr_conv.is_owned = false;
17509 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
17513 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
17514 LDKChannelTransactionParameters this_ptr_conv;
17515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17516 this_ptr_conv.is_owned = false;
17517 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
17520 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
17521 LDKChannelTransactionParameters this_ptr_conv;
17522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17523 this_ptr_conv.is_owned = false;
17524 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
17525 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17526 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17527 long ret_ref = (long)ret_var.inner;
17528 if (ret_var.is_owned) {
17534 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
17535 LDKChannelTransactionParameters this_ptr_conv;
17536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17537 this_ptr_conv.is_owned = false;
17538 LDKCounterpartyChannelTransactionParameters val_conv;
17539 val_conv.inner = (void*)(val & (~1));
17540 val_conv.is_owned = (val & 1) || (val == 0);
17541 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
17542 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
17545 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
17546 LDKChannelTransactionParameters this_ptr_conv;
17547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17548 this_ptr_conv.is_owned = false;
17549 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
17550 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17551 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17552 long ret_ref = (long)ret_var.inner;
17553 if (ret_var.is_owned) {
17559 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
17560 LDKChannelTransactionParameters this_ptr_conv;
17561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17562 this_ptr_conv.is_owned = false;
17563 LDKOutPoint val_conv;
17564 val_conv.inner = (void*)(val & (~1));
17565 val_conv.is_owned = (val & 1) || (val == 0);
17566 val_conv = OutPoint_clone(&val_conv);
17567 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
17570 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) {
17571 LDKChannelPublicKeys holder_pubkeys_arg_conv;
17572 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
17573 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
17574 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
17575 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
17576 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
17577 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
17578 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
17579 LDKOutPoint funding_outpoint_arg_conv;
17580 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
17581 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
17582 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
17583 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);
17584 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17585 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17586 long ret_ref = (long)ret_var.inner;
17587 if (ret_var.is_owned) {
17593 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
17594 LDKChannelTransactionParameters orig_conv;
17595 orig_conv.inner = (void*)(orig & (~1));
17596 orig_conv.is_owned = false;
17597 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
17598 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17599 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17600 long ret_ref = (long)ret_var.inner;
17601 if (ret_var.is_owned) {
17607 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
17608 LDKCounterpartyChannelTransactionParameters this_obj_conv;
17609 this_obj_conv.inner = (void*)(this_obj & (~1));
17610 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17611 CounterpartyChannelTransactionParameters_free(this_obj_conv);
17614 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
17615 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17617 this_ptr_conv.is_owned = false;
17618 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
17619 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17620 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17621 long ret_ref = (long)ret_var.inner;
17622 if (ret_var.is_owned) {
17628 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
17629 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17631 this_ptr_conv.is_owned = false;
17632 LDKChannelPublicKeys val_conv;
17633 val_conv.inner = (void*)(val & (~1));
17634 val_conv.is_owned = (val & 1) || (val == 0);
17635 val_conv = ChannelPublicKeys_clone(&val_conv);
17636 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
17639 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
17640 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17642 this_ptr_conv.is_owned = false;
17643 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
17647 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
17648 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17650 this_ptr_conv.is_owned = false;
17651 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
17654 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
17655 LDKChannelPublicKeys pubkeys_arg_conv;
17656 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
17657 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
17658 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
17659 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
17660 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17661 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17662 long ret_ref = (long)ret_var.inner;
17663 if (ret_var.is_owned) {
17669 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
17670 LDKCounterpartyChannelTransactionParameters orig_conv;
17671 orig_conv.inner = (void*)(orig & (~1));
17672 orig_conv.is_owned = false;
17673 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
17674 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17675 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17676 long ret_ref = (long)ret_var.inner;
17677 if (ret_var.is_owned) {
17683 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
17684 LDKChannelTransactionParameters this_arg_conv;
17685 this_arg_conv.inner = (void*)(this_arg & (~1));
17686 this_arg_conv.is_owned = false;
17687 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
17691 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
17692 LDKChannelTransactionParameters this_arg_conv;
17693 this_arg_conv.inner = (void*)(this_arg & (~1));
17694 this_arg_conv.is_owned = false;
17695 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
17696 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17697 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17698 long ret_ref = (long)ret_var.inner;
17699 if (ret_var.is_owned) {
17705 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
17706 LDKChannelTransactionParameters this_arg_conv;
17707 this_arg_conv.inner = (void*)(this_arg & (~1));
17708 this_arg_conv.is_owned = false;
17709 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
17710 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17711 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17712 long ret_ref = (long)ret_var.inner;
17713 if (ret_var.is_owned) {
17719 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
17720 LDKCounterpartyChannelTransactionParameters obj_conv;
17721 obj_conv.inner = (void*)(obj & (~1));
17722 obj_conv.is_owned = false;
17723 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
17724 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17725 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17726 CVec_u8Z_free(ret_var);
17730 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
17731 LDKu8slice ser_ref;
17732 ser_ref.datalen = *((uint32_t*)ser);
17733 ser_ref.data = (int8_t*)(ser + 4);
17734 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
17735 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
17736 return (long)ret_conv;
17739 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
17740 LDKChannelTransactionParameters obj_conv;
17741 obj_conv.inner = (void*)(obj & (~1));
17742 obj_conv.is_owned = false;
17743 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
17744 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17745 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17746 CVec_u8Z_free(ret_var);
17750 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
17751 LDKu8slice ser_ref;
17752 ser_ref.datalen = *((uint32_t*)ser);
17753 ser_ref.data = (int8_t*)(ser + 4);
17754 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
17755 *ret_conv = ChannelTransactionParameters_read(ser_ref);
17756 return (long)ret_conv;
17759 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
17760 LDKDirectedChannelTransactionParameters this_obj_conv;
17761 this_obj_conv.inner = (void*)(this_obj & (~1));
17762 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17763 DirectedChannelTransactionParameters_free(this_obj_conv);
17766 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
17767 LDKDirectedChannelTransactionParameters this_arg_conv;
17768 this_arg_conv.inner = (void*)(this_arg & (~1));
17769 this_arg_conv.is_owned = false;
17770 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
17771 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17772 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17773 long ret_ref = (long)ret_var.inner;
17774 if (ret_var.is_owned) {
17780 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
17781 LDKDirectedChannelTransactionParameters this_arg_conv;
17782 this_arg_conv.inner = (void*)(this_arg & (~1));
17783 this_arg_conv.is_owned = false;
17784 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
17785 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17786 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17787 long ret_ref = (long)ret_var.inner;
17788 if (ret_var.is_owned) {
17794 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
17795 LDKDirectedChannelTransactionParameters this_arg_conv;
17796 this_arg_conv.inner = (void*)(this_arg & (~1));
17797 this_arg_conv.is_owned = false;
17798 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
17802 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
17803 LDKDirectedChannelTransactionParameters this_arg_conv;
17804 this_arg_conv.inner = (void*)(this_arg & (~1));
17805 this_arg_conv.is_owned = false;
17806 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
17810 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
17811 LDKDirectedChannelTransactionParameters this_arg_conv;
17812 this_arg_conv.inner = (void*)(this_arg & (~1));
17813 this_arg_conv.is_owned = false;
17814 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
17815 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17816 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17817 long ret_ref = (long)ret_var.inner;
17818 if (ret_var.is_owned) {
17824 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
17825 LDKHolderCommitmentTransaction this_obj_conv;
17826 this_obj_conv.inner = (void*)(this_obj & (~1));
17827 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17828 HolderCommitmentTransaction_free(this_obj_conv);
17831 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
17832 LDKHolderCommitmentTransaction this_ptr_conv;
17833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17834 this_ptr_conv.is_owned = false;
17835 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17836 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
17840 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
17841 LDKHolderCommitmentTransaction this_ptr_conv;
17842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17843 this_ptr_conv.is_owned = false;
17844 LDKSignature val_ref;
17845 CHECK(*((uint32_t*)val) == 64);
17846 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17847 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
17850 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
17851 LDKHolderCommitmentTransaction this_ptr_conv;
17852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17853 this_ptr_conv.is_owned = false;
17854 LDKCVec_SignatureZ val_constr;
17855 val_constr.datalen = *((uint32_t*)val);
17856 if (val_constr.datalen > 0)
17857 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17859 val_constr.data = NULL;
17860 int8_tArray* val_vals = (int8_tArray*)(val + 4);
17861 for (size_t m = 0; m < val_constr.datalen; m++) {
17862 int8_tArray val_conv_12 = val_vals[m];
17863 LDKSignature val_conv_12_ref;
17864 CHECK(*((uint32_t*)val_conv_12) == 64);
17865 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
17866 val_constr.data[m] = val_conv_12_ref;
17868 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
17871 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
17872 LDKHolderCommitmentTransaction orig_conv;
17873 orig_conv.inner = (void*)(orig & (~1));
17874 orig_conv.is_owned = false;
17875 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
17876 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17877 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17878 long ret_ref = (long)ret_var.inner;
17879 if (ret_var.is_owned) {
17885 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
17886 LDKHolderCommitmentTransaction obj_conv;
17887 obj_conv.inner = (void*)(obj & (~1));
17888 obj_conv.is_owned = false;
17889 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
17890 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17891 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17892 CVec_u8Z_free(ret_var);
17896 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
17897 LDKu8slice ser_ref;
17898 ser_ref.datalen = *((uint32_t*)ser);
17899 ser_ref.data = (int8_t*)(ser + 4);
17900 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
17901 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
17902 return (long)ret_conv;
17905 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) {
17906 LDKCommitmentTransaction commitment_tx_conv;
17907 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
17908 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
17909 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
17910 LDKSignature counterparty_sig_ref;
17911 CHECK(*((uint32_t*)counterparty_sig) == 64);
17912 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
17913 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
17914 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
17915 if (counterparty_htlc_sigs_constr.datalen > 0)
17916 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17918 counterparty_htlc_sigs_constr.data = NULL;
17919 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
17920 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
17921 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
17922 LDKSignature counterparty_htlc_sigs_conv_12_ref;
17923 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
17924 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
17925 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
17927 LDKPublicKey holder_funding_key_ref;
17928 CHECK(*((uint32_t*)holder_funding_key) == 33);
17929 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
17930 LDKPublicKey counterparty_funding_key_ref;
17931 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
17932 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
17933 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
17934 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17935 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17936 long ret_ref = (long)ret_var.inner;
17937 if (ret_var.is_owned) {
17943 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
17944 LDKBuiltCommitmentTransaction this_obj_conv;
17945 this_obj_conv.inner = (void*)(this_obj & (~1));
17946 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17947 BuiltCommitmentTransaction_free(this_obj_conv);
17950 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
17951 LDKBuiltCommitmentTransaction this_ptr_conv;
17952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17953 this_ptr_conv.is_owned = false;
17954 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
17955 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17956 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17957 Transaction_free(ret_var);
17961 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
17962 LDKBuiltCommitmentTransaction this_ptr_conv;
17963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17964 this_ptr_conv.is_owned = false;
17965 LDKTransaction val_ref;
17966 val_ref.datalen = *((uint32_t*)val);
17967 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
17968 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
17969 val_ref.data_is_owned = true;
17970 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
17973 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
17974 LDKBuiltCommitmentTransaction 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(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17978 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
17982 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
17983 LDKBuiltCommitmentTransaction this_ptr_conv;
17984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17985 this_ptr_conv.is_owned = false;
17986 LDKThirtyTwoBytes val_ref;
17987 CHECK(*((uint32_t*)val) == 32);
17988 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17989 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
17992 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
17993 LDKTransaction transaction_arg_ref;
17994 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
17995 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
17996 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
17997 transaction_arg_ref.data_is_owned = true;
17998 LDKThirtyTwoBytes txid_arg_ref;
17999 CHECK(*((uint32_t*)txid_arg) == 32);
18000 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
18001 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
18002 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18003 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18004 long ret_ref = (long)ret_var.inner;
18005 if (ret_var.is_owned) {
18011 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
18012 LDKBuiltCommitmentTransaction orig_conv;
18013 orig_conv.inner = (void*)(orig & (~1));
18014 orig_conv.is_owned = false;
18015 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
18016 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18017 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18018 long ret_ref = (long)ret_var.inner;
18019 if (ret_var.is_owned) {
18025 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
18026 LDKBuiltCommitmentTransaction obj_conv;
18027 obj_conv.inner = (void*)(obj & (~1));
18028 obj_conv.is_owned = false;
18029 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
18030 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18031 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18032 CVec_u8Z_free(ret_var);
18036 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
18037 LDKu8slice ser_ref;
18038 ser_ref.datalen = *((uint32_t*)ser);
18039 ser_ref.data = (int8_t*)(ser + 4);
18040 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
18041 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
18042 return (long)ret_conv;
18045 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
18046 LDKBuiltCommitmentTransaction this_arg_conv;
18047 this_arg_conv.inner = (void*)(this_arg & (~1));
18048 this_arg_conv.is_owned = false;
18049 LDKu8slice funding_redeemscript_ref;
18050 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
18051 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
18052 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18053 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
18057 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) {
18058 LDKBuiltCommitmentTransaction this_arg_conv;
18059 this_arg_conv.inner = (void*)(this_arg & (~1));
18060 this_arg_conv.is_owned = false;
18061 unsigned char funding_key_arr[32];
18062 CHECK(*((uint32_t*)funding_key) == 32);
18063 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
18064 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
18065 LDKu8slice funding_redeemscript_ref;
18066 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
18067 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
18068 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18069 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
18073 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
18074 LDKCommitmentTransaction this_obj_conv;
18075 this_obj_conv.inner = (void*)(this_obj & (~1));
18076 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18077 CommitmentTransaction_free(this_obj_conv);
18080 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
18081 LDKCommitmentTransaction orig_conv;
18082 orig_conv.inner = (void*)(orig & (~1));
18083 orig_conv.is_owned = false;
18084 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
18085 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18086 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18087 long ret_ref = (long)ret_var.inner;
18088 if (ret_var.is_owned) {
18094 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
18095 LDKCommitmentTransaction obj_conv;
18096 obj_conv.inner = (void*)(obj & (~1));
18097 obj_conv.is_owned = false;
18098 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
18099 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18100 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18101 CVec_u8Z_free(ret_var);
18105 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
18106 LDKu8slice ser_ref;
18107 ser_ref.datalen = *((uint32_t*)ser);
18108 ser_ref.data = (int8_t*)(ser + 4);
18109 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
18110 *ret_conv = CommitmentTransaction_read(ser_ref);
18111 return (long)ret_conv;
18114 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
18115 LDKCommitmentTransaction this_arg_conv;
18116 this_arg_conv.inner = (void*)(this_arg & (~1));
18117 this_arg_conv.is_owned = false;
18118 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
18122 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
18123 LDKCommitmentTransaction this_arg_conv;
18124 this_arg_conv.inner = (void*)(this_arg & (~1));
18125 this_arg_conv.is_owned = false;
18126 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
18130 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
18131 LDKCommitmentTransaction this_arg_conv;
18132 this_arg_conv.inner = (void*)(this_arg & (~1));
18133 this_arg_conv.is_owned = false;
18134 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
18138 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
18139 LDKCommitmentTransaction this_arg_conv;
18140 this_arg_conv.inner = (void*)(this_arg & (~1));
18141 this_arg_conv.is_owned = false;
18142 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
18146 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
18147 LDKCommitmentTransaction this_arg_conv;
18148 this_arg_conv.inner = (void*)(this_arg & (~1));
18149 this_arg_conv.is_owned = false;
18150 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
18151 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18152 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18153 long ret_ref = (long)ret_var.inner;
18154 if (ret_var.is_owned) {
18160 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
18161 LDKCommitmentTransaction this_arg_conv;
18162 this_arg_conv.inner = (void*)(this_arg & (~1));
18163 this_arg_conv.is_owned = false;
18164 LDKDirectedChannelTransactionParameters channel_parameters_conv;
18165 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
18166 channel_parameters_conv.is_owned = false;
18167 LDKChannelPublicKeys broadcaster_keys_conv;
18168 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
18169 broadcaster_keys_conv.is_owned = false;
18170 LDKChannelPublicKeys countersignatory_keys_conv;
18171 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
18172 countersignatory_keys_conv.is_owned = false;
18173 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
18174 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
18175 return (long)ret_conv;
18178 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
18179 LDKTrustedCommitmentTransaction this_obj_conv;
18180 this_obj_conv.inner = (void*)(this_obj & (~1));
18181 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18182 TrustedCommitmentTransaction_free(this_obj_conv);
18185 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
18186 LDKTrustedCommitmentTransaction this_arg_conv;
18187 this_arg_conv.inner = (void*)(this_arg & (~1));
18188 this_arg_conv.is_owned = false;
18189 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18190 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
18194 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
18195 LDKTrustedCommitmentTransaction this_arg_conv;
18196 this_arg_conv.inner = (void*)(this_arg & (~1));
18197 this_arg_conv.is_owned = false;
18198 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
18199 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18200 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18201 long ret_ref = (long)ret_var.inner;
18202 if (ret_var.is_owned) {
18208 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
18209 LDKTrustedCommitmentTransaction this_arg_conv;
18210 this_arg_conv.inner = (void*)(this_arg & (~1));
18211 this_arg_conv.is_owned = false;
18212 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
18213 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18214 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18215 long ret_ref = (long)ret_var.inner;
18216 if (ret_var.is_owned) {
18222 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
18223 LDKTrustedCommitmentTransaction this_arg_conv;
18224 this_arg_conv.inner = (void*)(this_arg & (~1));
18225 this_arg_conv.is_owned = false;
18226 unsigned char htlc_base_key_arr[32];
18227 CHECK(*((uint32_t*)htlc_base_key) == 32);
18228 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
18229 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
18230 LDKDirectedChannelTransactionParameters channel_parameters_conv;
18231 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
18232 channel_parameters_conv.is_owned = false;
18233 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
18234 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
18235 return (long)ret_conv;
18238 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) {
18239 LDKPublicKey broadcaster_payment_basepoint_ref;
18240 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
18241 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
18242 LDKPublicKey countersignatory_payment_basepoint_ref;
18243 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
18244 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
18245 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
18249 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
18250 LDKInitFeatures orig_conv;
18251 orig_conv.inner = (void*)(orig & (~1));
18252 orig_conv.is_owned = false;
18253 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
18254 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18255 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18256 long ret_ref = (long)ret_var.inner;
18257 if (ret_var.is_owned) {
18263 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
18264 LDKNodeFeatures orig_conv;
18265 orig_conv.inner = (void*)(orig & (~1));
18266 orig_conv.is_owned = false;
18267 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
18268 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18269 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18270 long ret_ref = (long)ret_var.inner;
18271 if (ret_var.is_owned) {
18277 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
18278 LDKChannelFeatures orig_conv;
18279 orig_conv.inner = (void*)(orig & (~1));
18280 orig_conv.is_owned = false;
18281 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
18282 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18283 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18284 long ret_ref = (long)ret_var.inner;
18285 if (ret_var.is_owned) {
18291 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
18292 LDKInvoiceFeatures orig_conv;
18293 orig_conv.inner = (void*)(orig & (~1));
18294 orig_conv.is_owned = false;
18295 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
18296 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18297 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18298 long ret_ref = (long)ret_var.inner;
18299 if (ret_var.is_owned) {
18305 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
18306 LDKInitFeatures this_obj_conv;
18307 this_obj_conv.inner = (void*)(this_obj & (~1));
18308 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18309 InitFeatures_free(this_obj_conv);
18312 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
18313 LDKNodeFeatures this_obj_conv;
18314 this_obj_conv.inner = (void*)(this_obj & (~1));
18315 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18316 NodeFeatures_free(this_obj_conv);
18319 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
18320 LDKChannelFeatures this_obj_conv;
18321 this_obj_conv.inner = (void*)(this_obj & (~1));
18322 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18323 ChannelFeatures_free(this_obj_conv);
18326 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
18327 LDKInvoiceFeatures this_obj_conv;
18328 this_obj_conv.inner = (void*)(this_obj & (~1));
18329 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18330 InvoiceFeatures_free(this_obj_conv);
18333 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
18334 LDKInitFeatures ret_var = InitFeatures_empty();
18335 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18336 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18337 long ret_ref = (long)ret_var.inner;
18338 if (ret_var.is_owned) {
18344 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
18345 LDKInitFeatures ret_var = InitFeatures_known();
18346 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18347 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18348 long ret_ref = (long)ret_var.inner;
18349 if (ret_var.is_owned) {
18355 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
18356 LDKNodeFeatures ret_var = NodeFeatures_empty();
18357 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18358 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18359 long ret_ref = (long)ret_var.inner;
18360 if (ret_var.is_owned) {
18366 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
18367 LDKNodeFeatures ret_var = NodeFeatures_known();
18368 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18369 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18370 long ret_ref = (long)ret_var.inner;
18371 if (ret_var.is_owned) {
18377 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
18378 LDKChannelFeatures ret_var = ChannelFeatures_empty();
18379 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18380 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18381 long ret_ref = (long)ret_var.inner;
18382 if (ret_var.is_owned) {
18388 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
18389 LDKChannelFeatures ret_var = ChannelFeatures_known();
18390 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18391 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18392 long ret_ref = (long)ret_var.inner;
18393 if (ret_var.is_owned) {
18399 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
18400 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
18401 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18402 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18403 long ret_ref = (long)ret_var.inner;
18404 if (ret_var.is_owned) {
18410 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
18411 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
18412 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18413 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18414 long ret_ref = (long)ret_var.inner;
18415 if (ret_var.is_owned) {
18421 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
18422 LDKInitFeatures obj_conv;
18423 obj_conv.inner = (void*)(obj & (~1));
18424 obj_conv.is_owned = false;
18425 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
18426 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18427 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18428 CVec_u8Z_free(ret_var);
18432 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
18433 LDKNodeFeatures obj_conv;
18434 obj_conv.inner = (void*)(obj & (~1));
18435 obj_conv.is_owned = false;
18436 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
18437 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18438 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18439 CVec_u8Z_free(ret_var);
18443 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
18444 LDKChannelFeatures obj_conv;
18445 obj_conv.inner = (void*)(obj & (~1));
18446 obj_conv.is_owned = false;
18447 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
18448 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18449 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18450 CVec_u8Z_free(ret_var);
18454 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
18455 LDKInvoiceFeatures obj_conv;
18456 obj_conv.inner = (void*)(obj & (~1));
18457 obj_conv.is_owned = false;
18458 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
18459 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18460 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18461 CVec_u8Z_free(ret_var);
18465 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
18466 LDKu8slice ser_ref;
18467 ser_ref.datalen = *((uint32_t*)ser);
18468 ser_ref.data = (int8_t*)(ser + 4);
18469 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18470 *ret_conv = InitFeatures_read(ser_ref);
18471 return (long)ret_conv;
18474 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
18475 LDKu8slice ser_ref;
18476 ser_ref.datalen = *((uint32_t*)ser);
18477 ser_ref.data = (int8_t*)(ser + 4);
18478 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18479 *ret_conv = NodeFeatures_read(ser_ref);
18480 return (long)ret_conv;
18483 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
18484 LDKu8slice ser_ref;
18485 ser_ref.datalen = *((uint32_t*)ser);
18486 ser_ref.data = (int8_t*)(ser + 4);
18487 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18488 *ret_conv = ChannelFeatures_read(ser_ref);
18489 return (long)ret_conv;
18492 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
18493 LDKu8slice ser_ref;
18494 ser_ref.datalen = *((uint32_t*)ser);
18495 ser_ref.data = (int8_t*)(ser + 4);
18496 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
18497 *ret_conv = InvoiceFeatures_read(ser_ref);
18498 return (long)ret_conv;
18501 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
18502 LDKRouteHop this_obj_conv;
18503 this_obj_conv.inner = (void*)(this_obj & (~1));
18504 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18505 RouteHop_free(this_obj_conv);
18508 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
18509 LDKRouteHop this_ptr_conv;
18510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18511 this_ptr_conv.is_owned = false;
18512 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18513 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
18517 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
18518 LDKRouteHop this_ptr_conv;
18519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18520 this_ptr_conv.is_owned = false;
18521 LDKPublicKey val_ref;
18522 CHECK(*((uint32_t*)val) == 33);
18523 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18524 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
18527 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
18528 LDKRouteHop this_ptr_conv;
18529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18530 this_ptr_conv.is_owned = false;
18531 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
18532 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18533 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18534 long ret_ref = (long)ret_var.inner;
18535 if (ret_var.is_owned) {
18541 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
18542 LDKRouteHop this_ptr_conv;
18543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18544 this_ptr_conv.is_owned = false;
18545 LDKNodeFeatures val_conv;
18546 val_conv.inner = (void*)(val & (~1));
18547 val_conv.is_owned = (val & 1) || (val == 0);
18548 val_conv = NodeFeatures_clone(&val_conv);
18549 RouteHop_set_node_features(&this_ptr_conv, val_conv);
18552 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
18553 LDKRouteHop this_ptr_conv;
18554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18555 this_ptr_conv.is_owned = false;
18556 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
18560 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
18561 LDKRouteHop this_ptr_conv;
18562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18563 this_ptr_conv.is_owned = false;
18564 RouteHop_set_short_channel_id(&this_ptr_conv, val);
18567 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
18568 LDKRouteHop this_ptr_conv;
18569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18570 this_ptr_conv.is_owned = false;
18571 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
18572 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18573 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18574 long ret_ref = (long)ret_var.inner;
18575 if (ret_var.is_owned) {
18581 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
18582 LDKRouteHop this_ptr_conv;
18583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18584 this_ptr_conv.is_owned = false;
18585 LDKChannelFeatures val_conv;
18586 val_conv.inner = (void*)(val & (~1));
18587 val_conv.is_owned = (val & 1) || (val == 0);
18588 val_conv = ChannelFeatures_clone(&val_conv);
18589 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
18592 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
18593 LDKRouteHop this_ptr_conv;
18594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18595 this_ptr_conv.is_owned = false;
18596 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
18600 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
18601 LDKRouteHop this_ptr_conv;
18602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18603 this_ptr_conv.is_owned = false;
18604 RouteHop_set_fee_msat(&this_ptr_conv, val);
18607 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
18608 LDKRouteHop this_ptr_conv;
18609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18610 this_ptr_conv.is_owned = false;
18611 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
18615 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
18616 LDKRouteHop this_ptr_conv;
18617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18618 this_ptr_conv.is_owned = false;
18619 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
18622 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) {
18623 LDKPublicKey pubkey_arg_ref;
18624 CHECK(*((uint32_t*)pubkey_arg) == 33);
18625 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
18626 LDKNodeFeatures node_features_arg_conv;
18627 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
18628 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
18629 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
18630 LDKChannelFeatures channel_features_arg_conv;
18631 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
18632 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
18633 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
18634 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);
18635 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18636 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18637 long ret_ref = (long)ret_var.inner;
18638 if (ret_var.is_owned) {
18644 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
18645 LDKRouteHop orig_conv;
18646 orig_conv.inner = (void*)(orig & (~1));
18647 orig_conv.is_owned = false;
18648 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
18649 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18650 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18651 long ret_ref = (long)ret_var.inner;
18652 if (ret_var.is_owned) {
18658 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
18659 LDKRoute this_obj_conv;
18660 this_obj_conv.inner = (void*)(this_obj & (~1));
18661 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18662 Route_free(this_obj_conv);
18665 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
18666 LDKRoute this_ptr_conv;
18667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18668 this_ptr_conv.is_owned = false;
18669 LDKCVec_CVec_RouteHopZZ val_constr;
18670 val_constr.datalen = *((uint32_t*)val);
18671 if (val_constr.datalen > 0)
18672 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
18674 val_constr.data = NULL;
18675 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
18676 for (size_t m = 0; m < val_constr.datalen; m++) {
18677 uint32_tArray val_conv_12 = val_vals[m];
18678 LDKCVec_RouteHopZ val_conv_12_constr;
18679 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
18680 if (val_conv_12_constr.datalen > 0)
18681 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
18683 val_conv_12_constr.data = NULL;
18684 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
18685 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
18686 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
18687 LDKRouteHop val_conv_12_conv_10_conv;
18688 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
18689 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
18690 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
18691 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
18693 val_constr.data[m] = val_conv_12_constr;
18695 Route_set_paths(&this_ptr_conv, val_constr);
18698 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) {
18699 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
18700 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
18701 if (paths_arg_constr.datalen > 0)
18702 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
18704 paths_arg_constr.data = NULL;
18705 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
18706 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
18707 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
18708 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
18709 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
18710 if (paths_arg_conv_12_constr.datalen > 0)
18711 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
18713 paths_arg_conv_12_constr.data = NULL;
18714 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
18715 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
18716 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
18717 LDKRouteHop paths_arg_conv_12_conv_10_conv;
18718 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
18719 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
18720 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
18721 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
18723 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
18725 LDKRoute ret_var = Route_new(paths_arg_constr);
18726 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18727 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18728 long ret_ref = (long)ret_var.inner;
18729 if (ret_var.is_owned) {
18735 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
18736 LDKRoute orig_conv;
18737 orig_conv.inner = (void*)(orig & (~1));
18738 orig_conv.is_owned = false;
18739 LDKRoute ret_var = Route_clone(&orig_conv);
18740 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18741 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18742 long ret_ref = (long)ret_var.inner;
18743 if (ret_var.is_owned) {
18749 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
18751 obj_conv.inner = (void*)(obj & (~1));
18752 obj_conv.is_owned = false;
18753 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
18754 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18755 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18756 CVec_u8Z_free(ret_var);
18760 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
18761 LDKu8slice ser_ref;
18762 ser_ref.datalen = *((uint32_t*)ser);
18763 ser_ref.data = (int8_t*)(ser + 4);
18764 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
18765 *ret_conv = Route_read(ser_ref);
18766 return (long)ret_conv;
18769 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
18770 LDKRouteHint this_obj_conv;
18771 this_obj_conv.inner = (void*)(this_obj & (~1));
18772 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18773 RouteHint_free(this_obj_conv);
18776 int8_tArray __attribute__((visibility("default"))) TS_RouteHint_get_src_node_id(uint32_t this_ptr) {
18777 LDKRouteHint this_ptr_conv;
18778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18779 this_ptr_conv.is_owned = false;
18780 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18781 memcpy((uint8_t*)(ret_arr + 4), RouteHint_get_src_node_id(&this_ptr_conv).compressed_form, 33);
18785 void __attribute__((visibility("default"))) TS_RouteHint_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
18786 LDKRouteHint this_ptr_conv;
18787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18788 this_ptr_conv.is_owned = false;
18789 LDKPublicKey val_ref;
18790 CHECK(*((uint32_t*)val) == 33);
18791 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18792 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
18795 int64_t __attribute__((visibility("default"))) TS_RouteHint_get_short_channel_id(uint32_t this_ptr) {
18796 LDKRouteHint this_ptr_conv;
18797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18798 this_ptr_conv.is_owned = false;
18799 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
18803 void __attribute__((visibility("default"))) TS_RouteHint_set_short_channel_id(uint32_t this_ptr, int64_t val) {
18804 LDKRouteHint this_ptr_conv;
18805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18806 this_ptr_conv.is_owned = false;
18807 RouteHint_set_short_channel_id(&this_ptr_conv, val);
18810 uint32_t __attribute__((visibility("default"))) TS_RouteHint_get_fees(uint32_t this_ptr) {
18811 LDKRouteHint this_ptr_conv;
18812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18813 this_ptr_conv.is_owned = false;
18814 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
18815 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18816 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18817 long ret_ref = (long)ret_var.inner;
18818 if (ret_var.is_owned) {
18824 void __attribute__((visibility("default"))) TS_RouteHint_set_fees(uint32_t this_ptr, uint32_t val) {
18825 LDKRouteHint this_ptr_conv;
18826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18827 this_ptr_conv.is_owned = false;
18828 LDKRoutingFees val_conv;
18829 val_conv.inner = (void*)(val & (~1));
18830 val_conv.is_owned = (val & 1) || (val == 0);
18831 val_conv = RoutingFees_clone(&val_conv);
18832 RouteHint_set_fees(&this_ptr_conv, val_conv);
18835 int16_t __attribute__((visibility("default"))) TS_RouteHint_get_cltv_expiry_delta(uint32_t this_ptr) {
18836 LDKRouteHint this_ptr_conv;
18837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18838 this_ptr_conv.is_owned = false;
18839 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
18843 void __attribute__((visibility("default"))) TS_RouteHint_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
18844 LDKRouteHint this_ptr_conv;
18845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18846 this_ptr_conv.is_owned = false;
18847 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
18850 uint32_t __attribute__((visibility("default"))) TS_RouteHint_get_htlc_minimum_msat(uint32_t this_ptr) {
18851 LDKRouteHint this_ptr_conv;
18852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18853 this_ptr_conv.is_owned = false;
18854 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18855 *ret_copy = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
18856 long ret_ref = (long)ret_copy;
18860 void __attribute__((visibility("default"))) TS_RouteHint_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
18861 LDKRouteHint this_ptr_conv;
18862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18863 this_ptr_conv.is_owned = false;
18864 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
18866 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
18869 uint32_t __attribute__((visibility("default"))) TS_RouteHint_get_htlc_maximum_msat(uint32_t this_ptr) {
18870 LDKRouteHint this_ptr_conv;
18871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18872 this_ptr_conv.is_owned = false;
18873 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18874 *ret_copy = RouteHint_get_htlc_maximum_msat(&this_ptr_conv);
18875 long ret_ref = (long)ret_copy;
18879 void __attribute__((visibility("default"))) TS_RouteHint_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
18880 LDKRouteHint this_ptr_conv;
18881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18882 this_ptr_conv.is_owned = false;
18883 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
18885 RouteHint_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
18888 uint32_t __attribute__((visibility("default"))) TS_RouteHint_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) {
18889 LDKPublicKey src_node_id_arg_ref;
18890 CHECK(*((uint32_t*)src_node_id_arg) == 33);
18891 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
18892 LDKRoutingFees fees_arg_conv;
18893 fees_arg_conv.inner = (void*)(fees_arg & (~1));
18894 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
18895 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
18896 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
18897 FREE((void*)htlc_minimum_msat_arg);
18898 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
18899 FREE((void*)htlc_maximum_msat_arg);
18900 LDKRouteHint ret_var = RouteHint_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);
18901 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18902 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18903 long ret_ref = (long)ret_var.inner;
18904 if (ret_var.is_owned) {
18910 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
18911 LDKRouteHint orig_conv;
18912 orig_conv.inner = (void*)(orig & (~1));
18913 orig_conv.is_owned = false;
18914 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
18915 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18916 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18917 long ret_ref = (long)ret_var.inner;
18918 if (ret_var.is_owned) {
18924 uint32_t __attribute__((visibility("default"))) TS_get_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_t payee_features, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
18925 LDKPublicKey our_node_id_ref;
18926 CHECK(*((uint32_t*)our_node_id) == 33);
18927 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
18928 LDKNetworkGraph network_conv;
18929 network_conv.inner = (void*)(network & (~1));
18930 network_conv.is_owned = false;
18931 LDKPublicKey payee_ref;
18932 CHECK(*((uint32_t*)payee) == 33);
18933 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
18934 LDKInvoiceFeatures payee_features_conv;
18935 payee_features_conv.inner = (void*)(payee_features & (~1));
18936 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
18937 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
18938 LDKCVec_ChannelDetailsZ first_hops_constr;
18939 first_hops_constr.datalen = *((uint32_t*)first_hops);
18940 if (first_hops_constr.datalen > 0)
18941 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18943 first_hops_constr.data = NULL;
18944 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
18945 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
18946 uint32_t first_hops_conv_16 = first_hops_vals[q];
18947 LDKChannelDetails first_hops_conv_16_conv;
18948 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
18949 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
18950 first_hops_constr.data[q] = first_hops_conv_16_conv;
18952 LDKCVec_RouteHintZ last_hops_constr;
18953 last_hops_constr.datalen = *((uint32_t*)last_hops);
18954 if (last_hops_constr.datalen > 0)
18955 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
18957 last_hops_constr.data = NULL;
18958 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
18959 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
18960 uint32_t last_hops_conv_11 = last_hops_vals[l];
18961 LDKRouteHint last_hops_conv_11_conv;
18962 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
18963 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
18964 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
18965 last_hops_constr.data[l] = last_hops_conv_11_conv;
18967 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
18968 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18969 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
18970 FREE(first_hops_constr.data);
18971 return (long)ret_conv;
18974 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
18975 LDKNetworkGraph this_obj_conv;
18976 this_obj_conv.inner = (void*)(this_obj & (~1));
18977 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18978 NetworkGraph_free(this_obj_conv);
18981 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
18982 LDKNetworkGraph orig_conv;
18983 orig_conv.inner = (void*)(orig & (~1));
18984 orig_conv.is_owned = false;
18985 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
18986 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18987 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18988 long ret_ref = (long)ret_var.inner;
18989 if (ret_var.is_owned) {
18995 void __attribute__((visibility("default"))) TS_LockedNetworkGraph_free(uint32_t this_obj) {
18996 LDKLockedNetworkGraph this_obj_conv;
18997 this_obj_conv.inner = (void*)(this_obj & (~1));
18998 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18999 LockedNetworkGraph_free(this_obj_conv);
19002 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
19003 LDKNetGraphMsgHandler this_obj_conv;
19004 this_obj_conv.inner = (void*)(this_obj & (~1));
19005 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19006 NetGraphMsgHandler_free(this_obj_conv);
19009 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(int8_tArray genesis_hash, uint32_t chain_access, uint32_t logger) {
19010 LDKThirtyTwoBytes genesis_hash_ref;
19011 CHECK(*((uint32_t*)genesis_hash) == 32);
19012 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
19013 LDKAccess *chain_access_conv_ptr = NULL;
19014 if (chain_access != 0) {
19015 LDKAccess chain_access_conv;
19016 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19017 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19018 *chain_access_conv_ptr = chain_access_conv;
19020 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19021 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
19022 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19023 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19024 long ret_ref = (long)ret_var.inner;
19025 if (ret_var.is_owned) {
19031 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_from_net_graph(uint32_t chain_access, uint32_t logger, uint32_t network_graph) {
19032 LDKAccess *chain_access_conv_ptr = NULL;
19033 if (chain_access != 0) {
19034 LDKAccess chain_access_conv;
19035 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19036 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19037 *chain_access_conv_ptr = chain_access_conv;
19039 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19040 LDKNetworkGraph network_graph_conv;
19041 network_graph_conv.inner = (void*)(network_graph & (~1));
19042 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
19043 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
19044 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
19045 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19046 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19047 long ret_ref = (long)ret_var.inner;
19048 if (ret_var.is_owned) {
19054 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
19055 LDKNetGraphMsgHandler this_arg_conv;
19056 this_arg_conv.inner = (void*)(this_arg & (~1));
19057 this_arg_conv.is_owned = false;
19058 LDKAccess *chain_access_conv_ptr = NULL;
19059 if (chain_access != 0) {
19060 LDKAccess chain_access_conv;
19061 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19062 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19063 *chain_access_conv_ptr = chain_access_conv;
19065 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
19068 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_read_locked_graph(uint32_t this_arg) {
19069 LDKNetGraphMsgHandler this_arg_conv;
19070 this_arg_conv.inner = (void*)(this_arg & (~1));
19071 this_arg_conv.is_owned = false;
19072 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
19073 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19074 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19075 long ret_ref = (long)ret_var.inner;
19076 if (ret_var.is_owned) {
19082 uint32_t __attribute__((visibility("default"))) TS_LockedNetworkGraph_graph(uint32_t this_arg) {
19083 LDKLockedNetworkGraph this_arg_conv;
19084 this_arg_conv.inner = (void*)(this_arg & (~1));
19085 this_arg_conv.is_owned = false;
19086 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
19087 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19088 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19089 long ret_ref = (long)ret_var.inner;
19090 if (ret_var.is_owned) {
19096 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
19097 LDKNetGraphMsgHandler this_arg_conv;
19098 this_arg_conv.inner = (void*)(this_arg & (~1));
19099 this_arg_conv.is_owned = false;
19100 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
19101 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
19105 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
19106 LDKNetGraphMsgHandler this_arg_conv;
19107 this_arg_conv.inner = (void*)(this_arg & (~1));
19108 this_arg_conv.is_owned = false;
19109 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
19110 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
19114 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
19115 LDKDirectionalChannelInfo this_obj_conv;
19116 this_obj_conv.inner = (void*)(this_obj & (~1));
19117 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19118 DirectionalChannelInfo_free(this_obj_conv);
19121 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
19122 LDKDirectionalChannelInfo this_ptr_conv;
19123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19124 this_ptr_conv.is_owned = false;
19125 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
19129 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
19130 LDKDirectionalChannelInfo this_ptr_conv;
19131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19132 this_ptr_conv.is_owned = false;
19133 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
19136 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
19137 LDKDirectionalChannelInfo this_ptr_conv;
19138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19139 this_ptr_conv.is_owned = false;
19140 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
19144 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
19145 LDKDirectionalChannelInfo this_ptr_conv;
19146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19147 this_ptr_conv.is_owned = false;
19148 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
19151 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
19152 LDKDirectionalChannelInfo this_ptr_conv;
19153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19154 this_ptr_conv.is_owned = false;
19155 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
19159 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
19160 LDKDirectionalChannelInfo this_ptr_conv;
19161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19162 this_ptr_conv.is_owned = false;
19163 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
19166 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
19167 LDKDirectionalChannelInfo this_ptr_conv;
19168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19169 this_ptr_conv.is_owned = false;
19170 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
19174 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
19175 LDKDirectionalChannelInfo this_ptr_conv;
19176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19177 this_ptr_conv.is_owned = false;
19178 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
19181 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
19182 LDKDirectionalChannelInfo this_ptr_conv;
19183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19184 this_ptr_conv.is_owned = false;
19185 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19186 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
19187 long ret_ref = (long)ret_copy;
19191 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
19192 LDKDirectionalChannelInfo this_ptr_conv;
19193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19194 this_ptr_conv.is_owned = false;
19195 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
19197 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
19200 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
19201 LDKDirectionalChannelInfo this_ptr_conv;
19202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19203 this_ptr_conv.is_owned = false;
19204 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
19205 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19206 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19207 long ret_ref = (long)ret_var.inner;
19208 if (ret_var.is_owned) {
19214 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
19215 LDKDirectionalChannelInfo this_ptr_conv;
19216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19217 this_ptr_conv.is_owned = false;
19218 LDKRoutingFees val_conv;
19219 val_conv.inner = (void*)(val & (~1));
19220 val_conv.is_owned = (val & 1) || (val == 0);
19221 val_conv = RoutingFees_clone(&val_conv);
19222 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
19225 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
19226 LDKDirectionalChannelInfo this_ptr_conv;
19227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19228 this_ptr_conv.is_owned = false;
19229 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
19230 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19231 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19232 long ret_ref = (long)ret_var.inner;
19233 if (ret_var.is_owned) {
19239 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
19240 LDKDirectionalChannelInfo this_ptr_conv;
19241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19242 this_ptr_conv.is_owned = false;
19243 LDKChannelUpdate val_conv;
19244 val_conv.inner = (void*)(val & (~1));
19245 val_conv.is_owned = (val & 1) || (val == 0);
19246 val_conv = ChannelUpdate_clone(&val_conv);
19247 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
19250 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) {
19251 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
19252 FREE((void*)htlc_maximum_msat_arg);
19253 LDKRoutingFees fees_arg_conv;
19254 fees_arg_conv.inner = (void*)(fees_arg & (~1));
19255 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
19256 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
19257 LDKChannelUpdate last_update_message_arg_conv;
19258 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
19259 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
19260 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
19261 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);
19262 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19263 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19264 long ret_ref = (long)ret_var.inner;
19265 if (ret_var.is_owned) {
19271 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
19272 LDKDirectionalChannelInfo orig_conv;
19273 orig_conv.inner = (void*)(orig & (~1));
19274 orig_conv.is_owned = false;
19275 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
19276 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19277 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19278 long ret_ref = (long)ret_var.inner;
19279 if (ret_var.is_owned) {
19285 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
19286 LDKDirectionalChannelInfo obj_conv;
19287 obj_conv.inner = (void*)(obj & (~1));
19288 obj_conv.is_owned = false;
19289 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
19290 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19291 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19292 CVec_u8Z_free(ret_var);
19296 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
19297 LDKu8slice ser_ref;
19298 ser_ref.datalen = *((uint32_t*)ser);
19299 ser_ref.data = (int8_t*)(ser + 4);
19300 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
19301 *ret_conv = DirectionalChannelInfo_read(ser_ref);
19302 return (long)ret_conv;
19305 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
19306 LDKChannelInfo this_obj_conv;
19307 this_obj_conv.inner = (void*)(this_obj & (~1));
19308 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19309 ChannelInfo_free(this_obj_conv);
19312 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
19313 LDKChannelInfo this_ptr_conv;
19314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19315 this_ptr_conv.is_owned = false;
19316 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
19317 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19318 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19319 long ret_ref = (long)ret_var.inner;
19320 if (ret_var.is_owned) {
19326 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
19327 LDKChannelInfo this_ptr_conv;
19328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19329 this_ptr_conv.is_owned = false;
19330 LDKChannelFeatures val_conv;
19331 val_conv.inner = (void*)(val & (~1));
19332 val_conv.is_owned = (val & 1) || (val == 0);
19333 val_conv = ChannelFeatures_clone(&val_conv);
19334 ChannelInfo_set_features(&this_ptr_conv, val_conv);
19337 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
19338 LDKChannelInfo this_ptr_conv;
19339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19340 this_ptr_conv.is_owned = false;
19341 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19342 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
19346 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, int8_tArray val) {
19347 LDKChannelInfo this_ptr_conv;
19348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19349 this_ptr_conv.is_owned = false;
19350 LDKPublicKey val_ref;
19351 CHECK(*((uint32_t*)val) == 33);
19352 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19353 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
19356 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
19357 LDKChannelInfo this_ptr_conv;
19358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19359 this_ptr_conv.is_owned = false;
19360 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
19361 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19362 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19363 long ret_ref = (long)ret_var.inner;
19364 if (ret_var.is_owned) {
19370 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
19371 LDKChannelInfo this_ptr_conv;
19372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19373 this_ptr_conv.is_owned = false;
19374 LDKDirectionalChannelInfo val_conv;
19375 val_conv.inner = (void*)(val & (~1));
19376 val_conv.is_owned = (val & 1) || (val == 0);
19377 val_conv = DirectionalChannelInfo_clone(&val_conv);
19378 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
19381 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
19382 LDKChannelInfo this_ptr_conv;
19383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19384 this_ptr_conv.is_owned = false;
19385 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19386 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
19390 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, int8_tArray val) {
19391 LDKChannelInfo this_ptr_conv;
19392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19393 this_ptr_conv.is_owned = false;
19394 LDKPublicKey val_ref;
19395 CHECK(*((uint32_t*)val) == 33);
19396 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19397 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
19400 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
19401 LDKChannelInfo this_ptr_conv;
19402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19403 this_ptr_conv.is_owned = false;
19404 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
19405 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19406 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19407 long ret_ref = (long)ret_var.inner;
19408 if (ret_var.is_owned) {
19414 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
19415 LDKChannelInfo this_ptr_conv;
19416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19417 this_ptr_conv.is_owned = false;
19418 LDKDirectionalChannelInfo val_conv;
19419 val_conv.inner = (void*)(val & (~1));
19420 val_conv.is_owned = (val & 1) || (val == 0);
19421 val_conv = DirectionalChannelInfo_clone(&val_conv);
19422 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
19425 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
19426 LDKChannelInfo this_ptr_conv;
19427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19428 this_ptr_conv.is_owned = false;
19429 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19430 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
19431 long ret_ref = (long)ret_copy;
19435 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
19436 LDKChannelInfo this_ptr_conv;
19437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19438 this_ptr_conv.is_owned = false;
19439 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
19441 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
19444 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
19445 LDKChannelInfo this_ptr_conv;
19446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19447 this_ptr_conv.is_owned = false;
19448 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
19449 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19450 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19451 long ret_ref = (long)ret_var.inner;
19452 if (ret_var.is_owned) {
19458 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
19459 LDKChannelInfo this_ptr_conv;
19460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19461 this_ptr_conv.is_owned = false;
19462 LDKChannelAnnouncement val_conv;
19463 val_conv.inner = (void*)(val & (~1));
19464 val_conv.is_owned = (val & 1) || (val == 0);
19465 val_conv = ChannelAnnouncement_clone(&val_conv);
19466 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
19469 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_new(uint32_t features_arg, int8_tArray node_one_arg, uint32_t one_to_two_arg, int8_tArray node_two_arg, uint32_t two_to_one_arg, uint32_t capacity_sats_arg, uint32_t announcement_message_arg) {
19470 LDKChannelFeatures features_arg_conv;
19471 features_arg_conv.inner = (void*)(features_arg & (~1));
19472 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
19473 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
19474 LDKPublicKey node_one_arg_ref;
19475 CHECK(*((uint32_t*)node_one_arg) == 33);
19476 memcpy(node_one_arg_ref.compressed_form, (uint8_t*)(node_one_arg + 4), 33);
19477 LDKDirectionalChannelInfo one_to_two_arg_conv;
19478 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
19479 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
19480 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
19481 LDKPublicKey node_two_arg_ref;
19482 CHECK(*((uint32_t*)node_two_arg) == 33);
19483 memcpy(node_two_arg_ref.compressed_form, (uint8_t*)(node_two_arg + 4), 33);
19484 LDKDirectionalChannelInfo two_to_one_arg_conv;
19485 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
19486 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
19487 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
19488 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
19489 FREE((void*)capacity_sats_arg);
19490 LDKChannelAnnouncement announcement_message_arg_conv;
19491 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
19492 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
19493 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
19494 LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_ref, one_to_two_arg_conv, node_two_arg_ref, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv);
19495 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19496 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19497 long ret_ref = (long)ret_var.inner;
19498 if (ret_var.is_owned) {
19504 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
19505 LDKChannelInfo orig_conv;
19506 orig_conv.inner = (void*)(orig & (~1));
19507 orig_conv.is_owned = false;
19508 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
19509 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19510 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19511 long ret_ref = (long)ret_var.inner;
19512 if (ret_var.is_owned) {
19518 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
19519 LDKChannelInfo obj_conv;
19520 obj_conv.inner = (void*)(obj & (~1));
19521 obj_conv.is_owned = false;
19522 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
19523 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19524 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19525 CVec_u8Z_free(ret_var);
19529 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
19530 LDKu8slice ser_ref;
19531 ser_ref.datalen = *((uint32_t*)ser);
19532 ser_ref.data = (int8_t*)(ser + 4);
19533 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19534 *ret_conv = ChannelInfo_read(ser_ref);
19535 return (long)ret_conv;
19538 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
19539 LDKRoutingFees this_obj_conv;
19540 this_obj_conv.inner = (void*)(this_obj & (~1));
19541 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19542 RoutingFees_free(this_obj_conv);
19545 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
19546 LDKRoutingFees this_ptr_conv;
19547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19548 this_ptr_conv.is_owned = false;
19549 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
19553 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
19554 LDKRoutingFees this_ptr_conv;
19555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19556 this_ptr_conv.is_owned = false;
19557 RoutingFees_set_base_msat(&this_ptr_conv, val);
19560 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
19561 LDKRoutingFees this_ptr_conv;
19562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19563 this_ptr_conv.is_owned = false;
19564 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
19568 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
19569 LDKRoutingFees this_ptr_conv;
19570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19571 this_ptr_conv.is_owned = false;
19572 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
19575 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
19576 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
19577 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19578 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19579 long ret_ref = (long)ret_var.inner;
19580 if (ret_var.is_owned) {
19586 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
19587 LDKRoutingFees orig_conv;
19588 orig_conv.inner = (void*)(orig & (~1));
19589 orig_conv.is_owned = false;
19590 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
19591 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19592 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19593 long ret_ref = (long)ret_var.inner;
19594 if (ret_var.is_owned) {
19600 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
19601 LDKu8slice ser_ref;
19602 ser_ref.datalen = *((uint32_t*)ser);
19603 ser_ref.data = (int8_t*)(ser + 4);
19604 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19605 *ret_conv = RoutingFees_read(ser_ref);
19606 return (long)ret_conv;
19609 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
19610 LDKRoutingFees obj_conv;
19611 obj_conv.inner = (void*)(obj & (~1));
19612 obj_conv.is_owned = false;
19613 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
19614 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19615 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19616 CVec_u8Z_free(ret_var);
19620 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
19621 LDKNodeAnnouncementInfo this_obj_conv;
19622 this_obj_conv.inner = (void*)(this_obj & (~1));
19623 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19624 NodeAnnouncementInfo_free(this_obj_conv);
19627 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
19628 LDKNodeAnnouncementInfo this_ptr_conv;
19629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19630 this_ptr_conv.is_owned = false;
19631 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
19632 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19633 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19634 long ret_ref = (long)ret_var.inner;
19635 if (ret_var.is_owned) {
19641 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
19642 LDKNodeAnnouncementInfo this_ptr_conv;
19643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19644 this_ptr_conv.is_owned = false;
19645 LDKNodeFeatures val_conv;
19646 val_conv.inner = (void*)(val & (~1));
19647 val_conv.is_owned = (val & 1) || (val == 0);
19648 val_conv = NodeFeatures_clone(&val_conv);
19649 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
19652 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
19653 LDKNodeAnnouncementInfo this_ptr_conv;
19654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19655 this_ptr_conv.is_owned = false;
19656 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
19660 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
19661 LDKNodeAnnouncementInfo this_ptr_conv;
19662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19663 this_ptr_conv.is_owned = false;
19664 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
19667 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
19668 LDKNodeAnnouncementInfo this_ptr_conv;
19669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19670 this_ptr_conv.is_owned = false;
19671 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
19672 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
19676 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
19677 LDKNodeAnnouncementInfo this_ptr_conv;
19678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19679 this_ptr_conv.is_owned = false;
19680 LDKThreeBytes val_ref;
19681 CHECK(*((uint32_t*)val) == 3);
19682 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
19683 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
19686 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
19687 LDKNodeAnnouncementInfo this_ptr_conv;
19688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19689 this_ptr_conv.is_owned = false;
19690 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19691 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
19695 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
19696 LDKNodeAnnouncementInfo this_ptr_conv;
19697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19698 this_ptr_conv.is_owned = false;
19699 LDKThirtyTwoBytes val_ref;
19700 CHECK(*((uint32_t*)val) == 32);
19701 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19702 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
19705 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
19706 LDKNodeAnnouncementInfo this_ptr_conv;
19707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19708 this_ptr_conv.is_owned = false;
19709 LDKCVec_NetAddressZ val_constr;
19710 val_constr.datalen = *((uint32_t*)val);
19711 if (val_constr.datalen > 0)
19712 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19714 val_constr.data = NULL;
19715 uint32_t* val_vals = (uint32_t*)(val + 4);
19716 for (size_t m = 0; m < val_constr.datalen; m++) {
19717 uint32_t val_conv_12 = val_vals[m];
19718 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
19719 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
19720 val_constr.data[m] = val_conv_12_conv;
19722 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
19725 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
19726 LDKNodeAnnouncementInfo this_ptr_conv;
19727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19728 this_ptr_conv.is_owned = false;
19729 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
19730 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19731 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19732 long ret_ref = (long)ret_var.inner;
19733 if (ret_var.is_owned) {
19739 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
19740 LDKNodeAnnouncementInfo this_ptr_conv;
19741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19742 this_ptr_conv.is_owned = false;
19743 LDKNodeAnnouncement val_conv;
19744 val_conv.inner = (void*)(val & (~1));
19745 val_conv.is_owned = (val & 1) || (val == 0);
19746 val_conv = NodeAnnouncement_clone(&val_conv);
19747 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
19750 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) {
19751 LDKNodeFeatures features_arg_conv;
19752 features_arg_conv.inner = (void*)(features_arg & (~1));
19753 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
19754 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
19755 LDKThreeBytes rgb_arg_ref;
19756 CHECK(*((uint32_t*)rgb_arg) == 3);
19757 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
19758 LDKThirtyTwoBytes alias_arg_ref;
19759 CHECK(*((uint32_t*)alias_arg) == 32);
19760 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
19761 LDKCVec_NetAddressZ addresses_arg_constr;
19762 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
19763 if (addresses_arg_constr.datalen > 0)
19764 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19766 addresses_arg_constr.data = NULL;
19767 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
19768 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
19769 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
19770 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
19771 FREE((void*)addresses_arg_conv_12);
19772 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
19774 LDKNodeAnnouncement announcement_message_arg_conv;
19775 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
19776 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
19777 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
19778 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
19779 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19780 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19781 long ret_ref = (long)ret_var.inner;
19782 if (ret_var.is_owned) {
19788 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
19789 LDKNodeAnnouncementInfo orig_conv;
19790 orig_conv.inner = (void*)(orig & (~1));
19791 orig_conv.is_owned = false;
19792 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
19793 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19794 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19795 long ret_ref = (long)ret_var.inner;
19796 if (ret_var.is_owned) {
19802 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
19803 LDKNodeAnnouncementInfo obj_conv;
19804 obj_conv.inner = (void*)(obj & (~1));
19805 obj_conv.is_owned = false;
19806 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
19807 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19808 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19809 CVec_u8Z_free(ret_var);
19813 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
19814 LDKu8slice ser_ref;
19815 ser_ref.datalen = *((uint32_t*)ser);
19816 ser_ref.data = (int8_t*)(ser + 4);
19817 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19818 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
19819 return (long)ret_conv;
19822 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
19823 LDKNodeInfo this_obj_conv;
19824 this_obj_conv.inner = (void*)(this_obj & (~1));
19825 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19826 NodeInfo_free(this_obj_conv);
19829 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
19830 LDKNodeInfo this_ptr_conv;
19831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19832 this_ptr_conv.is_owned = false;
19833 LDKCVec_u64Z val_constr;
19834 val_constr.datalen = *((uint32_t*)val);
19835 if (val_constr.datalen > 0)
19836 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19838 val_constr.data = NULL;
19839 int64_t* val_vals = (int64_t*)(val + 4);
19840 for (size_t i = 0; i < val_constr.datalen; i++) {
19841 int64_t val_conv_8 = val_vals[i];
19842 val_constr.data[i] = val_conv_8;
19844 NodeInfo_set_channels(&this_ptr_conv, val_constr);
19847 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
19848 LDKNodeInfo this_ptr_conv;
19849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19850 this_ptr_conv.is_owned = false;
19851 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
19852 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19853 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19854 long ret_ref = (long)ret_var.inner;
19855 if (ret_var.is_owned) {
19861 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
19862 LDKNodeInfo this_ptr_conv;
19863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19864 this_ptr_conv.is_owned = false;
19865 LDKRoutingFees val_conv;
19866 val_conv.inner = (void*)(val & (~1));
19867 val_conv.is_owned = (val & 1) || (val == 0);
19868 val_conv = RoutingFees_clone(&val_conv);
19869 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
19872 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
19873 LDKNodeInfo this_ptr_conv;
19874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19875 this_ptr_conv.is_owned = false;
19876 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
19877 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19878 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19879 long ret_ref = (long)ret_var.inner;
19880 if (ret_var.is_owned) {
19886 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
19887 LDKNodeInfo this_ptr_conv;
19888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19889 this_ptr_conv.is_owned = false;
19890 LDKNodeAnnouncementInfo val_conv;
19891 val_conv.inner = (void*)(val & (~1));
19892 val_conv.is_owned = (val & 1) || (val == 0);
19893 val_conv = NodeAnnouncementInfo_clone(&val_conv);
19894 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
19897 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
19898 LDKCVec_u64Z channels_arg_constr;
19899 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
19900 if (channels_arg_constr.datalen > 0)
19901 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19903 channels_arg_constr.data = NULL;
19904 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
19905 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
19906 int64_t channels_arg_conv_8 = channels_arg_vals[i];
19907 channels_arg_constr.data[i] = channels_arg_conv_8;
19909 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
19910 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
19911 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
19912 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
19913 LDKNodeAnnouncementInfo announcement_info_arg_conv;
19914 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
19915 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
19916 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
19917 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
19918 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19919 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19920 long ret_ref = (long)ret_var.inner;
19921 if (ret_var.is_owned) {
19927 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
19928 LDKNodeInfo orig_conv;
19929 orig_conv.inner = (void*)(orig & (~1));
19930 orig_conv.is_owned = false;
19931 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
19932 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19933 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19934 long ret_ref = (long)ret_var.inner;
19935 if (ret_var.is_owned) {
19941 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
19942 LDKNodeInfo obj_conv;
19943 obj_conv.inner = (void*)(obj & (~1));
19944 obj_conv.is_owned = false;
19945 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
19946 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19947 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19948 CVec_u8Z_free(ret_var);
19952 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
19953 LDKu8slice ser_ref;
19954 ser_ref.datalen = *((uint32_t*)ser);
19955 ser_ref.data = (int8_t*)(ser + 4);
19956 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19957 *ret_conv = NodeInfo_read(ser_ref);
19958 return (long)ret_conv;
19961 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
19962 LDKNetworkGraph obj_conv;
19963 obj_conv.inner = (void*)(obj & (~1));
19964 obj_conv.is_owned = false;
19965 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
19966 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19967 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19968 CVec_u8Z_free(ret_var);
19972 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
19973 LDKu8slice ser_ref;
19974 ser_ref.datalen = *((uint32_t*)ser);
19975 ser_ref.data = (int8_t*)(ser + 4);
19976 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19977 *ret_conv = NetworkGraph_read(ser_ref);
19978 return (long)ret_conv;
19981 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
19982 LDKThirtyTwoBytes genesis_hash_ref;
19983 CHECK(*((uint32_t*)genesis_hash) == 32);
19984 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
19985 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
19986 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19987 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19988 long ret_ref = (long)ret_var.inner;
19989 if (ret_var.is_owned) {
19995 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
19996 LDKNetworkGraph this_arg_conv;
19997 this_arg_conv.inner = (void*)(this_arg & (~1));
19998 this_arg_conv.is_owned = false;
19999 LDKNodeAnnouncement msg_conv;
20000 msg_conv.inner = (void*)(msg & (~1));
20001 msg_conv.is_owned = false;
20002 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20003 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
20004 return (long)ret_conv;
20007 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
20008 LDKNetworkGraph this_arg_conv;
20009 this_arg_conv.inner = (void*)(this_arg & (~1));
20010 this_arg_conv.is_owned = false;
20011 LDKUnsignedNodeAnnouncement msg_conv;
20012 msg_conv.inner = (void*)(msg & (~1));
20013 msg_conv.is_owned = false;
20014 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20015 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
20016 return (long)ret_conv;
20019 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
20020 LDKNetworkGraph this_arg_conv;
20021 this_arg_conv.inner = (void*)(this_arg & (~1));
20022 this_arg_conv.is_owned = false;
20023 LDKChannelAnnouncement msg_conv;
20024 msg_conv.inner = (void*)(msg & (~1));
20025 msg_conv.is_owned = false;
20026 LDKAccess *chain_access_conv_ptr = NULL;
20027 if (chain_access != 0) {
20028 LDKAccess chain_access_conv;
20029 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
20030 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
20031 *chain_access_conv_ptr = chain_access_conv;
20033 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20034 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
20035 return (long)ret_conv;
20038 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
20039 LDKNetworkGraph this_arg_conv;
20040 this_arg_conv.inner = (void*)(this_arg & (~1));
20041 this_arg_conv.is_owned = false;
20042 LDKUnsignedChannelAnnouncement msg_conv;
20043 msg_conv.inner = (void*)(msg & (~1));
20044 msg_conv.is_owned = false;
20045 LDKAccess *chain_access_conv_ptr = NULL;
20046 if (chain_access != 0) {
20047 LDKAccess chain_access_conv;
20048 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
20049 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
20050 *chain_access_conv_ptr = chain_access_conv;
20052 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20053 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
20054 return (long)ret_conv;
20057 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
20058 LDKNetworkGraph this_arg_conv;
20059 this_arg_conv.inner = (void*)(this_arg & (~1));
20060 this_arg_conv.is_owned = false;
20061 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
20064 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
20065 LDKNetworkGraph this_arg_conv;
20066 this_arg_conv.inner = (void*)(this_arg & (~1));
20067 this_arg_conv.is_owned = false;
20068 LDKChannelUpdate msg_conv;
20069 msg_conv.inner = (void*)(msg & (~1));
20070 msg_conv.is_owned = false;
20071 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20072 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
20073 return (long)ret_conv;
20076 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
20077 LDKNetworkGraph this_arg_conv;
20078 this_arg_conv.inner = (void*)(this_arg & (~1));
20079 this_arg_conv.is_owned = false;
20080 LDKUnsignedChannelUpdate msg_conv;
20081 msg_conv.inner = (void*)(msg & (~1));
20082 msg_conv.is_owned = false;
20083 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20084 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
20085 return (long)ret_conv;
20088 void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) {
20089 LDKFilesystemPersister this_obj_conv;
20090 this_obj_conv.inner = (void*)(this_obj & (~1));
20091 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20092 FilesystemPersister_free(this_obj_conv);
20095 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_new(int8_tArray path_to_channel_data) {
20096 LDKCVec_u8Z path_to_channel_data_ref;
20097 path_to_channel_data_ref.datalen = *((uint32_t*)path_to_channel_data);
20098 path_to_channel_data_ref.data = MALLOC(path_to_channel_data_ref.datalen, "LDKCVec_u8Z Bytes");
20099 memcpy(path_to_channel_data_ref.data, (uint8_t*)(path_to_channel_data + 4), path_to_channel_data_ref.datalen);
20100 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_ref);
20101 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20102 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20103 long ret_ref = (long)ret_var.inner;
20104 if (ret_var.is_owned) {
20110 int8_tArray __attribute__((visibility("default"))) TS_FilesystemPersister_get_data_dir(uint32_t this_arg) {
20111 LDKFilesystemPersister this_arg_conv;
20112 this_arg_conv.inner = (void*)(this_arg & (~1));
20113 this_arg_conv.is_owned = false;
20114 LDKCVec_u8Z ret_var = FilesystemPersister_get_data_dir(&this_arg_conv);
20115 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20116 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20117 CVec_u8Z_free(ret_var);
20121 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_persist_manager(int8_tArray data_dir, uint32_t manager) {
20122 LDKCVec_u8Z data_dir_ref;
20123 data_dir_ref.datalen = *((uint32_t*)data_dir);
20124 data_dir_ref.data = MALLOC(data_dir_ref.datalen, "LDKCVec_u8Z Bytes");
20125 memcpy(data_dir_ref.data, (uint8_t*)(data_dir + 4), data_dir_ref.datalen);
20126 LDKChannelManager manager_conv;
20127 manager_conv.inner = (void*)(manager & (~1));
20128 manager_conv.is_owned = false;
20129 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
20130 *ret_conv = FilesystemPersister_persist_manager(data_dir_ref, &manager_conv);
20131 return (long)ret_conv;
20134 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_read_channelmonitors(uint32_t this_arg, uint32_t keys_manager) {
20135 LDKFilesystemPersister this_arg_conv;
20136 this_arg_conv.inner = (void*)(this_arg & (~1));
20137 this_arg_conv.is_owned = false;
20138 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
20139 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
20140 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
20141 return (long)ret_conv;
20144 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_as_Persist(uint32_t this_arg) {
20145 LDKFilesystemPersister this_arg_conv;
20146 this_arg_conv.inner = (void*)(this_arg & (~1));
20147 this_arg_conv.is_owned = false;
20148 LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
20149 *ret = FilesystemPersister_as_Persist(&this_arg_conv);