1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
3 #include <rust_types.h>
8 // These should be provided...somehow...
9 void *memset(void *s, int c, size_t n);
10 void *memcpy(void *dest, const void *src, size_t n);
11 int memcmp(const void *s1, const void *s2, size_t n);
13 void __attribute__((noreturn)) abort(void);
14 static inline void assert(bool expression) {
15 if (!expression) { abort(); }
18 void *malloc(size_t size);
21 #define MALLOC(a, _) malloc(a)
22 #define FREE(p) if ((long)(p) > 1024) { free(p); }
23 #define DO_ASSERT(a) (void)(a)
26 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
27 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
28 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
29 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
31 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
33 typedef uint32_t int64_tArray;
34 typedef uint32_t int8_tArray;
35 typedef uint32_t uint32_tArray;
36 typedef uint32_t ptrArray;
37 typedef uint32_t jstring;
39 static inline uint32_t init_arr(size_t arr_len, size_t elem_size, const char *type_desc) {
40 uint32_t *elems = (uint32_t*)MALLOC(arr_len * elem_size + 4, type_desc);
42 return (uint32_t)elems;
45 jstring str_ref_to_ts(const char* chars, size_t len) {
46 char* err_buf = MALLOC(len + 4, "str conv buf");
47 *((uint32_t*)err_buf) = len;
48 memcpy(err_buf + 4, chars, len);
49 return (uint32_t) err_buf;
52 typedef bool jboolean;
54 uint32_t __attribute__((visibility("default"))) TS_malloc(uint32_t size) {
55 return (uint32_t)MALLOC(size, "JS-Called malloc");
57 void __attribute__((visibility("default"))) TS_free(uint32_t ptr) {
60 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
61 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
63 case 0: return LDKAccessError_UnknownChain;
64 case 1: return LDKAccessError_UnknownTx;
68 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
70 case LDKAccessError_UnknownChain: return 0;
71 case LDKAccessError_UnknownTx: return 1;
75 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
77 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
78 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
82 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
84 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
85 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
89 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
91 case 0: return LDKConfirmationTarget_Background;
92 case 1: return LDKConfirmationTarget_Normal;
93 case 2: return LDKConfirmationTarget_HighPriority;
97 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
99 case LDKConfirmationTarget_Background: return 0;
100 case LDKConfirmationTarget_Normal: return 1;
101 case LDKConfirmationTarget_HighPriority: return 2;
105 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
107 case 0: return LDKIOError_NotFound;
108 case 1: return LDKIOError_PermissionDenied;
109 case 2: return LDKIOError_ConnectionRefused;
110 case 3: return LDKIOError_ConnectionReset;
111 case 4: return LDKIOError_ConnectionAborted;
112 case 5: return LDKIOError_NotConnected;
113 case 6: return LDKIOError_AddrInUse;
114 case 7: return LDKIOError_AddrNotAvailable;
115 case 8: return LDKIOError_BrokenPipe;
116 case 9: return LDKIOError_AlreadyExists;
117 case 10: return LDKIOError_WouldBlock;
118 case 11: return LDKIOError_InvalidInput;
119 case 12: return LDKIOError_InvalidData;
120 case 13: return LDKIOError_TimedOut;
121 case 14: return LDKIOError_WriteZero;
122 case 15: return LDKIOError_Interrupted;
123 case 16: return LDKIOError_Other;
124 case 17: return LDKIOError_UnexpectedEof;
128 static inline int32_t LDKIOError_to_js(LDKIOError val) {
130 case LDKIOError_NotFound: return 0;
131 case LDKIOError_PermissionDenied: return 1;
132 case LDKIOError_ConnectionRefused: return 2;
133 case LDKIOError_ConnectionReset: return 3;
134 case LDKIOError_ConnectionAborted: return 4;
135 case LDKIOError_NotConnected: return 5;
136 case LDKIOError_AddrInUse: return 6;
137 case LDKIOError_AddrNotAvailable: return 7;
138 case LDKIOError_BrokenPipe: return 8;
139 case LDKIOError_AlreadyExists: return 9;
140 case LDKIOError_WouldBlock: return 10;
141 case LDKIOError_InvalidInput: return 11;
142 case LDKIOError_InvalidData: return 12;
143 case LDKIOError_TimedOut: return 13;
144 case LDKIOError_WriteZero: return 14;
145 case LDKIOError_Interrupted: return 15;
146 case LDKIOError_Other: return 16;
147 case LDKIOError_UnexpectedEof: return 17;
151 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
153 case 0: return LDKLevel_Off;
154 case 1: return LDKLevel_Error;
155 case 2: return LDKLevel_Warn;
156 case 3: return LDKLevel_Info;
157 case 4: return LDKLevel_Debug;
158 case 5: return LDKLevel_Trace;
162 static inline int32_t LDKLevel_to_js(LDKLevel val) {
164 case LDKLevel_Off: return 0;
165 case LDKLevel_Error: return 1;
166 case LDKLevel_Warn: return 2;
167 case LDKLevel_Info: return 3;
168 case LDKLevel_Debug: return 4;
169 case LDKLevel_Trace: return 5;
173 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
175 case 0: return LDKNetwork_Bitcoin;
176 case 1: return LDKNetwork_Testnet;
177 case 2: return LDKNetwork_Regtest;
178 case 3: return LDKNetwork_Signet;
182 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
184 case LDKNetwork_Bitcoin: return 0;
185 case LDKNetwork_Testnet: return 1;
186 case LDKNetwork_Regtest: return 2;
187 case LDKNetwork_Signet: return 3;
191 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
193 case 0: return LDKSecp256k1Error_IncorrectSignature;
194 case 1: return LDKSecp256k1Error_InvalidMessage;
195 case 2: return LDKSecp256k1Error_InvalidPublicKey;
196 case 3: return LDKSecp256k1Error_InvalidSignature;
197 case 4: return LDKSecp256k1Error_InvalidSecretKey;
198 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
199 case 6: return LDKSecp256k1Error_InvalidTweak;
200 case 7: return LDKSecp256k1Error_TweakCheckFailed;
201 case 8: return LDKSecp256k1Error_NotEnoughMemory;
205 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
207 case LDKSecp256k1Error_IncorrectSignature: return 0;
208 case LDKSecp256k1Error_InvalidMessage: return 1;
209 case LDKSecp256k1Error_InvalidPublicKey: return 2;
210 case LDKSecp256k1Error_InvalidSignature: return 3;
211 case LDKSecp256k1Error_InvalidSecretKey: return 4;
212 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
213 case LDKSecp256k1Error_InvalidTweak: return 6;
214 case LDKSecp256k1Error_TweakCheckFailed: return 7;
215 case LDKSecp256k1Error_NotEnoughMemory: return 8;
219 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u8Z_new(int8_tArray elems) {
220 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
221 ret->datalen = *((uint32_t*)elems);
222 if (ret->datalen == 0) {
225 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
226 int8_t *java_elems = (int8_t*)(elems + 4);
227 for (size_t i = 0; i < ret->datalen; i++) {
228 ret->data[i] = java_elems[i];
233 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
234 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
235 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
238 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
239 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
241 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
242 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
243 CHECK(val->result_ok);
244 LDKChannelConfig res_var = (*val->contents.result);
245 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
246 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
247 long res_ref = (long)res_var.inner & ~1;
250 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
251 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
252 CHECK(!val->result_ok);
253 LDKDecodeError err_var = (*val->contents.err);
254 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
255 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
256 long err_ref = (long)err_var.inner & ~1;
259 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
260 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
262 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
263 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
264 CHECK(val->result_ok);
265 LDKOutPoint res_var = (*val->contents.result);
266 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
267 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
268 long res_ref = (long)res_var.inner & ~1;
271 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
272 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
273 CHECK(!val->result_ok);
274 LDKDecodeError err_var = (*val->contents.err);
275 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
276 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
277 long err_ref = (long)err_var.inner & ~1;
280 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_result_ok(uint32_t arg) {
281 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
283 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_ok(uint32_t arg) {
284 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
285 CHECK(val->result_ok);
286 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
287 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).bytes, 32);
290 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_err(uint32_t arg) {
291 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
292 CHECK(!val->result_ok);
293 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
296 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_result_ok(uint32_t arg) {
297 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
299 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_ok(uint32_t arg) {
300 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
301 CHECK(val->result_ok);
302 int8_tArray res_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
303 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compressed_form, 33);
306 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_err(uint32_t arg) {
307 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
308 CHECK(!val->result_ok);
309 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
312 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_result_ok(uint32_t arg) {
313 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
315 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t arg) {
316 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
317 CHECK(val->result_ok);
318 LDKTxCreationKeys res_var = (*val->contents.result);
319 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
320 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
321 long res_ref = (long)res_var.inner & ~1;
324 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t arg) {
325 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
326 CHECK(!val->result_ok);
327 LDKDecodeError err_var = (*val->contents.err);
328 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
329 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
330 long err_ref = (long)err_var.inner & ~1;
333 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_result_ok(uint32_t arg) {
334 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
336 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t arg) {
337 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
338 CHECK(val->result_ok);
339 LDKChannelPublicKeys res_var = (*val->contents.result);
340 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
341 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
342 long res_ref = (long)res_var.inner & ~1;
345 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t arg) {
346 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
347 CHECK(!val->result_ok);
348 LDKDecodeError err_var = (*val->contents.err);
349 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
350 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
351 long err_ref = (long)err_var.inner & ~1;
354 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_result_ok(uint32_t arg) {
355 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
357 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_ok(uint32_t arg) {
358 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
359 CHECK(val->result_ok);
360 LDKTxCreationKeys res_var = (*val->contents.result);
361 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
362 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
363 long res_ref = (long)res_var.inner & ~1;
366 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_err(uint32_t arg) {
367 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
368 CHECK(!val->result_ok);
369 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
372 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u32Z_ref_from_ptr(uint32_t ptr) {
373 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
375 case LDKCOption_u32Z_Some: {
376 return 0 /* LDKCOption_u32Z - Some */; (void) obj->some;
378 case LDKCOption_u32Z_None: {
379 return 0 /* LDKCOption_u32Z - None */;
384 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_result_ok(uint32_t arg) {
385 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
387 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
388 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
389 CHECK(val->result_ok);
390 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
391 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
392 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
393 long res_ref = (long)res_var.inner & ~1;
396 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
397 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
398 CHECK(!val->result_ok);
399 LDKDecodeError err_var = (*val->contents.err);
400 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
401 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
402 long err_ref = (long)err_var.inner & ~1;
405 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
406 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
408 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
409 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
410 CHECK(val->result_ok);
411 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
412 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
413 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
414 long res_ref = (long)res_var.inner & ~1;
417 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
418 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
419 CHECK(!val->result_ok);
420 LDKDecodeError err_var = (*val->contents.err);
421 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
422 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
423 long err_ref = (long)err_var.inner & ~1;
426 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
427 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
429 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
430 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
431 CHECK(val->result_ok);
432 LDKChannelTransactionParameters res_var = (*val->contents.result);
433 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
434 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
435 long res_ref = (long)res_var.inner & ~1;
438 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
439 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
440 CHECK(!val->result_ok);
441 LDKDecodeError err_var = (*val->contents.err);
442 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
443 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
444 long err_ref = (long)err_var.inner & ~1;
447 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
448 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
450 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
451 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
452 CHECK(val->result_ok);
453 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
454 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
455 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
456 long res_ref = (long)res_var.inner & ~1;
459 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
460 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
461 CHECK(!val->result_ok);
462 LDKDecodeError err_var = (*val->contents.err);
463 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
464 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
465 long err_ref = (long)err_var.inner & ~1;
468 jboolean __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
469 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
471 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
472 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
473 CHECK(val->result_ok);
474 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
475 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
476 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
477 long res_ref = (long)res_var.inner & ~1;
480 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
481 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
482 CHECK(!val->result_ok);
483 LDKDecodeError err_var = (*val->contents.err);
484 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
485 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
486 long err_ref = (long)err_var.inner & ~1;
489 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
490 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
492 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
493 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
494 CHECK(val->result_ok);
495 LDKCommitmentTransaction res_var = (*val->contents.result);
496 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
497 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
498 long res_ref = (long)res_var.inner & ~1;
501 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
502 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
503 CHECK(!val->result_ok);
504 LDKDecodeError err_var = (*val->contents.err);
505 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
506 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
507 long err_ref = (long)err_var.inner & ~1;
510 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_result_ok(uint32_t arg) {
511 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
513 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
514 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
515 CHECK(val->result_ok);
516 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
517 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
518 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
519 long res_ref = (long)res_var.inner & ~1;
522 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
523 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
524 CHECK(!val->result_ok);
525 return *val->contents.err;
527 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_result_ok(uint32_t arg) {
528 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
530 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
531 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
532 CHECK(val->result_ok);
533 LDKCVec_SignatureZ res_var = (*val->contents.result);
534 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
535 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
536 for (size_t m = 0; m < res_var.datalen; m++) {
537 int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
538 memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64);
539 res_arr_ptr[m] = res_conv_12_arr;
543 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
544 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
545 CHECK(!val->result_ok);
546 return *val->contents.err;
548 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
549 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
551 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
552 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
553 CHECK(val->result_ok);
554 LDKChannelMonitorUpdate res_var = (*val->contents.result);
555 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
556 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
557 long res_ref = (long)res_var.inner & ~1;
560 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
561 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
562 CHECK(!val->result_ok);
563 LDKDecodeError err_var = (*val->contents.err);
564 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
565 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
566 long err_ref = (long)err_var.inner & ~1;
569 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
570 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
572 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
573 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
574 CHECK(val->result_ok);
575 LDKHTLCUpdate res_var = (*val->contents.result);
576 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
577 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
578 long res_ref = (long)res_var.inner & ~1;
581 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
582 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
583 CHECK(!val->result_ok);
584 LDKDecodeError err_var = (*val->contents.err);
585 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
586 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
587 long err_ref = (long)err_var.inner & ~1;
590 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
591 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
593 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
594 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
595 CHECK(val->result_ok);
596 return *val->contents.result;
598 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
599 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
600 CHECK(!val->result_ok);
601 LDKMonitorUpdateError err_var = (*val->contents.err);
602 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
603 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
604 long err_ref = (long)err_var.inner & ~1;
607 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
608 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
610 a_conv.inner = (void*)(a & (~1));
611 a_conv.is_owned = (a & 1) || (a == 0);
612 a_conv = OutPoint_clone(&a_conv);
615 b_ref.datalen = *((uint32_t*)b);
616 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
617 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
621 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_a(uint32_t ptr) {
622 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
623 LDKOutPoint a_var = tuple->a;
624 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
625 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
626 long a_ref = (long)a_var.inner & ~1;
629 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_b(uint32_t ptr) {
630 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
631 LDKCVec_u8Z b_var = tuple->b;
632 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
633 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
636 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
637 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
640 b_ref.datalen = *((uint32_t*)b);
641 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
642 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
646 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_a(uint32_t ptr) {
647 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
650 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_b(uint32_t ptr) {
651 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
652 LDKCVec_u8Z b_var = tuple->b;
653 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
654 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
657 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32ScriptZZ_new(uint32_tArray elems) {
658 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
659 ret->datalen = *((uint32_t*)elems);
660 if (ret->datalen == 0) {
663 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
664 uint32_t *java_elems = (uint32_t*)(elems + 4);
665 for (size_t i = 0; i < ret->datalen; i++) {
666 uint32_t arr_elem = java_elems[i];
667 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
668 // Warning: we may need a move here but no clone is available for LDKC2Tuple_u32ScriptZ
669 ret->data[i] = arr_elem_conv;
674 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
675 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
676 LDKThirtyTwoBytes a_ref;
677 CHECK(*((uint32_t*)a) == 32);
678 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
680 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
681 b_constr.datalen = *((uint32_t*)b);
682 if (b_constr.datalen > 0)
683 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
685 b_constr.data = NULL;
686 uint32_t* b_vals = (uint32_t*)(b + 4);
687 for (size_t e = 0; e < b_constr.datalen; e++) {
688 uint32_t b_conv_30 = b_vals[e];
689 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
690 // Warning: we may need a move here but no clone is available for LDKC2Tuple_u32ScriptZ
691 b_constr.data[e] = b_conv_30_conv;
696 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t ptr) {
697 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
698 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
699 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
702 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t ptr) {
703 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
704 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
705 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
706 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
707 for (size_t e = 0; e < b_var.datalen; e++) {
708 long b_conv_30_ref = (long)(&b_var.data[e]) | 1;
709 b_arr_ptr[e] = b_conv_30_ref;
713 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_new(uint32_tArray elems) {
714 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
715 ret->datalen = *((uint32_t*)elems);
716 if (ret->datalen == 0) {
719 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
720 uint32_t *java_elems = (uint32_t*)(elems + 4);
721 for (size_t i = 0; i < ret->datalen; i++) {
722 uint32_t arr_elem = java_elems[i];
723 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
724 // Warning: we may need a move here but no clone is available for LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ
725 ret->data[i] = arr_elem_conv;
730 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
731 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
733 case LDKMonitorEvent_HTLCEvent: {
734 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
735 CHECK((((long)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
736 CHECK((((long)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
737 long htlc_event_ref = (long)htlc_event_var.inner & ~1;
738 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
740 case LDKMonitorEvent_CommitmentTxBroadcasted: {
741 LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
742 CHECK((((long)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
743 CHECK((((long)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
744 long commitment_tx_broadcasted_ref = (long)commitment_tx_broadcasted_var.inner & ~1;
745 return 0 /* LDKMonitorEvent - CommitmentTxBroadcasted */; (void) commitment_tx_broadcasted_ref;
750 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) {
751 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
752 ret->datalen = *((uint32_t*)elems);
753 if (ret->datalen == 0) {
756 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
757 uint32_t *java_elems = (uint32_t*)(elems + 4);
758 for (size_t i = 0; i < ret->datalen; i++) {
759 uint32_t arr_elem = java_elems[i];
760 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
761 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
762 ret->data[i] = arr_elem_conv;
767 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
768 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
769 for (size_t i = 0; i < ret.datalen; i++) {
770 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
774 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
775 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
777 case LDKSpendableOutputDescriptor_StaticOutput: {
778 LDKOutPoint outpoint_var = obj->static_output.outpoint;
779 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
780 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
781 long outpoint_ref = (long)outpoint_var.inner & ~1;
782 long output_ref = ((long)&obj->static_output.output) | 1;
783 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (long)output_ref;
785 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
786 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
787 CHECK((((long)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
788 CHECK((((long)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
789 long delayed_payment_output_ref = (long)delayed_payment_output_var.inner & ~1;
790 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
792 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
793 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
794 CHECK((((long)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
795 CHECK((((long)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
796 long static_payment_output_ref = (long)static_payment_output_var.inner & ~1;
797 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
802 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_SpendableOutputDescriptorZ_new(uint32_tArray elems) {
803 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
804 ret->datalen = *((uint32_t*)elems);
805 if (ret->datalen == 0) {
808 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
809 uint32_t *java_elems = (uint32_t*)(elems + 4);
810 for (size_t i = 0; i < ret->datalen; i++) {
811 uint32_t arr_elem = java_elems[i];
812 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
813 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
814 ret->data[i] = arr_elem_conv;
819 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
820 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
821 for (size_t i = 0; i < ret.datalen; i++) {
822 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
826 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
827 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
829 case LDKEvent_FundingGenerationReady: {
830 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
831 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
832 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
833 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
834 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
835 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;
837 case LDKEvent_PaymentReceived: {
838 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
839 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
840 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
841 memcpy((uint8_t*)(payment_secret_arr + 4), obj->payment_received.payment_secret.data, 32);
842 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) payment_secret_arr; (void) obj->payment_received.amt;
844 case LDKEvent_PaymentSent: {
845 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
846 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
847 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
849 case LDKEvent_PaymentFailed: {
850 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
851 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_failed.payment_hash.data, 32);
852 return 0 /* LDKEvent - PaymentFailed */; (void) payment_hash_arr; (void) obj->payment_failed.rejected_by_dest;
854 case LDKEvent_PendingHTLCsForwardable: {
855 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
857 case LDKEvent_SpendableOutputs: {
858 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
859 uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
860 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
861 for (size_t b = 0; b < outputs_var.datalen; b++) {
862 long outputs_conv_27_ref = ((long)&outputs_var.data[b]) | 1;
863 outputs_arr_ptr[b] = outputs_conv_27_ref;
865 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
870 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
871 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
872 ret->datalen = *((uint32_t*)elems);
873 if (ret->datalen == 0) {
876 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
877 uint32_t *java_elems = (uint32_t*)(elems + 4);
878 for (size_t i = 0; i < ret->datalen; i++) {
879 uint32_t arr_elem = java_elems[i];
880 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
881 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
882 ret->data[i] = arr_elem_conv;
887 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
888 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
889 for (size_t i = 0; i < ret.datalen; i++) {
890 ret.data[i] = Event_clone(&orig->data[i]);
894 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
895 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
897 LDKTransaction b_ref;
898 b_ref.datalen = *((uint32_t*)b);
899 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
900 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
901 b_ref.data_is_owned = false;
905 int64_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_a(uint32_t ptr) {
906 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
909 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_b(uint32_t ptr) {
910 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
911 LDKTransaction b_var = tuple->b;
912 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
913 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
916 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_usizeTransactionZZ_new(uint32_tArray elems) {
917 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
918 ret->datalen = *((uint32_t*)elems);
919 if (ret->datalen == 0) {
922 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
923 uint32_t *java_elems = (uint32_t*)(elems + 4);
924 for (size_t i = 0; i < ret->datalen; i++) {
925 uint32_t arr_elem = java_elems[i];
926 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
927 // Warning: we may need a move here but no clone is available for LDKC2Tuple_usizeTransactionZ
928 ret->data[i] = arr_elem_conv;
933 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
934 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
936 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
937 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
941 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_a(uint32_t ptr) {
942 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
945 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_b(uint32_t ptr) {
946 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
947 long b_ref = ((long)&tuple->b) | 1;
950 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
951 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
952 ret->datalen = *((uint32_t*)elems);
953 if (ret->datalen == 0) {
956 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
957 uint32_t *java_elems = (uint32_t*)(elems + 4);
958 for (size_t i = 0; i < ret->datalen; i++) {
959 uint32_t arr_elem = java_elems[i];
960 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
961 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
962 ret->data[i] = arr_elem_conv;
967 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
968 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
969 for (size_t i = 0; i < ret.datalen; i++) {
970 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
974 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
975 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
976 LDKThirtyTwoBytes a_ref;
977 CHECK(*((uint32_t*)a) == 32);
978 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
980 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
981 b_constr.datalen = *((uint32_t*)b);
982 if (b_constr.datalen > 0)
983 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
985 b_constr.data = NULL;
986 uint32_t* b_vals = (uint32_t*)(b + 4);
987 for (size_t z = 0; z < b_constr.datalen; z++) {
988 uint32_t b_conv_25 = b_vals[z];
989 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
990 b_conv_25_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1));
991 b_constr.data[z] = b_conv_25_conv;
996 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t ptr) {
997 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
998 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
999 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
1002 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t ptr) {
1003 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
1004 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
1005 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1006 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
1007 for (size_t z = 0; z < b_var.datalen; z++) {
1008 long b_conv_25_ref = (long)(&b_var.data[z]) | 1;
1009 b_arr_ptr[z] = b_conv_25_ref;
1013 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
1014 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
1015 ret->datalen = *((uint32_t*)elems);
1016 if (ret->datalen == 0) {
1019 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
1020 uint32_t *java_elems = (uint32_t*)(elems + 4);
1021 for (size_t i = 0; i < ret->datalen; i++) {
1022 uint32_t arr_elem = java_elems[i];
1023 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
1024 // Warning: we may need a move here but no clone is available for LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ
1025 ret->data[i] = arr_elem_conv;
1030 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1031 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1032 for (size_t i = 0; i < ret.datalen; i++) {
1033 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1037 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(uint32_t arg) {
1038 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1040 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
1041 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1042 CHECK(val->result_ok);
1043 return *val->contents.result;
1045 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
1046 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1047 CHECK(!val->result_ok);
1048 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
1051 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
1052 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1054 CHECK(*((uint32_t*)a) == 64);
1055 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
1057 LDKCVec_SignatureZ b_constr;
1058 b_constr.datalen = *((uint32_t*)b);
1059 if (b_constr.datalen > 0)
1060 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1062 b_constr.data = NULL;
1063 int8_tArray* b_vals = (int8_tArray*)(b + 4);
1064 for (size_t m = 0; m < b_constr.datalen; m++) {
1065 int8_tArray b_conv_12 = b_vals[m];
1066 LDKSignature b_conv_12_ref;
1067 CHECK(*((uint32_t*)b_conv_12) == 64);
1068 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
1069 b_constr.data[m] = b_conv_12_ref;
1074 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t ptr) {
1075 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1076 int8_tArray a_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1077 memcpy((uint8_t*)(a_arr + 4), tuple->a.compact_form, 64);
1080 ptrArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t ptr) {
1081 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1082 LDKCVec_SignatureZ b_var = tuple->b;
1083 ptrArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1084 int8_tArray *b_arr_ptr = (int8_tArray*)(b_arr + 4);
1085 for (size_t m = 0; m < b_var.datalen; m++) {
1086 int8_tArray b_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1087 memcpy((uint8_t*)(b_conv_12_arr + 4), b_var.data[m].compact_form, 64);
1088 b_arr_ptr[m] = b_conv_12_arr;
1092 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(uint32_t arg) {
1093 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1095 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1096 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1097 CHECK(val->result_ok);
1098 long res_ref = (long)(&(*val->contents.result)) | 1;
1101 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1102 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1103 CHECK(!val->result_ok);
1104 return *val->contents.err;
1106 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_result_ok(uint32_t arg) {
1107 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1109 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1110 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1111 CHECK(val->result_ok);
1112 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1113 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1116 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1117 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1118 CHECK(!val->result_ok);
1119 return *val->contents.err;
1121 typedef struct LDKBaseSign_JCalls {
1122 atomic_size_t refcnt;
1123 uint32_t get_per_commitment_point_meth;
1124 uint32_t release_commitment_secret_meth;
1125 uint32_t channel_keys_id_meth;
1126 uint32_t sign_counterparty_commitment_meth;
1127 uint32_t sign_holder_commitment_and_htlcs_meth;
1128 uint32_t sign_justice_transaction_meth;
1129 uint32_t sign_counterparty_htlc_transaction_meth;
1130 uint32_t sign_closing_transaction_meth;
1131 uint32_t sign_channel_announcement_meth;
1132 uint32_t ready_channel_meth;
1133 } LDKBaseSign_JCalls;
1134 static void LDKBaseSign_JCalls_free(void* this_arg) {
1135 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1136 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1137 js_free(j_calls->get_per_commitment_point_meth);
1138 js_free(j_calls->release_commitment_secret_meth);
1139 js_free(j_calls->channel_keys_id_meth);
1140 js_free(j_calls->sign_counterparty_commitment_meth);
1141 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1142 js_free(j_calls->sign_justice_transaction_meth);
1143 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1144 js_free(j_calls->sign_closing_transaction_meth);
1145 js_free(j_calls->sign_channel_announcement_meth);
1146 js_free(j_calls->ready_channel_meth);
1150 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1151 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1152 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1153 LDKPublicKey ret_ref;
1154 CHECK(*((uint32_t*)ret) == 33);
1155 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1158 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1159 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1160 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1161 LDKThirtyTwoBytes ret_ref;
1162 CHECK(*((uint32_t*)ret) == 32);
1163 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1166 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1167 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1168 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1169 LDKThirtyTwoBytes ret_ref;
1170 CHECK(*((uint32_t*)ret) == 32);
1171 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1174 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1175 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1176 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1177 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1178 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1179 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1180 long commitment_tx_ref = (long)commitment_tx_var.inner;
1181 if (commitment_tx_var.is_owned) {
1182 commitment_tx_ref |= 1;
1184 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1185 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1186 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1189 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1190 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1191 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1192 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1193 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1194 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1195 long commitment_tx_ref = (long)commitment_tx_var.inner;
1196 if (commitment_tx_var.is_owned) {
1197 commitment_tx_ref |= 1;
1199 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1200 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1201 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1204 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) {
1205 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1206 LDKTransaction justice_tx_var = justice_tx;
1207 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1208 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1209 Transaction_free(justice_tx_var);
1210 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1211 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1212 LDKHTLCOutputInCommitment htlc_var = *htlc;
1213 htlc_var = HTLCOutputInCommitment_clone(htlc);
1214 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1215 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1216 long htlc_ref = (long)htlc_var.inner;
1217 if (htlc_var.is_owned) {
1220 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);
1221 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1222 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1225 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) {
1226 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1227 LDKTransaction htlc_tx_var = htlc_tx;
1228 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1229 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1230 Transaction_free(htlc_tx_var);
1231 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1232 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1233 LDKHTLCOutputInCommitment htlc_var = *htlc;
1234 htlc_var = HTLCOutputInCommitment_clone(htlc);
1235 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1236 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1237 long htlc_ref = (long)htlc_var.inner;
1238 if (htlc_var.is_owned) {
1241 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);
1242 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1243 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1246 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
1247 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1248 LDKTransaction closing_tx_var = closing_tx;
1249 int8_tArray closing_tx_arr = init_arr(closing_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1250 memcpy((uint8_t*)(closing_tx_arr + 4), closing_tx_var.data, closing_tx_var.datalen);
1251 Transaction_free(closing_tx_var);
1252 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_arr);
1253 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1254 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1257 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1258 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1259 LDKUnsignedChannelAnnouncement msg_var = *msg;
1260 msg_var = UnsignedChannelAnnouncement_clone(msg);
1261 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1262 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1263 long msg_ref = (long)msg_var.inner;
1264 if (msg_var.is_owned) {
1267 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
1268 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1269 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1272 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1273 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1274 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1275 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1276 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1277 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1278 long channel_parameters_ref = (long)channel_parameters_var.inner;
1279 if (channel_parameters_var.is_owned) {
1280 channel_parameters_ref |= 1;
1282 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
1284 static void* LDKBaseSign_JCalls_clone(const void* this_arg) {
1285 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1286 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1287 return (void*) this_arg;
1289 static inline LDKBaseSign LDKBaseSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1290 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
1291 atomic_init(&calls->refcnt, 1);
1292 //TODO: Assign calls->o from o
1294 LDKChannelPublicKeys pubkeys_conv;
1295 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1296 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1297 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1300 .this_arg = (void*) calls,
1301 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
1302 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
1303 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
1304 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
1305 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
1306 .sign_justice_transaction = sign_justice_transaction_LDKBaseSign_jcall,
1307 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
1308 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
1309 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
1310 .ready_channel = ready_channel_LDKBaseSign_jcall,
1311 .free = LDKBaseSign_JCalls_free,
1312 .pubkeys = pubkeys_conv,
1313 .set_pubkeys = NULL,
1317 long __attribute__((visibility("default"))) TS_LDKBaseSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1318 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
1319 *res_ptr = LDKBaseSign_init(o, pubkeys);
1320 return (long)res_ptr;
1322 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
1323 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1324 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1325 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1329 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
1330 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1331 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1332 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1336 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
1337 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1338 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1339 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1343 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
1344 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1345 LDKCommitmentTransaction commitment_tx_conv;
1346 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1347 commitment_tx_conv.is_owned = false;
1348 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1349 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1350 return (long)ret_conv;
1353 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
1354 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1355 LDKHolderCommitmentTransaction commitment_tx_conv;
1356 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1357 commitment_tx_conv.is_owned = false;
1358 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1359 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1360 return (long)ret_conv;
1363 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) {
1364 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1365 LDKTransaction justice_tx_ref;
1366 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1367 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1368 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1369 justice_tx_ref.data_is_owned = true;
1370 unsigned char per_commitment_key_arr[32];
1371 CHECK(*((uint32_t*)per_commitment_key) == 32);
1372 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1373 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1374 LDKHTLCOutputInCommitment htlc_conv;
1375 htlc_conv.inner = (void*)(htlc & (~1));
1376 htlc_conv.is_owned = false;
1377 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1378 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
1379 return (long)ret_conv;
1382 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) {
1383 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1384 LDKTransaction htlc_tx_ref;
1385 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
1386 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1387 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
1388 htlc_tx_ref.data_is_owned = true;
1389 LDKPublicKey per_commitment_point_ref;
1390 CHECK(*((uint32_t*)per_commitment_point) == 33);
1391 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
1392 LDKHTLCOutputInCommitment htlc_conv;
1393 htlc_conv.inner = (void*)(htlc & (~1));
1394 htlc_conv.is_owned = false;
1395 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1396 *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);
1397 return (long)ret_conv;
1400 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, int8_tArray closing_tx) {
1401 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1402 LDKTransaction closing_tx_ref;
1403 closing_tx_ref.datalen = *((uint32_t*)closing_tx);
1404 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
1405 memcpy(closing_tx_ref.data, (uint8_t*)(closing_tx + 4), closing_tx_ref.datalen);
1406 closing_tx_ref.data_is_owned = true;
1407 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1408 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
1409 return (long)ret_conv;
1412 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
1413 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1414 LDKUnsignedChannelAnnouncement msg_conv;
1415 msg_conv.inner = (void*)(msg & (~1));
1416 msg_conv.is_owned = false;
1417 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1418 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1419 return (long)ret_conv;
1422 void __attribute__((visibility("default"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
1423 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1424 LDKChannelTransactionParameters channel_parameters_conv;
1425 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1426 channel_parameters_conv.is_owned = false;
1427 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1430 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
1431 if (this_arg->set_pubkeys != NULL)
1432 this_arg->set_pubkeys(this_arg);
1433 return this_arg->pubkeys;
1435 uint32_t __attribute__((visibility("default"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
1436 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1437 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
1438 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1439 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1440 long ret_ref = (long)ret_var.inner;
1441 if (ret_var.is_owned) {
1447 typedef struct LDKSign_JCalls {
1448 atomic_size_t refcnt;
1449 LDKBaseSign_JCalls* BaseSign;
1450 uint32_t write_meth;
1452 static void LDKSign_JCalls_free(void* this_arg) {
1453 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1454 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1455 js_free(j_calls->write_meth);
1459 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
1460 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1461 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
1462 LDKCVec_u8Z ret_ref;
1463 ret_ref.datalen = *((uint32_t*)ret);
1464 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
1465 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
1468 static void* LDKSign_JCalls_clone(const void* this_arg) {
1469 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1470 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1471 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
1472 return (void*) this_arg;
1474 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* BaseSign, uint32_t pubkeys) {
1475 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
1476 atomic_init(&calls->refcnt, 1);
1477 //TODO: Assign calls->o from o
1479 LDKChannelPublicKeys pubkeys_conv;
1480 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1481 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1482 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1485 .this_arg = (void*) calls,
1486 .write = write_LDKSign_jcall,
1487 .clone = LDKSign_JCalls_clone,
1488 .free = LDKSign_JCalls_free,
1489 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
1491 calls->BaseSign = ret.BaseSign.this_arg;
1494 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* BaseSign, uint32_t pubkeys) {
1495 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
1496 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
1497 return (long)res_ptr;
1499 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
1500 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
1501 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1502 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1503 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
1504 CVec_u8Z_free(ret_var);
1508 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
1509 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
1510 LDKThirtyTwoBytes a_ref;
1511 CHECK(*((uint32_t*)a) == 32);
1512 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
1514 LDKChannelMonitor b_conv;
1515 b_conv.inner = (void*)(b & (~1));
1516 b_conv.is_owned = (b & 1) || (b == 0);
1517 b_conv = ChannelMonitor_clone(&b_conv);
1521 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t ptr) {
1522 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
1523 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1524 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
1527 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t ptr) {
1528 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
1529 LDKChannelMonitor b_var = tuple->b;
1530 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1531 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1532 long b_ref = (long)b_var.inner & ~1;
1535 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
1536 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
1538 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
1539 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
1540 CHECK(val->result_ok);
1541 long res_ref = (long)(&(*val->contents.result)) | 1;
1544 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
1545 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
1546 CHECK(!val->result_ok);
1547 LDKDecodeError err_var = (*val->contents.err);
1548 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1549 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1550 long err_ref = (long)err_var.inner & ~1;
1553 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) {
1554 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1555 ret->datalen = *((uint32_t*)elems);
1556 if (ret->datalen == 0) {
1559 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1560 uint32_t *java_elems = (uint32_t*)(elems + 4);
1561 for (size_t i = 0; i < ret->datalen; i++) {
1562 uint32_t arr_elem = java_elems[i];
1563 LDKRouteHop arr_elem_conv;
1564 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1565 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1566 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1567 ret->data[i] = arr_elem_conv;
1572 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1573 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1574 for (size_t i = 0; i < ret.datalen; i++) {
1575 ret.data[i] = RouteHop_clone(&orig->data[i]);
1579 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1580 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1581 for (size_t i = 0; i < ret.datalen; i++) {
1582 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1586 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_result_ok(uint32_t arg) {
1587 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1589 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
1590 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1591 CHECK(val->result_ok);
1592 LDKRoute res_var = (*val->contents.result);
1593 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1594 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1595 long res_ref = (long)res_var.inner & ~1;
1598 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
1599 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1600 CHECK(!val->result_ok);
1601 LDKDecodeError err_var = (*val->contents.err);
1602 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1603 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1604 long err_ref = (long)err_var.inner & ~1;
1607 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
1608 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1610 case LDKCOption_u64Z_Some: {
1611 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
1613 case LDKCOption_u64Z_None: {
1614 return 0 /* LDKCOption_u64Z - None */;
1619 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) {
1620 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1621 ret->datalen = *((uint32_t*)elems);
1622 if (ret->datalen == 0) {
1625 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1626 uint32_t *java_elems = (uint32_t*)(elems + 4);
1627 for (size_t i = 0; i < ret->datalen; i++) {
1628 uint32_t arr_elem = java_elems[i];
1629 LDKChannelDetails arr_elem_conv;
1630 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1631 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1632 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1633 ret->data[i] = arr_elem_conv;
1638 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1639 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1640 for (size_t i = 0; i < ret.datalen; i++) {
1641 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1645 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintZ_new(uint32_tArray elems) {
1646 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
1647 ret->datalen = *((uint32_t*)elems);
1648 if (ret->datalen == 0) {
1651 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
1652 uint32_t *java_elems = (uint32_t*)(elems + 4);
1653 for (size_t i = 0; i < ret->datalen; i++) {
1654 uint32_t arr_elem = java_elems[i];
1655 LDKRouteHint arr_elem_conv;
1656 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1657 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1658 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
1659 ret->data[i] = arr_elem_conv;
1664 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1665 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1666 for (size_t i = 0; i < ret.datalen; i++) {
1667 ret.data[i] = RouteHint_clone(&orig->data[i]);
1671 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_result_ok(uint32_t arg) {
1672 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1674 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
1675 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1676 CHECK(val->result_ok);
1677 LDKRoute res_var = (*val->contents.result);
1678 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1679 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1680 long res_ref = (long)res_var.inner & ~1;
1683 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
1684 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1685 CHECK(!val->result_ok);
1686 LDKLightningError err_var = (*val->contents.err);
1687 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1688 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1689 long err_ref = (long)err_var.inner & ~1;
1692 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
1693 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1695 case LDKErrorAction_DisconnectPeer: {
1696 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1697 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1698 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1699 long msg_ref = (long)msg_var.inner & ~1;
1700 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
1702 case LDKErrorAction_IgnoreError: {
1703 return 0 /* LDKErrorAction - IgnoreError */;
1705 case LDKErrorAction_SendErrorMessage: {
1706 LDKErrorMessage msg_var = obj->send_error_message.msg;
1707 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1708 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1709 long msg_ref = (long)msg_var.inner & ~1;
1710 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
1715 uint32_t __attribute__((visibility("default"))) TS_LDKHTLCFailChannelUpdate_ref_from_ptr(uint32_t ptr) {
1716 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
1718 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1719 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1720 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1721 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1722 long msg_ref = (long)msg_var.inner & ~1;
1723 return 0 /* LDKHTLCFailChannelUpdate - ChannelUpdateMessage */; (void) msg_ref;
1725 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1726 return 0 /* LDKHTLCFailChannelUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
1728 case LDKHTLCFailChannelUpdate_NodeFailure: {
1729 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1730 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
1731 return 0 /* LDKHTLCFailChannelUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
1736 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
1737 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1739 case LDKMessageSendEvent_SendAcceptChannel: {
1740 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1741 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
1742 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1743 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1744 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1745 long msg_ref = (long)msg_var.inner & ~1;
1746 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
1748 case LDKMessageSendEvent_SendOpenChannel: {
1749 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1750 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
1751 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1752 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1753 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1754 long msg_ref = (long)msg_var.inner & ~1;
1755 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
1757 case LDKMessageSendEvent_SendFundingCreated: {
1758 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1759 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
1760 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1761 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1762 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1763 long msg_ref = (long)msg_var.inner & ~1;
1764 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
1766 case LDKMessageSendEvent_SendFundingSigned: {
1767 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1768 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
1769 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1770 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1771 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1772 long msg_ref = (long)msg_var.inner & ~1;
1773 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
1775 case LDKMessageSendEvent_SendFundingLocked: {
1776 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1777 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
1778 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1779 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1780 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1781 long msg_ref = (long)msg_var.inner & ~1;
1782 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
1784 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1785 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1786 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
1787 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1788 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1789 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1790 long msg_ref = (long)msg_var.inner & ~1;
1791 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
1793 case LDKMessageSendEvent_UpdateHTLCs: {
1794 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1795 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
1796 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1797 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1798 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1799 long updates_ref = (long)updates_var.inner & ~1;
1800 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
1802 case LDKMessageSendEvent_SendRevokeAndACK: {
1803 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1804 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
1805 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1806 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1807 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1808 long msg_ref = (long)msg_var.inner & ~1;
1809 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
1811 case LDKMessageSendEvent_SendClosingSigned: {
1812 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1813 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
1814 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1815 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1816 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1817 long msg_ref = (long)msg_var.inner & ~1;
1818 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
1820 case LDKMessageSendEvent_SendShutdown: {
1821 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1822 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
1823 LDKShutdown msg_var = obj->send_shutdown.msg;
1824 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1825 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1826 long msg_ref = (long)msg_var.inner & ~1;
1827 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
1829 case LDKMessageSendEvent_SendChannelReestablish: {
1830 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1831 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
1832 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1833 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1834 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1835 long msg_ref = (long)msg_var.inner & ~1;
1836 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
1838 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1839 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1840 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1841 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1842 long msg_ref = (long)msg_var.inner & ~1;
1843 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1844 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1845 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1846 long update_msg_ref = (long)update_msg_var.inner & ~1;
1847 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
1849 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1850 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1851 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1852 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1853 long msg_ref = (long)msg_var.inner & ~1;
1854 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
1856 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1857 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1858 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1859 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1860 long msg_ref = (long)msg_var.inner & ~1;
1861 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
1863 case LDKMessageSendEvent_HandleError: {
1864 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1865 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
1866 long action_ref = ((long)&obj->handle_error.action) | 1;
1867 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
1869 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1870 long update_ref = ((long)&obj->payment_failure_network_update.update) | 1;
1871 return 0 /* LDKMessageSendEvent - PaymentFailureNetworkUpdate */; (void) update_ref;
1873 case LDKMessageSendEvent_SendChannelRangeQuery: {
1874 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1875 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
1876 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1877 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1878 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1879 long msg_ref = (long)msg_var.inner & ~1;
1880 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
1882 case LDKMessageSendEvent_SendShortIdsQuery: {
1883 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1884 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
1885 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1886 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1887 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1888 long msg_ref = (long)msg_var.inner & ~1;
1889 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
1891 case LDKMessageSendEvent_SendReplyChannelRange: {
1892 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1893 memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33);
1894 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1895 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1896 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1897 long msg_ref = (long)msg_var.inner & ~1;
1898 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
1903 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MessageSendEventZ_new(uint32_tArray elems) {
1904 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1905 ret->datalen = *((uint32_t*)elems);
1906 if (ret->datalen == 0) {
1909 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1910 uint32_t *java_elems = (uint32_t*)(elems + 4);
1911 for (size_t i = 0; i < ret->datalen; i++) {
1912 uint32_t arr_elem = java_elems[i];
1913 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1914 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1915 ret->data[i] = arr_elem_conv;
1920 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1921 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1922 for (size_t i = 0; i < ret.datalen; i++) {
1923 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1927 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
1928 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
1930 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
1931 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
1932 CHECK(val->result_ok);
1933 return *val->contents.result;
1935 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
1936 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
1937 CHECK(!val->result_ok);
1938 LDKLightningError err_var = (*val->contents.err);
1939 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1940 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1941 long err_ref = (long)err_var.inner & ~1;
1944 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
1945 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
1946 LDKChannelAnnouncement a_conv;
1947 a_conv.inner = (void*)(a & (~1));
1948 a_conv.is_owned = (a & 1) || (a == 0);
1949 a_conv = ChannelAnnouncement_clone(&a_conv);
1951 LDKChannelUpdate b_conv;
1952 b_conv.inner = (void*)(b & (~1));
1953 b_conv.is_owned = (b & 1) || (b == 0);
1954 b_conv = ChannelUpdate_clone(&b_conv);
1956 LDKChannelUpdate c_conv;
1957 c_conv.inner = (void*)(c & (~1));
1958 c_conv.is_owned = (c & 1) || (c == 0);
1959 c_conv = ChannelUpdate_clone(&c_conv);
1963 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t ptr) {
1964 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1965 LDKChannelAnnouncement a_var = tuple->a;
1966 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1967 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1968 long a_ref = (long)a_var.inner & ~1;
1971 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t ptr) {
1972 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1973 LDKChannelUpdate b_var = tuple->b;
1974 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1975 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1976 long b_ref = (long)b_var.inner & ~1;
1979 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t ptr) {
1980 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1981 LDKChannelUpdate c_var = tuple->c;
1982 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1983 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1984 long c_ref = (long)c_var.inner & ~1;
1987 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
1988 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
1989 ret->datalen = *((uint32_t*)elems);
1990 if (ret->datalen == 0) {
1993 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
1994 uint32_t *java_elems = (uint32_t*)(elems + 4);
1995 for (size_t i = 0; i < ret->datalen; i++) {
1996 uint32_t arr_elem = java_elems[i];
1997 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
1998 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
1999 ret->data[i] = arr_elem_conv;
2004 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
2005 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
2006 for (size_t i = 0; i < ret.datalen; i++) {
2007 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
2011 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
2012 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
2013 ret->datalen = *((uint32_t*)elems);
2014 if (ret->datalen == 0) {
2017 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
2018 uint32_t *java_elems = (uint32_t*)(elems + 4);
2019 for (size_t i = 0; i < ret->datalen; i++) {
2020 uint32_t arr_elem = java_elems[i];
2021 LDKNodeAnnouncement arr_elem_conv;
2022 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2023 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2024 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
2025 ret->data[i] = arr_elem_conv;
2030 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
2031 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
2032 for (size_t i = 0; i < ret.datalen; i++) {
2033 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
2037 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
2038 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
2040 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
2041 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
2042 CHECK(val->result_ok);
2043 return *val->contents.result;
2045 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
2046 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
2047 CHECK(!val->result_ok);
2048 LDKLightningError err_var = (*val->contents.err);
2049 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2050 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2051 long err_ref = (long)err_var.inner & ~1;
2054 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
2055 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
2057 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
2058 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
2059 CHECK(val->result_ok);
2060 LDKCVec_u8Z res_var = (*val->contents.result);
2061 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2062 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
2065 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
2066 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
2067 CHECK(!val->result_ok);
2068 LDKPeerHandleError err_var = (*val->contents.err);
2069 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2070 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2071 long err_ref = (long)err_var.inner & ~1;
2074 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
2075 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
2077 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
2078 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
2079 CHECK(val->result_ok);
2080 return *val->contents.result;
2082 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
2083 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
2084 CHECK(!val->result_ok);
2085 LDKPeerHandleError err_var = (*val->contents.err);
2086 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2087 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2088 long err_ref = (long)err_var.inner & ~1;
2091 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
2092 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
2094 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
2095 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
2096 CHECK(val->result_ok);
2097 return *val->contents.result;
2099 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
2100 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
2101 CHECK(!val->result_ok);
2102 LDKPeerHandleError err_var = (*val->contents.err);
2103 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2104 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2105 long err_ref = (long)err_var.inner & ~1;
2108 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_result_ok(uint32_t arg) {
2109 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
2111 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
2112 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2113 CHECK(val->result_ok);
2114 long res_ref = ((long)&(*val->contents.result)) | 1;
2115 return (long)res_ref;
2117 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
2118 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2119 CHECK(!val->result_ok);
2120 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
2123 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
2124 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
2126 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
2127 long some_ref = (long)(&obj->some) | 1;
2128 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) some_ref;
2130 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
2131 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
2136 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
2137 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
2139 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
2140 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
2141 CHECK(val->result_ok);
2142 LDKDirectionalChannelInfo res_var = (*val->contents.result);
2143 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2144 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2145 long res_ref = (long)res_var.inner & ~1;
2148 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
2149 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
2150 CHECK(!val->result_ok);
2151 LDKDecodeError err_var = (*val->contents.err);
2152 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2153 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2154 long err_ref = (long)err_var.inner & ~1;
2157 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
2158 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
2160 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
2161 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
2162 CHECK(val->result_ok);
2163 LDKChannelInfo res_var = (*val->contents.result);
2164 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2165 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2166 long res_ref = (long)res_var.inner & ~1;
2169 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
2170 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
2171 CHECK(!val->result_ok);
2172 LDKDecodeError err_var = (*val->contents.err);
2173 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2174 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2175 long err_ref = (long)err_var.inner & ~1;
2178 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
2179 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
2181 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
2182 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
2183 CHECK(val->result_ok);
2184 LDKRoutingFees res_var = (*val->contents.result);
2185 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2186 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2187 long res_ref = (long)res_var.inner & ~1;
2190 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
2191 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
2192 CHECK(!val->result_ok);
2193 LDKDecodeError err_var = (*val->contents.err);
2194 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2195 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2196 long err_ref = (long)err_var.inner & ~1;
2199 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
2200 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
2202 case LDKNetAddress_IPv4: {
2203 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
2204 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
2205 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
2207 case LDKNetAddress_IPv6: {
2208 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
2209 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
2210 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
2212 case LDKNetAddress_OnionV2: {
2213 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
2214 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
2215 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
2217 case LDKNetAddress_OnionV3: {
2218 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2219 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
2220 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
2225 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
2226 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2227 ret->datalen = *((uint32_t*)elems);
2228 if (ret->datalen == 0) {
2231 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2232 uint32_t *java_elems = (uint32_t*)(elems + 4);
2233 for (size_t i = 0; i < ret->datalen; i++) {
2234 uint32_t arr_elem = java_elems[i];
2235 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
2236 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
2237 ret->data[i] = arr_elem_conv;
2242 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2243 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2244 for (size_t i = 0; i < ret.datalen; i++) {
2245 ret.data[i] = NetAddress_clone(&orig->data[i]);
2249 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
2250 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
2252 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
2253 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
2254 CHECK(val->result_ok);
2255 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
2256 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2257 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2258 long res_ref = (long)res_var.inner & ~1;
2261 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
2262 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
2263 CHECK(!val->result_ok);
2264 LDKDecodeError err_var = (*val->contents.err);
2265 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2266 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2267 long err_ref = (long)err_var.inner & ~1;
2270 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
2271 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
2272 ret->datalen = *((uint32_t*)elems);
2273 if (ret->datalen == 0) {
2276 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
2277 int64_t *java_elems = (int64_t*)(elems + 4);
2278 for (size_t i = 0; i < ret->datalen; i++) {
2279 ret->data[i] = java_elems[i];
2284 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2285 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2286 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2289 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
2290 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
2292 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
2293 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
2294 CHECK(val->result_ok);
2295 LDKNodeInfo res_var = (*val->contents.result);
2296 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2297 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2298 long res_ref = (long)res_var.inner & ~1;
2301 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
2302 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
2303 CHECK(!val->result_ok);
2304 LDKDecodeError err_var = (*val->contents.err);
2305 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2306 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2307 long err_ref = (long)err_var.inner & ~1;
2310 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
2311 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
2313 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
2314 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
2315 CHECK(val->result_ok);
2316 LDKNetworkGraph res_var = (*val->contents.result);
2317 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2318 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2319 long res_ref = (long)res_var.inner & ~1;
2322 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
2323 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
2324 CHECK(!val->result_ok);
2325 LDKDecodeError err_var = (*val->contents.err);
2326 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2327 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2328 long err_ref = (long)err_var.inner & ~1;
2331 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
2332 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
2334 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
2335 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2336 CHECK(val->result_ok);
2337 LDKInitFeatures res_var = (*val->contents.result);
2338 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2339 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2340 long res_ref = (long)res_var.inner & ~1;
2343 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
2344 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2345 CHECK(!val->result_ok);
2346 LDKDecodeError err_var = (*val->contents.err);
2347 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2348 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2349 long err_ref = (long)err_var.inner & ~1;
2352 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
2353 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
2355 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
2356 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2357 CHECK(val->result_ok);
2358 LDKNodeFeatures res_var = (*val->contents.result);
2359 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2360 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2361 long res_ref = (long)res_var.inner & ~1;
2364 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
2365 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2366 CHECK(!val->result_ok);
2367 LDKDecodeError err_var = (*val->contents.err);
2368 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2369 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2370 long err_ref = (long)err_var.inner & ~1;
2373 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
2374 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
2376 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
2377 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2378 CHECK(val->result_ok);
2379 LDKChannelFeatures res_var = (*val->contents.result);
2380 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2381 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2382 long res_ref = (long)res_var.inner & ~1;
2385 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
2386 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2387 CHECK(!val->result_ok);
2388 LDKDecodeError err_var = (*val->contents.err);
2389 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2390 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2391 long err_ref = (long)err_var.inner & ~1;
2394 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
2395 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
2397 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
2398 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2399 CHECK(val->result_ok);
2400 LDKInvoiceFeatures res_var = (*val->contents.result);
2401 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2402 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2403 long res_ref = (long)res_var.inner & ~1;
2406 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) {
2407 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2408 CHECK(!val->result_ok);
2409 LDKDecodeError err_var = (*val->contents.err);
2410 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2411 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2412 long err_ref = (long)err_var.inner & ~1;
2415 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) {
2416 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
2418 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_ok(uint32_t arg) {
2419 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
2420 CHECK(val->result_ok);
2421 long res_ref = ((long)&(*val->contents.result)) | 1;
2424 int8_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_err(uint32_t arg) {
2425 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
2426 CHECK(!val->result_ok);
2427 return *val->contents.err;
2429 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_result_ok(uint32_t arg) {
2430 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
2432 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_ok(uint32_t arg) {
2433 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
2434 CHECK(val->result_ok);
2435 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
2436 *res_conv = (*val->contents.result);
2437 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
2438 return (long)res_conv;
2440 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_err(uint32_t arg) {
2441 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
2442 CHECK(!val->result_ok);
2443 LDKDecodeError err_var = (*val->contents.err);
2444 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2445 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2446 long err_ref = (long)err_var.inner & ~1;
2449 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
2450 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
2451 ret->datalen = *((uint32_t*)elems);
2452 if (ret->datalen == 0) {
2455 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
2456 uint32_t *java_elems = (uint32_t*)(elems + 4);
2457 for (size_t i = 0; i < ret->datalen; i++) {
2458 uint32_t arr_elem = java_elems[i];
2459 LDKUpdateAddHTLC arr_elem_conv;
2460 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2461 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2462 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
2463 ret->data[i] = arr_elem_conv;
2468 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
2469 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
2470 for (size_t i = 0; i < ret.datalen; i++) {
2471 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
2475 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
2476 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
2477 ret->datalen = *((uint32_t*)elems);
2478 if (ret->datalen == 0) {
2481 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
2482 uint32_t *java_elems = (uint32_t*)(elems + 4);
2483 for (size_t i = 0; i < ret->datalen; i++) {
2484 uint32_t arr_elem = java_elems[i];
2485 LDKUpdateFulfillHTLC arr_elem_conv;
2486 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2487 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2488 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
2489 ret->data[i] = arr_elem_conv;
2494 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
2495 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
2496 for (size_t i = 0; i < ret.datalen; i++) {
2497 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
2501 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
2502 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
2503 ret->datalen = *((uint32_t*)elems);
2504 if (ret->datalen == 0) {
2507 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
2508 uint32_t *java_elems = (uint32_t*)(elems + 4);
2509 for (size_t i = 0; i < ret->datalen; i++) {
2510 uint32_t arr_elem = java_elems[i];
2511 LDKUpdateFailHTLC arr_elem_conv;
2512 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2513 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2514 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
2515 ret->data[i] = arr_elem_conv;
2520 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
2521 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
2522 for (size_t i = 0; i < ret.datalen; i++) {
2523 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
2527 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
2528 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
2529 ret->datalen = *((uint32_t*)elems);
2530 if (ret->datalen == 0) {
2533 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
2534 uint32_t *java_elems = (uint32_t*)(elems + 4);
2535 for (size_t i = 0; i < ret->datalen; i++) {
2536 uint32_t arr_elem = java_elems[i];
2537 LDKUpdateFailMalformedHTLC arr_elem_conv;
2538 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2539 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2540 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
2541 ret->data[i] = arr_elem_conv;
2546 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
2547 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
2548 for (size_t i = 0; i < ret.datalen; i++) {
2549 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
2553 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
2554 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
2556 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
2557 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
2558 CHECK(val->result_ok);
2559 LDKAcceptChannel res_var = (*val->contents.result);
2560 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2561 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2562 long res_ref = (long)res_var.inner & ~1;
2565 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
2566 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
2567 CHECK(!val->result_ok);
2568 LDKDecodeError err_var = (*val->contents.err);
2569 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2570 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2571 long err_ref = (long)err_var.inner & ~1;
2574 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
2575 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
2577 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
2578 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
2579 CHECK(val->result_ok);
2580 LDKAnnouncementSignatures res_var = (*val->contents.result);
2581 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2582 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2583 long res_ref = (long)res_var.inner & ~1;
2586 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
2587 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
2588 CHECK(!val->result_ok);
2589 LDKDecodeError err_var = (*val->contents.err);
2590 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2591 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2592 long err_ref = (long)err_var.inner & ~1;
2595 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
2596 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
2598 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
2599 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
2600 CHECK(val->result_ok);
2601 LDKChannelReestablish res_var = (*val->contents.result);
2602 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2603 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2604 long res_ref = (long)res_var.inner & ~1;
2607 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
2608 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
2609 CHECK(!val->result_ok);
2610 LDKDecodeError err_var = (*val->contents.err);
2611 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2612 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2613 long err_ref = (long)err_var.inner & ~1;
2616 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
2617 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
2619 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
2620 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
2621 CHECK(val->result_ok);
2622 LDKClosingSigned res_var = (*val->contents.result);
2623 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2624 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2625 long res_ref = (long)res_var.inner & ~1;
2628 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
2629 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
2630 CHECK(!val->result_ok);
2631 LDKDecodeError err_var = (*val->contents.err);
2632 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2633 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2634 long err_ref = (long)err_var.inner & ~1;
2637 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
2638 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
2640 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
2641 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
2642 CHECK(val->result_ok);
2643 LDKCommitmentSigned res_var = (*val->contents.result);
2644 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2645 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2646 long res_ref = (long)res_var.inner & ~1;
2649 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
2650 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
2651 CHECK(!val->result_ok);
2652 LDKDecodeError err_var = (*val->contents.err);
2653 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2654 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2655 long err_ref = (long)err_var.inner & ~1;
2658 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
2659 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
2661 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
2662 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
2663 CHECK(val->result_ok);
2664 LDKFundingCreated res_var = (*val->contents.result);
2665 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2666 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2667 long res_ref = (long)res_var.inner & ~1;
2670 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
2671 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
2672 CHECK(!val->result_ok);
2673 LDKDecodeError err_var = (*val->contents.err);
2674 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2675 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2676 long err_ref = (long)err_var.inner & ~1;
2679 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
2680 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
2682 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
2683 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
2684 CHECK(val->result_ok);
2685 LDKFundingSigned res_var = (*val->contents.result);
2686 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2687 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2688 long res_ref = (long)res_var.inner & ~1;
2691 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
2692 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
2693 CHECK(!val->result_ok);
2694 LDKDecodeError err_var = (*val->contents.err);
2695 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2696 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2697 long err_ref = (long)err_var.inner & ~1;
2700 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
2701 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
2703 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
2704 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
2705 CHECK(val->result_ok);
2706 LDKFundingLocked res_var = (*val->contents.result);
2707 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2708 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2709 long res_ref = (long)res_var.inner & ~1;
2712 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
2713 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
2714 CHECK(!val->result_ok);
2715 LDKDecodeError err_var = (*val->contents.err);
2716 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2717 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2718 long err_ref = (long)err_var.inner & ~1;
2721 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_result_ok(uint32_t arg) {
2722 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
2724 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
2725 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
2726 CHECK(val->result_ok);
2727 LDKInit res_var = (*val->contents.result);
2728 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2729 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2730 long res_ref = (long)res_var.inner & ~1;
2733 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
2734 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
2735 CHECK(!val->result_ok);
2736 LDKDecodeError err_var = (*val->contents.err);
2737 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2738 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2739 long err_ref = (long)err_var.inner & ~1;
2742 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
2743 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
2745 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
2746 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
2747 CHECK(val->result_ok);
2748 LDKOpenChannel res_var = (*val->contents.result);
2749 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2750 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2751 long res_ref = (long)res_var.inner & ~1;
2754 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
2755 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
2756 CHECK(!val->result_ok);
2757 LDKDecodeError err_var = (*val->contents.err);
2758 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2759 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2760 long err_ref = (long)err_var.inner & ~1;
2763 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
2764 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
2766 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
2767 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
2768 CHECK(val->result_ok);
2769 LDKRevokeAndACK res_var = (*val->contents.result);
2770 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2771 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2772 long res_ref = (long)res_var.inner & ~1;
2775 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
2776 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
2777 CHECK(!val->result_ok);
2778 LDKDecodeError err_var = (*val->contents.err);
2779 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2780 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2781 long err_ref = (long)err_var.inner & ~1;
2784 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
2785 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
2787 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
2788 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
2789 CHECK(val->result_ok);
2790 LDKShutdown res_var = (*val->contents.result);
2791 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2792 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2793 long res_ref = (long)res_var.inner & ~1;
2796 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
2797 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
2798 CHECK(!val->result_ok);
2799 LDKDecodeError err_var = (*val->contents.err);
2800 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2801 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2802 long err_ref = (long)err_var.inner & ~1;
2805 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
2806 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
2808 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
2809 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
2810 CHECK(val->result_ok);
2811 LDKUpdateFailHTLC res_var = (*val->contents.result);
2812 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2813 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2814 long res_ref = (long)res_var.inner & ~1;
2817 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
2818 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
2819 CHECK(!val->result_ok);
2820 LDKDecodeError err_var = (*val->contents.err);
2821 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2822 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2823 long err_ref = (long)err_var.inner & ~1;
2826 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
2827 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
2829 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
2830 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
2831 CHECK(val->result_ok);
2832 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
2833 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2834 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2835 long res_ref = (long)res_var.inner & ~1;
2838 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
2839 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
2840 CHECK(!val->result_ok);
2841 LDKDecodeError err_var = (*val->contents.err);
2842 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2843 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2844 long err_ref = (long)err_var.inner & ~1;
2847 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
2848 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
2850 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
2851 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
2852 CHECK(val->result_ok);
2853 LDKUpdateFee res_var = (*val->contents.result);
2854 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2855 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2856 long res_ref = (long)res_var.inner & ~1;
2859 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
2860 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
2861 CHECK(!val->result_ok);
2862 LDKDecodeError err_var = (*val->contents.err);
2863 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2864 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2865 long err_ref = (long)err_var.inner & ~1;
2868 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
2869 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
2871 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
2872 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
2873 CHECK(val->result_ok);
2874 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
2875 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2876 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2877 long res_ref = (long)res_var.inner & ~1;
2880 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
2881 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
2882 CHECK(!val->result_ok);
2883 LDKDecodeError err_var = (*val->contents.err);
2884 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2885 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2886 long err_ref = (long)err_var.inner & ~1;
2889 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
2890 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
2892 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
2893 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
2894 CHECK(val->result_ok);
2895 LDKUpdateAddHTLC res_var = (*val->contents.result);
2896 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2897 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2898 long res_ref = (long)res_var.inner & ~1;
2901 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
2902 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
2903 CHECK(!val->result_ok);
2904 LDKDecodeError err_var = (*val->contents.err);
2905 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2906 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2907 long err_ref = (long)err_var.inner & ~1;
2910 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_result_ok(uint32_t arg) {
2911 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
2913 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
2914 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
2915 CHECK(val->result_ok);
2916 LDKPing res_var = (*val->contents.result);
2917 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2918 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2919 long res_ref = (long)res_var.inner & ~1;
2922 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
2923 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
2924 CHECK(!val->result_ok);
2925 LDKDecodeError err_var = (*val->contents.err);
2926 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2927 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2928 long err_ref = (long)err_var.inner & ~1;
2931 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_result_ok(uint32_t arg) {
2932 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
2934 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
2935 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
2936 CHECK(val->result_ok);
2937 LDKPong res_var = (*val->contents.result);
2938 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2939 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2940 long res_ref = (long)res_var.inner & ~1;
2943 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
2944 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
2945 CHECK(!val->result_ok);
2946 LDKDecodeError err_var = (*val->contents.err);
2947 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2948 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2949 long err_ref = (long)err_var.inner & ~1;
2952 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
2953 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
2955 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
2956 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
2957 CHECK(val->result_ok);
2958 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
2959 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2960 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2961 long res_ref = (long)res_var.inner & ~1;
2964 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
2965 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
2966 CHECK(!val->result_ok);
2967 LDKDecodeError err_var = (*val->contents.err);
2968 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2969 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2970 long err_ref = (long)err_var.inner & ~1;
2973 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
2974 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
2976 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
2977 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
2978 CHECK(val->result_ok);
2979 LDKChannelAnnouncement res_var = (*val->contents.result);
2980 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2981 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2982 long res_ref = (long)res_var.inner & ~1;
2985 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
2986 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
2987 CHECK(!val->result_ok);
2988 LDKDecodeError err_var = (*val->contents.err);
2989 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2990 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2991 long err_ref = (long)err_var.inner & ~1;
2994 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
2995 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
2997 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
2998 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
2999 CHECK(val->result_ok);
3000 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
3001 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3002 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3003 long res_ref = (long)res_var.inner & ~1;
3006 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
3007 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
3008 CHECK(!val->result_ok);
3009 LDKDecodeError err_var = (*val->contents.err);
3010 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3011 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3012 long err_ref = (long)err_var.inner & ~1;
3015 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3016 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
3018 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3019 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
3020 CHECK(val->result_ok);
3021 LDKChannelUpdate res_var = (*val->contents.result);
3022 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3023 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3024 long res_ref = (long)res_var.inner & ~1;
3027 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
3028 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
3029 CHECK(!val->result_ok);
3030 LDKDecodeError err_var = (*val->contents.err);
3031 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3032 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3033 long err_ref = (long)err_var.inner & ~1;
3036 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
3037 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
3039 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
3040 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3041 CHECK(val->result_ok);
3042 LDKErrorMessage res_var = (*val->contents.result);
3043 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3044 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3045 long res_ref = (long)res_var.inner & ~1;
3048 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
3049 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3050 CHECK(!val->result_ok);
3051 LDKDecodeError err_var = (*val->contents.err);
3052 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3053 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3054 long err_ref = (long)err_var.inner & ~1;
3057 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3058 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3060 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3061 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3062 CHECK(val->result_ok);
3063 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
3064 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3065 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3066 long res_ref = (long)res_var.inner & ~1;
3069 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3070 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3071 CHECK(!val->result_ok);
3072 LDKDecodeError err_var = (*val->contents.err);
3073 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3074 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3075 long err_ref = (long)err_var.inner & ~1;
3078 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3079 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3081 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3082 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
3083 CHECK(val->result_ok);
3084 LDKNodeAnnouncement res_var = (*val->contents.result);
3085 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3086 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3087 long res_ref = (long)res_var.inner & ~1;
3090 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3091 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
3092 CHECK(!val->result_ok);
3093 LDKDecodeError err_var = (*val->contents.err);
3094 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3095 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3096 long err_ref = (long)err_var.inner & ~1;
3099 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
3100 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
3102 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
3103 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3104 CHECK(val->result_ok);
3105 LDKQueryShortChannelIds res_var = (*val->contents.result);
3106 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3107 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3108 long res_ref = (long)res_var.inner & ~1;
3111 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
3112 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3113 CHECK(!val->result_ok);
3114 LDKDecodeError err_var = (*val->contents.err);
3115 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3116 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3117 long err_ref = (long)err_var.inner & ~1;
3120 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
3121 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
3123 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
3124 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3125 CHECK(val->result_ok);
3126 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
3127 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3128 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3129 long res_ref = (long)res_var.inner & ~1;
3132 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
3133 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3134 CHECK(!val->result_ok);
3135 LDKDecodeError err_var = (*val->contents.err);
3136 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3137 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3138 long err_ref = (long)err_var.inner & ~1;
3141 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
3142 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
3144 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
3145 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3146 CHECK(val->result_ok);
3147 LDKQueryChannelRange res_var = (*val->contents.result);
3148 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3149 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3150 long res_ref = (long)res_var.inner & ~1;
3153 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
3154 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3155 CHECK(!val->result_ok);
3156 LDKDecodeError err_var = (*val->contents.err);
3157 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3158 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3159 long err_ref = (long)err_var.inner & ~1;
3162 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
3163 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
3165 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
3166 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3167 CHECK(val->result_ok);
3168 LDKReplyChannelRange res_var = (*val->contents.result);
3169 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3170 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3171 long res_ref = (long)res_var.inner & ~1;
3174 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
3175 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3176 CHECK(!val->result_ok);
3177 LDKDecodeError err_var = (*val->contents.err);
3178 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3179 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3180 long err_ref = (long)err_var.inner & ~1;
3183 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
3184 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
3186 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
3187 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3188 CHECK(val->result_ok);
3189 LDKGossipTimestampFilter res_var = (*val->contents.result);
3190 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3191 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3192 long res_ref = (long)res_var.inner & ~1;
3195 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
3196 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3197 CHECK(!val->result_ok);
3198 LDKDecodeError err_var = (*val->contents.err);
3199 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3200 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3201 long err_ref = (long)err_var.inner & ~1;
3204 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
3205 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
3207 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
3208 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
3209 CHECK(val->result_ok);
3210 long res_ref = ((long)&(*val->contents.result)) | 1;
3213 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
3214 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
3215 CHECK(!val->result_ok);
3216 LDKDecodeError err_var = (*val->contents.err);
3217 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3218 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3219 long err_ref = (long)err_var.inner & ~1;
3222 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_result_ok(uint32_t arg) {
3223 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
3225 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
3226 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3227 CHECK(val->result_ok);
3228 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3229 *ret = Sign_clone(&(*val->contents.result));
3232 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
3233 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3234 CHECK(!val->result_ok);
3235 LDKDecodeError err_var = (*val->contents.err);
3236 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3237 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3238 long err_ref = (long)err_var.inner & ~1;
3241 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3242 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3243 for (size_t i = 0; i < ret.datalen; i++) {
3244 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3248 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(uint32_t arg) {
3249 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
3251 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
3252 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3253 CHECK(val->result_ok);
3254 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
3255 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
3256 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
3257 for (size_t m = 0; m < res_var.datalen; m++) {
3258 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
3259 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3260 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
3261 res_arr_ptr[m] = res_conv_12_arr;
3265 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
3266 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3267 CHECK(!val->result_ok);
3268 return *val->contents.err;
3270 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_result_ok(uint32_t arg) {
3271 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
3273 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
3274 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3275 CHECK(val->result_ok);
3276 LDKInMemorySigner res_var = (*val->contents.result);
3277 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3278 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3279 long res_ref = (long)res_var.inner & ~1;
3282 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
3283 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3284 CHECK(!val->result_ok);
3285 LDKDecodeError err_var = (*val->contents.err);
3286 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3287 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3288 long err_ref = (long)err_var.inner & ~1;
3291 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_TxOutZ_new(uint32_tArray elems) {
3292 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
3293 ret->datalen = *((uint32_t*)elems);
3294 if (ret->datalen == 0) {
3297 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
3298 uint32_t *java_elems = (uint32_t*)(elems + 4);
3299 for (size_t i = 0; i < ret->datalen; i++) {
3300 uint32_t arr_elem = java_elems[i];
3301 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
3302 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
3303 ret->data[i] = arr_elem_conv;
3308 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
3309 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
3310 for (size_t i = 0; i < ret.datalen; i++) {
3311 ret.data[i] = TxOut_clone(&orig->data[i]);
3315 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_result_ok(uint32_t arg) {
3316 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
3318 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
3319 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3320 CHECK(val->result_ok);
3321 LDKTransaction res_var = (*val->contents.result);
3322 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3323 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
3326 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
3327 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3328 CHECK(!val->result_ok);
3329 return *val->contents.err;
3331 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_result_ok(uint32_t arg) {
3332 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
3334 void __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_ok(uint32_t arg) {
3335 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
3336 CHECK(val->result_ok);
3337 return *val->contents.result;
3339 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_err(uint32_t arg) {
3340 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
3341 CHECK(!val->result_ok);
3342 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
3345 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_BlockHashChannelMonitorZZ_new(uint32_tArray elems) {
3346 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
3347 ret->datalen = *((uint32_t*)elems);
3348 if (ret->datalen == 0) {
3351 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
3352 uint32_t *java_elems = (uint32_t*)(elems + 4);
3353 for (size_t i = 0; i < ret->datalen; i++) {
3354 uint32_t arr_elem = java_elems[i];
3355 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
3356 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
3357 ret->data[i] = arr_elem_conv;
3362 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_result_ok(uint32_t arg) {
3363 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
3365 uint32_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(uint32_t arg) {
3366 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3367 CHECK(val->result_ok);
3368 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
3369 uint32_tArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3370 uint32_t *res_arr_ptr = (uint32_t*)(res_arr + 4);
3371 for (size_t m = 0; m < res_var.datalen; m++) {
3372 long res_conv_38_ref = (long)(&res_var.data[m]) | 1;
3373 res_arr_ptr[m] = res_conv_38_ref;
3377 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(uint32_t arg) {
3378 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3379 CHECK(!val->result_ok);
3380 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
3383 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
3384 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3386 case LDKAPIError_APIMisuseError: {
3387 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
3388 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3389 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
3390 return 0 /* LDKAPIError - APIMisuseError */; (void) err_arr;
3392 case LDKAPIError_FeeRateTooHigh: {
3393 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
3394 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3395 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
3396 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_arr; (void) obj->fee_rate_too_high.feerate;
3398 case LDKAPIError_RouteError: {
3399 LDKStr err_str = obj->route_error.err;
3400 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3401 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
3403 case LDKAPIError_ChannelUnavailable: {
3404 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
3405 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3406 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
3407 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_arr;
3409 case LDKAPIError_MonitorUpdateFailed: {
3410 return 0 /* LDKAPIError - MonitorUpdateFailed */;
3415 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
3416 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
3418 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
3419 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3420 CHECK(val->result_ok);
3421 return *val->contents.result;
3423 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
3424 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3425 CHECK(!val->result_ok);
3426 long err_ref = ((long)&(*val->contents.err)) | 1;
3429 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) {
3430 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
3431 ret->datalen = *((uint32_t*)elems);
3432 if (ret->datalen == 0) {
3435 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
3436 uint32_t *java_elems = (uint32_t*)(elems + 4);
3437 for (size_t i = 0; i < ret->datalen; i++) {
3438 uint32_t arr_elem = java_elems[i];
3439 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
3440 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
3441 ret->data[i] = arr_elem_conv;
3446 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
3447 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
3448 for (size_t i = 0; i < ret.datalen; i++) {
3449 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3453 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) {
3454 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
3455 ret->datalen = *((uint32_t*)elems);
3456 if (ret->datalen == 0) {
3459 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3460 uint32_t *java_elems = (uint32_t*)(elems + 4);
3461 for (size_t i = 0; i < ret->datalen; i++) {
3462 uint32_t arr_elem = java_elems[i];
3463 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
3464 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3465 ret->data[i] = arr_elem_conv;
3470 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3471 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3472 for (size_t i = 0; i < ret.datalen; i++) {
3473 ret.data[i] = APIError_clone(&orig->data[i]);
3477 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
3478 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3480 case LDKPaymentSendFailure_ParameterError: {
3481 long parameter_error_ref = ((long)&obj->parameter_error) | 1;
3482 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
3484 case LDKPaymentSendFailure_PathParameterError: {
3485 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3486 uint32_tArray path_parameter_error_arr = init_arr(path_parameter_error_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3487 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
3488 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3489 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3490 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3491 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3492 path_parameter_error_arr_ptr[w] = (long)path_parameter_error_conv_22_conv;
3494 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
3496 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3497 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3498 uint32_tArray all_failed_retry_safe_arr = init_arr(all_failed_retry_safe_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3499 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
3500 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3501 long all_failed_retry_safe_conv_10_ref = ((long)&all_failed_retry_safe_var.data[k]) | 1;
3502 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3504 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
3506 case LDKPaymentSendFailure_PartialFailure: {
3507 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3508 uint32_tArray partial_failure_arr = init_arr(partial_failure_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3509 uint32_t *partial_failure_arr_ptr = (uint32_t*)(partial_failure_arr + 4);
3510 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3511 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3512 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3513 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3514 partial_failure_arr_ptr[w] = (long)partial_failure_conv_22_conv;
3516 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) partial_failure_arr;
3521 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
3522 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3524 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
3525 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3526 CHECK(val->result_ok);
3527 return *val->contents.result;
3529 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
3530 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3531 CHECK(!val->result_ok);
3532 long err_ref = ((long)&(*val->contents.err)) | 1;
3535 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
3536 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3537 ret->datalen = *((uint32_t*)elems);
3538 if (ret->datalen == 0) {
3541 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3542 uint32_t *java_elems = (uint32_t*)(elems + 4);
3543 for (size_t i = 0; i < ret->datalen; i++) {
3544 uint32_t arr_elem = java_elems[i];
3545 LDKChannelMonitor arr_elem_conv;
3546 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3547 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3548 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3549 ret->data[i] = arr_elem_conv;
3554 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3555 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3556 for (size_t i = 0; i < ret.datalen; i++) {
3557 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3561 typedef struct LDKWatch_JCalls {
3562 atomic_size_t refcnt;
3563 uint32_t watch_channel_meth;
3564 uint32_t update_channel_meth;
3565 uint32_t release_pending_monitor_events_meth;
3567 static void LDKWatch_JCalls_free(void* this_arg) {
3568 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3569 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3570 js_free(j_calls->watch_channel_meth);
3571 js_free(j_calls->update_channel_meth);
3572 js_free(j_calls->release_pending_monitor_events_meth);
3576 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3577 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3578 LDKOutPoint funding_txo_var = funding_txo;
3579 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3580 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3581 long funding_txo_ref = (long)funding_txo_var.inner;
3582 if (funding_txo_var.is_owned) {
3583 funding_txo_ref |= 1;
3585 LDKChannelMonitor monitor_var = monitor;
3586 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3587 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3588 long monitor_ref = (long)monitor_var.inner;
3589 if (monitor_var.is_owned) {
3592 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3593 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3594 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3597 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3598 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3599 LDKOutPoint funding_txo_var = funding_txo;
3600 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3601 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3602 long funding_txo_ref = (long)funding_txo_var.inner;
3603 if (funding_txo_var.is_owned) {
3604 funding_txo_ref |= 1;
3606 LDKChannelMonitorUpdate update_var = update;
3607 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3608 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3609 long update_ref = (long)update_var.inner;
3610 if (update_var.is_owned) {
3613 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
3614 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3615 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3618 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3619 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3620 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
3621 LDKCVec_MonitorEventZ ret_constr;
3622 ret_constr.datalen = *((uint32_t*)ret);
3623 if (ret_constr.datalen > 0)
3624 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3626 ret_constr.data = NULL;
3627 uint32_t* ret_vals = (uint32_t*)(ret + 4);
3628 for (size_t o = 0; o < ret_constr.datalen; o++) {
3629 uint32_t ret_conv_14 = ret_vals[o];
3630 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3631 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
3632 ret_constr.data[o] = ret_conv_14_conv;
3636 static void* LDKWatch_JCalls_clone(const void* this_arg) {
3637 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3638 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3639 return (void*) this_arg;
3641 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
3642 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3643 atomic_init(&calls->refcnt, 1);
3644 //TODO: Assign calls->o from o
3647 .this_arg = (void*) calls,
3648 .watch_channel = watch_channel_LDKWatch_jcall,
3649 .update_channel = update_channel_LDKWatch_jcall,
3650 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3651 .free = LDKWatch_JCalls_free,
3655 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
3656 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3657 *res_ptr = LDKWatch_init(o);
3658 return (long)res_ptr;
3660 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
3661 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3662 LDKOutPoint funding_txo_conv;
3663 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3664 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3665 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3666 LDKChannelMonitor monitor_conv;
3667 monitor_conv.inner = (void*)(monitor & (~1));
3668 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3669 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3670 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3671 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3672 return (long)ret_conv;
3675 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
3676 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3677 LDKOutPoint funding_txo_conv;
3678 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3679 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3680 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3681 LDKChannelMonitorUpdate update_conv;
3682 update_conv.inner = (void*)(update & (~1));
3683 update_conv.is_owned = (update & 1) || (update == 0);
3684 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3685 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3686 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3687 return (long)ret_conv;
3690 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
3691 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3692 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3693 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3694 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3695 for (size_t o = 0; o < ret_var.datalen; o++) {
3696 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3697 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3698 long ret_conv_14_ref = (long)ret_conv_14_copy;
3699 ret_arr_ptr[o] = ret_conv_14_ref;
3705 typedef struct LDKBroadcasterInterface_JCalls {
3706 atomic_size_t refcnt;
3707 uint32_t broadcast_transaction_meth;
3708 } LDKBroadcasterInterface_JCalls;
3709 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3710 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3711 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3712 js_free(j_calls->broadcast_transaction_meth);
3716 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3717 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3718 LDKTransaction tx_var = tx;
3719 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3720 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
3721 Transaction_free(tx_var);
3722 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
3724 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
3725 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3726 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3727 return (void*) this_arg;
3729 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
3730 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3731 atomic_init(&calls->refcnt, 1);
3732 //TODO: Assign calls->o from o
3734 LDKBroadcasterInterface ret = {
3735 .this_arg = (void*) calls,
3736 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3737 .free = LDKBroadcasterInterface_JCalls_free,
3741 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
3742 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3743 *res_ptr = LDKBroadcasterInterface_init(o);
3744 return (long)res_ptr;
3746 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
3747 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3748 LDKTransaction tx_ref;
3749 tx_ref.datalen = *((uint32_t*)tx);
3750 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3751 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
3752 tx_ref.data_is_owned = true;
3753 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3756 typedef struct LDKKeysInterface_JCalls {
3757 atomic_size_t refcnt;
3758 uint32_t get_node_secret_meth;
3759 uint32_t get_destination_script_meth;
3760 uint32_t get_shutdown_pubkey_meth;
3761 uint32_t get_channel_signer_meth;
3762 uint32_t get_secure_random_bytes_meth;
3763 uint32_t read_chan_signer_meth;
3764 } LDKKeysInterface_JCalls;
3765 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3766 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3767 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3768 js_free(j_calls->get_node_secret_meth);
3769 js_free(j_calls->get_destination_script_meth);
3770 js_free(j_calls->get_shutdown_pubkey_meth);
3771 js_free(j_calls->get_channel_signer_meth);
3772 js_free(j_calls->get_secure_random_bytes_meth);
3773 js_free(j_calls->read_chan_signer_meth);
3777 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3778 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3779 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
3780 LDKSecretKey ret_ref;
3781 CHECK(*((uint32_t*)ret) == 32);
3782 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
3785 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3786 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3787 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
3788 LDKCVec_u8Z ret_ref;
3789 ret_ref.datalen = *((uint32_t*)ret);
3790 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3791 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
3794 LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
3795 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3796 int8_tArray ret = js_invoke_function_0(j_calls->get_shutdown_pubkey_meth);
3797 LDKPublicKey ret_ref;
3798 CHECK(*((uint32_t*)ret) == 33);
3799 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
3802 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3803 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3804 LDKSign* ret = (LDKSign*)js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3805 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
3806 ret_conv = Sign_clone(ret);
3809 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3810 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3811 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
3812 LDKThirtyTwoBytes ret_ref;
3813 CHECK(*((uint32_t*)ret) == 32);
3814 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
3817 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3818 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3819 LDKu8slice reader_var = reader;
3820 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3821 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
3822 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
3823 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
3824 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
3827 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
3828 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3829 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3830 return (void*) this_arg;
3832 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
3833 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3834 atomic_init(&calls->refcnt, 1);
3835 //TODO: Assign calls->o from o
3837 LDKKeysInterface ret = {
3838 .this_arg = (void*) calls,
3839 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
3840 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
3841 .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
3842 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
3843 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
3844 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
3845 .free = LDKKeysInterface_JCalls_free,
3849 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
3850 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3851 *res_ptr = LDKKeysInterface_init(o);
3852 return (long)res_ptr;
3854 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
3855 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3856 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3857 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
3861 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
3862 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3863 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3864 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3865 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3866 CVec_u8Z_free(ret_var);
3870 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_pubkey(uint32_t this_arg) {
3871 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3872 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
3873 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form, 33);
3877 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
3878 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3879 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3880 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3884 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
3885 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3886 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3887 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
3891 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
3892 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3893 LDKu8slice reader_ref;
3894 reader_ref.datalen = *((uint32_t*)reader);
3895 reader_ref.data = (int8_t*)(reader + 4);
3896 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3897 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3898 return (long)ret_conv;
3901 typedef struct LDKFeeEstimator_JCalls {
3902 atomic_size_t refcnt;
3903 uint32_t get_est_sat_per_1000_weight_meth;
3904 } LDKFeeEstimator_JCalls;
3905 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3906 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3907 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3908 js_free(j_calls->get_est_sat_per_1000_weight_meth);
3912 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3913 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3914 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
3915 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3917 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
3918 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3919 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3920 return (void*) this_arg;
3922 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
3923 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3924 atomic_init(&calls->refcnt, 1);
3925 //TODO: Assign calls->o from o
3927 LDKFeeEstimator ret = {
3928 .this_arg = (void*) calls,
3929 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3930 .free = LDKFeeEstimator_JCalls_free,
3934 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
3935 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3936 *res_ptr = LDKFeeEstimator_init(o);
3937 return (long)res_ptr;
3939 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
3940 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
3941 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
3942 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3946 typedef struct LDKLogger_JCalls {
3947 atomic_size_t refcnt;
3950 static void LDKLogger_JCalls_free(void* this_arg) {
3951 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3952 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3953 js_free(j_calls->log_meth);
3957 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
3958 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3959 const char* record_str = record;
3960 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
3961 js_invoke_function_1(j_calls->log_meth, record_conv);
3963 static void* LDKLogger_JCalls_clone(const void* this_arg) {
3964 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3965 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3966 return (void*) this_arg;
3968 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
3969 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3970 atomic_init(&calls->refcnt, 1);
3971 //TODO: Assign calls->o from o
3974 .this_arg = (void*) calls,
3975 .log = log_LDKLogger_jcall,
3976 .free = LDKLogger_JCalls_free,
3980 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
3981 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3982 *res_ptr = LDKLogger_init(o);
3983 return (long)res_ptr;
3985 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
3986 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
3987 LDKThirtyTwoBytes a_ref;
3988 CHECK(*((uint32_t*)a) == 32);
3989 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3991 LDKChannelManager b_conv;
3992 b_conv.inner = (void*)(b & (~1));
3993 b_conv.is_owned = (b & 1) || (b == 0);
3994 // Warning: we need a move here but no clone is available for LDKChannelManager
3998 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_a(uint32_t ptr) {
3999 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4000 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4001 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
4004 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_b(uint32_t ptr) {
4005 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4006 LDKChannelManager b_var = tuple->b;
4007 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4008 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4009 long b_ref = (long)b_var.inner & ~1;
4012 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
4013 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
4015 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
4016 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4017 CHECK(val->result_ok);
4018 long res_ref = (long)(&(*val->contents.result)) | 1;
4021 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
4022 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4023 CHECK(!val->result_ok);
4024 LDKDecodeError err_var = (*val->contents.err);
4025 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4026 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4027 long err_ref = (long)err_var.inner & ~1;
4030 typedef struct LDKMessageSendEventsProvider_JCalls {
4031 atomic_size_t refcnt;
4032 uint32_t get_and_clear_pending_msg_events_meth;
4033 } LDKMessageSendEventsProvider_JCalls;
4034 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
4035 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4036 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4037 js_free(j_calls->get_and_clear_pending_msg_events_meth);
4041 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
4042 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4043 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
4044 LDKCVec_MessageSendEventZ ret_constr;
4045 ret_constr.datalen = *((uint32_t*)ret);
4046 if (ret_constr.datalen > 0)
4047 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4049 ret_constr.data = NULL;
4050 uint32_t* ret_vals = (uint32_t*)(ret + 4);
4051 for (size_t s = 0; s < ret_constr.datalen; s++) {
4052 uint32_t ret_conv_18 = ret_vals[s];
4053 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
4054 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
4055 ret_constr.data[s] = ret_conv_18_conv;
4059 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
4060 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4061 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4062 return (void*) this_arg;
4064 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
4065 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
4066 atomic_init(&calls->refcnt, 1);
4067 //TODO: Assign calls->o from o
4069 LDKMessageSendEventsProvider ret = {
4070 .this_arg = (void*) calls,
4071 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
4072 .free = LDKMessageSendEventsProvider_JCalls_free,
4076 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
4077 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
4078 *res_ptr = LDKMessageSendEventsProvider_init(o);
4079 return (long)res_ptr;
4081 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
4082 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
4083 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
4084 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4085 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
4086 for (size_t s = 0; s < ret_var.datalen; s++) {
4087 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
4088 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
4089 long ret_conv_18_ref = (long)ret_conv_18_copy;
4090 ret_arr_ptr[s] = ret_conv_18_ref;
4096 typedef struct LDKEventsProvider_JCalls {
4097 atomic_size_t refcnt;
4098 uint32_t get_and_clear_pending_events_meth;
4099 } LDKEventsProvider_JCalls;
4100 static void LDKEventsProvider_JCalls_free(void* this_arg) {
4101 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4102 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4103 js_free(j_calls->get_and_clear_pending_events_meth);
4107 LDKCVec_EventZ get_and_clear_pending_events_LDKEventsProvider_jcall(const void* this_arg) {
4108 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4109 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_events_meth);
4110 LDKCVec_EventZ ret_constr;
4111 ret_constr.datalen = *((uint32_t*)ret);
4112 if (ret_constr.datalen > 0)
4113 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4115 ret_constr.data = NULL;
4116 uint32_t* ret_vals = (uint32_t*)(ret + 4);
4117 for (size_t h = 0; h < ret_constr.datalen; h++) {
4118 uint32_t ret_conv_7 = ret_vals[h];
4119 LDKEvent ret_conv_7_conv = *(LDKEvent*)(((uint64_t)ret_conv_7) & ~1);
4120 ret_conv_7_conv = Event_clone((LDKEvent*)(((uint64_t)ret_conv_7) & ~1));
4121 ret_constr.data[h] = ret_conv_7_conv;
4125 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
4126 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4127 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4128 return (void*) this_arg;
4130 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
4131 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
4132 atomic_init(&calls->refcnt, 1);
4133 //TODO: Assign calls->o from o
4135 LDKEventsProvider ret = {
4136 .this_arg = (void*) calls,
4137 .get_and_clear_pending_events = get_and_clear_pending_events_LDKEventsProvider_jcall,
4138 .free = LDKEventsProvider_JCalls_free,
4142 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
4143 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
4144 *res_ptr = LDKEventsProvider_init(o);
4145 return (long)res_ptr;
4147 uint32_tArray __attribute__((visibility("default"))) TS_EventsProvider_get_and_clear_pending_events(uint32_t this_arg) {
4148 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
4149 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
4150 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4151 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
4152 for (size_t h = 0; h < ret_var.datalen; h++) {
4153 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
4154 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
4155 long ret_conv_7_ref = (long)ret_conv_7_copy;
4156 ret_arr_ptr[h] = ret_conv_7_ref;
4162 typedef struct LDKAccess_JCalls {
4163 atomic_size_t refcnt;
4164 uint32_t get_utxo_meth;
4166 static void LDKAccess_JCalls_free(void* this_arg) {
4167 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4168 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4169 js_free(j_calls->get_utxo_meth);
4173 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4174 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4175 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4176 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
4177 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4178 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
4179 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
4182 static void* LDKAccess_JCalls_clone(const void* this_arg) {
4183 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4184 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4185 return (void*) this_arg;
4187 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
4188 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4189 atomic_init(&calls->refcnt, 1);
4190 //TODO: Assign calls->o from o
4193 .this_arg = (void*) calls,
4194 .get_utxo = get_utxo_LDKAccess_jcall,
4195 .free = LDKAccess_JCalls_free,
4199 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
4200 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4201 *res_ptr = LDKAccess_init(o);
4202 return (long)res_ptr;
4204 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4205 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
4206 unsigned char genesis_hash_arr[32];
4207 CHECK(*((uint32_t*)genesis_hash) == 32);
4208 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
4209 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4210 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4211 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4212 return (long)ret_conv;
4215 typedef struct LDKListen_JCalls {
4216 atomic_size_t refcnt;
4217 uint32_t block_connected_meth;
4218 uint32_t block_disconnected_meth;
4220 static void LDKListen_JCalls_free(void* this_arg) {
4221 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4222 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4223 js_free(j_calls->block_connected_meth);
4224 js_free(j_calls->block_disconnected_meth);
4228 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
4229 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4230 LDKu8slice block_var = block;
4231 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4232 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
4233 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
4235 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
4236 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4237 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
4238 memcpy((uint8_t*)(header_arr + 4), *header, 80);
4239 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
4241 static void* LDKListen_JCalls_clone(const void* this_arg) {
4242 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4243 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4244 return (void*) this_arg;
4246 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
4247 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
4248 atomic_init(&calls->refcnt, 1);
4249 //TODO: Assign calls->o from o
4252 .this_arg = (void*) calls,
4253 .block_connected = block_connected_LDKListen_jcall,
4254 .block_disconnected = block_disconnected_LDKListen_jcall,
4255 .free = LDKListen_JCalls_free,
4259 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
4260 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
4261 *res_ptr = LDKListen_init(o);
4262 return (long)res_ptr;
4264 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
4265 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
4266 LDKu8slice block_ref;
4267 block_ref.datalen = *((uint32_t*)block);
4268 block_ref.data = (int8_t*)(block + 4);
4269 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
4272 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
4273 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
4274 unsigned char header_arr[80];
4275 CHECK(*((uint32_t*)header) == 80);
4276 memcpy(header_arr, (uint8_t*)(header + 4), 80);
4277 unsigned char (*header_ref)[80] = &header_arr;
4278 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
4281 typedef struct LDKFilter_JCalls {
4282 atomic_size_t refcnt;
4283 uint32_t register_tx_meth;
4284 uint32_t register_output_meth;
4286 static void LDKFilter_JCalls_free(void* this_arg) {
4287 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4288 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4289 js_free(j_calls->register_tx_meth);
4290 js_free(j_calls->register_output_meth);
4294 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
4295 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4296 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4297 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
4298 LDKu8slice script_pubkey_var = script_pubkey;
4299 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4300 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
4301 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
4303 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
4304 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4305 LDKWatchedOutput output_var = output;
4306 CHECK((((long)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4307 CHECK((((long)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4308 long output_ref = (long)output_var.inner;
4309 if (output_var.is_owned) {
4312 LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)js_invoke_function_1(j_calls->register_output_meth, output_ref);
4313 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
4314 // Warning: we may need a move here but no clone is available for LDKCOption_C2Tuple_usizeTransactionZZ
4317 static void* LDKFilter_JCalls_clone(const void* this_arg) {
4318 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4319 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4320 return (void*) this_arg;
4322 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
4323 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
4324 atomic_init(&calls->refcnt, 1);
4325 //TODO: Assign calls->o from o
4328 .this_arg = (void*) calls,
4329 .register_tx = register_tx_LDKFilter_jcall,
4330 .register_output = register_output_LDKFilter_jcall,
4331 .free = LDKFilter_JCalls_free,
4335 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
4336 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
4337 *res_ptr = LDKFilter_init(o);
4338 return (long)res_ptr;
4340 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
4341 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
4342 unsigned char txid_arr[32];
4343 CHECK(*((uint32_t*)txid) == 32);
4344 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
4345 unsigned char (*txid_ref)[32] = &txid_arr;
4346 LDKu8slice script_pubkey_ref;
4347 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
4348 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
4349 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
4352 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
4353 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
4354 LDKWatchedOutput output_conv;
4355 output_conv.inner = (void*)(output & (~1));
4356 output_conv.is_owned = (output & 1) || (output == 0);
4357 // Warning: we need a move here but no clone is available for LDKWatchedOutput
4358 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
4359 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
4360 long ret_ref = (long)ret_copy;
4364 typedef struct LDKPersist_JCalls {
4365 atomic_size_t refcnt;
4366 uint32_t persist_new_channel_meth;
4367 uint32_t update_persisted_channel_meth;
4368 } LDKPersist_JCalls;
4369 static void LDKPersist_JCalls_free(void* this_arg) {
4370 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4371 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4372 js_free(j_calls->persist_new_channel_meth);
4373 js_free(j_calls->update_persisted_channel_meth);
4377 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
4378 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4379 LDKOutPoint id_var = id;
4380 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4381 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4382 long id_ref = (long)id_var.inner;
4383 if (id_var.is_owned) {
4386 LDKChannelMonitor data_var = *data;
4387 data_var = ChannelMonitor_clone(data);
4388 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4389 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4390 long data_ref = (long)data_var.inner;
4391 if (data_var.is_owned) {
4394 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
4395 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4396 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
4399 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
4400 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4401 LDKOutPoint id_var = id;
4402 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4403 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4404 long id_ref = (long)id_var.inner;
4405 if (id_var.is_owned) {
4408 LDKChannelMonitorUpdate update_var = *update;
4409 update_var = ChannelMonitorUpdate_clone(update);
4410 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4411 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4412 long update_ref = (long)update_var.inner;
4413 if (update_var.is_owned) {
4416 LDKChannelMonitor data_var = *data;
4417 data_var = ChannelMonitor_clone(data);
4418 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4419 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4420 long data_ref = (long)data_var.inner;
4421 if (data_var.is_owned) {
4424 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
4425 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4426 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
4429 static void* LDKPersist_JCalls_clone(const void* this_arg) {
4430 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4431 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4432 return (void*) this_arg;
4434 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
4435 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
4436 atomic_init(&calls->refcnt, 1);
4437 //TODO: Assign calls->o from o
4440 .this_arg = (void*) calls,
4441 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
4442 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
4443 .free = LDKPersist_JCalls_free,
4447 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
4448 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
4449 *res_ptr = LDKPersist_init(o);
4450 return (long)res_ptr;
4452 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t id, uint32_t data) {
4453 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
4454 LDKOutPoint id_conv;
4455 id_conv.inner = (void*)(id & (~1));
4456 id_conv.is_owned = (id & 1) || (id == 0);
4457 id_conv = OutPoint_clone(&id_conv);
4458 LDKChannelMonitor data_conv;
4459 data_conv.inner = (void*)(data & (~1));
4460 data_conv.is_owned = false;
4461 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4462 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
4463 return (long)ret_conv;
4466 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
4467 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
4468 LDKOutPoint id_conv;
4469 id_conv.inner = (void*)(id & (~1));
4470 id_conv.is_owned = (id & 1) || (id == 0);
4471 id_conv = OutPoint_clone(&id_conv);
4472 LDKChannelMonitorUpdate update_conv;
4473 update_conv.inner = (void*)(update & (~1));
4474 update_conv.is_owned = false;
4475 LDKChannelMonitor data_conv;
4476 data_conv.inner = (void*)(data & (~1));
4477 data_conv.is_owned = false;
4478 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4479 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
4480 return (long)ret_conv;
4483 typedef struct LDKChannelMessageHandler_JCalls {
4484 atomic_size_t refcnt;
4485 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4486 uint32_t handle_open_channel_meth;
4487 uint32_t handle_accept_channel_meth;
4488 uint32_t handle_funding_created_meth;
4489 uint32_t handle_funding_signed_meth;
4490 uint32_t handle_funding_locked_meth;
4491 uint32_t handle_shutdown_meth;
4492 uint32_t handle_closing_signed_meth;
4493 uint32_t handle_update_add_htlc_meth;
4494 uint32_t handle_update_fulfill_htlc_meth;
4495 uint32_t handle_update_fail_htlc_meth;
4496 uint32_t handle_update_fail_malformed_htlc_meth;
4497 uint32_t handle_commitment_signed_meth;
4498 uint32_t handle_revoke_and_ack_meth;
4499 uint32_t handle_update_fee_meth;
4500 uint32_t handle_announcement_signatures_meth;
4501 uint32_t peer_disconnected_meth;
4502 uint32_t peer_connected_meth;
4503 uint32_t handle_channel_reestablish_meth;
4504 uint32_t handle_channel_update_meth;
4505 uint32_t handle_error_meth;
4506 } LDKChannelMessageHandler_JCalls;
4507 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
4508 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4509 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4510 js_free(j_calls->handle_open_channel_meth);
4511 js_free(j_calls->handle_accept_channel_meth);
4512 js_free(j_calls->handle_funding_created_meth);
4513 js_free(j_calls->handle_funding_signed_meth);
4514 js_free(j_calls->handle_funding_locked_meth);
4515 js_free(j_calls->handle_shutdown_meth);
4516 js_free(j_calls->handle_closing_signed_meth);
4517 js_free(j_calls->handle_update_add_htlc_meth);
4518 js_free(j_calls->handle_update_fulfill_htlc_meth);
4519 js_free(j_calls->handle_update_fail_htlc_meth);
4520 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
4521 js_free(j_calls->handle_commitment_signed_meth);
4522 js_free(j_calls->handle_revoke_and_ack_meth);
4523 js_free(j_calls->handle_update_fee_meth);
4524 js_free(j_calls->handle_announcement_signatures_meth);
4525 js_free(j_calls->peer_disconnected_meth);
4526 js_free(j_calls->peer_connected_meth);
4527 js_free(j_calls->handle_channel_reestablish_meth);
4528 js_free(j_calls->handle_channel_update_meth);
4529 js_free(j_calls->handle_error_meth);
4533 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
4534 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4535 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4536 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4537 LDKInitFeatures their_features_var = their_features;
4538 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4539 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4540 long their_features_ref = (long)their_features_var.inner;
4541 if (their_features_var.is_owned) {
4542 their_features_ref |= 1;
4544 LDKOpenChannel msg_var = *msg;
4545 msg_var = OpenChannel_clone(msg);
4546 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4547 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4548 long msg_ref = (long)msg_var.inner;
4549 if (msg_var.is_owned) {
4552 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4554 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
4555 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4556 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4557 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4558 LDKInitFeatures their_features_var = their_features;
4559 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4560 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4561 long their_features_ref = (long)their_features_var.inner;
4562 if (their_features_var.is_owned) {
4563 their_features_ref |= 1;
4565 LDKAcceptChannel msg_var = *msg;
4566 msg_var = AcceptChannel_clone(msg);
4567 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4568 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4569 long msg_ref = (long)msg_var.inner;
4570 if (msg_var.is_owned) {
4573 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4575 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
4576 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4577 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4578 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4579 LDKFundingCreated msg_var = *msg;
4580 msg_var = FundingCreated_clone(msg);
4581 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4582 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4583 long msg_ref = (long)msg_var.inner;
4584 if (msg_var.is_owned) {
4587 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
4589 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
4590 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4591 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4592 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4593 LDKFundingSigned msg_var = *msg;
4594 msg_var = FundingSigned_clone(msg);
4595 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4596 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4597 long msg_ref = (long)msg_var.inner;
4598 if (msg_var.is_owned) {
4601 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
4603 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
4604 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4605 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4606 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4607 LDKFundingLocked msg_var = *msg;
4608 msg_var = FundingLocked_clone(msg);
4609 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4610 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4611 long msg_ref = (long)msg_var.inner;
4612 if (msg_var.is_owned) {
4615 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
4617 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
4618 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4619 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4620 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4621 LDKInitFeatures their_features_var = *their_features;
4622 their_features_var = InitFeatures_clone(their_features);
4623 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4624 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4625 long their_features_ref = (long)their_features_var.inner;
4626 if (their_features_var.is_owned) {
4627 their_features_ref |= 1;
4629 LDKShutdown msg_var = *msg;
4630 msg_var = Shutdown_clone(msg);
4631 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4632 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4633 long msg_ref = (long)msg_var.inner;
4634 if (msg_var.is_owned) {
4637 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
4639 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
4640 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4641 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4642 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4643 LDKClosingSigned msg_var = *msg;
4644 msg_var = ClosingSigned_clone(msg);
4645 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4646 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4647 long msg_ref = (long)msg_var.inner;
4648 if (msg_var.is_owned) {
4651 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
4653 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
4654 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4655 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4656 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4657 LDKUpdateAddHTLC msg_var = *msg;
4658 msg_var = UpdateAddHTLC_clone(msg);
4659 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4660 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4661 long msg_ref = (long)msg_var.inner;
4662 if (msg_var.is_owned) {
4665 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
4667 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
4668 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4669 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4670 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4671 LDKUpdateFulfillHTLC msg_var = *msg;
4672 msg_var = UpdateFulfillHTLC_clone(msg);
4673 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4674 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4675 long msg_ref = (long)msg_var.inner;
4676 if (msg_var.is_owned) {
4679 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
4681 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
4682 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4683 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4684 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4685 LDKUpdateFailHTLC msg_var = *msg;
4686 msg_var = UpdateFailHTLC_clone(msg);
4687 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4688 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4689 long msg_ref = (long)msg_var.inner;
4690 if (msg_var.is_owned) {
4693 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
4695 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
4696 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4697 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4698 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4699 LDKUpdateFailMalformedHTLC msg_var = *msg;
4700 msg_var = UpdateFailMalformedHTLC_clone(msg);
4701 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4702 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4703 long msg_ref = (long)msg_var.inner;
4704 if (msg_var.is_owned) {
4707 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
4709 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
4710 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4711 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4712 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4713 LDKCommitmentSigned msg_var = *msg;
4714 msg_var = CommitmentSigned_clone(msg);
4715 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4716 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4717 long msg_ref = (long)msg_var.inner;
4718 if (msg_var.is_owned) {
4721 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
4723 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
4724 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4725 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4726 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4727 LDKRevokeAndACK msg_var = *msg;
4728 msg_var = RevokeAndACK_clone(msg);
4729 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4730 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4731 long msg_ref = (long)msg_var.inner;
4732 if (msg_var.is_owned) {
4735 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
4737 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
4738 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4739 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4740 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4741 LDKUpdateFee msg_var = *msg;
4742 msg_var = UpdateFee_clone(msg);
4743 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4744 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4745 long msg_ref = (long)msg_var.inner;
4746 if (msg_var.is_owned) {
4749 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
4751 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
4752 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4753 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4754 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4755 LDKAnnouncementSignatures msg_var = *msg;
4756 msg_var = AnnouncementSignatures_clone(msg);
4757 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4758 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4759 long msg_ref = (long)msg_var.inner;
4760 if (msg_var.is_owned) {
4763 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
4765 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
4766 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4767 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4768 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4769 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
4771 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
4772 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4773 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4774 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4775 LDKInit msg_var = *msg;
4776 msg_var = Init_clone(msg);
4777 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4778 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4779 long msg_ref = (long)msg_var.inner;
4780 if (msg_var.is_owned) {
4783 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
4785 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
4786 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4787 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4788 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4789 LDKChannelReestablish msg_var = *msg;
4790 msg_var = ChannelReestablish_clone(msg);
4791 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4792 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4793 long msg_ref = (long)msg_var.inner;
4794 if (msg_var.is_owned) {
4797 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
4799 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
4800 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4801 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4802 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4803 LDKChannelUpdate msg_var = *msg;
4804 msg_var = ChannelUpdate_clone(msg);
4805 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4806 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4807 long msg_ref = (long)msg_var.inner;
4808 if (msg_var.is_owned) {
4811 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
4813 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
4814 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4815 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4816 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4817 LDKErrorMessage msg_var = *msg;
4818 msg_var = ErrorMessage_clone(msg);
4819 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4820 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4821 long msg_ref = (long)msg_var.inner;
4822 if (msg_var.is_owned) {
4825 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
4827 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
4828 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4829 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4830 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4831 return (void*) this_arg;
4833 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
4834 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
4835 atomic_init(&calls->refcnt, 1);
4836 //TODO: Assign calls->o from o
4838 LDKChannelMessageHandler ret = {
4839 .this_arg = (void*) calls,
4840 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
4841 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
4842 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
4843 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
4844 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
4845 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
4846 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
4847 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
4848 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
4849 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
4850 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
4851 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
4852 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
4853 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
4854 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
4855 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
4856 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
4857 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
4858 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
4859 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
4860 .free = LDKChannelMessageHandler_JCalls_free,
4861 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
4863 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
4866 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
4867 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
4868 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
4869 return (long)res_ptr;
4871 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) {
4872 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4873 LDKPublicKey their_node_id_ref;
4874 CHECK(*((uint32_t*)their_node_id) == 33);
4875 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4876 LDKInitFeatures their_features_conv;
4877 their_features_conv.inner = (void*)(their_features & (~1));
4878 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4879 their_features_conv = InitFeatures_clone(&their_features_conv);
4880 LDKOpenChannel msg_conv;
4881 msg_conv.inner = (void*)(msg & (~1));
4882 msg_conv.is_owned = false;
4883 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4886 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) {
4887 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4888 LDKPublicKey their_node_id_ref;
4889 CHECK(*((uint32_t*)their_node_id) == 33);
4890 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4891 LDKInitFeatures their_features_conv;
4892 their_features_conv.inner = (void*)(their_features & (~1));
4893 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4894 their_features_conv = InitFeatures_clone(&their_features_conv);
4895 LDKAcceptChannel msg_conv;
4896 msg_conv.inner = (void*)(msg & (~1));
4897 msg_conv.is_owned = false;
4898 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4901 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4902 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4903 LDKPublicKey their_node_id_ref;
4904 CHECK(*((uint32_t*)their_node_id) == 33);
4905 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4906 LDKFundingCreated msg_conv;
4907 msg_conv.inner = (void*)(msg & (~1));
4908 msg_conv.is_owned = false;
4909 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4912 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4913 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4914 LDKPublicKey their_node_id_ref;
4915 CHECK(*((uint32_t*)their_node_id) == 33);
4916 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4917 LDKFundingSigned msg_conv;
4918 msg_conv.inner = (void*)(msg & (~1));
4919 msg_conv.is_owned = false;
4920 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4923 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4924 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4925 LDKPublicKey their_node_id_ref;
4926 CHECK(*((uint32_t*)their_node_id) == 33);
4927 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4928 LDKFundingLocked msg_conv;
4929 msg_conv.inner = (void*)(msg & (~1));
4930 msg_conv.is_owned = false;
4931 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4934 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
4935 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4936 LDKPublicKey their_node_id_ref;
4937 CHECK(*((uint32_t*)their_node_id) == 33);
4938 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4939 LDKInitFeatures their_features_conv;
4940 their_features_conv.inner = (void*)(their_features & (~1));
4941 their_features_conv.is_owned = false;
4942 LDKShutdown msg_conv;
4943 msg_conv.inner = (void*)(msg & (~1));
4944 msg_conv.is_owned = false;
4945 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
4948 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4949 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4950 LDKPublicKey their_node_id_ref;
4951 CHECK(*((uint32_t*)their_node_id) == 33);
4952 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4953 LDKClosingSigned msg_conv;
4954 msg_conv.inner = (void*)(msg & (~1));
4955 msg_conv.is_owned = false;
4956 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4959 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4960 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4961 LDKPublicKey their_node_id_ref;
4962 CHECK(*((uint32_t*)their_node_id) == 33);
4963 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4964 LDKUpdateAddHTLC msg_conv;
4965 msg_conv.inner = (void*)(msg & (~1));
4966 msg_conv.is_owned = false;
4967 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4970 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4971 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4972 LDKPublicKey their_node_id_ref;
4973 CHECK(*((uint32_t*)their_node_id) == 33);
4974 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4975 LDKUpdateFulfillHTLC msg_conv;
4976 msg_conv.inner = (void*)(msg & (~1));
4977 msg_conv.is_owned = false;
4978 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4981 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4982 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4983 LDKPublicKey their_node_id_ref;
4984 CHECK(*((uint32_t*)their_node_id) == 33);
4985 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4986 LDKUpdateFailHTLC msg_conv;
4987 msg_conv.inner = (void*)(msg & (~1));
4988 msg_conv.is_owned = false;
4989 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4992 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4993 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4994 LDKPublicKey their_node_id_ref;
4995 CHECK(*((uint32_t*)their_node_id) == 33);
4996 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4997 LDKUpdateFailMalformedHTLC msg_conv;
4998 msg_conv.inner = (void*)(msg & (~1));
4999 msg_conv.is_owned = false;
5000 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5003 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5004 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5005 LDKPublicKey their_node_id_ref;
5006 CHECK(*((uint32_t*)their_node_id) == 33);
5007 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5008 LDKCommitmentSigned msg_conv;
5009 msg_conv.inner = (void*)(msg & (~1));
5010 msg_conv.is_owned = false;
5011 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5014 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5015 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5016 LDKPublicKey their_node_id_ref;
5017 CHECK(*((uint32_t*)their_node_id) == 33);
5018 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5019 LDKRevokeAndACK msg_conv;
5020 msg_conv.inner = (void*)(msg & (~1));
5021 msg_conv.is_owned = false;
5022 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5025 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5026 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5027 LDKPublicKey their_node_id_ref;
5028 CHECK(*((uint32_t*)their_node_id) == 33);
5029 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5030 LDKUpdateFee msg_conv;
5031 msg_conv.inner = (void*)(msg & (~1));
5032 msg_conv.is_owned = false;
5033 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5036 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5037 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5038 LDKPublicKey their_node_id_ref;
5039 CHECK(*((uint32_t*)their_node_id) == 33);
5040 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5041 LDKAnnouncementSignatures msg_conv;
5042 msg_conv.inner = (void*)(msg & (~1));
5043 msg_conv.is_owned = false;
5044 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5047 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
5048 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5049 LDKPublicKey their_node_id_ref;
5050 CHECK(*((uint32_t*)their_node_id) == 33);
5051 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5052 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
5055 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5056 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5057 LDKPublicKey their_node_id_ref;
5058 CHECK(*((uint32_t*)their_node_id) == 33);
5059 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5061 msg_conv.inner = (void*)(msg & (~1));
5062 msg_conv.is_owned = false;
5063 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5066 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5067 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5068 LDKPublicKey their_node_id_ref;
5069 CHECK(*((uint32_t*)their_node_id) == 33);
5070 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5071 LDKChannelReestablish msg_conv;
5072 msg_conv.inner = (void*)(msg & (~1));
5073 msg_conv.is_owned = false;
5074 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5077 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5078 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5079 LDKPublicKey their_node_id_ref;
5080 CHECK(*((uint32_t*)their_node_id) == 33);
5081 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5082 LDKChannelUpdate msg_conv;
5083 msg_conv.inner = (void*)(msg & (~1));
5084 msg_conv.is_owned = false;
5085 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5088 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5089 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5090 LDKPublicKey their_node_id_ref;
5091 CHECK(*((uint32_t*)their_node_id) == 33);
5092 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5093 LDKErrorMessage msg_conv;
5094 msg_conv.inner = (void*)(msg & (~1));
5095 msg_conv.is_owned = false;
5096 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5099 typedef struct LDKRoutingMessageHandler_JCalls {
5100 atomic_size_t refcnt;
5101 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5102 uint32_t handle_node_announcement_meth;
5103 uint32_t handle_channel_announcement_meth;
5104 uint32_t handle_channel_update_meth;
5105 uint32_t handle_htlc_fail_channel_update_meth;
5106 uint32_t get_next_channel_announcements_meth;
5107 uint32_t get_next_node_announcements_meth;
5108 uint32_t sync_routing_table_meth;
5109 uint32_t handle_reply_channel_range_meth;
5110 uint32_t handle_reply_short_channel_ids_end_meth;
5111 uint32_t handle_query_channel_range_meth;
5112 uint32_t handle_query_short_channel_ids_meth;
5113 } LDKRoutingMessageHandler_JCalls;
5114 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
5115 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5116 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5117 js_free(j_calls->handle_node_announcement_meth);
5118 js_free(j_calls->handle_channel_announcement_meth);
5119 js_free(j_calls->handle_channel_update_meth);
5120 js_free(j_calls->handle_htlc_fail_channel_update_meth);
5121 js_free(j_calls->get_next_channel_announcements_meth);
5122 js_free(j_calls->get_next_node_announcements_meth);
5123 js_free(j_calls->sync_routing_table_meth);
5124 js_free(j_calls->handle_reply_channel_range_meth);
5125 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
5126 js_free(j_calls->handle_query_channel_range_meth);
5127 js_free(j_calls->handle_query_short_channel_ids_meth);
5131 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
5132 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5133 LDKNodeAnnouncement msg_var = *msg;
5134 msg_var = NodeAnnouncement_clone(msg);
5135 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5136 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5137 long msg_ref = (long)msg_var.inner;
5138 if (msg_var.is_owned) {
5141 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
5142 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5143 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
5146 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
5147 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5148 LDKChannelAnnouncement msg_var = *msg;
5149 msg_var = ChannelAnnouncement_clone(msg);
5150 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5151 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5152 long msg_ref = (long)msg_var.inner;
5153 if (msg_var.is_owned) {
5156 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
5157 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5158 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
5161 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
5162 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5163 LDKChannelUpdate msg_var = *msg;
5164 msg_var = ChannelUpdate_clone(msg);
5165 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5166 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5167 long msg_ref = (long)msg_var.inner;
5168 if (msg_var.is_owned) {
5171 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
5172 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5173 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
5176 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
5177 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5178 long ret_update = (long)update;
5179 js_invoke_function_1(j_calls->handle_htlc_fail_channel_update_meth, ret_update);
5181 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
5182 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5183 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
5184 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
5185 ret_constr.datalen = *((uint32_t*)ret);
5186 if (ret_constr.datalen > 0)
5187 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5189 ret_constr.data = NULL;
5190 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5191 for (size_t l = 0; l < ret_constr.datalen; l++) {
5192 uint32_t ret_conv_63 = ret_vals[l];
5193 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
5194 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
5195 ret_constr.data[l] = ret_conv_63_conv;
5199 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
5200 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5201 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5202 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
5203 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
5204 LDKCVec_NodeAnnouncementZ ret_constr;
5205 ret_constr.datalen = *((uint32_t*)ret);
5206 if (ret_constr.datalen > 0)
5207 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5209 ret_constr.data = NULL;
5210 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5211 for (size_t s = 0; s < ret_constr.datalen; s++) {
5212 uint32_t ret_conv_18 = ret_vals[s];
5213 LDKNodeAnnouncement ret_conv_18_conv;
5214 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
5215 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
5216 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
5217 ret_constr.data[s] = ret_conv_18_conv;
5221 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
5222 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5223 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5224 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5225 LDKInit init_var = *init;
5226 init_var = Init_clone(init);
5227 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5228 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5229 long init_ref = (long)init_var.inner;
5230 if (init_var.is_owned) {
5233 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
5235 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
5236 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5237 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5238 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5239 LDKReplyChannelRange msg_var = msg;
5240 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5241 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5242 long msg_ref = (long)msg_var.inner;
5243 if (msg_var.is_owned) {
5246 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
5247 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5248 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
5251 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
5252 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5253 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5254 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5255 LDKReplyShortChannelIdsEnd msg_var = msg;
5256 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5257 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5258 long msg_ref = (long)msg_var.inner;
5259 if (msg_var.is_owned) {
5262 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
5263 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5264 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
5267 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
5268 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5269 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5270 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5271 LDKQueryChannelRange msg_var = msg;
5272 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5273 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5274 long msg_ref = (long)msg_var.inner;
5275 if (msg_var.is_owned) {
5278 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
5279 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5280 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
5283 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
5284 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5285 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5286 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5287 LDKQueryShortChannelIds msg_var = msg;
5288 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5289 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5290 long msg_ref = (long)msg_var.inner;
5291 if (msg_var.is_owned) {
5294 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
5295 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5296 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
5299 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
5300 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5301 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5302 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5303 return (void*) this_arg;
5305 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
5306 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
5307 atomic_init(&calls->refcnt, 1);
5308 //TODO: Assign calls->o from o
5310 LDKRoutingMessageHandler ret = {
5311 .this_arg = (void*) calls,
5312 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
5313 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
5314 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
5315 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
5316 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
5317 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
5318 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
5319 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
5320 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
5321 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
5322 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
5323 .free = LDKRoutingMessageHandler_JCalls_free,
5324 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
5326 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5329 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
5330 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
5331 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
5332 return (long)res_ptr;
5334 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
5335 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5336 LDKNodeAnnouncement msg_conv;
5337 msg_conv.inner = (void*)(msg & (~1));
5338 msg_conv.is_owned = false;
5339 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5340 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
5341 return (long)ret_conv;
5344 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
5345 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5346 LDKChannelAnnouncement msg_conv;
5347 msg_conv.inner = (void*)(msg & (~1));
5348 msg_conv.is_owned = false;
5349 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5350 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5351 return (long)ret_conv;
5354 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
5355 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5356 LDKChannelUpdate msg_conv;
5357 msg_conv.inner = (void*)(msg & (~1));
5358 msg_conv.is_owned = false;
5359 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5360 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
5361 return (long)ret_conv;
5364 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_htlc_fail_channel_update(uint32_t this_arg, uint32_t update) {
5365 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5366 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
5367 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
5370 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
5371 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5372 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
5373 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5374 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5375 for (size_t l = 0; l < ret_var.datalen; l++) {
5376 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5377 *ret_conv_63_ref = ret_var.data[l];
5378 ret_arr_ptr[l] = (long)ret_conv_63_ref;
5384 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
5385 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5386 LDKPublicKey starting_point_ref;
5387 CHECK(*((uint32_t*)starting_point) == 33);
5388 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
5389 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
5390 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5391 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5392 for (size_t s = 0; s < ret_var.datalen; s++) {
5393 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
5394 CHECK((((long)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5395 CHECK((((long)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5396 long ret_conv_18_ref = (long)ret_conv_18_var.inner;
5397 if (ret_conv_18_var.is_owned) {
5398 ret_conv_18_ref |= 1;
5400 ret_arr_ptr[s] = ret_conv_18_ref;
5406 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
5407 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5408 LDKPublicKey their_node_id_ref;
5409 CHECK(*((uint32_t*)their_node_id) == 33);
5410 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5412 init_conv.inner = (void*)(init & (~1));
5413 init_conv.is_owned = false;
5414 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
5417 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5418 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5419 LDKPublicKey their_node_id_ref;
5420 CHECK(*((uint32_t*)their_node_id) == 33);
5421 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5422 LDKReplyChannelRange msg_conv;
5423 msg_conv.inner = (void*)(msg & (~1));
5424 msg_conv.is_owned = (msg & 1) || (msg == 0);
5425 msg_conv = ReplyChannelRange_clone(&msg_conv);
5426 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5427 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5428 return (long)ret_conv;
5431 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) {
5432 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5433 LDKPublicKey their_node_id_ref;
5434 CHECK(*((uint32_t*)their_node_id) == 33);
5435 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5436 LDKReplyShortChannelIdsEnd msg_conv;
5437 msg_conv.inner = (void*)(msg & (~1));
5438 msg_conv.is_owned = (msg & 1) || (msg == 0);
5439 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
5440 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5441 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5442 return (long)ret_conv;
5445 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5446 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5447 LDKPublicKey their_node_id_ref;
5448 CHECK(*((uint32_t*)their_node_id) == 33);
5449 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5450 LDKQueryChannelRange msg_conv;
5451 msg_conv.inner = (void*)(msg & (~1));
5452 msg_conv.is_owned = (msg & 1) || (msg == 0);
5453 msg_conv = QueryChannelRange_clone(&msg_conv);
5454 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5455 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5456 return (long)ret_conv;
5459 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5460 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5461 LDKPublicKey their_node_id_ref;
5462 CHECK(*((uint32_t*)their_node_id) == 33);
5463 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5464 LDKQueryShortChannelIds msg_conv;
5465 msg_conv.inner = (void*)(msg & (~1));
5466 msg_conv.is_owned = (msg & 1) || (msg == 0);
5467 msg_conv = QueryShortChannelIds_clone(&msg_conv);
5468 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5469 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5470 return (long)ret_conv;
5473 typedef struct LDKSocketDescriptor_JCalls {
5474 atomic_size_t refcnt;
5475 uint32_t send_data_meth;
5476 uint32_t disconnect_socket_meth;
5479 } LDKSocketDescriptor_JCalls;
5480 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
5481 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5482 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5483 js_free(j_calls->send_data_meth);
5484 js_free(j_calls->disconnect_socket_meth);
5485 js_free(j_calls->eq_meth);
5486 js_free(j_calls->hash_meth);
5490 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
5491 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5492 LDKu8slice data_var = data;
5493 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5494 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
5495 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
5497 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
5498 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5499 js_invoke_function_0(j_calls->disconnect_socket_meth);
5501 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
5502 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5503 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5504 *other_arg_clone = SocketDescriptor_clone(other_arg);
5505 return js_invoke_function_1(j_calls->eq_meth, (long)other_arg_clone);
5507 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
5508 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5509 return js_invoke_function_0(j_calls->hash_meth);
5511 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
5512 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5513 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5514 return (void*) this_arg;
5516 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
5517 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
5518 atomic_init(&calls->refcnt, 1);
5519 //TODO: Assign calls->o from o
5521 LDKSocketDescriptor ret = {
5522 .this_arg = (void*) calls,
5523 .send_data = send_data_LDKSocketDescriptor_jcall,
5524 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
5525 .eq = eq_LDKSocketDescriptor_jcall,
5526 .hash = hash_LDKSocketDescriptor_jcall,
5527 .clone = LDKSocketDescriptor_JCalls_clone,
5528 .free = LDKSocketDescriptor_JCalls_free,
5532 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
5533 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5534 *res_ptr = LDKSocketDescriptor_init(o);
5535 return (long)res_ptr;
5537 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
5538 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
5539 LDKu8slice data_ref;
5540 data_ref.datalen = *((uint32_t*)data);
5541 data_ref.data = (int8_t*)(data + 4);
5542 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
5546 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
5547 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
5548 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
5551 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
5552 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
5553 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
5557 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
5558 LDKTransaction _res_ref;
5559 _res_ref.datalen = *((uint32_t*)_res);
5560 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5561 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
5562 _res_ref.data_is_owned = true;
5563 Transaction_free(_res_ref);
5566 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
5567 if ((_res & 1) != 0) return;
5568 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
5570 TxOut_free(_res_conv);
5573 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
5574 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
5575 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5576 *ret_ref = TxOut_clone(orig_conv);
5577 return (long)ret_ref;
5580 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
5581 LDKChannelConfig o_conv;
5582 o_conv.inner = (void*)(o & (~1));
5583 o_conv.is_owned = (o & 1) || (o == 0);
5584 o_conv = ChannelConfig_clone(&o_conv);
5585 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
5586 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
5587 return (long)ret_conv;
5590 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
5591 LDKDecodeError e_conv;
5592 e_conv.inner = (void*)(e & (~1));
5593 e_conv.is_owned = (e & 1) || (e == 0);
5594 e_conv = DecodeError_clone(&e_conv);
5595 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
5596 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
5597 return (long)ret_conv;
5600 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
5601 if ((_res & 1) != 0) return;
5602 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
5604 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
5607 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
5608 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
5609 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
5610 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
5611 return (long)ret_conv;
5614 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
5616 o_conv.inner = (void*)(o & (~1));
5617 o_conv.is_owned = (o & 1) || (o == 0);
5618 o_conv = OutPoint_clone(&o_conv);
5619 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
5620 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
5621 return (long)ret_conv;
5624 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
5625 LDKDecodeError e_conv;
5626 e_conv.inner = (void*)(e & (~1));
5627 e_conv.is_owned = (e & 1) || (e == 0);
5628 e_conv = DecodeError_clone(&e_conv);
5629 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
5630 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
5631 return (long)ret_conv;
5634 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
5635 if ((_res & 1) != 0) return;
5636 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
5638 CResult_OutPointDecodeErrorZ_free(_res_conv);
5641 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
5642 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
5643 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
5644 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
5645 return (long)ret_conv;
5648 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
5650 CHECK(*((uint32_t*)o) == 32);
5651 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
5652 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
5653 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
5654 return (long)ret_conv;
5657 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
5658 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5659 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
5660 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
5661 return (long)ret_conv;
5664 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
5665 if ((_res & 1) != 0) return;
5666 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
5668 CResult_SecretKeyErrorZ_free(_res_conv);
5671 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
5673 CHECK(*((uint32_t*)o) == 33);
5674 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
5675 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
5676 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
5677 return (long)ret_conv;
5680 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
5681 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5682 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
5683 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
5684 return (long)ret_conv;
5687 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
5688 if ((_res & 1) != 0) return;
5689 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
5691 CResult_PublicKeyErrorZ_free(_res_conv);
5694 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
5695 LDKTxCreationKeys o_conv;
5696 o_conv.inner = (void*)(o & (~1));
5697 o_conv.is_owned = (o & 1) || (o == 0);
5698 o_conv = TxCreationKeys_clone(&o_conv);
5699 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5700 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
5701 return (long)ret_conv;
5704 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
5705 LDKDecodeError e_conv;
5706 e_conv.inner = (void*)(e & (~1));
5707 e_conv.is_owned = (e & 1) || (e == 0);
5708 e_conv = DecodeError_clone(&e_conv);
5709 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5710 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
5711 return (long)ret_conv;
5714 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
5715 if ((_res & 1) != 0) return;
5716 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
5718 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
5721 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
5722 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
5723 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5724 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
5725 return (long)ret_conv;
5728 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
5729 LDKChannelPublicKeys o_conv;
5730 o_conv.inner = (void*)(o & (~1));
5731 o_conv.is_owned = (o & 1) || (o == 0);
5732 o_conv = ChannelPublicKeys_clone(&o_conv);
5733 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5734 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
5735 return (long)ret_conv;
5738 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
5739 LDKDecodeError e_conv;
5740 e_conv.inner = (void*)(e & (~1));
5741 e_conv.is_owned = (e & 1) || (e == 0);
5742 e_conv = DecodeError_clone(&e_conv);
5743 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5744 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
5745 return (long)ret_conv;
5748 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
5749 if ((_res & 1) != 0) return;
5750 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
5752 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
5755 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
5756 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
5757 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5758 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
5759 return (long)ret_conv;
5762 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
5763 LDKTxCreationKeys o_conv;
5764 o_conv.inner = (void*)(o & (~1));
5765 o_conv.is_owned = (o & 1) || (o == 0);
5766 o_conv = TxCreationKeys_clone(&o_conv);
5767 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
5768 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
5769 return (long)ret_conv;
5772 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
5773 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5774 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
5775 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
5776 return (long)ret_conv;
5779 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
5780 if ((_res & 1) != 0) return;
5781 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
5783 CResult_TxCreationKeysErrorZ_free(_res_conv);
5786 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
5787 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
5788 *ret_copy = COption_u32Z_some(o);
5789 long ret_ref = (long)ret_copy;
5793 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
5794 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
5795 *ret_copy = COption_u32Z_none();
5796 long ret_ref = (long)ret_copy;
5800 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
5801 if ((_res & 1) != 0) return;
5802 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
5804 COption_u32Z_free(_res_conv);
5807 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
5808 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
5809 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
5810 *ret_copy = COption_u32Z_clone(orig_conv);
5811 long ret_ref = (long)ret_copy;
5815 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
5816 LDKHTLCOutputInCommitment o_conv;
5817 o_conv.inner = (void*)(o & (~1));
5818 o_conv.is_owned = (o & 1) || (o == 0);
5819 o_conv = HTLCOutputInCommitment_clone(&o_conv);
5820 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5821 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
5822 return (long)ret_conv;
5825 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
5826 LDKDecodeError e_conv;
5827 e_conv.inner = (void*)(e & (~1));
5828 e_conv.is_owned = (e & 1) || (e == 0);
5829 e_conv = DecodeError_clone(&e_conv);
5830 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5831 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
5832 return (long)ret_conv;
5835 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
5836 if ((_res & 1) != 0) return;
5837 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
5839 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
5842 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
5843 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
5844 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5845 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
5846 return (long)ret_conv;
5849 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
5850 LDKCounterpartyChannelTransactionParameters o_conv;
5851 o_conv.inner = (void*)(o & (~1));
5852 o_conv.is_owned = (o & 1) || (o == 0);
5853 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
5854 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5855 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
5856 return (long)ret_conv;
5859 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
5860 LDKDecodeError e_conv;
5861 e_conv.inner = (void*)(e & (~1));
5862 e_conv.is_owned = (e & 1) || (e == 0);
5863 e_conv = DecodeError_clone(&e_conv);
5864 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5865 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
5866 return (long)ret_conv;
5869 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
5870 if ((_res & 1) != 0) return;
5871 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
5873 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
5876 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
5877 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
5878 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5879 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
5880 return (long)ret_conv;
5883 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
5884 LDKChannelTransactionParameters o_conv;
5885 o_conv.inner = (void*)(o & (~1));
5886 o_conv.is_owned = (o & 1) || (o == 0);
5887 o_conv = ChannelTransactionParameters_clone(&o_conv);
5888 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5889 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
5890 return (long)ret_conv;
5893 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
5894 LDKDecodeError e_conv;
5895 e_conv.inner = (void*)(e & (~1));
5896 e_conv.is_owned = (e & 1) || (e == 0);
5897 e_conv = DecodeError_clone(&e_conv);
5898 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5899 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
5900 return (long)ret_conv;
5903 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
5904 if ((_res & 1) != 0) return;
5905 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
5907 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
5910 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
5911 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
5912 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5913 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
5914 return (long)ret_conv;
5917 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
5918 LDKCVec_SignatureZ _res_constr;
5919 _res_constr.datalen = *((uint32_t*)_res);
5920 if (_res_constr.datalen > 0)
5921 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5923 _res_constr.data = NULL;
5924 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
5925 for (size_t m = 0; m < _res_constr.datalen; m++) {
5926 int8_tArray _res_conv_12 = _res_vals[m];
5927 LDKSignature _res_conv_12_ref;
5928 CHECK(*((uint32_t*)_res_conv_12) == 64);
5929 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
5930 _res_constr.data[m] = _res_conv_12_ref;
5932 CVec_SignatureZ_free(_res_constr);
5935 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5936 LDKHolderCommitmentTransaction o_conv;
5937 o_conv.inner = (void*)(o & (~1));
5938 o_conv.is_owned = (o & 1) || (o == 0);
5939 o_conv = HolderCommitmentTransaction_clone(&o_conv);
5940 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5941 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
5942 return (long)ret_conv;
5945 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5946 LDKDecodeError e_conv;
5947 e_conv.inner = (void*)(e & (~1));
5948 e_conv.is_owned = (e & 1) || (e == 0);
5949 e_conv = DecodeError_clone(&e_conv);
5950 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5951 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
5952 return (long)ret_conv;
5955 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5956 if ((_res & 1) != 0) return;
5957 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5959 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
5962 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5963 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
5964 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5965 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
5966 return (long)ret_conv;
5969 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5970 LDKBuiltCommitmentTransaction o_conv;
5971 o_conv.inner = (void*)(o & (~1));
5972 o_conv.is_owned = (o & 1) || (o == 0);
5973 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
5974 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5975 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
5976 return (long)ret_conv;
5979 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5980 LDKDecodeError e_conv;
5981 e_conv.inner = (void*)(e & (~1));
5982 e_conv.is_owned = (e & 1) || (e == 0);
5983 e_conv = DecodeError_clone(&e_conv);
5984 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5985 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
5986 return (long)ret_conv;
5989 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5990 if ((_res & 1) != 0) return;
5991 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5993 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
5996 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5997 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
5998 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5999 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6000 return (long)ret_conv;
6003 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
6004 LDKCommitmentTransaction o_conv;
6005 o_conv.inner = (void*)(o & (~1));
6006 o_conv.is_owned = (o & 1) || (o == 0);
6007 o_conv = CommitmentTransaction_clone(&o_conv);
6008 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6009 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
6010 return (long)ret_conv;
6013 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
6014 LDKDecodeError e_conv;
6015 e_conv.inner = (void*)(e & (~1));
6016 e_conv.is_owned = (e & 1) || (e == 0);
6017 e_conv = DecodeError_clone(&e_conv);
6018 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6019 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
6020 return (long)ret_conv;
6023 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
6024 if ((_res & 1) != 0) return;
6025 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6027 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
6030 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
6031 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
6032 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6033 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
6034 return (long)ret_conv;
6037 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
6038 LDKTrustedCommitmentTransaction o_conv;
6039 o_conv.inner = (void*)(o & (~1));
6040 o_conv.is_owned = (o & 1) || (o == 0);
6041 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
6042 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6043 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
6044 return (long)ret_conv;
6047 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
6048 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6049 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
6050 return (long)ret_conv;
6053 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
6054 if ((_res & 1) != 0) return;
6055 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
6057 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
6060 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
6061 LDKCVec_SignatureZ o_constr;
6062 o_constr.datalen = *((uint32_t*)o);
6063 if (o_constr.datalen > 0)
6064 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6066 o_constr.data = NULL;
6067 int8_tArray* o_vals = (int8_tArray*)(o + 4);
6068 for (size_t m = 0; m < o_constr.datalen; m++) {
6069 int8_tArray o_conv_12 = o_vals[m];
6070 LDKSignature o_conv_12_ref;
6071 CHECK(*((uint32_t*)o_conv_12) == 64);
6072 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
6073 o_constr.data[m] = o_conv_12_ref;
6075 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6076 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
6077 return (long)ret_conv;
6080 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
6081 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6082 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
6083 return (long)ret_conv;
6086 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
6087 if ((_res & 1) != 0) return;
6088 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
6090 CResult_CVec_SignatureZNoneZ_free(_res_conv);
6093 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
6094 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
6095 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6096 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
6097 return (long)ret_conv;
6100 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
6101 LDKChannelMonitorUpdate o_conv;
6102 o_conv.inner = (void*)(o & (~1));
6103 o_conv.is_owned = (o & 1) || (o == 0);
6104 o_conv = ChannelMonitorUpdate_clone(&o_conv);
6105 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6106 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
6107 return (long)ret_conv;
6110 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
6111 LDKDecodeError e_conv;
6112 e_conv.inner = (void*)(e & (~1));
6113 e_conv.is_owned = (e & 1) || (e == 0);
6114 e_conv = DecodeError_clone(&e_conv);
6115 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6116 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
6117 return (long)ret_conv;
6120 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
6121 if ((_res & 1) != 0) return;
6122 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
6124 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
6127 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
6128 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
6129 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6130 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
6131 return (long)ret_conv;
6134 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
6135 LDKHTLCUpdate o_conv;
6136 o_conv.inner = (void*)(o & (~1));
6137 o_conv.is_owned = (o & 1) || (o == 0);
6138 o_conv = HTLCUpdate_clone(&o_conv);
6139 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6140 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
6141 return (long)ret_conv;
6144 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
6145 LDKDecodeError e_conv;
6146 e_conv.inner = (void*)(e & (~1));
6147 e_conv.is_owned = (e & 1) || (e == 0);
6148 e_conv = DecodeError_clone(&e_conv);
6149 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6150 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
6151 return (long)ret_conv;
6154 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
6155 if ((_res & 1) != 0) return;
6156 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
6158 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
6161 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
6162 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
6163 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6164 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
6165 return (long)ret_conv;
6168 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
6169 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6170 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
6171 return (long)ret_conv;
6174 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
6175 LDKMonitorUpdateError e_conv;
6176 e_conv.inner = (void*)(e & (~1));
6177 e_conv.is_owned = (e & 1) || (e == 0);
6178 e_conv = MonitorUpdateError_clone(&e_conv);
6179 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6180 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
6181 return (long)ret_conv;
6184 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
6185 if ((_res & 1) != 0) return;
6186 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
6188 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
6191 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
6192 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
6193 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6194 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
6195 return (long)ret_conv;
6198 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
6200 a_conv.inner = (void*)(a & (~1));
6201 a_conv.is_owned = (a & 1) || (a == 0);
6202 a_conv = OutPoint_clone(&a_conv);
6204 b_ref.datalen = *((uint32_t*)b);
6205 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
6206 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6207 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6208 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
6209 return (long)ret_ref;
6212 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
6213 if ((_res & 1) != 0) return;
6214 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
6216 C2Tuple_OutPointScriptZ_free(_res_conv);
6219 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
6221 b_ref.datalen = *((uint32_t*)b);
6222 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
6223 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6224 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6225 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
6226 return (long)ret_ref;
6229 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
6230 if ((_res & 1) != 0) return;
6231 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
6233 C2Tuple_u32ScriptZ_free(_res_conv);
6236 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
6237 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
6238 _res_constr.datalen = *((uint32_t*)_res);
6239 if (_res_constr.datalen > 0)
6240 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
6242 _res_constr.data = NULL;
6243 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6244 for (size_t e = 0; e < _res_constr.datalen; e++) {
6245 uint32_t _res_conv_30 = _res_vals[e];
6246 LDKC2Tuple_u32ScriptZ _res_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_30) & ~1);
6247 FREE((void*)_res_conv_30);
6248 _res_constr.data[e] = _res_conv_30_conv;
6250 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
6253 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
6254 LDKThirtyTwoBytes a_ref;
6255 CHECK(*((uint32_t*)a) == 32);
6256 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6257 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
6258 b_constr.datalen = *((uint32_t*)b);
6259 if (b_constr.datalen > 0)
6260 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
6262 b_constr.data = NULL;
6263 uint32_t* b_vals = (uint32_t*)(b + 4);
6264 for (size_t e = 0; e < b_constr.datalen; e++) {
6265 uint32_t b_conv_30 = b_vals[e];
6266 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
6267 // Warning: we may need a move here but no clone is available for LDKC2Tuple_u32ScriptZ
6268 b_constr.data[e] = b_conv_30_conv;
6270 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
6271 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
6272 return (long)ret_ref;
6275 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
6276 if ((_res & 1) != 0) return;
6277 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
6279 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
6282 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
6283 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
6284 _res_constr.datalen = *((uint32_t*)_res);
6285 if (_res_constr.datalen > 0)
6286 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
6288 _res_constr.data = NULL;
6289 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6290 for (size_t c = 0; c < _res_constr.datalen; c++) {
6291 uint32_t _res_conv_54 = _res_vals[c];
6292 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_54_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_54) & ~1);
6293 FREE((void*)_res_conv_54);
6294 _res_constr.data[c] = _res_conv_54_conv;
6296 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
6299 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
6300 LDKCVec_MonitorEventZ _res_constr;
6301 _res_constr.datalen = *((uint32_t*)_res);
6302 if (_res_constr.datalen > 0)
6303 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
6305 _res_constr.data = NULL;
6306 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6307 for (size_t o = 0; o < _res_constr.datalen; o++) {
6308 uint32_t _res_conv_14 = _res_vals[o];
6309 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
6310 FREE((void*)_res_conv_14);
6311 _res_constr.data[o] = _res_conv_14_conv;
6313 CVec_MonitorEventZ_free(_res_constr);
6316 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
6317 LDKCVec_EventZ _res_constr;
6318 _res_constr.datalen = *((uint32_t*)_res);
6319 if (_res_constr.datalen > 0)
6320 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
6322 _res_constr.data = NULL;
6323 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6324 for (size_t h = 0; h < _res_constr.datalen; h++) {
6325 uint32_t _res_conv_7 = _res_vals[h];
6326 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
6327 FREE((void*)_res_conv_7);
6328 _res_constr.data[h] = _res_conv_7_conv;
6330 CVec_EventZ_free(_res_constr);
6333 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
6334 LDKCVec_TransactionZ _res_constr;
6335 _res_constr.datalen = *((uint32_t*)_res);
6336 if (_res_constr.datalen > 0)
6337 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
6339 _res_constr.data = NULL;
6340 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
6341 for (size_t m = 0; m < _res_constr.datalen; m++) {
6342 int8_tArray _res_conv_12 = _res_vals[m];
6343 LDKTransaction _res_conv_12_ref;
6344 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
6345 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
6346 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
6347 _res_conv_12_ref.data_is_owned = true;
6348 _res_constr.data[m] = _res_conv_12_ref;
6350 CVec_TransactionZ_free(_res_constr);
6353 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
6354 LDKTransaction b_ref;
6355 b_ref.datalen = *((uint32_t*)b);
6356 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
6357 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6358 b_ref.data_is_owned = true;
6359 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6360 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
6361 return (long)ret_ref;
6364 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
6365 if ((_res & 1) != 0) return;
6366 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
6368 C2Tuple_usizeTransactionZ_free(_res_conv);
6371 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
6372 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
6373 _res_constr.datalen = *((uint32_t*)_res);
6374 if (_res_constr.datalen > 0)
6375 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6377 _res_constr.data = NULL;
6378 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6379 for (size_t e = 0; e < _res_constr.datalen; e++) {
6380 uint32_t _res_conv_30 = _res_vals[e];
6381 LDKC2Tuple_usizeTransactionZ _res_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_30) & ~1);
6382 FREE((void*)_res_conv_30);
6383 _res_constr.data[e] = _res_conv_30_conv;
6385 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
6388 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
6389 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
6390 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6391 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
6392 return (long)ret_ref;
6395 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
6396 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
6398 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6399 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
6400 return (long)ret_ref;
6403 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
6404 if ((_res & 1) != 0) return;
6405 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
6407 C2Tuple_u32TxOutZ_free(_res_conv);
6410 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
6411 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
6412 _res_constr.datalen = *((uint32_t*)_res);
6413 if (_res_constr.datalen > 0)
6414 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
6416 _res_constr.data = NULL;
6417 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6418 for (size_t z = 0; z < _res_constr.datalen; z++) {
6419 uint32_t _res_conv_25 = _res_vals[z];
6420 LDKC2Tuple_u32TxOutZ _res_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_25) & ~1);
6421 FREE((void*)_res_conv_25);
6422 _res_constr.data[z] = _res_conv_25_conv;
6424 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
6427 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
6428 LDKThirtyTwoBytes a_ref;
6429 CHECK(*((uint32_t*)a) == 32);
6430 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6431 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
6432 b_constr.datalen = *((uint32_t*)b);
6433 if (b_constr.datalen > 0)
6434 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
6436 b_constr.data = NULL;
6437 uint32_t* b_vals = (uint32_t*)(b + 4);
6438 for (size_t z = 0; z < b_constr.datalen; z++) {
6439 uint32_t b_conv_25 = b_vals[z];
6440 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
6441 b_conv_25_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1));
6442 b_constr.data[z] = b_conv_25_conv;
6444 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
6445 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
6446 return (long)ret_ref;
6449 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
6450 if ((_res & 1) != 0) return;
6451 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
6453 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
6456 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
6457 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
6458 _res_constr.datalen = *((uint32_t*)_res);
6459 if (_res_constr.datalen > 0)
6460 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
6462 _res_constr.data = NULL;
6463 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6464 for (size_t x = 0; x < _res_constr.datalen; x++) {
6465 uint32_t _res_conv_49 = _res_vals[x];
6466 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_49) & ~1);
6467 FREE((void*)_res_conv_49);
6468 _res_constr.data[x] = _res_conv_49_conv;
6470 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
6473 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
6474 LDKCVec_TxidZ _res_constr;
6475 _res_constr.datalen = *((uint32_t*)_res);
6476 if (_res_constr.datalen > 0)
6477 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
6479 _res_constr.data = NULL;
6480 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
6481 for (size_t m = 0; m < _res_constr.datalen; m++) {
6482 int8_tArray _res_conv_12 = _res_vals[m];
6483 LDKThirtyTwoBytes _res_conv_12_ref;
6484 CHECK(*((uint32_t*)_res_conv_12) == 32);
6485 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), 32);
6486 _res_constr.data[m] = _res_conv_12_ref;
6488 CVec_TxidZ_free(_res_constr);
6491 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
6492 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6493 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
6494 return (long)ret_conv;
6497 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
6498 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
6499 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6500 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
6501 return (long)ret_conv;
6504 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
6505 if ((_res & 1) != 0) return;
6506 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
6508 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
6511 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
6512 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
6513 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6514 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
6515 return (long)ret_conv;
6518 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
6519 LDKThirtyTwoBytes a_ref;
6520 CHECK(*((uint32_t*)a) == 32);
6521 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6522 LDKChannelMonitor b_conv;
6523 b_conv.inner = (void*)(b & (~1));
6524 b_conv.is_owned = (b & 1) || (b == 0);
6525 b_conv = ChannelMonitor_clone(&b_conv);
6526 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6527 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
6528 return (long)ret_ref;
6531 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
6532 if ((_res & 1) != 0) return;
6533 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
6535 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
6538 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
6539 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
6541 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
6542 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
6543 return (long)ret_conv;
6546 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
6547 LDKDecodeError e_conv;
6548 e_conv.inner = (void*)(e & (~1));
6549 e_conv.is_owned = (e & 1) || (e == 0);
6550 e_conv = DecodeError_clone(&e_conv);
6551 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
6552 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
6553 return (long)ret_conv;
6556 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
6557 if ((_res & 1) != 0) return;
6558 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
6560 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
6563 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
6564 LDKCVec_RouteHopZ _res_constr;
6565 _res_constr.datalen = *((uint32_t*)_res);
6566 if (_res_constr.datalen > 0)
6567 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
6569 _res_constr.data = NULL;
6570 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6571 for (size_t k = 0; k < _res_constr.datalen; k++) {
6572 uint32_t _res_conv_10 = _res_vals[k];
6573 LDKRouteHop _res_conv_10_conv;
6574 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
6575 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
6576 _res_constr.data[k] = _res_conv_10_conv;
6578 CVec_RouteHopZ_free(_res_constr);
6581 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
6582 LDKCVec_CVec_RouteHopZZ _res_constr;
6583 _res_constr.datalen = *((uint32_t*)_res);
6584 if (_res_constr.datalen > 0)
6585 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
6587 _res_constr.data = NULL;
6588 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
6589 for (size_t m = 0; m < _res_constr.datalen; m++) {
6590 uint32_tArray _res_conv_12 = _res_vals[m];
6591 LDKCVec_RouteHopZ _res_conv_12_constr;
6592 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
6593 if (_res_conv_12_constr.datalen > 0)
6594 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
6596 _res_conv_12_constr.data = NULL;
6597 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
6598 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
6599 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
6600 LDKRouteHop _res_conv_12_conv_10_conv;
6601 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
6602 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
6603 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
6605 _res_constr.data[m] = _res_conv_12_constr;
6607 CVec_CVec_RouteHopZZ_free(_res_constr);
6610 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
6612 o_conv.inner = (void*)(o & (~1));
6613 o_conv.is_owned = (o & 1) || (o == 0);
6614 o_conv = Route_clone(&o_conv);
6615 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
6616 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
6617 return (long)ret_conv;
6620 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
6621 LDKDecodeError e_conv;
6622 e_conv.inner = (void*)(e & (~1));
6623 e_conv.is_owned = (e & 1) || (e == 0);
6624 e_conv = DecodeError_clone(&e_conv);
6625 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
6626 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
6627 return (long)ret_conv;
6630 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
6631 if ((_res & 1) != 0) return;
6632 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
6634 CResult_RouteDecodeErrorZ_free(_res_conv);
6637 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
6638 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
6639 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
6640 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
6641 return (long)ret_conv;
6644 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
6645 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
6646 *ret_copy = COption_u64Z_some(o);
6647 long ret_ref = (long)ret_copy;
6651 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
6652 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
6653 *ret_copy = COption_u64Z_none();
6654 long ret_ref = (long)ret_copy;
6658 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
6659 if ((_res & 1) != 0) return;
6660 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
6662 COption_u64Z_free(_res_conv);
6665 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
6666 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
6667 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
6668 *ret_copy = COption_u64Z_clone(orig_conv);
6669 long ret_ref = (long)ret_copy;
6673 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
6674 LDKCVec_ChannelDetailsZ _res_constr;
6675 _res_constr.datalen = *((uint32_t*)_res);
6676 if (_res_constr.datalen > 0)
6677 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6679 _res_constr.data = NULL;
6680 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6681 for (size_t q = 0; q < _res_constr.datalen; q++) {
6682 uint32_t _res_conv_16 = _res_vals[q];
6683 LDKChannelDetails _res_conv_16_conv;
6684 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
6685 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
6686 _res_constr.data[q] = _res_conv_16_conv;
6688 CVec_ChannelDetailsZ_free(_res_constr);
6691 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
6692 LDKCVec_RouteHintZ _res_constr;
6693 _res_constr.datalen = *((uint32_t*)_res);
6694 if (_res_constr.datalen > 0)
6695 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
6697 _res_constr.data = NULL;
6698 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6699 for (size_t l = 0; l < _res_constr.datalen; l++) {
6700 uint32_t _res_conv_11 = _res_vals[l];
6701 LDKRouteHint _res_conv_11_conv;
6702 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
6703 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
6704 _res_constr.data[l] = _res_conv_11_conv;
6706 CVec_RouteHintZ_free(_res_constr);
6709 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
6711 o_conv.inner = (void*)(o & (~1));
6712 o_conv.is_owned = (o & 1) || (o == 0);
6713 o_conv = Route_clone(&o_conv);
6714 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6715 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
6716 return (long)ret_conv;
6719 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
6720 LDKLightningError e_conv;
6721 e_conv.inner = (void*)(e & (~1));
6722 e_conv.is_owned = (e & 1) || (e == 0);
6723 e_conv = LightningError_clone(&e_conv);
6724 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6725 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
6726 return (long)ret_conv;
6729 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
6730 if ((_res & 1) != 0) return;
6731 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
6733 CResult_RouteLightningErrorZ_free(_res_conv);
6736 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
6737 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
6738 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6739 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
6740 return (long)ret_conv;
6743 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
6744 LDKCVec_MessageSendEventZ _res_constr;
6745 _res_constr.datalen = *((uint32_t*)_res);
6746 if (_res_constr.datalen > 0)
6747 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
6749 _res_constr.data = NULL;
6750 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6751 for (size_t s = 0; s < _res_constr.datalen; s++) {
6752 uint32_t _res_conv_18 = _res_vals[s];
6753 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
6754 FREE((void*)_res_conv_18);
6755 _res_constr.data[s] = _res_conv_18_conv;
6757 CVec_MessageSendEventZ_free(_res_constr);
6760 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
6761 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6762 *ret_conv = CResult_boolLightningErrorZ_ok(o);
6763 return (long)ret_conv;
6766 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
6767 LDKLightningError e_conv;
6768 e_conv.inner = (void*)(e & (~1));
6769 e_conv.is_owned = (e & 1) || (e == 0);
6770 e_conv = LightningError_clone(&e_conv);
6771 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6772 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
6773 return (long)ret_conv;
6776 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
6777 if ((_res & 1) != 0) return;
6778 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
6780 CResult_boolLightningErrorZ_free(_res_conv);
6783 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
6784 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
6785 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6786 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
6787 return (long)ret_conv;
6790 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
6791 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
6792 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6793 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
6794 return (long)ret_ref;
6797 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
6798 LDKChannelAnnouncement a_conv;
6799 a_conv.inner = (void*)(a & (~1));
6800 a_conv.is_owned = (a & 1) || (a == 0);
6801 a_conv = ChannelAnnouncement_clone(&a_conv);
6802 LDKChannelUpdate b_conv;
6803 b_conv.inner = (void*)(b & (~1));
6804 b_conv.is_owned = (b & 1) || (b == 0);
6805 b_conv = ChannelUpdate_clone(&b_conv);
6806 LDKChannelUpdate c_conv;
6807 c_conv.inner = (void*)(c & (~1));
6808 c_conv.is_owned = (c & 1) || (c == 0);
6809 c_conv = ChannelUpdate_clone(&c_conv);
6810 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6811 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
6812 return (long)ret_ref;
6815 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
6816 if ((_res & 1) != 0) return;
6817 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
6819 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
6822 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
6823 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
6824 _res_constr.datalen = *((uint32_t*)_res);
6825 if (_res_constr.datalen > 0)
6826 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6828 _res_constr.data = NULL;
6829 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6830 for (size_t l = 0; l < _res_constr.datalen; l++) {
6831 uint32_t _res_conv_63 = _res_vals[l];
6832 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
6833 FREE((void*)_res_conv_63);
6834 _res_constr.data[l] = _res_conv_63_conv;
6836 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
6839 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
6840 LDKCVec_NodeAnnouncementZ _res_constr;
6841 _res_constr.datalen = *((uint32_t*)_res);
6842 if (_res_constr.datalen > 0)
6843 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6845 _res_constr.data = NULL;
6846 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6847 for (size_t s = 0; s < _res_constr.datalen; s++) {
6848 uint32_t _res_conv_18 = _res_vals[s];
6849 LDKNodeAnnouncement _res_conv_18_conv;
6850 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
6851 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
6852 _res_constr.data[s] = _res_conv_18_conv;
6854 CVec_NodeAnnouncementZ_free(_res_constr);
6857 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
6858 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6859 *ret_conv = CResult_NoneLightningErrorZ_ok();
6860 return (long)ret_conv;
6863 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
6864 LDKLightningError e_conv;
6865 e_conv.inner = (void*)(e & (~1));
6866 e_conv.is_owned = (e & 1) || (e == 0);
6867 e_conv = LightningError_clone(&e_conv);
6868 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6869 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
6870 return (long)ret_conv;
6873 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
6874 if ((_res & 1) != 0) return;
6875 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
6877 CResult_NoneLightningErrorZ_free(_res_conv);
6880 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
6881 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
6882 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6883 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
6884 return (long)ret_conv;
6887 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
6888 LDKCVec_PublicKeyZ _res_constr;
6889 _res_constr.datalen = *((uint32_t*)_res);
6890 if (_res_constr.datalen > 0)
6891 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
6893 _res_constr.data = NULL;
6894 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
6895 for (size_t m = 0; m < _res_constr.datalen; m++) {
6896 int8_tArray _res_conv_12 = _res_vals[m];
6897 LDKPublicKey _res_conv_12_ref;
6898 CHECK(*((uint32_t*)_res_conv_12) == 33);
6899 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
6900 _res_constr.data[m] = _res_conv_12_ref;
6902 CVec_PublicKeyZ_free(_res_constr);
6905 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
6906 LDKCVec_u8Z _res_ref;
6907 _res_ref.datalen = *((uint32_t*)_res);
6908 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
6909 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
6910 CVec_u8Z_free(_res_ref);
6913 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
6915 o_ref.datalen = *((uint32_t*)o);
6916 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
6917 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
6918 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6919 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
6920 return (long)ret_conv;
6923 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
6924 LDKPeerHandleError e_conv;
6925 e_conv.inner = (void*)(e & (~1));
6926 e_conv.is_owned = (e & 1) || (e == 0);
6927 e_conv = PeerHandleError_clone(&e_conv);
6928 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6929 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
6930 return (long)ret_conv;
6933 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
6934 if ((_res & 1) != 0) return;
6935 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6937 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
6940 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
6941 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
6942 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6943 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
6944 return (long)ret_conv;
6947 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
6948 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6949 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
6950 return (long)ret_conv;
6953 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
6954 LDKPeerHandleError e_conv;
6955 e_conv.inner = (void*)(e & (~1));
6956 e_conv.is_owned = (e & 1) || (e == 0);
6957 e_conv = PeerHandleError_clone(&e_conv);
6958 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6959 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
6960 return (long)ret_conv;
6963 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
6964 if ((_res & 1) != 0) return;
6965 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6967 CResult_NonePeerHandleErrorZ_free(_res_conv);
6970 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
6971 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
6972 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6973 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
6974 return (long)ret_conv;
6977 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
6978 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6979 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
6980 return (long)ret_conv;
6983 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
6984 LDKPeerHandleError e_conv;
6985 e_conv.inner = (void*)(e & (~1));
6986 e_conv.is_owned = (e & 1) || (e == 0);
6987 e_conv = PeerHandleError_clone(&e_conv);
6988 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6989 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
6990 return (long)ret_conv;
6993 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
6994 if ((_res & 1) != 0) return;
6995 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6997 CResult_boolPeerHandleErrorZ_free(_res_conv);
7000 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
7001 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
7002 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
7003 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
7004 return (long)ret_conv;
7007 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
7008 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
7010 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7011 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
7012 return (long)ret_conv;
7015 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
7016 LDKAccessError e_conv = LDKAccessError_from_js(e);
7017 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7018 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
7019 return (long)ret_conv;
7022 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
7023 if ((_res & 1) != 0) return;
7024 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
7026 CResult_TxOutAccessErrorZ_free(_res_conv);
7029 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
7030 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
7031 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7032 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
7033 return (long)ret_conv;
7036 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
7037 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
7039 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7040 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
7041 long ret_ref = (long)ret_copy;
7045 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
7046 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7047 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
7048 long ret_ref = (long)ret_copy;
7052 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
7053 if ((_res & 1) != 0) return;
7054 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
7056 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
7059 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
7060 LDKCVec_SpendableOutputDescriptorZ _res_constr;
7061 _res_constr.datalen = *((uint32_t*)_res);
7062 if (_res_constr.datalen > 0)
7063 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
7065 _res_constr.data = NULL;
7066 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7067 for (size_t b = 0; b < _res_constr.datalen; b++) {
7068 uint32_t _res_conv_27 = _res_vals[b];
7069 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
7070 FREE((void*)_res_conv_27);
7071 _res_constr.data[b] = _res_conv_27_conv;
7073 CVec_SpendableOutputDescriptorZ_free(_res_constr);
7076 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
7077 LDKDirectionalChannelInfo o_conv;
7078 o_conv.inner = (void*)(o & (~1));
7079 o_conv.is_owned = (o & 1) || (o == 0);
7080 o_conv = DirectionalChannelInfo_clone(&o_conv);
7081 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7082 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
7083 return (long)ret_conv;
7086 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
7087 LDKDecodeError e_conv;
7088 e_conv.inner = (void*)(e & (~1));
7089 e_conv.is_owned = (e & 1) || (e == 0);
7090 e_conv = DecodeError_clone(&e_conv);
7091 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7092 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
7093 return (long)ret_conv;
7096 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
7097 if ((_res & 1) != 0) return;
7098 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7100 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
7103 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
7104 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
7105 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7106 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
7107 return (long)ret_conv;
7110 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
7111 LDKChannelInfo o_conv;
7112 o_conv.inner = (void*)(o & (~1));
7113 o_conv.is_owned = (o & 1) || (o == 0);
7114 o_conv = ChannelInfo_clone(&o_conv);
7115 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7116 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
7117 return (long)ret_conv;
7120 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
7121 LDKDecodeError e_conv;
7122 e_conv.inner = (void*)(e & (~1));
7123 e_conv.is_owned = (e & 1) || (e == 0);
7124 e_conv = DecodeError_clone(&e_conv);
7125 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7126 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
7127 return (long)ret_conv;
7130 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
7131 if ((_res & 1) != 0) return;
7132 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7134 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
7137 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
7138 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
7139 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7140 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
7141 return (long)ret_conv;
7144 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
7145 LDKRoutingFees o_conv;
7146 o_conv.inner = (void*)(o & (~1));
7147 o_conv.is_owned = (o & 1) || (o == 0);
7148 o_conv = RoutingFees_clone(&o_conv);
7149 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7150 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
7151 return (long)ret_conv;
7154 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
7155 LDKDecodeError e_conv;
7156 e_conv.inner = (void*)(e & (~1));
7157 e_conv.is_owned = (e & 1) || (e == 0);
7158 e_conv = DecodeError_clone(&e_conv);
7159 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7160 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
7161 return (long)ret_conv;
7164 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
7165 if ((_res & 1) != 0) return;
7166 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7168 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
7171 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
7172 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
7173 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7174 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
7175 return (long)ret_conv;
7178 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
7179 LDKCVec_NetAddressZ _res_constr;
7180 _res_constr.datalen = *((uint32_t*)_res);
7181 if (_res_constr.datalen > 0)
7182 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
7184 _res_constr.data = NULL;
7185 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7186 for (size_t m = 0; m < _res_constr.datalen; m++) {
7187 uint32_t _res_conv_12 = _res_vals[m];
7188 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
7189 FREE((void*)_res_conv_12);
7190 _res_constr.data[m] = _res_conv_12_conv;
7192 CVec_NetAddressZ_free(_res_constr);
7195 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
7196 LDKNodeAnnouncementInfo o_conv;
7197 o_conv.inner = (void*)(o & (~1));
7198 o_conv.is_owned = (o & 1) || (o == 0);
7199 o_conv = NodeAnnouncementInfo_clone(&o_conv);
7200 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7201 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
7202 return (long)ret_conv;
7205 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
7206 LDKDecodeError e_conv;
7207 e_conv.inner = (void*)(e & (~1));
7208 e_conv.is_owned = (e & 1) || (e == 0);
7209 e_conv = DecodeError_clone(&e_conv);
7210 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7211 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
7212 return (long)ret_conv;
7215 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
7216 if ((_res & 1) != 0) return;
7217 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7219 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
7222 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
7223 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
7224 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7225 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
7226 return (long)ret_conv;
7229 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
7230 LDKCVec_u64Z _res_constr;
7231 _res_constr.datalen = *((uint32_t*)_res);
7232 if (_res_constr.datalen > 0)
7233 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
7235 _res_constr.data = NULL;
7236 int64_t* _res_vals = (int64_t*)(_res + 4);
7237 for (size_t i = 0; i < _res_constr.datalen; i++) {
7238 int64_t _res_conv_8 = _res_vals[i];
7239 _res_constr.data[i] = _res_conv_8;
7241 CVec_u64Z_free(_res_constr);
7244 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
7246 o_conv.inner = (void*)(o & (~1));
7247 o_conv.is_owned = (o & 1) || (o == 0);
7248 o_conv = NodeInfo_clone(&o_conv);
7249 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7250 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
7251 return (long)ret_conv;
7254 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
7255 LDKDecodeError e_conv;
7256 e_conv.inner = (void*)(e & (~1));
7257 e_conv.is_owned = (e & 1) || (e == 0);
7258 e_conv = DecodeError_clone(&e_conv);
7259 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7260 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
7261 return (long)ret_conv;
7264 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
7265 if ((_res & 1) != 0) return;
7266 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7268 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
7271 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
7272 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
7273 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7274 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
7275 return (long)ret_conv;
7278 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
7279 LDKNetworkGraph o_conv;
7280 o_conv.inner = (void*)(o & (~1));
7281 o_conv.is_owned = (o & 1) || (o == 0);
7282 o_conv = NetworkGraph_clone(&o_conv);
7283 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7284 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
7285 return (long)ret_conv;
7288 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
7289 LDKDecodeError e_conv;
7290 e_conv.inner = (void*)(e & (~1));
7291 e_conv.is_owned = (e & 1) || (e == 0);
7292 e_conv = DecodeError_clone(&e_conv);
7293 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7294 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
7295 return (long)ret_conv;
7298 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
7299 if ((_res & 1) != 0) return;
7300 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
7302 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
7305 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
7306 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
7307 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7308 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
7309 return (long)ret_conv;
7312 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
7313 LDKInitFeatures o_conv;
7314 o_conv.inner = (void*)(o & (~1));
7315 o_conv.is_owned = (o & 1) || (o == 0);
7316 o_conv = InitFeatures_clone(&o_conv);
7317 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
7318 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
7319 return (long)ret_conv;
7322 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
7323 LDKDecodeError e_conv;
7324 e_conv.inner = (void*)(e & (~1));
7325 e_conv.is_owned = (e & 1) || (e == 0);
7326 e_conv = DecodeError_clone(&e_conv);
7327 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
7328 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
7329 return (long)ret_conv;
7332 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
7333 if ((_res & 1) != 0) return;
7334 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7336 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
7339 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
7340 LDKNodeFeatures o_conv;
7341 o_conv.inner = (void*)(o & (~1));
7342 o_conv.is_owned = (o & 1) || (o == 0);
7343 o_conv = NodeFeatures_clone(&o_conv);
7344 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
7345 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
7346 return (long)ret_conv;
7349 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
7350 LDKDecodeError e_conv;
7351 e_conv.inner = (void*)(e & (~1));
7352 e_conv.is_owned = (e & 1) || (e == 0);
7353 e_conv = DecodeError_clone(&e_conv);
7354 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
7355 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
7356 return (long)ret_conv;
7359 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
7360 if ((_res & 1) != 0) return;
7361 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7363 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
7366 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
7367 LDKChannelFeatures o_conv;
7368 o_conv.inner = (void*)(o & (~1));
7369 o_conv.is_owned = (o & 1) || (o == 0);
7370 o_conv = ChannelFeatures_clone(&o_conv);
7371 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7372 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
7373 return (long)ret_conv;
7376 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
7377 LDKDecodeError e_conv;
7378 e_conv.inner = (void*)(e & (~1));
7379 e_conv.is_owned = (e & 1) || (e == 0);
7380 e_conv = DecodeError_clone(&e_conv);
7381 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7382 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
7383 return (long)ret_conv;
7386 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
7387 if ((_res & 1) != 0) return;
7388 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7390 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
7393 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
7394 LDKInvoiceFeatures o_conv;
7395 o_conv.inner = (void*)(o & (~1));
7396 o_conv.is_owned = (o & 1) || (o == 0);
7397 o_conv = InvoiceFeatures_clone(&o_conv);
7398 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
7399 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
7400 return (long)ret_conv;
7403 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
7404 LDKDecodeError e_conv;
7405 e_conv.inner = (void*)(e & (~1));
7406 e_conv.is_owned = (e & 1) || (e == 0);
7407 e_conv = DecodeError_clone(&e_conv);
7408 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
7409 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
7410 return (long)ret_conv;
7413 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
7414 if ((_res & 1) != 0) return;
7415 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7417 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
7420 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
7421 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
7423 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7424 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
7425 return (long)ret_conv;
7428 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_err(int8_t e) {
7429 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7430 *ret_conv = CResult_NetAddressu8Z_err(e);
7431 return (long)ret_conv;
7434 void __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_free(uint32_t _res) {
7435 if ((_res & 1) != 0) return;
7436 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
7438 CResult_NetAddressu8Z_free(_res_conv);
7441 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_clone(uint32_t orig) {
7442 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
7443 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7444 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
7445 return (long)ret_conv;
7448 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
7449 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
7451 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7452 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
7453 return (long)ret_conv;
7456 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_err(uint32_t e) {
7457 LDKDecodeError e_conv;
7458 e_conv.inner = (void*)(e & (~1));
7459 e_conv.is_owned = (e & 1) || (e == 0);
7460 e_conv = DecodeError_clone(&e_conv);
7461 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7462 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
7463 return (long)ret_conv;
7466 void __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_free(uint32_t _res) {
7467 if ((_res & 1) != 0) return;
7468 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
7470 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
7473 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(uint32_t orig) {
7474 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
7475 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7476 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
7477 return (long)ret_conv;
7480 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
7481 LDKCVec_UpdateAddHTLCZ _res_constr;
7482 _res_constr.datalen = *((uint32_t*)_res);
7483 if (_res_constr.datalen > 0)
7484 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
7486 _res_constr.data = NULL;
7487 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7488 for (size_t p = 0; p < _res_constr.datalen; p++) {
7489 uint32_t _res_conv_15 = _res_vals[p];
7490 LDKUpdateAddHTLC _res_conv_15_conv;
7491 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
7492 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
7493 _res_constr.data[p] = _res_conv_15_conv;
7495 CVec_UpdateAddHTLCZ_free(_res_constr);
7498 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
7499 LDKCVec_UpdateFulfillHTLCZ _res_constr;
7500 _res_constr.datalen = *((uint32_t*)_res);
7501 if (_res_constr.datalen > 0)
7502 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
7504 _res_constr.data = NULL;
7505 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7506 for (size_t t = 0; t < _res_constr.datalen; t++) {
7507 uint32_t _res_conv_19 = _res_vals[t];
7508 LDKUpdateFulfillHTLC _res_conv_19_conv;
7509 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
7510 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
7511 _res_constr.data[t] = _res_conv_19_conv;
7513 CVec_UpdateFulfillHTLCZ_free(_res_constr);
7516 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
7517 LDKCVec_UpdateFailHTLCZ _res_constr;
7518 _res_constr.datalen = *((uint32_t*)_res);
7519 if (_res_constr.datalen > 0)
7520 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
7522 _res_constr.data = NULL;
7523 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7524 for (size_t q = 0; q < _res_constr.datalen; q++) {
7525 uint32_t _res_conv_16 = _res_vals[q];
7526 LDKUpdateFailHTLC _res_conv_16_conv;
7527 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7528 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7529 _res_constr.data[q] = _res_conv_16_conv;
7531 CVec_UpdateFailHTLCZ_free(_res_constr);
7534 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
7535 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
7536 _res_constr.datalen = *((uint32_t*)_res);
7537 if (_res_constr.datalen > 0)
7538 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
7540 _res_constr.data = NULL;
7541 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7542 for (size_t z = 0; z < _res_constr.datalen; z++) {
7543 uint32_t _res_conv_25 = _res_vals[z];
7544 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
7545 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
7546 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
7547 _res_constr.data[z] = _res_conv_25_conv;
7549 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
7552 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
7553 LDKAcceptChannel o_conv;
7554 o_conv.inner = (void*)(o & (~1));
7555 o_conv.is_owned = (o & 1) || (o == 0);
7556 o_conv = AcceptChannel_clone(&o_conv);
7557 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7558 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
7559 return (long)ret_conv;
7562 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
7563 LDKDecodeError e_conv;
7564 e_conv.inner = (void*)(e & (~1));
7565 e_conv.is_owned = (e & 1) || (e == 0);
7566 e_conv = DecodeError_clone(&e_conv);
7567 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7568 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
7569 return (long)ret_conv;
7572 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
7573 if ((_res & 1) != 0) return;
7574 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
7576 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
7579 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
7580 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
7581 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7582 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
7583 return (long)ret_conv;
7586 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
7587 LDKAnnouncementSignatures o_conv;
7588 o_conv.inner = (void*)(o & (~1));
7589 o_conv.is_owned = (o & 1) || (o == 0);
7590 o_conv = AnnouncementSignatures_clone(&o_conv);
7591 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7592 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
7593 return (long)ret_conv;
7596 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
7597 LDKDecodeError e_conv;
7598 e_conv.inner = (void*)(e & (~1));
7599 e_conv.is_owned = (e & 1) || (e == 0);
7600 e_conv = DecodeError_clone(&e_conv);
7601 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7602 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
7603 return (long)ret_conv;
7606 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
7607 if ((_res & 1) != 0) return;
7608 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7610 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
7613 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
7614 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
7615 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7616 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
7617 return (long)ret_conv;
7620 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
7621 LDKChannelReestablish o_conv;
7622 o_conv.inner = (void*)(o & (~1));
7623 o_conv.is_owned = (o & 1) || (o == 0);
7624 o_conv = ChannelReestablish_clone(&o_conv);
7625 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7626 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
7627 return (long)ret_conv;
7630 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
7631 LDKDecodeError e_conv;
7632 e_conv.inner = (void*)(e & (~1));
7633 e_conv.is_owned = (e & 1) || (e == 0);
7634 e_conv = DecodeError_clone(&e_conv);
7635 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7636 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
7637 return (long)ret_conv;
7640 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
7641 if ((_res & 1) != 0) return;
7642 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
7644 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
7647 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
7648 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
7649 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7650 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
7651 return (long)ret_conv;
7654 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
7655 LDKClosingSigned o_conv;
7656 o_conv.inner = (void*)(o & (~1));
7657 o_conv.is_owned = (o & 1) || (o == 0);
7658 o_conv = ClosingSigned_clone(&o_conv);
7659 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7660 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
7661 return (long)ret_conv;
7664 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
7665 LDKDecodeError e_conv;
7666 e_conv.inner = (void*)(e & (~1));
7667 e_conv.is_owned = (e & 1) || (e == 0);
7668 e_conv = DecodeError_clone(&e_conv);
7669 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7670 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
7671 return (long)ret_conv;
7674 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
7675 if ((_res & 1) != 0) return;
7676 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7678 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
7681 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
7682 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
7683 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7684 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
7685 return (long)ret_conv;
7688 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
7689 LDKCommitmentSigned o_conv;
7690 o_conv.inner = (void*)(o & (~1));
7691 o_conv.is_owned = (o & 1) || (o == 0);
7692 o_conv = CommitmentSigned_clone(&o_conv);
7693 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7694 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
7695 return (long)ret_conv;
7698 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
7699 LDKDecodeError e_conv;
7700 e_conv.inner = (void*)(e & (~1));
7701 e_conv.is_owned = (e & 1) || (e == 0);
7702 e_conv = DecodeError_clone(&e_conv);
7703 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7704 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
7705 return (long)ret_conv;
7708 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
7709 if ((_res & 1) != 0) return;
7710 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7712 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
7715 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
7716 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
7717 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7718 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
7719 return (long)ret_conv;
7722 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
7723 LDKFundingCreated o_conv;
7724 o_conv.inner = (void*)(o & (~1));
7725 o_conv.is_owned = (o & 1) || (o == 0);
7726 o_conv = FundingCreated_clone(&o_conv);
7727 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7728 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
7729 return (long)ret_conv;
7732 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
7733 LDKDecodeError e_conv;
7734 e_conv.inner = (void*)(e & (~1));
7735 e_conv.is_owned = (e & 1) || (e == 0);
7736 e_conv = DecodeError_clone(&e_conv);
7737 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7738 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
7739 return (long)ret_conv;
7742 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
7743 if ((_res & 1) != 0) return;
7744 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7746 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
7749 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
7750 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
7751 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7752 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
7753 return (long)ret_conv;
7756 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
7757 LDKFundingSigned o_conv;
7758 o_conv.inner = (void*)(o & (~1));
7759 o_conv.is_owned = (o & 1) || (o == 0);
7760 o_conv = FundingSigned_clone(&o_conv);
7761 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7762 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
7763 return (long)ret_conv;
7766 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
7767 LDKDecodeError e_conv;
7768 e_conv.inner = (void*)(e & (~1));
7769 e_conv.is_owned = (e & 1) || (e == 0);
7770 e_conv = DecodeError_clone(&e_conv);
7771 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7772 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
7773 return (long)ret_conv;
7776 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
7777 if ((_res & 1) != 0) return;
7778 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7780 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
7783 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
7784 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
7785 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7786 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
7787 return (long)ret_conv;
7790 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
7791 LDKFundingLocked o_conv;
7792 o_conv.inner = (void*)(o & (~1));
7793 o_conv.is_owned = (o & 1) || (o == 0);
7794 o_conv = FundingLocked_clone(&o_conv);
7795 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7796 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
7797 return (long)ret_conv;
7800 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
7801 LDKDecodeError e_conv;
7802 e_conv.inner = (void*)(e & (~1));
7803 e_conv.is_owned = (e & 1) || (e == 0);
7804 e_conv = DecodeError_clone(&e_conv);
7805 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7806 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
7807 return (long)ret_conv;
7810 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
7811 if ((_res & 1) != 0) return;
7812 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7814 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
7817 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
7818 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
7819 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7820 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
7821 return (long)ret_conv;
7824 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
7826 o_conv.inner = (void*)(o & (~1));
7827 o_conv.is_owned = (o & 1) || (o == 0);
7828 o_conv = Init_clone(&o_conv);
7829 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7830 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
7831 return (long)ret_conv;
7834 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
7835 LDKDecodeError e_conv;
7836 e_conv.inner = (void*)(e & (~1));
7837 e_conv.is_owned = (e & 1) || (e == 0);
7838 e_conv = DecodeError_clone(&e_conv);
7839 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7840 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
7841 return (long)ret_conv;
7844 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
7845 if ((_res & 1) != 0) return;
7846 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
7848 CResult_InitDecodeErrorZ_free(_res_conv);
7851 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
7852 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
7853 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7854 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
7855 return (long)ret_conv;
7858 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
7859 LDKOpenChannel o_conv;
7860 o_conv.inner = (void*)(o & (~1));
7861 o_conv.is_owned = (o & 1) || (o == 0);
7862 o_conv = OpenChannel_clone(&o_conv);
7863 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
7864 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
7865 return (long)ret_conv;
7868 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
7869 LDKDecodeError e_conv;
7870 e_conv.inner = (void*)(e & (~1));
7871 e_conv.is_owned = (e & 1) || (e == 0);
7872 e_conv = DecodeError_clone(&e_conv);
7873 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
7874 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
7875 return (long)ret_conv;
7878 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
7879 if ((_res & 1) != 0) return;
7880 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
7882 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
7885 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
7886 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
7887 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
7888 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
7889 return (long)ret_conv;
7892 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
7893 LDKRevokeAndACK o_conv;
7894 o_conv.inner = (void*)(o & (~1));
7895 o_conv.is_owned = (o & 1) || (o == 0);
7896 o_conv = RevokeAndACK_clone(&o_conv);
7897 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
7898 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
7899 return (long)ret_conv;
7902 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
7903 LDKDecodeError e_conv;
7904 e_conv.inner = (void*)(e & (~1));
7905 e_conv.is_owned = (e & 1) || (e == 0);
7906 e_conv = DecodeError_clone(&e_conv);
7907 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
7908 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
7909 return (long)ret_conv;
7912 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
7913 if ((_res & 1) != 0) return;
7914 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
7916 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
7919 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
7920 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
7921 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
7922 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
7923 return (long)ret_conv;
7926 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
7928 o_conv.inner = (void*)(o & (~1));
7929 o_conv.is_owned = (o & 1) || (o == 0);
7930 o_conv = Shutdown_clone(&o_conv);
7931 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
7932 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
7933 return (long)ret_conv;
7936 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
7937 LDKDecodeError e_conv;
7938 e_conv.inner = (void*)(e & (~1));
7939 e_conv.is_owned = (e & 1) || (e == 0);
7940 e_conv = DecodeError_clone(&e_conv);
7941 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
7942 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
7943 return (long)ret_conv;
7946 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
7947 if ((_res & 1) != 0) return;
7948 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
7950 CResult_ShutdownDecodeErrorZ_free(_res_conv);
7953 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
7954 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
7955 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
7956 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
7957 return (long)ret_conv;
7960 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
7961 LDKUpdateFailHTLC o_conv;
7962 o_conv.inner = (void*)(o & (~1));
7963 o_conv.is_owned = (o & 1) || (o == 0);
7964 o_conv = UpdateFailHTLC_clone(&o_conv);
7965 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
7966 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
7967 return (long)ret_conv;
7970 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
7971 LDKDecodeError e_conv;
7972 e_conv.inner = (void*)(e & (~1));
7973 e_conv.is_owned = (e & 1) || (e == 0);
7974 e_conv = DecodeError_clone(&e_conv);
7975 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
7976 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
7977 return (long)ret_conv;
7980 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
7981 if ((_res & 1) != 0) return;
7982 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
7984 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
7987 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
7988 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
7989 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
7990 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
7991 return (long)ret_conv;
7994 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
7995 LDKUpdateFailMalformedHTLC o_conv;
7996 o_conv.inner = (void*)(o & (~1));
7997 o_conv.is_owned = (o & 1) || (o == 0);
7998 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
7999 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8000 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
8001 return (long)ret_conv;
8004 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
8005 LDKDecodeError e_conv;
8006 e_conv.inner = (void*)(e & (~1));
8007 e_conv.is_owned = (e & 1) || (e == 0);
8008 e_conv = DecodeError_clone(&e_conv);
8009 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8010 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
8011 return (long)ret_conv;
8014 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
8015 if ((_res & 1) != 0) return;
8016 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8018 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
8021 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
8022 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
8023 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8024 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
8025 return (long)ret_conv;
8028 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
8029 LDKUpdateFee o_conv;
8030 o_conv.inner = (void*)(o & (~1));
8031 o_conv.is_owned = (o & 1) || (o == 0);
8032 o_conv = UpdateFee_clone(&o_conv);
8033 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8034 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
8035 return (long)ret_conv;
8038 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
8039 LDKDecodeError e_conv;
8040 e_conv.inner = (void*)(e & (~1));
8041 e_conv.is_owned = (e & 1) || (e == 0);
8042 e_conv = DecodeError_clone(&e_conv);
8043 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8044 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
8045 return (long)ret_conv;
8048 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
8049 if ((_res & 1) != 0) return;
8050 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8052 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
8055 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
8056 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
8057 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8058 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
8059 return (long)ret_conv;
8062 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
8063 LDKUpdateFulfillHTLC o_conv;
8064 o_conv.inner = (void*)(o & (~1));
8065 o_conv.is_owned = (o & 1) || (o == 0);
8066 o_conv = UpdateFulfillHTLC_clone(&o_conv);
8067 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8068 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
8069 return (long)ret_conv;
8072 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
8073 LDKDecodeError e_conv;
8074 e_conv.inner = (void*)(e & (~1));
8075 e_conv.is_owned = (e & 1) || (e == 0);
8076 e_conv = DecodeError_clone(&e_conv);
8077 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8078 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
8079 return (long)ret_conv;
8082 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
8083 if ((_res & 1) != 0) return;
8084 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8086 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
8089 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
8090 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
8091 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8092 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
8093 return (long)ret_conv;
8096 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
8097 LDKUpdateAddHTLC o_conv;
8098 o_conv.inner = (void*)(o & (~1));
8099 o_conv.is_owned = (o & 1) || (o == 0);
8100 o_conv = UpdateAddHTLC_clone(&o_conv);
8101 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8102 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
8103 return (long)ret_conv;
8106 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
8107 LDKDecodeError e_conv;
8108 e_conv.inner = (void*)(e & (~1));
8109 e_conv.is_owned = (e & 1) || (e == 0);
8110 e_conv = DecodeError_clone(&e_conv);
8111 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8112 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
8113 return (long)ret_conv;
8116 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
8117 if ((_res & 1) != 0) return;
8118 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8120 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
8123 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
8124 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
8125 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8126 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
8127 return (long)ret_conv;
8130 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
8132 o_conv.inner = (void*)(o & (~1));
8133 o_conv.is_owned = (o & 1) || (o == 0);
8134 o_conv = Ping_clone(&o_conv);
8135 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8136 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
8137 return (long)ret_conv;
8140 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
8141 LDKDecodeError e_conv;
8142 e_conv.inner = (void*)(e & (~1));
8143 e_conv.is_owned = (e & 1) || (e == 0);
8144 e_conv = DecodeError_clone(&e_conv);
8145 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8146 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
8147 return (long)ret_conv;
8150 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
8151 if ((_res & 1) != 0) return;
8152 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
8154 CResult_PingDecodeErrorZ_free(_res_conv);
8157 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
8158 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
8159 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8160 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
8161 return (long)ret_conv;
8164 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
8166 o_conv.inner = (void*)(o & (~1));
8167 o_conv.is_owned = (o & 1) || (o == 0);
8168 o_conv = Pong_clone(&o_conv);
8169 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8170 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
8171 return (long)ret_conv;
8174 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
8175 LDKDecodeError e_conv;
8176 e_conv.inner = (void*)(e & (~1));
8177 e_conv.is_owned = (e & 1) || (e == 0);
8178 e_conv = DecodeError_clone(&e_conv);
8179 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8180 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
8181 return (long)ret_conv;
8184 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
8185 if ((_res & 1) != 0) return;
8186 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
8188 CResult_PongDecodeErrorZ_free(_res_conv);
8191 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
8192 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
8193 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8194 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
8195 return (long)ret_conv;
8198 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
8199 LDKUnsignedChannelAnnouncement o_conv;
8200 o_conv.inner = (void*)(o & (~1));
8201 o_conv.is_owned = (o & 1) || (o == 0);
8202 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
8203 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8204 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
8205 return (long)ret_conv;
8208 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
8209 LDKDecodeError e_conv;
8210 e_conv.inner = (void*)(e & (~1));
8211 e_conv.is_owned = (e & 1) || (e == 0);
8212 e_conv = DecodeError_clone(&e_conv);
8213 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8214 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
8215 return (long)ret_conv;
8218 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
8219 if ((_res & 1) != 0) return;
8220 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8222 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
8225 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8226 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
8227 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8228 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
8229 return (long)ret_conv;
8232 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
8233 LDKChannelAnnouncement o_conv;
8234 o_conv.inner = (void*)(o & (~1));
8235 o_conv.is_owned = (o & 1) || (o == 0);
8236 o_conv = ChannelAnnouncement_clone(&o_conv);
8237 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8238 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
8239 return (long)ret_conv;
8242 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
8243 LDKDecodeError e_conv;
8244 e_conv.inner = (void*)(e & (~1));
8245 e_conv.is_owned = (e & 1) || (e == 0);
8246 e_conv = DecodeError_clone(&e_conv);
8247 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8248 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
8249 return (long)ret_conv;
8252 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
8253 if ((_res & 1) != 0) return;
8254 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8256 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
8259 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8260 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
8261 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8262 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
8263 return (long)ret_conv;
8266 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
8267 LDKUnsignedChannelUpdate o_conv;
8268 o_conv.inner = (void*)(o & (~1));
8269 o_conv.is_owned = (o & 1) || (o == 0);
8270 o_conv = UnsignedChannelUpdate_clone(&o_conv);
8271 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8272 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
8273 return (long)ret_conv;
8276 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
8277 LDKDecodeError e_conv;
8278 e_conv.inner = (void*)(e & (~1));
8279 e_conv.is_owned = (e & 1) || (e == 0);
8280 e_conv = DecodeError_clone(&e_conv);
8281 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8282 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
8283 return (long)ret_conv;
8286 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
8287 if ((_res & 1) != 0) return;
8288 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8290 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
8293 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
8294 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
8295 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8296 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
8297 return (long)ret_conv;
8300 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
8301 LDKChannelUpdate o_conv;
8302 o_conv.inner = (void*)(o & (~1));
8303 o_conv.is_owned = (o & 1) || (o == 0);
8304 o_conv = ChannelUpdate_clone(&o_conv);
8305 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8306 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
8307 return (long)ret_conv;
8310 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
8311 LDKDecodeError e_conv;
8312 e_conv.inner = (void*)(e & (~1));
8313 e_conv.is_owned = (e & 1) || (e == 0);
8314 e_conv = DecodeError_clone(&e_conv);
8315 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8316 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
8317 return (long)ret_conv;
8320 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
8321 if ((_res & 1) != 0) return;
8322 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8324 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
8327 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
8328 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
8329 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8330 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
8331 return (long)ret_conv;
8334 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
8335 LDKErrorMessage o_conv;
8336 o_conv.inner = (void*)(o & (~1));
8337 o_conv.is_owned = (o & 1) || (o == 0);
8338 o_conv = ErrorMessage_clone(&o_conv);
8339 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8340 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
8341 return (long)ret_conv;
8344 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
8345 LDKDecodeError e_conv;
8346 e_conv.inner = (void*)(e & (~1));
8347 e_conv.is_owned = (e & 1) || (e == 0);
8348 e_conv = DecodeError_clone(&e_conv);
8349 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8350 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
8351 return (long)ret_conv;
8354 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
8355 if ((_res & 1) != 0) return;
8356 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
8358 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
8361 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
8362 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
8363 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8364 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
8365 return (long)ret_conv;
8368 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
8369 LDKUnsignedNodeAnnouncement o_conv;
8370 o_conv.inner = (void*)(o & (~1));
8371 o_conv.is_owned = (o & 1) || (o == 0);
8372 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
8373 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8374 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
8375 return (long)ret_conv;
8378 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
8379 LDKDecodeError e_conv;
8380 e_conv.inner = (void*)(e & (~1));
8381 e_conv.is_owned = (e & 1) || (e == 0);
8382 e_conv = DecodeError_clone(&e_conv);
8383 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8384 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
8385 return (long)ret_conv;
8388 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
8389 if ((_res & 1) != 0) return;
8390 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8392 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
8395 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8396 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
8397 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8398 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
8399 return (long)ret_conv;
8402 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
8403 LDKNodeAnnouncement o_conv;
8404 o_conv.inner = (void*)(o & (~1));
8405 o_conv.is_owned = (o & 1) || (o == 0);
8406 o_conv = NodeAnnouncement_clone(&o_conv);
8407 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8408 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
8409 return (long)ret_conv;
8412 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
8413 LDKDecodeError e_conv;
8414 e_conv.inner = (void*)(e & (~1));
8415 e_conv.is_owned = (e & 1) || (e == 0);
8416 e_conv = DecodeError_clone(&e_conv);
8417 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8418 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
8419 return (long)ret_conv;
8422 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
8423 if ((_res & 1) != 0) return;
8424 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8426 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
8429 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8430 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
8431 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8432 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
8433 return (long)ret_conv;
8436 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
8437 LDKQueryShortChannelIds o_conv;
8438 o_conv.inner = (void*)(o & (~1));
8439 o_conv.is_owned = (o & 1) || (o == 0);
8440 o_conv = QueryShortChannelIds_clone(&o_conv);
8441 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8442 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
8443 return (long)ret_conv;
8446 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
8447 LDKDecodeError e_conv;
8448 e_conv.inner = (void*)(e & (~1));
8449 e_conv.is_owned = (e & 1) || (e == 0);
8450 e_conv = DecodeError_clone(&e_conv);
8451 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8452 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
8453 return (long)ret_conv;
8456 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
8457 if ((_res & 1) != 0) return;
8458 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
8460 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
8463 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
8464 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
8465 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8466 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
8467 return (long)ret_conv;
8470 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
8471 LDKReplyShortChannelIdsEnd o_conv;
8472 o_conv.inner = (void*)(o & (~1));
8473 o_conv.is_owned = (o & 1) || (o == 0);
8474 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
8475 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8476 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
8477 return (long)ret_conv;
8480 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
8481 LDKDecodeError e_conv;
8482 e_conv.inner = (void*)(e & (~1));
8483 e_conv.is_owned = (e & 1) || (e == 0);
8484 e_conv = DecodeError_clone(&e_conv);
8485 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8486 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
8487 return (long)ret_conv;
8490 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
8491 if ((_res & 1) != 0) return;
8492 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
8494 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
8497 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
8498 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
8499 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8500 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
8501 return (long)ret_conv;
8504 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
8505 LDKQueryChannelRange o_conv;
8506 o_conv.inner = (void*)(o & (~1));
8507 o_conv.is_owned = (o & 1) || (o == 0);
8508 o_conv = QueryChannelRange_clone(&o_conv);
8509 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8510 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
8511 return (long)ret_conv;
8514 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
8515 LDKDecodeError e_conv;
8516 e_conv.inner = (void*)(e & (~1));
8517 e_conv.is_owned = (e & 1) || (e == 0);
8518 e_conv = DecodeError_clone(&e_conv);
8519 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8520 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
8521 return (long)ret_conv;
8524 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
8525 if ((_res & 1) != 0) return;
8526 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8528 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
8531 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
8532 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
8533 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8534 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
8535 return (long)ret_conv;
8538 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
8539 LDKReplyChannelRange o_conv;
8540 o_conv.inner = (void*)(o & (~1));
8541 o_conv.is_owned = (o & 1) || (o == 0);
8542 o_conv = ReplyChannelRange_clone(&o_conv);
8543 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8544 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
8545 return (long)ret_conv;
8548 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
8549 LDKDecodeError e_conv;
8550 e_conv.inner = (void*)(e & (~1));
8551 e_conv.is_owned = (e & 1) || (e == 0);
8552 e_conv = DecodeError_clone(&e_conv);
8553 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8554 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
8555 return (long)ret_conv;
8558 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
8559 if ((_res & 1) != 0) return;
8560 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8562 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
8565 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
8566 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
8567 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8568 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
8569 return (long)ret_conv;
8572 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
8573 LDKGossipTimestampFilter o_conv;
8574 o_conv.inner = (void*)(o & (~1));
8575 o_conv.is_owned = (o & 1) || (o == 0);
8576 o_conv = GossipTimestampFilter_clone(&o_conv);
8577 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8578 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
8579 return (long)ret_conv;
8582 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
8583 LDKDecodeError e_conv;
8584 e_conv.inner = (void*)(e & (~1));
8585 e_conv.is_owned = (e & 1) || (e == 0);
8586 e_conv = DecodeError_clone(&e_conv);
8587 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8588 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
8589 return (long)ret_conv;
8592 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
8593 if ((_res & 1) != 0) return;
8594 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
8596 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
8599 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
8600 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
8601 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8602 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
8603 return (long)ret_conv;
8606 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8607 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
8609 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8610 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
8611 return (long)ret_conv;
8614 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8615 LDKDecodeError e_conv;
8616 e_conv.inner = (void*)(e & (~1));
8617 e_conv.is_owned = (e & 1) || (e == 0);
8618 e_conv = DecodeError_clone(&e_conv);
8619 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8620 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
8621 return (long)ret_conv;
8624 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8625 if ((_res & 1) != 0) return;
8626 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8628 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
8631 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8632 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
8633 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8634 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
8635 return (long)ret_conv;
8638 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
8639 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
8640 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8641 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
8642 return (long)ret_ref;
8645 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
8647 CHECK(*((uint32_t*)a) == 64);
8648 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
8649 LDKCVec_SignatureZ b_constr;
8650 b_constr.datalen = *((uint32_t*)b);
8651 if (b_constr.datalen > 0)
8652 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8654 b_constr.data = NULL;
8655 int8_tArray* b_vals = (int8_tArray*)(b + 4);
8656 for (size_t m = 0; m < b_constr.datalen; m++) {
8657 int8_tArray b_conv_12 = b_vals[m];
8658 LDKSignature b_conv_12_ref;
8659 CHECK(*((uint32_t*)b_conv_12) == 64);
8660 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
8661 b_constr.data[m] = b_conv_12_ref;
8663 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8664 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
8665 return (long)ret_ref;
8668 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
8669 if ((_res & 1) != 0) return;
8670 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
8672 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
8675 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
8676 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
8678 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8679 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
8680 return (long)ret_conv;
8683 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
8684 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8685 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
8686 return (long)ret_conv;
8689 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
8690 if ((_res & 1) != 0) return;
8691 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
8693 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
8696 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
8697 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
8698 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8699 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
8700 return (long)ret_conv;
8703 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
8705 CHECK(*((uint32_t*)o) == 64);
8706 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
8707 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8708 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
8709 return (long)ret_conv;
8712 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
8713 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8714 *ret_conv = CResult_SignatureNoneZ_err();
8715 return (long)ret_conv;
8718 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
8719 if ((_res & 1) != 0) return;
8720 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
8722 CResult_SignatureNoneZ_free(_res_conv);
8725 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
8726 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
8727 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8728 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
8729 return (long)ret_conv;
8732 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
8733 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
8734 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8735 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
8736 return (long)ret_conv;
8739 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
8740 LDKDecodeError e_conv;
8741 e_conv.inner = (void*)(e & (~1));
8742 e_conv.is_owned = (e & 1) || (e == 0);
8743 e_conv = DecodeError_clone(&e_conv);
8744 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8745 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
8746 return (long)ret_conv;
8749 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
8750 if ((_res & 1) != 0) return;
8751 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
8753 CResult_SignDecodeErrorZ_free(_res_conv);
8756 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
8757 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
8758 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8759 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
8760 return (long)ret_conv;
8763 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
8764 LDKCVec_CVec_u8ZZ _res_constr;
8765 _res_constr.datalen = *((uint32_t*)_res);
8766 if (_res_constr.datalen > 0)
8767 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8769 _res_constr.data = NULL;
8770 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
8771 for (size_t m = 0; m < _res_constr.datalen; m++) {
8772 int8_tArray _res_conv_12 = _res_vals[m];
8773 LDKCVec_u8Z _res_conv_12_ref;
8774 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
8775 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
8776 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
8777 _res_constr.data[m] = _res_conv_12_ref;
8779 CVec_CVec_u8ZZ_free(_res_constr);
8782 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
8783 LDKCVec_CVec_u8ZZ o_constr;
8784 o_constr.datalen = *((uint32_t*)o);
8785 if (o_constr.datalen > 0)
8786 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8788 o_constr.data = NULL;
8789 int8_tArray* o_vals = (int8_tArray*)(o + 4);
8790 for (size_t m = 0; m < o_constr.datalen; m++) {
8791 int8_tArray o_conv_12 = o_vals[m];
8792 LDKCVec_u8Z o_conv_12_ref;
8793 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
8794 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
8795 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
8796 o_constr.data[m] = o_conv_12_ref;
8798 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8799 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
8800 return (long)ret_conv;
8803 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
8804 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8805 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
8806 return (long)ret_conv;
8809 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
8810 if ((_res & 1) != 0) return;
8811 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
8813 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
8816 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
8817 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
8818 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8819 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
8820 return (long)ret_conv;
8823 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
8824 LDKInMemorySigner o_conv;
8825 o_conv.inner = (void*)(o & (~1));
8826 o_conv.is_owned = (o & 1) || (o == 0);
8827 o_conv = InMemorySigner_clone(&o_conv);
8828 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8829 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
8830 return (long)ret_conv;
8833 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
8834 LDKDecodeError e_conv;
8835 e_conv.inner = (void*)(e & (~1));
8836 e_conv.is_owned = (e & 1) || (e == 0);
8837 e_conv = DecodeError_clone(&e_conv);
8838 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8839 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
8840 return (long)ret_conv;
8843 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
8844 if ((_res & 1) != 0) return;
8845 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
8847 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
8850 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
8851 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
8852 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8853 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
8854 return (long)ret_conv;
8857 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
8858 LDKCVec_TxOutZ _res_constr;
8859 _res_constr.datalen = *((uint32_t*)_res);
8860 if (_res_constr.datalen > 0)
8861 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
8863 _res_constr.data = NULL;
8864 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8865 for (size_t h = 0; h < _res_constr.datalen; h++) {
8866 uint32_t _res_conv_7 = _res_vals[h];
8867 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
8868 FREE((void*)_res_conv_7);
8869 _res_constr.data[h] = _res_conv_7_conv;
8871 CVec_TxOutZ_free(_res_constr);
8874 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
8875 LDKTransaction o_ref;
8876 o_ref.datalen = *((uint32_t*)o);
8877 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
8878 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
8879 o_ref.data_is_owned = true;
8880 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8881 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
8882 return (long)ret_conv;
8885 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
8886 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8887 *ret_conv = CResult_TransactionNoneZ_err();
8888 return (long)ret_conv;
8891 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
8892 if ((_res & 1) != 0) return;
8893 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
8895 CResult_TransactionNoneZ_free(_res_conv);
8898 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
8899 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8900 *ret_conv = CResult_NoneErrorZ_ok();
8901 return (long)ret_conv;
8904 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
8905 LDKIOError e_conv = LDKIOError_from_js(e);
8906 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8907 *ret_conv = CResult_NoneErrorZ_err(e_conv);
8908 return (long)ret_conv;
8911 void __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
8912 if ((_res & 1) != 0) return;
8913 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
8915 CResult_NoneErrorZ_free(_res_conv);
8918 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_BlockHashChannelMonitorZZ_free(uint32_tArray _res) {
8919 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
8920 _res_constr.datalen = *((uint32_t*)_res);
8921 if (_res_constr.datalen > 0)
8922 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
8924 _res_constr.data = NULL;
8925 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8926 for (size_t m = 0; m < _res_constr.datalen; m++) {
8927 uint32_t _res_conv_38 = _res_vals[m];
8928 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_38_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_38) & ~1);
8929 FREE((void*)_res_conv_38);
8930 _res_constr.data[m] = _res_conv_38_conv;
8932 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
8935 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(uint32_tArray o) {
8936 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
8937 o_constr.datalen = *((uint32_t*)o);
8938 if (o_constr.datalen > 0)
8939 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
8941 o_constr.data = NULL;
8942 uint32_t* o_vals = (uint32_t*)(o + 4);
8943 for (size_t m = 0; m < o_constr.datalen; m++) {
8944 uint32_t o_conv_38 = o_vals[m];
8945 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_38_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_38) & ~1);
8946 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
8947 o_constr.data[m] = o_conv_38_conv;
8949 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
8950 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
8951 return (long)ret_conv;
8954 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(uint32_t e) {
8955 LDKIOError e_conv = LDKIOError_from_js(e);
8956 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
8957 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
8958 return (long)ret_conv;
8961 void __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(uint32_t _res) {
8962 if ((_res & 1) != 0) return;
8963 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
8965 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
8968 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
8969 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8970 *ret_conv = CResult_NoneAPIErrorZ_ok();
8971 return (long)ret_conv;
8974 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
8975 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
8977 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8978 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
8979 return (long)ret_conv;
8982 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
8983 if ((_res & 1) != 0) return;
8984 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
8986 CResult_NoneAPIErrorZ_free(_res_conv);
8989 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
8990 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
8991 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8992 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
8993 return (long)ret_conv;
8996 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
8997 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
8998 _res_constr.datalen = *((uint32_t*)_res);
8999 if (_res_constr.datalen > 0)
9000 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
9002 _res_constr.data = NULL;
9003 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9004 for (size_t w = 0; w < _res_constr.datalen; w++) {
9005 uint32_t _res_conv_22 = _res_vals[w];
9006 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
9007 FREE((void*)_res_conv_22);
9008 _res_constr.data[w] = _res_conv_22_conv;
9010 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
9013 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
9014 LDKCVec_APIErrorZ _res_constr;
9015 _res_constr.datalen = *((uint32_t*)_res);
9016 if (_res_constr.datalen > 0)
9017 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
9019 _res_constr.data = NULL;
9020 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9021 for (size_t k = 0; k < _res_constr.datalen; k++) {
9022 uint32_t _res_conv_10 = _res_vals[k];
9023 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
9024 FREE((void*)_res_conv_10);
9025 _res_constr.data[k] = _res_conv_10_conv;
9027 CVec_APIErrorZ_free(_res_constr);
9030 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
9031 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9032 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
9033 return (long)ret_conv;
9036 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
9037 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
9039 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9040 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
9041 return (long)ret_conv;
9044 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
9045 if ((_res & 1) != 0) return;
9046 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
9048 CResult_NonePaymentSendFailureZ_free(_res_conv);
9051 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
9052 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
9053 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9054 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
9055 return (long)ret_conv;
9058 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
9059 LDKCVec_ChannelMonitorZ _res_constr;
9060 _res_constr.datalen = *((uint32_t*)_res);
9061 if (_res_constr.datalen > 0)
9062 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
9064 _res_constr.data = NULL;
9065 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9066 for (size_t q = 0; q < _res_constr.datalen; q++) {
9067 uint32_t _res_conv_16 = _res_vals[q];
9068 LDKChannelMonitor _res_conv_16_conv;
9069 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9070 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9071 _res_constr.data[q] = _res_conv_16_conv;
9073 CVec_ChannelMonitorZ_free(_res_constr);
9076 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
9077 LDKThirtyTwoBytes a_ref;
9078 CHECK(*((uint32_t*)a) == 32);
9079 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9080 LDKChannelManager b_conv;
9081 b_conv.inner = (void*)(b & (~1));
9082 b_conv.is_owned = (b & 1) || (b == 0);
9083 // Warning: we need a move here but no clone is available for LDKChannelManager
9084 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
9085 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
9086 return (long)ret_ref;
9089 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
9090 if ((_res & 1) != 0) return;
9091 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
9093 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
9096 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
9097 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
9099 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9100 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
9101 return (long)ret_conv;
9104 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
9105 LDKDecodeError e_conv;
9106 e_conv.inner = (void*)(e & (~1));
9107 e_conv.is_owned = (e & 1) || (e == 0);
9108 e_conv = DecodeError_clone(&e_conv);
9109 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9110 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
9111 return (long)ret_conv;
9114 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
9115 if ((_res & 1) != 0) return;
9116 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9118 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
9121 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
9122 if ((this_ptr & 1) != 0) return;
9123 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
9124 FREE((void*)this_ptr);
9125 Event_free(this_ptr_conv);
9128 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
9129 LDKEvent* orig_conv = (LDKEvent*)orig;
9130 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
9131 *ret_copy = Event_clone(orig_conv);
9132 long ret_ref = (long)ret_copy;
9136 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
9137 LDKEvent* obj_conv = (LDKEvent*)obj;
9138 LDKCVec_u8Z ret_var = Event_write(obj_conv);
9139 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9140 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9141 CVec_u8Z_free(ret_var);
9145 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
9146 if ((this_ptr & 1) != 0) return;
9147 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
9148 FREE((void*)this_ptr);
9149 MessageSendEvent_free(this_ptr_conv);
9152 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
9153 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
9154 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
9155 *ret_copy = MessageSendEvent_clone(orig_conv);
9156 long ret_ref = (long)ret_copy;
9160 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
9161 if ((this_ptr & 1) != 0) return;
9162 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
9163 FREE((void*)this_ptr);
9164 MessageSendEventsProvider_free(this_ptr_conv);
9167 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
9168 if ((this_ptr & 1) != 0) return;
9169 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
9170 FREE((void*)this_ptr);
9171 EventsProvider_free(this_ptr_conv);
9174 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
9175 if ((this_ptr & 1) != 0) return;
9176 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
9177 FREE((void*)this_ptr);
9178 APIError_free(this_ptr_conv);
9181 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
9182 LDKAPIError* orig_conv = (LDKAPIError*)orig;
9183 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
9184 *ret_copy = APIError_clone(orig_conv);
9185 long ret_ref = (long)ret_copy;
9189 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
9190 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
9191 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
9195 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
9196 uint32_t ret_conv = LDKLevel_to_js(Level_max());
9200 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
9201 if ((this_ptr & 1) != 0) return;
9202 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
9203 FREE((void*)this_ptr);
9204 Logger_free(this_ptr_conv);
9207 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
9208 LDKChannelHandshakeConfig this_obj_conv;
9209 this_obj_conv.inner = (void*)(this_obj & (~1));
9210 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9211 ChannelHandshakeConfig_free(this_obj_conv);
9214 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
9215 LDKChannelHandshakeConfig this_ptr_conv;
9216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9217 this_ptr_conv.is_owned = false;
9218 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
9222 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
9223 LDKChannelHandshakeConfig this_ptr_conv;
9224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9225 this_ptr_conv.is_owned = false;
9226 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
9229 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
9230 LDKChannelHandshakeConfig this_ptr_conv;
9231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9232 this_ptr_conv.is_owned = false;
9233 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
9237 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
9238 LDKChannelHandshakeConfig this_ptr_conv;
9239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9240 this_ptr_conv.is_owned = false;
9241 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
9244 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
9245 LDKChannelHandshakeConfig this_ptr_conv;
9246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9247 this_ptr_conv.is_owned = false;
9248 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
9252 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
9253 LDKChannelHandshakeConfig this_ptr_conv;
9254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9255 this_ptr_conv.is_owned = false;
9256 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
9259 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) {
9260 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
9261 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9262 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9263 long ret_ref = (long)ret_var.inner;
9264 if (ret_var.is_owned) {
9270 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
9271 LDKChannelHandshakeConfig orig_conv;
9272 orig_conv.inner = (void*)(orig & (~1));
9273 orig_conv.is_owned = false;
9274 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
9275 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9276 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9277 long ret_ref = (long)ret_var.inner;
9278 if (ret_var.is_owned) {
9284 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
9285 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
9286 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9287 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9288 long ret_ref = (long)ret_var.inner;
9289 if (ret_var.is_owned) {
9295 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
9296 LDKChannelHandshakeLimits this_obj_conv;
9297 this_obj_conv.inner = (void*)(this_obj & (~1));
9298 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9299 ChannelHandshakeLimits_free(this_obj_conv);
9302 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
9303 LDKChannelHandshakeLimits this_ptr_conv;
9304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9305 this_ptr_conv.is_owned = false;
9306 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
9310 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
9311 LDKChannelHandshakeLimits this_ptr_conv;
9312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9313 this_ptr_conv.is_owned = false;
9314 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
9317 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
9318 LDKChannelHandshakeLimits this_ptr_conv;
9319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9320 this_ptr_conv.is_owned = false;
9321 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
9325 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
9326 LDKChannelHandshakeLimits this_ptr_conv;
9327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9328 this_ptr_conv.is_owned = false;
9329 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
9332 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
9333 LDKChannelHandshakeLimits this_ptr_conv;
9334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9335 this_ptr_conv.is_owned = false;
9336 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
9340 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
9341 LDKChannelHandshakeLimits this_ptr_conv;
9342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9343 this_ptr_conv.is_owned = false;
9344 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
9347 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
9348 LDKChannelHandshakeLimits this_ptr_conv;
9349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9350 this_ptr_conv.is_owned = false;
9351 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
9355 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
9356 LDKChannelHandshakeLimits this_ptr_conv;
9357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9358 this_ptr_conv.is_owned = false;
9359 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
9362 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
9363 LDKChannelHandshakeLimits this_ptr_conv;
9364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9365 this_ptr_conv.is_owned = false;
9366 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
9370 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
9371 LDKChannelHandshakeLimits this_ptr_conv;
9372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9373 this_ptr_conv.is_owned = false;
9374 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
9377 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_dust_limit_satoshis(uint32_t this_ptr) {
9378 LDKChannelHandshakeLimits this_ptr_conv;
9379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9380 this_ptr_conv.is_owned = false;
9381 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
9385 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
9386 LDKChannelHandshakeLimits this_ptr_conv;
9387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9388 this_ptr_conv.is_owned = false;
9389 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
9392 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_dust_limit_satoshis(uint32_t this_ptr) {
9393 LDKChannelHandshakeLimits this_ptr_conv;
9394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9395 this_ptr_conv.is_owned = false;
9396 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
9400 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
9401 LDKChannelHandshakeLimits this_ptr_conv;
9402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9403 this_ptr_conv.is_owned = false;
9404 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
9407 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
9408 LDKChannelHandshakeLimits this_ptr_conv;
9409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9410 this_ptr_conv.is_owned = false;
9411 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
9415 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
9416 LDKChannelHandshakeLimits this_ptr_conv;
9417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9418 this_ptr_conv.is_owned = false;
9419 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
9422 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
9423 LDKChannelHandshakeLimits this_ptr_conv;
9424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9425 this_ptr_conv.is_owned = false;
9426 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
9430 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
9431 LDKChannelHandshakeLimits this_ptr_conv;
9432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9433 this_ptr_conv.is_owned = false;
9434 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
9437 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
9438 LDKChannelHandshakeLimits this_ptr_conv;
9439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9440 this_ptr_conv.is_owned = false;
9441 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
9445 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
9446 LDKChannelHandshakeLimits this_ptr_conv;
9447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9448 this_ptr_conv.is_owned = false;
9449 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
9452 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) {
9453 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);
9454 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9455 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9456 long ret_ref = (long)ret_var.inner;
9457 if (ret_var.is_owned) {
9463 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
9464 LDKChannelHandshakeLimits orig_conv;
9465 orig_conv.inner = (void*)(orig & (~1));
9466 orig_conv.is_owned = false;
9467 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
9468 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9469 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9470 long ret_ref = (long)ret_var.inner;
9471 if (ret_var.is_owned) {
9477 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
9478 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
9479 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9480 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9481 long ret_ref = (long)ret_var.inner;
9482 if (ret_var.is_owned) {
9488 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
9489 LDKChannelConfig this_obj_conv;
9490 this_obj_conv.inner = (void*)(this_obj & (~1));
9491 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9492 ChannelConfig_free(this_obj_conv);
9495 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_fee_proportional_millionths(uint32_t this_ptr) {
9496 LDKChannelConfig this_ptr_conv;
9497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9498 this_ptr_conv.is_owned = false;
9499 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
9503 void __attribute__((visibility("default"))) TS_ChannelConfig_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
9504 LDKChannelConfig this_ptr_conv;
9505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9506 this_ptr_conv.is_owned = false;
9507 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
9510 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
9511 LDKChannelConfig this_ptr_conv;
9512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9513 this_ptr_conv.is_owned = false;
9514 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
9518 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
9519 LDKChannelConfig this_ptr_conv;
9520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9521 this_ptr_conv.is_owned = false;
9522 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
9525 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
9526 LDKChannelConfig this_ptr_conv;
9527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9528 this_ptr_conv.is_owned = false;
9529 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
9533 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
9534 LDKChannelConfig this_ptr_conv;
9535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9536 this_ptr_conv.is_owned = false;
9537 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
9540 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
9541 LDKChannelConfig this_ptr_conv;
9542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9543 this_ptr_conv.is_owned = false;
9544 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
9548 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
9549 LDKChannelConfig this_ptr_conv;
9550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9551 this_ptr_conv.is_owned = false;
9552 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
9555 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) {
9556 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
9557 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9558 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9559 long ret_ref = (long)ret_var.inner;
9560 if (ret_var.is_owned) {
9566 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
9567 LDKChannelConfig orig_conv;
9568 orig_conv.inner = (void*)(orig & (~1));
9569 orig_conv.is_owned = false;
9570 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
9571 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9572 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9573 long ret_ref = (long)ret_var.inner;
9574 if (ret_var.is_owned) {
9580 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
9581 LDKChannelConfig ret_var = ChannelConfig_default();
9582 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9583 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9584 long ret_ref = (long)ret_var.inner;
9585 if (ret_var.is_owned) {
9591 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
9592 LDKChannelConfig obj_conv;
9593 obj_conv.inner = (void*)(obj & (~1));
9594 obj_conv.is_owned = false;
9595 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
9596 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9597 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9598 CVec_u8Z_free(ret_var);
9602 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
9604 ser_ref.datalen = *((uint32_t*)ser);
9605 ser_ref.data = (int8_t*)(ser + 4);
9606 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9607 *ret_conv = ChannelConfig_read(ser_ref);
9608 return (long)ret_conv;
9611 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
9612 LDKUserConfig this_obj_conv;
9613 this_obj_conv.inner = (void*)(this_obj & (~1));
9614 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9615 UserConfig_free(this_obj_conv);
9618 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
9619 LDKUserConfig this_ptr_conv;
9620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9621 this_ptr_conv.is_owned = false;
9622 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
9623 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9624 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9625 long ret_ref = (long)ret_var.inner;
9626 if (ret_var.is_owned) {
9632 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
9633 LDKUserConfig this_ptr_conv;
9634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9635 this_ptr_conv.is_owned = false;
9636 LDKChannelHandshakeConfig val_conv;
9637 val_conv.inner = (void*)(val & (~1));
9638 val_conv.is_owned = (val & 1) || (val == 0);
9639 val_conv = ChannelHandshakeConfig_clone(&val_conv);
9640 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
9643 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
9644 LDKUserConfig this_ptr_conv;
9645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9646 this_ptr_conv.is_owned = false;
9647 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
9648 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9649 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9650 long ret_ref = (long)ret_var.inner;
9651 if (ret_var.is_owned) {
9657 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
9658 LDKUserConfig this_ptr_conv;
9659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9660 this_ptr_conv.is_owned = false;
9661 LDKChannelHandshakeLimits val_conv;
9662 val_conv.inner = (void*)(val & (~1));
9663 val_conv.is_owned = (val & 1) || (val == 0);
9664 val_conv = ChannelHandshakeLimits_clone(&val_conv);
9665 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
9668 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
9669 LDKUserConfig this_ptr_conv;
9670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9671 this_ptr_conv.is_owned = false;
9672 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
9673 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9674 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9675 long ret_ref = (long)ret_var.inner;
9676 if (ret_var.is_owned) {
9682 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
9683 LDKUserConfig this_ptr_conv;
9684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9685 this_ptr_conv.is_owned = false;
9686 LDKChannelConfig val_conv;
9687 val_conv.inner = (void*)(val & (~1));
9688 val_conv.is_owned = (val & 1) || (val == 0);
9689 val_conv = ChannelConfig_clone(&val_conv);
9690 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
9693 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) {
9694 LDKChannelHandshakeConfig own_channel_config_arg_conv;
9695 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
9696 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
9697 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
9698 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
9699 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
9700 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
9701 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
9702 LDKChannelConfig channel_options_arg_conv;
9703 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
9704 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
9705 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
9706 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
9707 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9708 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9709 long ret_ref = (long)ret_var.inner;
9710 if (ret_var.is_owned) {
9716 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
9717 LDKUserConfig orig_conv;
9718 orig_conv.inner = (void*)(orig & (~1));
9719 orig_conv.is_owned = false;
9720 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
9721 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9722 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9723 long ret_ref = (long)ret_var.inner;
9724 if (ret_var.is_owned) {
9730 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
9731 LDKUserConfig ret_var = UserConfig_default();
9732 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9733 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9734 long ret_ref = (long)ret_var.inner;
9735 if (ret_var.is_owned) {
9741 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
9742 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
9743 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
9747 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
9748 if ((this_ptr & 1) != 0) return;
9749 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
9750 FREE((void*)this_ptr);
9751 Access_free(this_ptr_conv);
9754 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
9755 if ((this_ptr & 1) != 0) return;
9756 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
9757 FREE((void*)this_ptr);
9758 Listen_free(this_ptr_conv);
9761 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
9762 if ((this_ptr & 1) != 0) return;
9763 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
9764 FREE((void*)this_ptr);
9765 Watch_free(this_ptr_conv);
9768 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
9769 if ((this_ptr & 1) != 0) return;
9770 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
9771 FREE((void*)this_ptr);
9772 Filter_free(this_ptr_conv);
9775 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
9776 LDKWatchedOutput this_obj_conv;
9777 this_obj_conv.inner = (void*)(this_obj & (~1));
9778 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9779 WatchedOutput_free(this_obj_conv);
9782 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
9783 LDKWatchedOutput this_ptr_conv;
9784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9785 this_ptr_conv.is_owned = false;
9786 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9787 memcpy((uint8_t*)(ret_arr + 4), WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
9791 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
9792 LDKWatchedOutput this_ptr_conv;
9793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9794 this_ptr_conv.is_owned = false;
9795 LDKThirtyTwoBytes val_ref;
9796 CHECK(*((uint32_t*)val) == 32);
9797 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
9798 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
9801 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
9802 LDKWatchedOutput this_ptr_conv;
9803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9804 this_ptr_conv.is_owned = false;
9805 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
9806 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9807 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9808 long ret_ref = (long)ret_var.inner;
9809 if (ret_var.is_owned) {
9815 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
9816 LDKWatchedOutput this_ptr_conv;
9817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9818 this_ptr_conv.is_owned = false;
9819 LDKOutPoint val_conv;
9820 val_conv.inner = (void*)(val & (~1));
9821 val_conv.is_owned = (val & 1) || (val == 0);
9822 val_conv = OutPoint_clone(&val_conv);
9823 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
9826 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
9827 LDKWatchedOutput this_ptr_conv;
9828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9829 this_ptr_conv.is_owned = false;
9830 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
9831 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9832 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9836 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
9837 LDKWatchedOutput this_ptr_conv;
9838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9839 this_ptr_conv.is_owned = false;
9840 LDKCVec_u8Z val_ref;
9841 val_ref.datalen = *((uint32_t*)val);
9842 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
9843 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
9844 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
9847 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
9848 LDKThirtyTwoBytes block_hash_arg_ref;
9849 CHECK(*((uint32_t*)block_hash_arg) == 32);
9850 memcpy(block_hash_arg_ref.data, (uint8_t*)(block_hash_arg + 4), 32);
9851 LDKOutPoint outpoint_arg_conv;
9852 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
9853 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
9854 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
9855 LDKCVec_u8Z script_pubkey_arg_ref;
9856 script_pubkey_arg_ref.datalen = *((uint32_t*)script_pubkey_arg);
9857 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
9858 memcpy(script_pubkey_arg_ref.data, (uint8_t*)(script_pubkey_arg + 4), script_pubkey_arg_ref.datalen);
9859 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
9860 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9861 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9862 long ret_ref = (long)ret_var.inner;
9863 if (ret_var.is_owned) {
9869 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
9870 if ((this_ptr & 1) != 0) return;
9871 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
9872 FREE((void*)this_ptr);
9873 BroadcasterInterface_free(this_ptr_conv);
9876 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
9877 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
9878 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
9882 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
9883 if ((this_ptr & 1) != 0) return;
9884 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
9885 FREE((void*)this_ptr);
9886 FeeEstimator_free(this_ptr_conv);
9889 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
9890 LDKChainMonitor this_obj_conv;
9891 this_obj_conv.inner = (void*)(this_obj & (~1));
9892 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9893 ChainMonitor_free(this_obj_conv);
9896 void __attribute__((visibility("default"))) TS_ChainMonitor_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
9897 LDKChainMonitor this_arg_conv;
9898 this_arg_conv.inner = (void*)(this_arg & (~1));
9899 this_arg_conv.is_owned = false;
9900 unsigned char header_arr[80];
9901 CHECK(*((uint32_t*)header) == 80);
9902 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9903 unsigned char (*header_ref)[80] = &header_arr;
9904 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9905 txdata_constr.datalen = *((uint32_t*)txdata);
9906 if (txdata_constr.datalen > 0)
9907 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9909 txdata_constr.data = NULL;
9910 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
9911 for (size_t e = 0; e < txdata_constr.datalen; e++) {
9912 uint32_t txdata_conv_30 = txdata_vals[e];
9913 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
9914 // Warning: we may need a move here but no clone is available for LDKC2Tuple_usizeTransactionZ
9915 txdata_constr.data[e] = txdata_conv_30_conv;
9917 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
9920 void __attribute__((visibility("default"))) TS_ChainMonitor_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
9921 LDKChainMonitor this_arg_conv;
9922 this_arg_conv.inner = (void*)(this_arg & (~1));
9923 this_arg_conv.is_owned = false;
9924 unsigned char header_arr[80];
9925 CHECK(*((uint32_t*)header) == 80);
9926 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9927 unsigned char (*header_ref)[80] = &header_arr;
9928 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9929 txdata_constr.datalen = *((uint32_t*)txdata);
9930 if (txdata_constr.datalen > 0)
9931 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9933 txdata_constr.data = NULL;
9934 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
9935 for (size_t e = 0; e < txdata_constr.datalen; e++) {
9936 uint32_t txdata_conv_30 = txdata_vals[e];
9937 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
9938 // Warning: we may need a move here but no clone is available for LDKC2Tuple_usizeTransactionZ
9939 txdata_constr.data[e] = txdata_conv_30_conv;
9941 ChainMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height);
9944 void __attribute__((visibility("default"))) TS_ChainMonitor_update_best_block(uint32_t this_arg, int8_tArray header, int32_t height) {
9945 LDKChainMonitor this_arg_conv;
9946 this_arg_conv.inner = (void*)(this_arg & (~1));
9947 this_arg_conv.is_owned = false;
9948 unsigned char header_arr[80];
9949 CHECK(*((uint32_t*)header) == 80);
9950 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9951 unsigned char (*header_ref)[80] = &header_arr;
9952 ChainMonitor_update_best_block(&this_arg_conv, header_ref, height);
9955 void __attribute__((visibility("default"))) TS_ChainMonitor_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t disconnected_height) {
9956 LDKChainMonitor this_arg_conv;
9957 this_arg_conv.inner = (void*)(this_arg & (~1));
9958 this_arg_conv.is_owned = false;
9959 unsigned char header_arr[80];
9960 CHECK(*((uint32_t*)header) == 80);
9961 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9962 unsigned char (*header_ref)[80] = &header_arr;
9963 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
9966 void __attribute__((visibility("default"))) TS_ChainMonitor_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
9967 LDKChainMonitor this_arg_conv;
9968 this_arg_conv.inner = (void*)(this_arg & (~1));
9969 this_arg_conv.is_owned = false;
9970 unsigned char txid_arr[32];
9971 CHECK(*((uint32_t*)txid) == 32);
9972 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
9973 unsigned char (*txid_ref)[32] = &txid_arr;
9974 ChainMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref);
9977 ptrArray __attribute__((visibility("default"))) TS_ChainMonitor_get_relevant_txids(uint32_t this_arg) {
9978 LDKChainMonitor this_arg_conv;
9979 this_arg_conv.inner = (void*)(this_arg & (~1));
9980 this_arg_conv.is_owned = false;
9981 LDKCVec_TxidZ ret_var = ChainMonitor_get_relevant_txids(&this_arg_conv);
9982 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
9983 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
9984 for (size_t m = 0; m < ret_var.datalen; m++) {
9985 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9986 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
9987 ret_arr_ptr[m] = ret_conv_12_arr;
9993 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
9994 LDKFilter *chain_source_conv_ptr = NULL;
9995 if (chain_source != 0) {
9996 LDKFilter chain_source_conv;
9997 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
9998 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
9999 *chain_source_conv_ptr = chain_source_conv;
10001 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10002 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10003 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
10004 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
10005 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
10006 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10007 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10008 long ret_ref = (long)ret_var.inner;
10009 if (ret_var.is_owned) {
10015 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
10016 LDKChainMonitor this_arg_conv;
10017 this_arg_conv.inner = (void*)(this_arg & (~1));
10018 this_arg_conv.is_owned = false;
10019 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
10020 *ret = ChainMonitor_as_Watch(&this_arg_conv);
10024 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
10025 LDKChainMonitor this_arg_conv;
10026 this_arg_conv.inner = (void*)(this_arg & (~1));
10027 this_arg_conv.is_owned = false;
10028 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
10029 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
10033 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
10034 LDKChannelMonitorUpdate this_obj_conv;
10035 this_obj_conv.inner = (void*)(this_obj & (~1));
10036 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10037 ChannelMonitorUpdate_free(this_obj_conv);
10040 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
10041 LDKChannelMonitorUpdate this_ptr_conv;
10042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10043 this_ptr_conv.is_owned = false;
10044 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
10048 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
10049 LDKChannelMonitorUpdate this_ptr_conv;
10050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10051 this_ptr_conv.is_owned = false;
10052 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
10055 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
10056 LDKChannelMonitorUpdate orig_conv;
10057 orig_conv.inner = (void*)(orig & (~1));
10058 orig_conv.is_owned = false;
10059 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
10060 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10061 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10062 long ret_ref = (long)ret_var.inner;
10063 if (ret_var.is_owned) {
10069 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
10070 LDKChannelMonitorUpdate obj_conv;
10071 obj_conv.inner = (void*)(obj & (~1));
10072 obj_conv.is_owned = false;
10073 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
10074 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10075 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10076 CVec_u8Z_free(ret_var);
10080 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
10081 LDKu8slice ser_ref;
10082 ser_ref.datalen = *((uint32_t*)ser);
10083 ser_ref.data = (int8_t*)(ser + 4);
10084 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10085 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
10086 return (long)ret_conv;
10089 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
10090 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
10091 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
10095 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) {
10096 LDKMonitorUpdateError this_obj_conv;
10097 this_obj_conv.inner = (void*)(this_obj & (~1));
10098 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10099 MonitorUpdateError_free(this_obj_conv);
10102 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
10103 LDKMonitorUpdateError orig_conv;
10104 orig_conv.inner = (void*)(orig & (~1));
10105 orig_conv.is_owned = false;
10106 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
10107 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10108 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10109 long ret_ref = (long)ret_var.inner;
10110 if (ret_var.is_owned) {
10116 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
10117 if ((this_ptr & 1) != 0) return;
10118 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
10119 FREE((void*)this_ptr);
10120 MonitorEvent_free(this_ptr_conv);
10123 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
10124 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
10125 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
10126 *ret_copy = MonitorEvent_clone(orig_conv);
10127 long ret_ref = (long)ret_copy;
10131 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
10132 LDKHTLCUpdate this_obj_conv;
10133 this_obj_conv.inner = (void*)(this_obj & (~1));
10134 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10135 HTLCUpdate_free(this_obj_conv);
10138 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
10139 LDKHTLCUpdate orig_conv;
10140 orig_conv.inner = (void*)(orig & (~1));
10141 orig_conv.is_owned = false;
10142 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
10143 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10144 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10145 long ret_ref = (long)ret_var.inner;
10146 if (ret_var.is_owned) {
10152 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
10153 LDKHTLCUpdate obj_conv;
10154 obj_conv.inner = (void*)(obj & (~1));
10155 obj_conv.is_owned = false;
10156 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
10157 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10158 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10159 CVec_u8Z_free(ret_var);
10163 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
10164 LDKu8slice ser_ref;
10165 ser_ref.datalen = *((uint32_t*)ser);
10166 ser_ref.data = (int8_t*)(ser + 4);
10167 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10168 *ret_conv = HTLCUpdate_read(ser_ref);
10169 return (long)ret_conv;
10172 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
10173 LDKChannelMonitor this_obj_conv;
10174 this_obj_conv.inner = (void*)(this_obj & (~1));
10175 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10176 ChannelMonitor_free(this_obj_conv);
10179 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
10180 LDKChannelMonitor orig_conv;
10181 orig_conv.inner = (void*)(orig & (~1));
10182 orig_conv.is_owned = false;
10183 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
10184 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10185 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10186 long ret_ref = (long)ret_var.inner;
10187 if (ret_var.is_owned) {
10193 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
10194 LDKChannelMonitor obj_conv;
10195 obj_conv.inner = (void*)(obj & (~1));
10196 obj_conv.is_owned = false;
10197 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
10198 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10199 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10200 CVec_u8Z_free(ret_var);
10204 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) {
10205 LDKChannelMonitor this_arg_conv;
10206 this_arg_conv.inner = (void*)(this_arg & (~1));
10207 this_arg_conv.is_owned = false;
10208 LDKChannelMonitorUpdate updates_conv;
10209 updates_conv.inner = (void*)(updates & (~1));
10210 updates_conv.is_owned = false;
10211 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10212 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10213 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
10214 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10215 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
10216 return (long)ret_conv;
10219 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
10220 LDKChannelMonitor this_arg_conv;
10221 this_arg_conv.inner = (void*)(this_arg & (~1));
10222 this_arg_conv.is_owned = false;
10223 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
10227 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
10228 LDKChannelMonitor this_arg_conv;
10229 this_arg_conv.inner = (void*)(this_arg & (~1));
10230 this_arg_conv.is_owned = false;
10231 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10232 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
10233 return (long)ret_ref;
10236 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
10237 LDKChannelMonitor this_arg_conv;
10238 this_arg_conv.inner = (void*)(this_arg & (~1));
10239 this_arg_conv.is_owned = false;
10240 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
10241 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10242 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10243 for (size_t c = 0; c < ret_var.datalen; c++) {
10244 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_54_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10245 *ret_conv_54_ref = ret_var.data[c];
10246 ret_arr_ptr[c] = (long)ret_conv_54_ref;
10248 FREE(ret_var.data);
10252 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
10253 LDKChannelMonitor this_arg_conv;
10254 this_arg_conv.inner = (void*)(this_arg & (~1));
10255 this_arg_conv.is_owned = false;
10256 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
10257 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
10260 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
10261 LDKChannelMonitor this_arg_conv;
10262 this_arg_conv.inner = (void*)(this_arg & (~1));
10263 this_arg_conv.is_owned = false;
10264 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
10265 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10266 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10267 for (size_t o = 0; o < ret_var.datalen; o++) {
10268 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
10269 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
10270 long ret_conv_14_ref = (long)ret_conv_14_copy;
10271 ret_arr_ptr[o] = ret_conv_14_ref;
10273 FREE(ret_var.data);
10277 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
10278 LDKChannelMonitor this_arg_conv;
10279 this_arg_conv.inner = (void*)(this_arg & (~1));
10280 this_arg_conv.is_owned = false;
10281 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
10282 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10283 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10284 for (size_t h = 0; h < ret_var.datalen; h++) {
10285 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10286 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
10287 long ret_conv_7_ref = (long)ret_conv_7_copy;
10288 ret_arr_ptr[h] = ret_conv_7_ref;
10290 FREE(ret_var.data);
10294 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
10295 LDKChannelMonitor this_arg_conv;
10296 this_arg_conv.inner = (void*)(this_arg & (~1));
10297 this_arg_conv.is_owned = false;
10298 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
10299 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
10300 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
10301 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
10302 for (size_t m = 0; m < ret_var.datalen; m++) {
10303 LDKTransaction ret_conv_12_var = ret_var.data[m];
10304 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10305 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
10306 Transaction_free(ret_conv_12_var);
10307 ret_arr_ptr[m] = ret_conv_12_arr;
10309 FREE(ret_var.data);
10313 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) {
10314 LDKChannelMonitor this_arg_conv;
10315 this_arg_conv.inner = (void*)(this_arg & (~1));
10316 this_arg_conv.is_owned = false;
10317 unsigned char header_arr[80];
10318 CHECK(*((uint32_t*)header) == 80);
10319 memcpy(header_arr, (uint8_t*)(header + 4), 80);
10320 unsigned char (*header_ref)[80] = &header_arr;
10321 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10322 txdata_constr.datalen = *((uint32_t*)txdata);
10323 if (txdata_constr.datalen > 0)
10324 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10326 txdata_constr.data = NULL;
10327 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
10328 for (size_t e = 0; e < txdata_constr.datalen; e++) {
10329 uint32_t txdata_conv_30 = txdata_vals[e];
10330 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
10331 // Warning: we may need a move here but no clone is available for LDKC2Tuple_usizeTransactionZ
10332 txdata_constr.data[e] = txdata_conv_30_conv;
10334 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10335 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10336 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10337 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);
10338 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10339 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10340 for (size_t x = 0; x < ret_var.datalen; x++) {
10341 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10342 *ret_conv_49_ref = ret_var.data[x];
10343 ret_arr_ptr[x] = (long)ret_conv_49_ref;
10345 FREE(ret_var.data);
10349 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) {
10350 LDKChannelMonitor this_arg_conv;
10351 this_arg_conv.inner = (void*)(this_arg & (~1));
10352 this_arg_conv.is_owned = false;
10353 unsigned char header_arr[80];
10354 CHECK(*((uint32_t*)header) == 80);
10355 memcpy(header_arr, (uint8_t*)(header + 4), 80);
10356 unsigned char (*header_ref)[80] = &header_arr;
10357 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10358 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10359 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10360 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
10363 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) {
10364 LDKChannelMonitor this_arg_conv;
10365 this_arg_conv.inner = (void*)(this_arg & (~1));
10366 this_arg_conv.is_owned = false;
10367 unsigned char header_arr[80];
10368 CHECK(*((uint32_t*)header) == 80);
10369 memcpy(header_arr, (uint8_t*)(header + 4), 80);
10370 unsigned char (*header_ref)[80] = &header_arr;
10371 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10372 txdata_constr.datalen = *((uint32_t*)txdata);
10373 if (txdata_constr.datalen > 0)
10374 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10376 txdata_constr.data = NULL;
10377 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
10378 for (size_t e = 0; e < txdata_constr.datalen; e++) {
10379 uint32_t txdata_conv_30 = txdata_vals[e];
10380 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
10381 // Warning: we may need a move here but no clone is available for LDKC2Tuple_usizeTransactionZ
10382 txdata_constr.data[e] = txdata_conv_30_conv;
10384 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10385 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10386 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10387 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);
10388 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10389 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10390 for (size_t x = 0; x < ret_var.datalen; x++) {
10391 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10392 *ret_conv_49_ref = ret_var.data[x];
10393 ret_arr_ptr[x] = (long)ret_conv_49_ref;
10395 FREE(ret_var.data);
10399 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) {
10400 LDKChannelMonitor this_arg_conv;
10401 this_arg_conv.inner = (void*)(this_arg & (~1));
10402 this_arg_conv.is_owned = false;
10403 unsigned char txid_arr[32];
10404 CHECK(*((uint32_t*)txid) == 32);
10405 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
10406 unsigned char (*txid_ref)[32] = &txid_arr;
10407 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10408 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10409 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10410 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
10413 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) {
10414 LDKChannelMonitor this_arg_conv;
10415 this_arg_conv.inner = (void*)(this_arg & (~1));
10416 this_arg_conv.is_owned = false;
10417 unsigned char header_arr[80];
10418 CHECK(*((uint32_t*)header) == 80);
10419 memcpy(header_arr, (uint8_t*)(header + 4), 80);
10420 unsigned char (*header_ref)[80] = &header_arr;
10421 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10422 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10423 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10424 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_update_best_block(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
10425 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10426 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10427 for (size_t x = 0; x < ret_var.datalen; x++) {
10428 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10429 *ret_conv_49_ref = ret_var.data[x];
10430 ret_arr_ptr[x] = (long)ret_conv_49_ref;
10432 FREE(ret_var.data);
10436 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
10437 LDKChannelMonitor this_arg_conv;
10438 this_arg_conv.inner = (void*)(this_arg & (~1));
10439 this_arg_conv.is_owned = false;
10440 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
10441 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
10442 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
10443 for (size_t m = 0; m < ret_var.datalen; m++) {
10444 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10445 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
10446 ret_arr_ptr[m] = ret_conv_12_arr;
10448 FREE(ret_var.data);
10452 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
10453 if ((this_ptr & 1) != 0) return;
10454 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
10455 FREE((void*)this_ptr);
10456 Persist_free(this_ptr_conv);
10459 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
10460 LDKu8slice ser_ref;
10461 ser_ref.datalen = *((uint32_t*)ser);
10462 ser_ref.data = (int8_t*)(ser + 4);
10463 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
10464 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10465 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
10466 return (long)ret_conv;
10469 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
10470 LDKOutPoint this_obj_conv;
10471 this_obj_conv.inner = (void*)(this_obj & (~1));
10472 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10473 OutPoint_free(this_obj_conv);
10476 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
10477 LDKOutPoint this_ptr_conv;
10478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10479 this_ptr_conv.is_owned = false;
10480 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10481 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
10485 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
10486 LDKOutPoint this_ptr_conv;
10487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10488 this_ptr_conv.is_owned = false;
10489 LDKThirtyTwoBytes val_ref;
10490 CHECK(*((uint32_t*)val) == 32);
10491 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10492 OutPoint_set_txid(&this_ptr_conv, val_ref);
10495 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
10496 LDKOutPoint this_ptr_conv;
10497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10498 this_ptr_conv.is_owned = false;
10499 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
10503 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
10504 LDKOutPoint this_ptr_conv;
10505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10506 this_ptr_conv.is_owned = false;
10507 OutPoint_set_index(&this_ptr_conv, val);
10510 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
10511 LDKThirtyTwoBytes txid_arg_ref;
10512 CHECK(*((uint32_t*)txid_arg) == 32);
10513 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
10514 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
10515 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10516 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10517 long ret_ref = (long)ret_var.inner;
10518 if (ret_var.is_owned) {
10524 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
10525 LDKOutPoint orig_conv;
10526 orig_conv.inner = (void*)(orig & (~1));
10527 orig_conv.is_owned = false;
10528 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
10529 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10530 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10531 long ret_ref = (long)ret_var.inner;
10532 if (ret_var.is_owned) {
10538 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
10539 LDKOutPoint this_arg_conv;
10540 this_arg_conv.inner = (void*)(this_arg & (~1));
10541 this_arg_conv.is_owned = false;
10542 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10543 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
10547 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
10548 LDKOutPoint obj_conv;
10549 obj_conv.inner = (void*)(obj & (~1));
10550 obj_conv.is_owned = false;
10551 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
10552 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10553 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10554 CVec_u8Z_free(ret_var);
10558 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
10559 LDKu8slice ser_ref;
10560 ser_ref.datalen = *((uint32_t*)ser);
10561 ser_ref.data = (int8_t*)(ser + 4);
10562 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10563 *ret_conv = OutPoint_read(ser_ref);
10564 return (long)ret_conv;
10567 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
10568 LDKDelayedPaymentOutputDescriptor this_obj_conv;
10569 this_obj_conv.inner = (void*)(this_obj & (~1));
10570 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10571 DelayedPaymentOutputDescriptor_free(this_obj_conv);
10574 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
10575 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10577 this_ptr_conv.is_owned = false;
10578 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
10579 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10580 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10581 long ret_ref = (long)ret_var.inner;
10582 if (ret_var.is_owned) {
10588 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
10589 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10591 this_ptr_conv.is_owned = false;
10592 LDKOutPoint val_conv;
10593 val_conv.inner = (void*)(val & (~1));
10594 val_conv.is_owned = (val & 1) || (val == 0);
10595 val_conv = OutPoint_clone(&val_conv);
10596 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
10599 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
10600 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10602 this_ptr_conv.is_owned = false;
10603 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10604 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
10608 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
10609 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10611 this_ptr_conv.is_owned = false;
10612 LDKPublicKey val_ref;
10613 CHECK(*((uint32_t*)val) == 33);
10614 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10615 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
10618 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
10619 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10621 this_ptr_conv.is_owned = false;
10622 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
10626 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
10627 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10629 this_ptr_conv.is_owned = false;
10630 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
10633 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
10634 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10636 this_ptr_conv.is_owned = false;
10637 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
10639 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
10642 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
10643 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10645 this_ptr_conv.is_owned = false;
10646 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10647 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
10651 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
10652 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10654 this_ptr_conv.is_owned = false;
10655 LDKPublicKey val_ref;
10656 CHECK(*((uint32_t*)val) == 33);
10657 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10658 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
10661 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
10662 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10664 this_ptr_conv.is_owned = false;
10665 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10666 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
10670 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
10671 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10673 this_ptr_conv.is_owned = false;
10674 LDKThirtyTwoBytes val_ref;
10675 CHECK(*((uint32_t*)val) == 32);
10676 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10677 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
10680 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
10681 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10683 this_ptr_conv.is_owned = false;
10684 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
10688 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
10689 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10691 this_ptr_conv.is_owned = false;
10692 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
10695 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) {
10696 LDKOutPoint outpoint_arg_conv;
10697 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
10698 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
10699 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
10700 LDKPublicKey per_commitment_point_arg_ref;
10701 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
10702 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
10703 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
10704 FREE((void*)output_arg);
10705 LDKPublicKey revocation_pubkey_arg_ref;
10706 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
10707 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
10708 LDKThirtyTwoBytes channel_keys_id_arg_ref;
10709 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
10710 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
10711 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);
10712 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10713 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10714 long ret_ref = (long)ret_var.inner;
10715 if (ret_var.is_owned) {
10721 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
10722 LDKDelayedPaymentOutputDescriptor orig_conv;
10723 orig_conv.inner = (void*)(orig & (~1));
10724 orig_conv.is_owned = false;
10725 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
10726 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10727 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10728 long ret_ref = (long)ret_var.inner;
10729 if (ret_var.is_owned) {
10735 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
10736 LDKStaticPaymentOutputDescriptor this_obj_conv;
10737 this_obj_conv.inner = (void*)(this_obj & (~1));
10738 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10739 StaticPaymentOutputDescriptor_free(this_obj_conv);
10742 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
10743 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10745 this_ptr_conv.is_owned = false;
10746 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
10747 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10748 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10749 long ret_ref = (long)ret_var.inner;
10750 if (ret_var.is_owned) {
10756 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
10757 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10759 this_ptr_conv.is_owned = false;
10760 LDKOutPoint val_conv;
10761 val_conv.inner = (void*)(val & (~1));
10762 val_conv.is_owned = (val & 1) || (val == 0);
10763 val_conv = OutPoint_clone(&val_conv);
10764 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
10767 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
10768 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10770 this_ptr_conv.is_owned = false;
10771 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
10773 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
10776 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
10777 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10779 this_ptr_conv.is_owned = false;
10780 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10781 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
10785 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
10786 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10788 this_ptr_conv.is_owned = false;
10789 LDKThirtyTwoBytes val_ref;
10790 CHECK(*((uint32_t*)val) == 32);
10791 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10792 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
10795 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
10796 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10798 this_ptr_conv.is_owned = false;
10799 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
10803 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
10804 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10806 this_ptr_conv.is_owned = false;
10807 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
10810 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) {
10811 LDKOutPoint outpoint_arg_conv;
10812 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
10813 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
10814 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
10815 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
10816 FREE((void*)output_arg);
10817 LDKThirtyTwoBytes channel_keys_id_arg_ref;
10818 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
10819 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
10820 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
10821 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10822 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10823 long ret_ref = (long)ret_var.inner;
10824 if (ret_var.is_owned) {
10830 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
10831 LDKStaticPaymentOutputDescriptor orig_conv;
10832 orig_conv.inner = (void*)(orig & (~1));
10833 orig_conv.is_owned = false;
10834 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
10835 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10836 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10837 long ret_ref = (long)ret_var.inner;
10838 if (ret_var.is_owned) {
10844 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
10845 if ((this_ptr & 1) != 0) return;
10846 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
10847 FREE((void*)this_ptr);
10848 SpendableOutputDescriptor_free(this_ptr_conv);
10851 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
10852 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
10853 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
10854 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
10855 long ret_ref = (long)ret_copy;
10859 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
10860 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
10861 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
10862 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10863 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10864 CVec_u8Z_free(ret_var);
10868 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
10869 LDKu8slice ser_ref;
10870 ser_ref.datalen = *((uint32_t*)ser);
10871 ser_ref.data = (int8_t*)(ser + 4);
10872 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10873 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
10874 return (long)ret_conv;
10877 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
10878 if ((this_ptr & 1) != 0) return;
10879 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
10880 FREE((void*)this_ptr);
10881 BaseSign_free(this_ptr_conv);
10884 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
10885 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
10886 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
10887 *ret = Sign_clone(orig_conv);
10891 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
10892 if ((this_ptr & 1) != 0) return;
10893 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
10894 FREE((void*)this_ptr);
10895 Sign_free(this_ptr_conv);
10898 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
10899 if ((this_ptr & 1) != 0) return;
10900 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
10901 FREE((void*)this_ptr);
10902 KeysInterface_free(this_ptr_conv);
10905 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
10906 LDKInMemorySigner this_obj_conv;
10907 this_obj_conv.inner = (void*)(this_obj & (~1));
10908 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10909 InMemorySigner_free(this_obj_conv);
10912 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
10913 LDKInMemorySigner this_ptr_conv;
10914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10915 this_ptr_conv.is_owned = false;
10916 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10917 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
10921 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
10922 LDKInMemorySigner this_ptr_conv;
10923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10924 this_ptr_conv.is_owned = false;
10925 LDKSecretKey val_ref;
10926 CHECK(*((uint32_t*)val) == 32);
10927 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10928 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
10931 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
10932 LDKInMemorySigner this_ptr_conv;
10933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10934 this_ptr_conv.is_owned = false;
10935 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10936 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
10940 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
10941 LDKInMemorySigner this_ptr_conv;
10942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10943 this_ptr_conv.is_owned = false;
10944 LDKSecretKey val_ref;
10945 CHECK(*((uint32_t*)val) == 32);
10946 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10947 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
10950 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
10951 LDKInMemorySigner this_ptr_conv;
10952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10953 this_ptr_conv.is_owned = false;
10954 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10955 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
10959 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
10960 LDKInMemorySigner this_ptr_conv;
10961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10962 this_ptr_conv.is_owned = false;
10963 LDKSecretKey val_ref;
10964 CHECK(*((uint32_t*)val) == 32);
10965 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10966 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
10969 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
10970 LDKInMemorySigner this_ptr_conv;
10971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10972 this_ptr_conv.is_owned = false;
10973 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10974 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
10978 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
10979 LDKInMemorySigner this_ptr_conv;
10980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10981 this_ptr_conv.is_owned = false;
10982 LDKSecretKey val_ref;
10983 CHECK(*((uint32_t*)val) == 32);
10984 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10985 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
10988 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
10989 LDKInMemorySigner this_ptr_conv;
10990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10991 this_ptr_conv.is_owned = false;
10992 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10993 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
10997 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
10998 LDKInMemorySigner this_ptr_conv;
10999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11000 this_ptr_conv.is_owned = false;
11001 LDKSecretKey val_ref;
11002 CHECK(*((uint32_t*)val) == 32);
11003 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
11004 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
11007 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
11008 LDKInMemorySigner this_ptr_conv;
11009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11010 this_ptr_conv.is_owned = false;
11011 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11012 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
11016 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
11017 LDKInMemorySigner this_ptr_conv;
11018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11019 this_ptr_conv.is_owned = false;
11020 LDKThirtyTwoBytes val_ref;
11021 CHECK(*((uint32_t*)val) == 32);
11022 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11023 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
11026 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
11027 LDKInMemorySigner orig_conv;
11028 orig_conv.inner = (void*)(orig & (~1));
11029 orig_conv.is_owned = false;
11030 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
11031 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11032 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11033 long ret_ref = (long)ret_var.inner;
11034 if (ret_var.is_owned) {
11040 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) {
11041 LDKSecretKey funding_key_ref;
11042 CHECK(*((uint32_t*)funding_key) == 32);
11043 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
11044 LDKSecretKey revocation_base_key_ref;
11045 CHECK(*((uint32_t*)revocation_base_key) == 32);
11046 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
11047 LDKSecretKey payment_key_ref;
11048 CHECK(*((uint32_t*)payment_key) == 32);
11049 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
11050 LDKSecretKey delayed_payment_base_key_ref;
11051 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
11052 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
11053 LDKSecretKey htlc_base_key_ref;
11054 CHECK(*((uint32_t*)htlc_base_key) == 32);
11055 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
11056 LDKThirtyTwoBytes commitment_seed_ref;
11057 CHECK(*((uint32_t*)commitment_seed) == 32);
11058 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
11059 LDKThirtyTwoBytes channel_keys_id_ref;
11060 CHECK(*((uint32_t*)channel_keys_id) == 32);
11061 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
11062 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);
11063 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11064 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11065 long ret_ref = (long)ret_var.inner;
11066 if (ret_var.is_owned) {
11072 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
11073 LDKInMemorySigner this_arg_conv;
11074 this_arg_conv.inner = (void*)(this_arg & (~1));
11075 this_arg_conv.is_owned = false;
11076 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
11077 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11078 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11079 long ret_ref = (long)ret_var.inner;
11080 if (ret_var.is_owned) {
11086 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
11087 LDKInMemorySigner this_arg_conv;
11088 this_arg_conv.inner = (void*)(this_arg & (~1));
11089 this_arg_conv.is_owned = false;
11090 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
11094 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
11095 LDKInMemorySigner this_arg_conv;
11096 this_arg_conv.inner = (void*)(this_arg & (~1));
11097 this_arg_conv.is_owned = false;
11098 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
11102 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
11103 LDKInMemorySigner this_arg_conv;
11104 this_arg_conv.inner = (void*)(this_arg & (~1));
11105 this_arg_conv.is_owned = false;
11106 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
11110 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
11111 LDKInMemorySigner this_arg_conv;
11112 this_arg_conv.inner = (void*)(this_arg & (~1));
11113 this_arg_conv.is_owned = false;
11114 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
11115 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11116 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11117 long ret_ref = (long)ret_var.inner;
11118 if (ret_var.is_owned) {
11124 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
11125 LDKInMemorySigner this_arg_conv;
11126 this_arg_conv.inner = (void*)(this_arg & (~1));
11127 this_arg_conv.is_owned = false;
11128 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
11129 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11130 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11131 long ret_ref = (long)ret_var.inner;
11132 if (ret_var.is_owned) {
11138 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) {
11139 LDKInMemorySigner this_arg_conv;
11140 this_arg_conv.inner = (void*)(this_arg & (~1));
11141 this_arg_conv.is_owned = false;
11142 LDKTransaction spend_tx_ref;
11143 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
11144 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
11145 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
11146 spend_tx_ref.data_is_owned = true;
11147 LDKStaticPaymentOutputDescriptor descriptor_conv;
11148 descriptor_conv.inner = (void*)(descriptor & (~1));
11149 descriptor_conv.is_owned = false;
11150 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11151 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
11152 return (long)ret_conv;
11155 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) {
11156 LDKInMemorySigner this_arg_conv;
11157 this_arg_conv.inner = (void*)(this_arg & (~1));
11158 this_arg_conv.is_owned = false;
11159 LDKTransaction spend_tx_ref;
11160 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
11161 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
11162 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
11163 spend_tx_ref.data_is_owned = true;
11164 LDKDelayedPaymentOutputDescriptor descriptor_conv;
11165 descriptor_conv.inner = (void*)(descriptor & (~1));
11166 descriptor_conv.is_owned = false;
11167 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11168 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
11169 return (long)ret_conv;
11172 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
11173 LDKInMemorySigner this_arg_conv;
11174 this_arg_conv.inner = (void*)(this_arg & (~1));
11175 this_arg_conv.is_owned = false;
11176 LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
11177 *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
11181 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
11182 LDKInMemorySigner this_arg_conv;
11183 this_arg_conv.inner = (void*)(this_arg & (~1));
11184 this_arg_conv.is_owned = false;
11185 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
11186 *ret = InMemorySigner_as_Sign(&this_arg_conv);
11190 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
11191 LDKInMemorySigner obj_conv;
11192 obj_conv.inner = (void*)(obj & (~1));
11193 obj_conv.is_owned = false;
11194 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
11195 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11196 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
11197 CVec_u8Z_free(ret_var);
11201 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
11202 LDKu8slice ser_ref;
11203 ser_ref.datalen = *((uint32_t*)ser);
11204 ser_ref.data = (int8_t*)(ser + 4);
11205 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11206 *ret_conv = InMemorySigner_read(ser_ref);
11207 return (long)ret_conv;
11210 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
11211 LDKKeysManager this_obj_conv;
11212 this_obj_conv.inner = (void*)(this_obj & (~1));
11213 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11214 KeysManager_free(this_obj_conv);
11217 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
11218 unsigned char seed_arr[32];
11219 CHECK(*((uint32_t*)seed) == 32);
11220 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
11221 unsigned char (*seed_ref)[32] = &seed_arr;
11222 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
11223 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11224 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11225 long ret_ref = (long)ret_var.inner;
11226 if (ret_var.is_owned) {
11232 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
11233 LDKKeysManager this_arg_conv;
11234 this_arg_conv.inner = (void*)(this_arg & (~1));
11235 this_arg_conv.is_owned = false;
11236 unsigned char params_arr[32];
11237 CHECK(*((uint32_t*)params) == 32);
11238 memcpy(params_arr, (uint8_t*)(params + 4), 32);
11239 unsigned char (*params_ref)[32] = ¶ms_arr;
11240 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
11241 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11242 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11243 long ret_ref = (long)ret_var.inner;
11244 if (ret_var.is_owned) {
11250 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) {
11251 LDKKeysManager this_arg_conv;
11252 this_arg_conv.inner = (void*)(this_arg & (~1));
11253 this_arg_conv.is_owned = false;
11254 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
11255 descriptors_constr.datalen = *((uint32_t*)descriptors);
11256 if (descriptors_constr.datalen > 0)
11257 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
11259 descriptors_constr.data = NULL;
11260 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
11261 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
11262 uint32_t descriptors_conv_27 = descriptors_vals[b];
11263 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
11264 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
11265 descriptors_constr.data[b] = descriptors_conv_27_conv;
11267 LDKCVec_TxOutZ outputs_constr;
11268 outputs_constr.datalen = *((uint32_t*)outputs);
11269 if (outputs_constr.datalen > 0)
11270 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
11272 outputs_constr.data = NULL;
11273 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
11274 for (size_t h = 0; h < outputs_constr.datalen; h++) {
11275 uint32_t outputs_conv_7 = outputs_vals[h];
11276 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
11277 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
11278 outputs_constr.data[h] = outputs_conv_7_conv;
11280 LDKCVec_u8Z change_destination_script_ref;
11281 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
11282 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
11283 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
11284 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11285 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
11286 return (long)ret_conv;
11289 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
11290 LDKKeysManager this_arg_conv;
11291 this_arg_conv.inner = (void*)(this_arg & (~1));
11292 this_arg_conv.is_owned = false;
11293 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
11294 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
11298 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
11299 LDKChannelManager this_obj_conv;
11300 this_obj_conv.inner = (void*)(this_obj & (~1));
11301 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11302 ChannelManager_free(this_obj_conv);
11305 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
11306 LDKChainParameters this_obj_conv;
11307 this_obj_conv.inner = (void*)(this_obj & (~1));
11308 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11309 ChainParameters_free(this_obj_conv);
11312 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
11313 LDKChainParameters this_ptr_conv;
11314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11315 this_ptr_conv.is_owned = false;
11316 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
11320 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
11321 LDKChainParameters this_ptr_conv;
11322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11323 this_ptr_conv.is_owned = false;
11324 LDKNetwork val_conv = LDKNetwork_from_js(val);
11325 ChainParameters_set_network(&this_ptr_conv, val_conv);
11328 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
11329 LDKChainParameters this_ptr_conv;
11330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11331 this_ptr_conv.is_owned = false;
11332 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
11333 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11334 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11335 long ret_ref = (long)ret_var.inner;
11336 if (ret_var.is_owned) {
11342 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
11343 LDKChainParameters this_ptr_conv;
11344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11345 this_ptr_conv.is_owned = false;
11346 LDKBestBlock val_conv;
11347 val_conv.inner = (void*)(val & (~1));
11348 val_conv.is_owned = (val & 1) || (val == 0);
11349 val_conv = BestBlock_clone(&val_conv);
11350 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
11353 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
11354 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
11355 LDKBestBlock best_block_arg_conv;
11356 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
11357 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
11358 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
11359 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
11360 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11361 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11362 long ret_ref = (long)ret_var.inner;
11363 if (ret_var.is_owned) {
11369 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
11370 LDKBestBlock this_obj_conv;
11371 this_obj_conv.inner = (void*)(this_obj & (~1));
11372 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11373 BestBlock_free(this_obj_conv);
11376 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
11377 LDKBestBlock orig_conv;
11378 orig_conv.inner = (void*)(orig & (~1));
11379 orig_conv.is_owned = false;
11380 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
11381 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11382 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11383 long ret_ref = (long)ret_var.inner;
11384 if (ret_var.is_owned) {
11390 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
11391 LDKNetwork network_conv = LDKNetwork_from_js(network);
11392 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
11393 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11394 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11395 long ret_ref = (long)ret_var.inner;
11396 if (ret_var.is_owned) {
11402 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
11403 LDKThirtyTwoBytes block_hash_ref;
11404 CHECK(*((uint32_t*)block_hash) == 32);
11405 memcpy(block_hash_ref.data, (uint8_t*)(block_hash + 4), 32);
11406 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
11407 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11408 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11409 long ret_ref = (long)ret_var.inner;
11410 if (ret_var.is_owned) {
11416 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
11417 LDKBestBlock this_arg_conv;
11418 this_arg_conv.inner = (void*)(this_arg & (~1));
11419 this_arg_conv.is_owned = false;
11420 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11421 memcpy((uint8_t*)(ret_arr + 4), BestBlock_block_hash(&this_arg_conv).data, 32);
11425 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
11426 LDKBestBlock this_arg_conv;
11427 this_arg_conv.inner = (void*)(this_arg & (~1));
11428 this_arg_conv.is_owned = false;
11429 int32_t ret_val = BestBlock_height(&this_arg_conv);
11433 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
11434 LDKChannelDetails this_obj_conv;
11435 this_obj_conv.inner = (void*)(this_obj & (~1));
11436 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11437 ChannelDetails_free(this_obj_conv);
11440 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
11441 LDKChannelDetails this_ptr_conv;
11442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11443 this_ptr_conv.is_owned = false;
11444 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11445 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
11449 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
11450 LDKChannelDetails this_ptr_conv;
11451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11452 this_ptr_conv.is_owned = false;
11453 LDKThirtyTwoBytes val_ref;
11454 CHECK(*((uint32_t*)val) == 32);
11455 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11456 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
11459 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
11460 LDKChannelDetails this_ptr_conv;
11461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11462 this_ptr_conv.is_owned = false;
11463 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11464 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
11465 long ret_ref = (long)ret_copy;
11469 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
11470 LDKChannelDetails this_ptr_conv;
11471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11472 this_ptr_conv.is_owned = false;
11473 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
11475 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
11478 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_remote_network_id(uint32_t this_ptr) {
11479 LDKChannelDetails this_ptr_conv;
11480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11481 this_ptr_conv.is_owned = false;
11482 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11483 memcpy((uint8_t*)(ret_arr + 4), ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form, 33);
11487 void __attribute__((visibility("default"))) TS_ChannelDetails_set_remote_network_id(uint32_t this_ptr, int8_tArray val) {
11488 LDKChannelDetails this_ptr_conv;
11489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11490 this_ptr_conv.is_owned = false;
11491 LDKPublicKey val_ref;
11492 CHECK(*((uint32_t*)val) == 33);
11493 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11494 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
11497 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty_features(uint32_t this_ptr) {
11498 LDKChannelDetails this_ptr_conv;
11499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11500 this_ptr_conv.is_owned = false;
11501 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
11502 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11503 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11504 long ret_ref = (long)ret_var.inner;
11505 if (ret_var.is_owned) {
11511 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty_features(uint32_t this_ptr, uint32_t val) {
11512 LDKChannelDetails this_ptr_conv;
11513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11514 this_ptr_conv.is_owned = false;
11515 LDKInitFeatures val_conv;
11516 val_conv.inner = (void*)(val & (~1));
11517 val_conv.is_owned = (val & 1) || (val == 0);
11518 val_conv = InitFeatures_clone(&val_conv);
11519 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
11522 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
11523 LDKChannelDetails this_ptr_conv;
11524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11525 this_ptr_conv.is_owned = false;
11526 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
11530 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
11531 LDKChannelDetails this_ptr_conv;
11532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11533 this_ptr_conv.is_owned = false;
11534 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
11537 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_id(uint32_t this_ptr) {
11538 LDKChannelDetails this_ptr_conv;
11539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11540 this_ptr_conv.is_owned = false;
11541 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
11545 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_id(uint32_t this_ptr, int64_t val) {
11546 LDKChannelDetails this_ptr_conv;
11547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11548 this_ptr_conv.is_owned = false;
11549 ChannelDetails_set_user_id(&this_ptr_conv, val);
11552 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
11553 LDKChannelDetails this_ptr_conv;
11554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11555 this_ptr_conv.is_owned = false;
11556 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
11560 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
11561 LDKChannelDetails this_ptr_conv;
11562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11563 this_ptr_conv.is_owned = false;
11564 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
11567 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
11568 LDKChannelDetails this_ptr_conv;
11569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11570 this_ptr_conv.is_owned = false;
11571 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
11575 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
11576 LDKChannelDetails this_ptr_conv;
11577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11578 this_ptr_conv.is_owned = false;
11579 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
11582 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_live(uint32_t this_ptr) {
11583 LDKChannelDetails this_ptr_conv;
11584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11585 this_ptr_conv.is_owned = false;
11586 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
11590 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_live(uint32_t this_ptr, jboolean val) {
11591 LDKChannelDetails this_ptr_conv;
11592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11593 this_ptr_conv.is_owned = false;
11594 ChannelDetails_set_is_live(&this_ptr_conv, val);
11597 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
11598 LDKChannelDetails orig_conv;
11599 orig_conv.inner = (void*)(orig & (~1));
11600 orig_conv.is_owned = false;
11601 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
11602 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11603 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11604 long ret_ref = (long)ret_var.inner;
11605 if (ret_var.is_owned) {
11611 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
11612 if ((this_ptr & 1) != 0) return;
11613 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
11614 FREE((void*)this_ptr);
11615 PaymentSendFailure_free(this_ptr_conv);
11618 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
11619 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
11620 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
11621 *ret_copy = PaymentSendFailure_clone(orig_conv);
11622 long ret_ref = (long)ret_copy;
11626 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) {
11627 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
11628 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
11629 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
11630 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
11631 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
11632 LDKUserConfig config_conv;
11633 config_conv.inner = (void*)(config & (~1));
11634 config_conv.is_owned = (config & 1) || (config == 0);
11635 config_conv = UserConfig_clone(&config_conv);
11636 LDKChainParameters params_conv;
11637 params_conv.inner = (void*)(params & (~1));
11638 params_conv.is_owned = (params & 1) || (params == 0);
11639 // Warning: we need a move here but no clone is available for LDKChainParameters
11640 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
11641 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11642 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11643 long ret_ref = (long)ret_var.inner;
11644 if (ret_var.is_owned) {
11650 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
11651 LDKChannelManager this_arg_conv;
11652 this_arg_conv.inner = (void*)(this_arg & (~1));
11653 this_arg_conv.is_owned = false;
11654 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
11655 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11656 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11657 long ret_ref = (long)ret_var.inner;
11658 if (ret_var.is_owned) {
11664 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) {
11665 LDKChannelManager this_arg_conv;
11666 this_arg_conv.inner = (void*)(this_arg & (~1));
11667 this_arg_conv.is_owned = false;
11668 LDKPublicKey their_network_key_ref;
11669 CHECK(*((uint32_t*)their_network_key) == 33);
11670 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
11671 LDKUserConfig override_config_conv;
11672 override_config_conv.inner = (void*)(override_config & (~1));
11673 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
11674 override_config_conv = UserConfig_clone(&override_config_conv);
11675 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11676 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
11677 return (long)ret_conv;
11680 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
11681 LDKChannelManager this_arg_conv;
11682 this_arg_conv.inner = (void*)(this_arg & (~1));
11683 this_arg_conv.is_owned = false;
11684 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
11685 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
11686 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
11687 for (size_t q = 0; q < ret_var.datalen; q++) {
11688 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
11689 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11690 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11691 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
11692 if (ret_conv_16_var.is_owned) {
11693 ret_conv_16_ref |= 1;
11695 ret_arr_ptr[q] = ret_conv_16_ref;
11697 FREE(ret_var.data);
11701 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
11702 LDKChannelManager this_arg_conv;
11703 this_arg_conv.inner = (void*)(this_arg & (~1));
11704 this_arg_conv.is_owned = false;
11705 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
11706 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
11707 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
11708 for (size_t q = 0; q < ret_var.datalen; q++) {
11709 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
11710 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11711 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11712 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
11713 if (ret_conv_16_var.is_owned) {
11714 ret_conv_16_ref |= 1;
11716 ret_arr_ptr[q] = ret_conv_16_ref;
11718 FREE(ret_var.data);
11722 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
11723 LDKChannelManager this_arg_conv;
11724 this_arg_conv.inner = (void*)(this_arg & (~1));
11725 this_arg_conv.is_owned = false;
11726 unsigned char channel_id_arr[32];
11727 CHECK(*((uint32_t*)channel_id) == 32);
11728 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
11729 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
11730 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11731 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
11732 return (long)ret_conv;
11735 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
11736 LDKChannelManager this_arg_conv;
11737 this_arg_conv.inner = (void*)(this_arg & (~1));
11738 this_arg_conv.is_owned = false;
11739 unsigned char channel_id_arr[32];
11740 CHECK(*((uint32_t*)channel_id) == 32);
11741 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
11742 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
11743 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11744 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
11745 return (long)ret_conv;
11748 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
11749 LDKChannelManager this_arg_conv;
11750 this_arg_conv.inner = (void*)(this_arg & (~1));
11751 this_arg_conv.is_owned = false;
11752 ChannelManager_force_close_all_channels(&this_arg_conv);
11755 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
11756 LDKChannelManager this_arg_conv;
11757 this_arg_conv.inner = (void*)(this_arg & (~1));
11758 this_arg_conv.is_owned = false;
11759 LDKRoute route_conv;
11760 route_conv.inner = (void*)(route & (~1));
11761 route_conv.is_owned = false;
11762 LDKThirtyTwoBytes payment_hash_ref;
11763 CHECK(*((uint32_t*)payment_hash) == 32);
11764 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
11765 LDKThirtyTwoBytes payment_secret_ref;
11766 CHECK(*((uint32_t*)payment_secret) == 32);
11767 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
11768 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11769 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
11770 return (long)ret_conv;
11773 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
11774 LDKChannelManager this_arg_conv;
11775 this_arg_conv.inner = (void*)(this_arg & (~1));
11776 this_arg_conv.is_owned = false;
11777 unsigned char temporary_channel_id_arr[32];
11778 CHECK(*((uint32_t*)temporary_channel_id) == 32);
11779 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
11780 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
11781 LDKTransaction funding_transaction_ref;
11782 funding_transaction_ref.datalen = *((uint32_t*)funding_transaction);
11783 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
11784 memcpy(funding_transaction_ref.data, (uint8_t*)(funding_transaction + 4), funding_transaction_ref.datalen);
11785 funding_transaction_ref.data_is_owned = true;
11786 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11787 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
11788 return (long)ret_conv;
11791 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
11792 LDKChannelManager this_arg_conv;
11793 this_arg_conv.inner = (void*)(this_arg & (~1));
11794 this_arg_conv.is_owned = false;
11795 LDKThreeBytes rgb_ref;
11796 CHECK(*((uint32_t*)rgb) == 3);
11797 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
11798 LDKThirtyTwoBytes alias_ref;
11799 CHECK(*((uint32_t*)alias) == 32);
11800 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
11801 LDKCVec_NetAddressZ addresses_constr;
11802 addresses_constr.datalen = *((uint32_t*)addresses);
11803 if (addresses_constr.datalen > 0)
11804 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11806 addresses_constr.data = NULL;
11807 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
11808 for (size_t m = 0; m < addresses_constr.datalen; m++) {
11809 uint32_t addresses_conv_12 = addresses_vals[m];
11810 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
11811 FREE((void*)addresses_conv_12);
11812 addresses_constr.data[m] = addresses_conv_12_conv;
11814 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
11817 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
11818 LDKChannelManager this_arg_conv;
11819 this_arg_conv.inner = (void*)(this_arg & (~1));
11820 this_arg_conv.is_owned = false;
11821 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
11824 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
11825 LDKChannelManager this_arg_conv;
11826 this_arg_conv.inner = (void*)(this_arg & (~1));
11827 this_arg_conv.is_owned = false;
11828 ChannelManager_timer_tick_occurred(&this_arg_conv);
11831 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
11832 LDKChannelManager this_arg_conv;
11833 this_arg_conv.inner = (void*)(this_arg & (~1));
11834 this_arg_conv.is_owned = false;
11835 unsigned char payment_hash_arr[32];
11836 CHECK(*((uint32_t*)payment_hash) == 32);
11837 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
11838 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
11839 LDKThirtyTwoBytes payment_secret_ref;
11840 CHECK(*((uint32_t*)payment_secret) == 32);
11841 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
11842 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
11846 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t expected_amount) {
11847 LDKChannelManager this_arg_conv;
11848 this_arg_conv.inner = (void*)(this_arg & (~1));
11849 this_arg_conv.is_owned = false;
11850 LDKThirtyTwoBytes payment_preimage_ref;
11851 CHECK(*((uint32_t*)payment_preimage) == 32);
11852 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
11853 LDKThirtyTwoBytes payment_secret_ref;
11854 CHECK(*((uint32_t*)payment_secret) == 32);
11855 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
11856 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
11860 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
11861 LDKChannelManager this_arg_conv;
11862 this_arg_conv.inner = (void*)(this_arg & (~1));
11863 this_arg_conv.is_owned = false;
11864 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11865 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
11869 void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
11870 LDKChannelManager this_arg_conv;
11871 this_arg_conv.inner = (void*)(this_arg & (~1));
11872 this_arg_conv.is_owned = false;
11873 LDKOutPoint funding_txo_conv;
11874 funding_txo_conv.inner = (void*)(funding_txo & (~1));
11875 funding_txo_conv.is_owned = false;
11876 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
11879 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
11880 LDKChannelManager this_arg_conv;
11881 this_arg_conv.inner = (void*)(this_arg & (~1));
11882 this_arg_conv.is_owned = false;
11883 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
11884 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
11888 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
11889 LDKChannelManager this_arg_conv;
11890 this_arg_conv.inner = (void*)(this_arg & (~1));
11891 this_arg_conv.is_owned = false;
11892 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
11893 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
11897 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
11898 LDKChannelManager this_arg_conv;
11899 this_arg_conv.inner = (void*)(this_arg & (~1));
11900 this_arg_conv.is_owned = false;
11901 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
11902 *ret = ChannelManager_as_Listen(&this_arg_conv);
11906 void __attribute__((visibility("default"))) TS_ChannelManager_transactions_confirmed(uint32_t this_arg, int8_tArray header, int32_t height, uint32_tArray txdata) {
11907 LDKChannelManager this_arg_conv;
11908 this_arg_conv.inner = (void*)(this_arg & (~1));
11909 this_arg_conv.is_owned = false;
11910 unsigned char header_arr[80];
11911 CHECK(*((uint32_t*)header) == 80);
11912 memcpy(header_arr, (uint8_t*)(header + 4), 80);
11913 unsigned char (*header_ref)[80] = &header_arr;
11914 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11915 txdata_constr.datalen = *((uint32_t*)txdata);
11916 if (txdata_constr.datalen > 0)
11917 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11919 txdata_constr.data = NULL;
11920 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
11921 for (size_t e = 0; e < txdata_constr.datalen; e++) {
11922 uint32_t txdata_conv_30 = txdata_vals[e];
11923 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
11924 // Warning: we may need a move here but no clone is available for LDKC2Tuple_usizeTransactionZ
11925 txdata_constr.data[e] = txdata_conv_30_conv;
11927 ChannelManager_transactions_confirmed(&this_arg_conv, header_ref, height, txdata_constr);
11930 void __attribute__((visibility("default"))) TS_ChannelManager_update_best_block(uint32_t this_arg, int8_tArray header, int32_t height) {
11931 LDKChannelManager this_arg_conv;
11932 this_arg_conv.inner = (void*)(this_arg & (~1));
11933 this_arg_conv.is_owned = false;
11934 unsigned char header_arr[80];
11935 CHECK(*((uint32_t*)header) == 80);
11936 memcpy(header_arr, (uint8_t*)(header + 4), 80);
11937 unsigned char (*header_ref)[80] = &header_arr;
11938 ChannelManager_update_best_block(&this_arg_conv, header_ref, height);
11941 ptrArray __attribute__((visibility("default"))) TS_ChannelManager_get_relevant_txids(uint32_t this_arg) {
11942 LDKChannelManager this_arg_conv;
11943 this_arg_conv.inner = (void*)(this_arg & (~1));
11944 this_arg_conv.is_owned = false;
11945 LDKCVec_TxidZ ret_var = ChannelManager_get_relevant_txids(&this_arg_conv);
11946 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
11947 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
11948 for (size_t m = 0; m < ret_var.datalen; m++) {
11949 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11950 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
11951 ret_arr_ptr[m] = ret_conv_12_arr;
11953 FREE(ret_var.data);
11957 void __attribute__((visibility("default"))) TS_ChannelManager_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
11958 LDKChannelManager this_arg_conv;
11959 this_arg_conv.inner = (void*)(this_arg & (~1));
11960 this_arg_conv.is_owned = false;
11961 unsigned char txid_arr[32];
11962 CHECK(*((uint32_t*)txid) == 32);
11963 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
11964 unsigned char (*txid_ref)[32] = &txid_arr;
11965 ChannelManager_transaction_unconfirmed(&this_arg_conv, txid_ref);
11968 jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
11969 LDKChannelManager this_arg_conv;
11970 this_arg_conv.inner = (void*)(this_arg & (~1));
11971 this_arg_conv.is_owned = false;
11972 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
11976 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
11977 LDKChannelManager this_arg_conv;
11978 this_arg_conv.inner = (void*)(this_arg & (~1));
11979 this_arg_conv.is_owned = false;
11980 ChannelManager_await_persistable_update(&this_arg_conv);
11983 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
11984 LDKChannelManager this_arg_conv;
11985 this_arg_conv.inner = (void*)(this_arg & (~1));
11986 this_arg_conv.is_owned = false;
11987 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
11988 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
11992 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
11993 LDKChannelManager obj_conv;
11994 obj_conv.inner = (void*)(obj & (~1));
11995 obj_conv.is_owned = false;
11996 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
11997 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11998 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
11999 CVec_u8Z_free(ret_var);
12003 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
12004 LDKChannelManagerReadArgs this_obj_conv;
12005 this_obj_conv.inner = (void*)(this_obj & (~1));
12006 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12007 ChannelManagerReadArgs_free(this_obj_conv);
12010 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
12011 LDKChannelManagerReadArgs this_ptr_conv;
12012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12013 this_ptr_conv.is_owned = false;
12014 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
12018 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
12019 LDKChannelManagerReadArgs this_ptr_conv;
12020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12021 this_ptr_conv.is_owned = false;
12022 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
12023 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
12026 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
12027 LDKChannelManagerReadArgs this_ptr_conv;
12028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12029 this_ptr_conv.is_owned = false;
12030 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
12034 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
12035 LDKChannelManagerReadArgs this_ptr_conv;
12036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12037 this_ptr_conv.is_owned = false;
12038 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
12039 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
12042 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
12043 LDKChannelManagerReadArgs this_ptr_conv;
12044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12045 this_ptr_conv.is_owned = false;
12046 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
12050 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
12051 LDKChannelManagerReadArgs this_ptr_conv;
12052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12053 this_ptr_conv.is_owned = false;
12054 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
12055 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
12058 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
12059 LDKChannelManagerReadArgs this_ptr_conv;
12060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12061 this_ptr_conv.is_owned = false;
12062 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
12066 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
12067 LDKChannelManagerReadArgs this_ptr_conv;
12068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12069 this_ptr_conv.is_owned = false;
12070 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
12071 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
12074 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
12075 LDKChannelManagerReadArgs this_ptr_conv;
12076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12077 this_ptr_conv.is_owned = false;
12078 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
12082 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
12083 LDKChannelManagerReadArgs this_ptr_conv;
12084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12085 this_ptr_conv.is_owned = false;
12086 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
12087 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
12090 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
12091 LDKChannelManagerReadArgs this_ptr_conv;
12092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12093 this_ptr_conv.is_owned = false;
12094 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
12095 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12096 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12097 long ret_ref = (long)ret_var.inner;
12098 if (ret_var.is_owned) {
12104 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
12105 LDKChannelManagerReadArgs this_ptr_conv;
12106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12107 this_ptr_conv.is_owned = false;
12108 LDKUserConfig val_conv;
12109 val_conv.inner = (void*)(val & (~1));
12110 val_conv.is_owned = (val & 1) || (val == 0);
12111 val_conv = UserConfig_clone(&val_conv);
12112 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
12115 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) {
12116 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
12117 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12118 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
12119 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
12120 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12121 LDKUserConfig default_config_conv;
12122 default_config_conv.inner = (void*)(default_config & (~1));
12123 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
12124 default_config_conv = UserConfig_clone(&default_config_conv);
12125 LDKCVec_ChannelMonitorZ channel_monitors_constr;
12126 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
12127 if (channel_monitors_constr.datalen > 0)
12128 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
12130 channel_monitors_constr.data = NULL;
12131 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
12132 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
12133 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
12134 LDKChannelMonitor channel_monitors_conv_16_conv;
12135 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
12136 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
12137 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
12139 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);
12140 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12141 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12142 long ret_ref = (long)ret_var.inner;
12143 if (ret_var.is_owned) {
12149 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
12150 LDKu8slice ser_ref;
12151 ser_ref.datalen = *((uint32_t*)ser);
12152 ser_ref.data = (int8_t*)(ser + 4);
12153 LDKChannelManagerReadArgs arg_conv;
12154 arg_conv.inner = (void*)(arg & (~1));
12155 arg_conv.is_owned = (arg & 1) || (arg == 0);
12156 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
12157 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
12158 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
12159 return (long)ret_conv;
12162 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
12163 LDKDecodeError this_obj_conv;
12164 this_obj_conv.inner = (void*)(this_obj & (~1));
12165 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12166 DecodeError_free(this_obj_conv);
12169 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
12170 LDKDecodeError orig_conv;
12171 orig_conv.inner = (void*)(orig & (~1));
12172 orig_conv.is_owned = false;
12173 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
12174 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12175 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12176 long ret_ref = (long)ret_var.inner;
12177 if (ret_var.is_owned) {
12183 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
12184 LDKInit this_obj_conv;
12185 this_obj_conv.inner = (void*)(this_obj & (~1));
12186 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12187 Init_free(this_obj_conv);
12190 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
12191 LDKInit this_ptr_conv;
12192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12193 this_ptr_conv.is_owned = false;
12194 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
12195 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12196 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12197 long ret_ref = (long)ret_var.inner;
12198 if (ret_var.is_owned) {
12204 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
12205 LDKInit this_ptr_conv;
12206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12207 this_ptr_conv.is_owned = false;
12208 LDKInitFeatures val_conv;
12209 val_conv.inner = (void*)(val & (~1));
12210 val_conv.is_owned = (val & 1) || (val == 0);
12211 val_conv = InitFeatures_clone(&val_conv);
12212 Init_set_features(&this_ptr_conv, val_conv);
12215 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
12216 LDKInitFeatures features_arg_conv;
12217 features_arg_conv.inner = (void*)(features_arg & (~1));
12218 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
12219 features_arg_conv = InitFeatures_clone(&features_arg_conv);
12220 LDKInit ret_var = Init_new(features_arg_conv);
12221 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12222 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12223 long ret_ref = (long)ret_var.inner;
12224 if (ret_var.is_owned) {
12230 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
12232 orig_conv.inner = (void*)(orig & (~1));
12233 orig_conv.is_owned = false;
12234 LDKInit ret_var = Init_clone(&orig_conv);
12235 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12236 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12237 long ret_ref = (long)ret_var.inner;
12238 if (ret_var.is_owned) {
12244 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
12245 LDKErrorMessage this_obj_conv;
12246 this_obj_conv.inner = (void*)(this_obj & (~1));
12247 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12248 ErrorMessage_free(this_obj_conv);
12251 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
12252 LDKErrorMessage this_ptr_conv;
12253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12254 this_ptr_conv.is_owned = false;
12255 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12256 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
12260 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12261 LDKErrorMessage this_ptr_conv;
12262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12263 this_ptr_conv.is_owned = false;
12264 LDKThirtyTwoBytes val_ref;
12265 CHECK(*((uint32_t*)val) == 32);
12266 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12267 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
12270 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
12271 LDKErrorMessage this_ptr_conv;
12272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12273 this_ptr_conv.is_owned = false;
12274 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
12275 jstring _conv = str_ref_to_ts(_str.chars, _str.len);
12279 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, int8_tArray val) {
12280 LDKErrorMessage this_ptr_conv;
12281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12282 this_ptr_conv.is_owned = false;
12283 LDKCVec_u8Z val_ref;
12284 val_ref.datalen = *((uint32_t*)val);
12285 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
12286 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
12287 ErrorMessage_set_data(&this_ptr_conv, val_ref);
12290 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
12291 LDKThirtyTwoBytes channel_id_arg_ref;
12292 CHECK(*((uint32_t*)channel_id_arg) == 32);
12293 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12294 LDKCVec_u8Z data_arg_ref;
12295 data_arg_ref.datalen = *((uint32_t*)data_arg);
12296 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
12297 memcpy(data_arg_ref.data, (uint8_t*)(data_arg + 4), data_arg_ref.datalen);
12298 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
12299 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12300 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12301 long ret_ref = (long)ret_var.inner;
12302 if (ret_var.is_owned) {
12308 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
12309 LDKErrorMessage orig_conv;
12310 orig_conv.inner = (void*)(orig & (~1));
12311 orig_conv.is_owned = false;
12312 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
12313 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12314 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12315 long ret_ref = (long)ret_var.inner;
12316 if (ret_var.is_owned) {
12322 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
12323 LDKPing this_obj_conv;
12324 this_obj_conv.inner = (void*)(this_obj & (~1));
12325 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12326 Ping_free(this_obj_conv);
12329 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
12330 LDKPing this_ptr_conv;
12331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12332 this_ptr_conv.is_owned = false;
12333 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
12337 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
12338 LDKPing this_ptr_conv;
12339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12340 this_ptr_conv.is_owned = false;
12341 Ping_set_ponglen(&this_ptr_conv, val);
12344 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
12345 LDKPing this_ptr_conv;
12346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12347 this_ptr_conv.is_owned = false;
12348 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
12352 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
12353 LDKPing this_ptr_conv;
12354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12355 this_ptr_conv.is_owned = false;
12356 Ping_set_byteslen(&this_ptr_conv, val);
12359 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
12360 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
12361 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12362 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12363 long ret_ref = (long)ret_var.inner;
12364 if (ret_var.is_owned) {
12370 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
12372 orig_conv.inner = (void*)(orig & (~1));
12373 orig_conv.is_owned = false;
12374 LDKPing ret_var = Ping_clone(&orig_conv);
12375 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12376 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12377 long ret_ref = (long)ret_var.inner;
12378 if (ret_var.is_owned) {
12384 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
12385 LDKPong this_obj_conv;
12386 this_obj_conv.inner = (void*)(this_obj & (~1));
12387 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12388 Pong_free(this_obj_conv);
12391 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
12392 LDKPong this_ptr_conv;
12393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12394 this_ptr_conv.is_owned = false;
12395 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
12399 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
12400 LDKPong this_ptr_conv;
12401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12402 this_ptr_conv.is_owned = false;
12403 Pong_set_byteslen(&this_ptr_conv, val);
12406 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
12407 LDKPong ret_var = Pong_new(byteslen_arg);
12408 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12409 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12410 long ret_ref = (long)ret_var.inner;
12411 if (ret_var.is_owned) {
12417 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
12419 orig_conv.inner = (void*)(orig & (~1));
12420 orig_conv.is_owned = false;
12421 LDKPong ret_var = Pong_clone(&orig_conv);
12422 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12423 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12424 long ret_ref = (long)ret_var.inner;
12425 if (ret_var.is_owned) {
12431 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
12432 LDKOpenChannel this_obj_conv;
12433 this_obj_conv.inner = (void*)(this_obj & (~1));
12434 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12435 OpenChannel_free(this_obj_conv);
12438 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
12439 LDKOpenChannel this_ptr_conv;
12440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12441 this_ptr_conv.is_owned = false;
12442 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12443 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
12447 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
12448 LDKOpenChannel this_ptr_conv;
12449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12450 this_ptr_conv.is_owned = false;
12451 LDKThirtyTwoBytes val_ref;
12452 CHECK(*((uint32_t*)val) == 32);
12453 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12454 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
12457 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
12458 LDKOpenChannel this_ptr_conv;
12459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12460 this_ptr_conv.is_owned = false;
12461 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12462 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
12466 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
12467 LDKOpenChannel this_ptr_conv;
12468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12469 this_ptr_conv.is_owned = false;
12470 LDKThirtyTwoBytes val_ref;
12471 CHECK(*((uint32_t*)val) == 32);
12472 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12473 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
12476 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
12477 LDKOpenChannel this_ptr_conv;
12478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12479 this_ptr_conv.is_owned = false;
12480 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
12484 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
12485 LDKOpenChannel this_ptr_conv;
12486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12487 this_ptr_conv.is_owned = false;
12488 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
12491 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
12492 LDKOpenChannel this_ptr_conv;
12493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12494 this_ptr_conv.is_owned = false;
12495 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
12499 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
12500 LDKOpenChannel this_ptr_conv;
12501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12502 this_ptr_conv.is_owned = false;
12503 OpenChannel_set_push_msat(&this_ptr_conv, val);
12506 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
12507 LDKOpenChannel this_ptr_conv;
12508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12509 this_ptr_conv.is_owned = false;
12510 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
12514 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
12515 LDKOpenChannel this_ptr_conv;
12516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12517 this_ptr_conv.is_owned = false;
12518 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
12521 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
12522 LDKOpenChannel this_ptr_conv;
12523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12524 this_ptr_conv.is_owned = false;
12525 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
12529 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
12530 LDKOpenChannel this_ptr_conv;
12531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12532 this_ptr_conv.is_owned = false;
12533 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
12536 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
12537 LDKOpenChannel this_ptr_conv;
12538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12539 this_ptr_conv.is_owned = false;
12540 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
12544 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
12545 LDKOpenChannel this_ptr_conv;
12546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12547 this_ptr_conv.is_owned = false;
12548 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
12551 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
12552 LDKOpenChannel this_ptr_conv;
12553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12554 this_ptr_conv.is_owned = false;
12555 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
12559 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
12560 LDKOpenChannel this_ptr_conv;
12561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12562 this_ptr_conv.is_owned = false;
12563 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
12566 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
12567 LDKOpenChannel this_ptr_conv;
12568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12569 this_ptr_conv.is_owned = false;
12570 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
12574 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
12575 LDKOpenChannel this_ptr_conv;
12576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12577 this_ptr_conv.is_owned = false;
12578 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
12581 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
12582 LDKOpenChannel this_ptr_conv;
12583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12584 this_ptr_conv.is_owned = false;
12585 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
12589 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
12590 LDKOpenChannel this_ptr_conv;
12591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12592 this_ptr_conv.is_owned = false;
12593 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
12596 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
12597 LDKOpenChannel this_ptr_conv;
12598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12599 this_ptr_conv.is_owned = false;
12600 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
12604 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
12605 LDKOpenChannel this_ptr_conv;
12606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12607 this_ptr_conv.is_owned = false;
12608 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
12611 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
12612 LDKOpenChannel this_ptr_conv;
12613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12614 this_ptr_conv.is_owned = false;
12615 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12616 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
12620 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
12621 LDKOpenChannel this_ptr_conv;
12622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12623 this_ptr_conv.is_owned = false;
12624 LDKPublicKey val_ref;
12625 CHECK(*((uint32_t*)val) == 33);
12626 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12627 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
12630 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
12631 LDKOpenChannel this_ptr_conv;
12632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12633 this_ptr_conv.is_owned = false;
12634 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12635 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
12639 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
12640 LDKOpenChannel this_ptr_conv;
12641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12642 this_ptr_conv.is_owned = false;
12643 LDKPublicKey val_ref;
12644 CHECK(*((uint32_t*)val) == 33);
12645 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12646 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
12649 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
12650 LDKOpenChannel this_ptr_conv;
12651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12652 this_ptr_conv.is_owned = false;
12653 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12654 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
12658 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
12659 LDKOpenChannel this_ptr_conv;
12660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12661 this_ptr_conv.is_owned = false;
12662 LDKPublicKey val_ref;
12663 CHECK(*((uint32_t*)val) == 33);
12664 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12665 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
12668 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
12669 LDKOpenChannel this_ptr_conv;
12670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12671 this_ptr_conv.is_owned = false;
12672 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12673 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
12677 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
12678 LDKOpenChannel this_ptr_conv;
12679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12680 this_ptr_conv.is_owned = false;
12681 LDKPublicKey val_ref;
12682 CHECK(*((uint32_t*)val) == 33);
12683 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12684 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12687 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
12688 LDKOpenChannel this_ptr_conv;
12689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12690 this_ptr_conv.is_owned = false;
12691 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12692 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
12696 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
12697 LDKOpenChannel this_ptr_conv;
12698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12699 this_ptr_conv.is_owned = false;
12700 LDKPublicKey val_ref;
12701 CHECK(*((uint32_t*)val) == 33);
12702 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12703 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
12706 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
12707 LDKOpenChannel this_ptr_conv;
12708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12709 this_ptr_conv.is_owned = false;
12710 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12711 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12715 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12716 LDKOpenChannel this_ptr_conv;
12717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12718 this_ptr_conv.is_owned = false;
12719 LDKPublicKey val_ref;
12720 CHECK(*((uint32_t*)val) == 33);
12721 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12722 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
12725 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
12726 LDKOpenChannel this_ptr_conv;
12727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12728 this_ptr_conv.is_owned = false;
12729 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
12733 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
12734 LDKOpenChannel this_ptr_conv;
12735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12736 this_ptr_conv.is_owned = false;
12737 OpenChannel_set_channel_flags(&this_ptr_conv, val);
12740 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
12741 LDKOpenChannel orig_conv;
12742 orig_conv.inner = (void*)(orig & (~1));
12743 orig_conv.is_owned = false;
12744 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
12745 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12746 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12747 long ret_ref = (long)ret_var.inner;
12748 if (ret_var.is_owned) {
12754 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
12755 LDKAcceptChannel this_obj_conv;
12756 this_obj_conv.inner = (void*)(this_obj & (~1));
12757 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12758 AcceptChannel_free(this_obj_conv);
12761 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
12762 LDKAcceptChannel this_ptr_conv;
12763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12764 this_ptr_conv.is_owned = false;
12765 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12766 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
12770 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
12771 LDKAcceptChannel this_ptr_conv;
12772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12773 this_ptr_conv.is_owned = false;
12774 LDKThirtyTwoBytes val_ref;
12775 CHECK(*((uint32_t*)val) == 32);
12776 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12777 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
12780 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
12781 LDKAcceptChannel this_ptr_conv;
12782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12783 this_ptr_conv.is_owned = false;
12784 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
12788 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
12789 LDKAcceptChannel this_ptr_conv;
12790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12791 this_ptr_conv.is_owned = false;
12792 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
12795 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
12796 LDKAcceptChannel this_ptr_conv;
12797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12798 this_ptr_conv.is_owned = false;
12799 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
12803 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
12804 LDKAcceptChannel this_ptr_conv;
12805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12806 this_ptr_conv.is_owned = false;
12807 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
12810 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
12811 LDKAcceptChannel this_ptr_conv;
12812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12813 this_ptr_conv.is_owned = false;
12814 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
12818 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
12819 LDKAcceptChannel this_ptr_conv;
12820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12821 this_ptr_conv.is_owned = false;
12822 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
12825 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
12826 LDKAcceptChannel this_ptr_conv;
12827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12828 this_ptr_conv.is_owned = false;
12829 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
12833 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
12834 LDKAcceptChannel this_ptr_conv;
12835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12836 this_ptr_conv.is_owned = false;
12837 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
12840 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
12841 LDKAcceptChannel this_ptr_conv;
12842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12843 this_ptr_conv.is_owned = false;
12844 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
12848 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
12849 LDKAcceptChannel this_ptr_conv;
12850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12851 this_ptr_conv.is_owned = false;
12852 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
12855 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
12856 LDKAcceptChannel this_ptr_conv;
12857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12858 this_ptr_conv.is_owned = false;
12859 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
12863 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
12864 LDKAcceptChannel this_ptr_conv;
12865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12866 this_ptr_conv.is_owned = false;
12867 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
12870 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
12871 LDKAcceptChannel this_ptr_conv;
12872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12873 this_ptr_conv.is_owned = false;
12874 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
12878 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
12879 LDKAcceptChannel this_ptr_conv;
12880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12881 this_ptr_conv.is_owned = false;
12882 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
12885 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
12886 LDKAcceptChannel this_ptr_conv;
12887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12888 this_ptr_conv.is_owned = false;
12889 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12890 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
12894 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
12895 LDKAcceptChannel this_ptr_conv;
12896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12897 this_ptr_conv.is_owned = false;
12898 LDKPublicKey val_ref;
12899 CHECK(*((uint32_t*)val) == 33);
12900 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12901 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
12904 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
12905 LDKAcceptChannel this_ptr_conv;
12906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12907 this_ptr_conv.is_owned = false;
12908 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12909 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
12913 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
12914 LDKAcceptChannel this_ptr_conv;
12915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12916 this_ptr_conv.is_owned = false;
12917 LDKPublicKey val_ref;
12918 CHECK(*((uint32_t*)val) == 33);
12919 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12920 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
12923 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
12924 LDKAcceptChannel this_ptr_conv;
12925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12926 this_ptr_conv.is_owned = false;
12927 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12928 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
12932 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
12933 LDKAcceptChannel this_ptr_conv;
12934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12935 this_ptr_conv.is_owned = false;
12936 LDKPublicKey val_ref;
12937 CHECK(*((uint32_t*)val) == 33);
12938 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12939 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
12942 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
12943 LDKAcceptChannel this_ptr_conv;
12944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12945 this_ptr_conv.is_owned = false;
12946 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12947 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
12951 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
12952 LDKAcceptChannel this_ptr_conv;
12953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12954 this_ptr_conv.is_owned = false;
12955 LDKPublicKey val_ref;
12956 CHECK(*((uint32_t*)val) == 33);
12957 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12958 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12961 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
12962 LDKAcceptChannel this_ptr_conv;
12963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12964 this_ptr_conv.is_owned = false;
12965 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12966 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
12970 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
12971 LDKAcceptChannel this_ptr_conv;
12972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12973 this_ptr_conv.is_owned = false;
12974 LDKPublicKey val_ref;
12975 CHECK(*((uint32_t*)val) == 33);
12976 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12977 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
12980 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
12981 LDKAcceptChannel this_ptr_conv;
12982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12983 this_ptr_conv.is_owned = false;
12984 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12985 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12989 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12990 LDKAcceptChannel this_ptr_conv;
12991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12992 this_ptr_conv.is_owned = false;
12993 LDKPublicKey val_ref;
12994 CHECK(*((uint32_t*)val) == 33);
12995 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12996 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
12999 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
13000 LDKAcceptChannel orig_conv;
13001 orig_conv.inner = (void*)(orig & (~1));
13002 orig_conv.is_owned = false;
13003 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
13004 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13005 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13006 long ret_ref = (long)ret_var.inner;
13007 if (ret_var.is_owned) {
13013 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
13014 LDKFundingCreated this_obj_conv;
13015 this_obj_conv.inner = (void*)(this_obj & (~1));
13016 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13017 FundingCreated_free(this_obj_conv);
13020 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
13021 LDKFundingCreated this_ptr_conv;
13022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13023 this_ptr_conv.is_owned = false;
13024 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13025 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
13029 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
13030 LDKFundingCreated this_ptr_conv;
13031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13032 this_ptr_conv.is_owned = false;
13033 LDKThirtyTwoBytes val_ref;
13034 CHECK(*((uint32_t*)val) == 32);
13035 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13036 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
13039 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
13040 LDKFundingCreated this_ptr_conv;
13041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13042 this_ptr_conv.is_owned = false;
13043 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13044 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
13048 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
13049 LDKFundingCreated this_ptr_conv;
13050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13051 this_ptr_conv.is_owned = false;
13052 LDKThirtyTwoBytes val_ref;
13053 CHECK(*((uint32_t*)val) == 32);
13054 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13055 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
13058 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
13059 LDKFundingCreated this_ptr_conv;
13060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13061 this_ptr_conv.is_owned = false;
13062 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
13066 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
13067 LDKFundingCreated this_ptr_conv;
13068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13069 this_ptr_conv.is_owned = false;
13070 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
13073 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
13074 LDKFundingCreated this_ptr_conv;
13075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13076 this_ptr_conv.is_owned = false;
13077 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13078 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
13082 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
13083 LDKFundingCreated this_ptr_conv;
13084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13085 this_ptr_conv.is_owned = false;
13086 LDKSignature val_ref;
13087 CHECK(*((uint32_t*)val) == 64);
13088 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13089 FundingCreated_set_signature(&this_ptr_conv, val_ref);
13092 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) {
13093 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
13094 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
13095 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
13096 LDKThirtyTwoBytes funding_txid_arg_ref;
13097 CHECK(*((uint32_t*)funding_txid_arg) == 32);
13098 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
13099 LDKSignature signature_arg_ref;
13100 CHECK(*((uint32_t*)signature_arg) == 64);
13101 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
13102 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
13103 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13104 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13105 long ret_ref = (long)ret_var.inner;
13106 if (ret_var.is_owned) {
13112 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
13113 LDKFundingCreated orig_conv;
13114 orig_conv.inner = (void*)(orig & (~1));
13115 orig_conv.is_owned = false;
13116 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
13117 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13118 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13119 long ret_ref = (long)ret_var.inner;
13120 if (ret_var.is_owned) {
13126 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
13127 LDKFundingSigned this_obj_conv;
13128 this_obj_conv.inner = (void*)(this_obj & (~1));
13129 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13130 FundingSigned_free(this_obj_conv);
13133 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
13134 LDKFundingSigned this_ptr_conv;
13135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13136 this_ptr_conv.is_owned = false;
13137 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13138 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
13142 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13143 LDKFundingSigned this_ptr_conv;
13144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13145 this_ptr_conv.is_owned = false;
13146 LDKThirtyTwoBytes val_ref;
13147 CHECK(*((uint32_t*)val) == 32);
13148 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13149 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
13152 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
13153 LDKFundingSigned this_ptr_conv;
13154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13155 this_ptr_conv.is_owned = false;
13156 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13157 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
13161 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
13162 LDKFundingSigned this_ptr_conv;
13163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13164 this_ptr_conv.is_owned = false;
13165 LDKSignature val_ref;
13166 CHECK(*((uint32_t*)val) == 64);
13167 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13168 FundingSigned_set_signature(&this_ptr_conv, val_ref);
13171 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
13172 LDKThirtyTwoBytes channel_id_arg_ref;
13173 CHECK(*((uint32_t*)channel_id_arg) == 32);
13174 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13175 LDKSignature signature_arg_ref;
13176 CHECK(*((uint32_t*)signature_arg) == 64);
13177 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
13178 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
13179 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13180 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13181 long ret_ref = (long)ret_var.inner;
13182 if (ret_var.is_owned) {
13188 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
13189 LDKFundingSigned orig_conv;
13190 orig_conv.inner = (void*)(orig & (~1));
13191 orig_conv.is_owned = false;
13192 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
13193 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13194 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13195 long ret_ref = (long)ret_var.inner;
13196 if (ret_var.is_owned) {
13202 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
13203 LDKFundingLocked this_obj_conv;
13204 this_obj_conv.inner = (void*)(this_obj & (~1));
13205 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13206 FundingLocked_free(this_obj_conv);
13209 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
13210 LDKFundingLocked this_ptr_conv;
13211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13212 this_ptr_conv.is_owned = false;
13213 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13214 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
13218 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13219 LDKFundingLocked this_ptr_conv;
13220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13221 this_ptr_conv.is_owned = false;
13222 LDKThirtyTwoBytes val_ref;
13223 CHECK(*((uint32_t*)val) == 32);
13224 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13225 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
13228 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
13229 LDKFundingLocked this_ptr_conv;
13230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13231 this_ptr_conv.is_owned = false;
13232 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13233 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
13237 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
13238 LDKFundingLocked this_ptr_conv;
13239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13240 this_ptr_conv.is_owned = false;
13241 LDKPublicKey val_ref;
13242 CHECK(*((uint32_t*)val) == 33);
13243 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13244 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
13247 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
13248 LDKThirtyTwoBytes channel_id_arg_ref;
13249 CHECK(*((uint32_t*)channel_id_arg) == 32);
13250 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13251 LDKPublicKey next_per_commitment_point_arg_ref;
13252 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
13253 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
13254 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
13255 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13256 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13257 long ret_ref = (long)ret_var.inner;
13258 if (ret_var.is_owned) {
13264 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
13265 LDKFundingLocked orig_conv;
13266 orig_conv.inner = (void*)(orig & (~1));
13267 orig_conv.is_owned = false;
13268 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
13269 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13270 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13271 long ret_ref = (long)ret_var.inner;
13272 if (ret_var.is_owned) {
13278 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
13279 LDKShutdown this_obj_conv;
13280 this_obj_conv.inner = (void*)(this_obj & (~1));
13281 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13282 Shutdown_free(this_obj_conv);
13285 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
13286 LDKShutdown this_ptr_conv;
13287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13288 this_ptr_conv.is_owned = false;
13289 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13290 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
13294 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13295 LDKShutdown this_ptr_conv;
13296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13297 this_ptr_conv.is_owned = false;
13298 LDKThirtyTwoBytes val_ref;
13299 CHECK(*((uint32_t*)val) == 32);
13300 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13301 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
13304 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
13305 LDKShutdown this_ptr_conv;
13306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13307 this_ptr_conv.is_owned = false;
13308 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
13309 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13310 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13314 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
13315 LDKShutdown this_ptr_conv;
13316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13317 this_ptr_conv.is_owned = false;
13318 LDKCVec_u8Z val_ref;
13319 val_ref.datalen = *((uint32_t*)val);
13320 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13321 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
13322 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
13325 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
13326 LDKThirtyTwoBytes channel_id_arg_ref;
13327 CHECK(*((uint32_t*)channel_id_arg) == 32);
13328 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13329 LDKCVec_u8Z scriptpubkey_arg_ref;
13330 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
13331 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13332 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
13333 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
13334 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13335 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13336 long ret_ref = (long)ret_var.inner;
13337 if (ret_var.is_owned) {
13343 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
13344 LDKShutdown orig_conv;
13345 orig_conv.inner = (void*)(orig & (~1));
13346 orig_conv.is_owned = false;
13347 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
13348 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13349 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13350 long ret_ref = (long)ret_var.inner;
13351 if (ret_var.is_owned) {
13357 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
13358 LDKClosingSigned this_obj_conv;
13359 this_obj_conv.inner = (void*)(this_obj & (~1));
13360 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13361 ClosingSigned_free(this_obj_conv);
13364 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
13365 LDKClosingSigned this_ptr_conv;
13366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13367 this_ptr_conv.is_owned = false;
13368 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13369 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
13373 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13374 LDKClosingSigned this_ptr_conv;
13375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13376 this_ptr_conv.is_owned = false;
13377 LDKThirtyTwoBytes val_ref;
13378 CHECK(*((uint32_t*)val) == 32);
13379 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13380 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
13383 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
13384 LDKClosingSigned this_ptr_conv;
13385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13386 this_ptr_conv.is_owned = false;
13387 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
13391 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
13392 LDKClosingSigned this_ptr_conv;
13393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13394 this_ptr_conv.is_owned = false;
13395 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
13398 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
13399 LDKClosingSigned this_ptr_conv;
13400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13401 this_ptr_conv.is_owned = false;
13402 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13403 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
13407 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
13408 LDKClosingSigned this_ptr_conv;
13409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13410 this_ptr_conv.is_owned = false;
13411 LDKSignature val_ref;
13412 CHECK(*((uint32_t*)val) == 64);
13413 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13414 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
13417 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
13418 LDKThirtyTwoBytes channel_id_arg_ref;
13419 CHECK(*((uint32_t*)channel_id_arg) == 32);
13420 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13421 LDKSignature signature_arg_ref;
13422 CHECK(*((uint32_t*)signature_arg) == 64);
13423 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
13424 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
13425 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13426 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13427 long ret_ref = (long)ret_var.inner;
13428 if (ret_var.is_owned) {
13434 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
13435 LDKClosingSigned orig_conv;
13436 orig_conv.inner = (void*)(orig & (~1));
13437 orig_conv.is_owned = false;
13438 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
13439 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13440 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13441 long ret_ref = (long)ret_var.inner;
13442 if (ret_var.is_owned) {
13448 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
13449 LDKUpdateAddHTLC this_obj_conv;
13450 this_obj_conv.inner = (void*)(this_obj & (~1));
13451 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13452 UpdateAddHTLC_free(this_obj_conv);
13455 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
13456 LDKUpdateAddHTLC this_ptr_conv;
13457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13458 this_ptr_conv.is_owned = false;
13459 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13460 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
13464 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13465 LDKUpdateAddHTLC this_ptr_conv;
13466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13467 this_ptr_conv.is_owned = false;
13468 LDKThirtyTwoBytes val_ref;
13469 CHECK(*((uint32_t*)val) == 32);
13470 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13471 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
13474 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
13475 LDKUpdateAddHTLC this_ptr_conv;
13476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13477 this_ptr_conv.is_owned = false;
13478 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
13482 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
13483 LDKUpdateAddHTLC this_ptr_conv;
13484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13485 this_ptr_conv.is_owned = false;
13486 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
13489 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
13490 LDKUpdateAddHTLC this_ptr_conv;
13491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13492 this_ptr_conv.is_owned = false;
13493 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
13497 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
13498 LDKUpdateAddHTLC this_ptr_conv;
13499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13500 this_ptr_conv.is_owned = false;
13501 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
13504 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
13505 LDKUpdateAddHTLC this_ptr_conv;
13506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13507 this_ptr_conv.is_owned = false;
13508 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13509 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
13513 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
13514 LDKUpdateAddHTLC this_ptr_conv;
13515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13516 this_ptr_conv.is_owned = false;
13517 LDKThirtyTwoBytes val_ref;
13518 CHECK(*((uint32_t*)val) == 32);
13519 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13520 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
13523 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
13524 LDKUpdateAddHTLC this_ptr_conv;
13525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13526 this_ptr_conv.is_owned = false;
13527 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
13531 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
13532 LDKUpdateAddHTLC this_ptr_conv;
13533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13534 this_ptr_conv.is_owned = false;
13535 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
13538 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
13539 LDKUpdateAddHTLC orig_conv;
13540 orig_conv.inner = (void*)(orig & (~1));
13541 orig_conv.is_owned = false;
13542 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
13543 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13544 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13545 long ret_ref = (long)ret_var.inner;
13546 if (ret_var.is_owned) {
13552 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
13553 LDKUpdateFulfillHTLC this_obj_conv;
13554 this_obj_conv.inner = (void*)(this_obj & (~1));
13555 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13556 UpdateFulfillHTLC_free(this_obj_conv);
13559 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
13560 LDKUpdateFulfillHTLC this_ptr_conv;
13561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13562 this_ptr_conv.is_owned = false;
13563 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13564 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
13568 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13569 LDKUpdateFulfillHTLC this_ptr_conv;
13570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13571 this_ptr_conv.is_owned = false;
13572 LDKThirtyTwoBytes val_ref;
13573 CHECK(*((uint32_t*)val) == 32);
13574 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13575 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
13578 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
13579 LDKUpdateFulfillHTLC this_ptr_conv;
13580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13581 this_ptr_conv.is_owned = false;
13582 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
13586 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
13587 LDKUpdateFulfillHTLC this_ptr_conv;
13588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13589 this_ptr_conv.is_owned = false;
13590 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
13593 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
13594 LDKUpdateFulfillHTLC this_ptr_conv;
13595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13596 this_ptr_conv.is_owned = false;
13597 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13598 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
13602 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
13603 LDKUpdateFulfillHTLC this_ptr_conv;
13604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13605 this_ptr_conv.is_owned = false;
13606 LDKThirtyTwoBytes val_ref;
13607 CHECK(*((uint32_t*)val) == 32);
13608 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13609 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
13612 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
13613 LDKThirtyTwoBytes channel_id_arg_ref;
13614 CHECK(*((uint32_t*)channel_id_arg) == 32);
13615 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13616 LDKThirtyTwoBytes payment_preimage_arg_ref;
13617 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
13618 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
13619 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
13620 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13621 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13622 long ret_ref = (long)ret_var.inner;
13623 if (ret_var.is_owned) {
13629 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
13630 LDKUpdateFulfillHTLC orig_conv;
13631 orig_conv.inner = (void*)(orig & (~1));
13632 orig_conv.is_owned = false;
13633 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
13634 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13635 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13636 long ret_ref = (long)ret_var.inner;
13637 if (ret_var.is_owned) {
13643 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
13644 LDKUpdateFailHTLC this_obj_conv;
13645 this_obj_conv.inner = (void*)(this_obj & (~1));
13646 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13647 UpdateFailHTLC_free(this_obj_conv);
13650 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
13651 LDKUpdateFailHTLC this_ptr_conv;
13652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13653 this_ptr_conv.is_owned = false;
13654 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13655 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
13659 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13660 LDKUpdateFailHTLC this_ptr_conv;
13661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13662 this_ptr_conv.is_owned = false;
13663 LDKThirtyTwoBytes val_ref;
13664 CHECK(*((uint32_t*)val) == 32);
13665 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13666 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
13669 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
13670 LDKUpdateFailHTLC this_ptr_conv;
13671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13672 this_ptr_conv.is_owned = false;
13673 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
13677 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
13678 LDKUpdateFailHTLC this_ptr_conv;
13679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13680 this_ptr_conv.is_owned = false;
13681 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
13684 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
13685 LDKUpdateFailHTLC orig_conv;
13686 orig_conv.inner = (void*)(orig & (~1));
13687 orig_conv.is_owned = false;
13688 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
13689 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13690 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13691 long ret_ref = (long)ret_var.inner;
13692 if (ret_var.is_owned) {
13698 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
13699 LDKUpdateFailMalformedHTLC this_obj_conv;
13700 this_obj_conv.inner = (void*)(this_obj & (~1));
13701 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13702 UpdateFailMalformedHTLC_free(this_obj_conv);
13705 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
13706 LDKUpdateFailMalformedHTLC this_ptr_conv;
13707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13708 this_ptr_conv.is_owned = false;
13709 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13710 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
13714 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13715 LDKUpdateFailMalformedHTLC this_ptr_conv;
13716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13717 this_ptr_conv.is_owned = false;
13718 LDKThirtyTwoBytes val_ref;
13719 CHECK(*((uint32_t*)val) == 32);
13720 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13721 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
13724 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
13725 LDKUpdateFailMalformedHTLC this_ptr_conv;
13726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13727 this_ptr_conv.is_owned = false;
13728 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
13732 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
13733 LDKUpdateFailMalformedHTLC this_ptr_conv;
13734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13735 this_ptr_conv.is_owned = false;
13736 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
13739 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
13740 LDKUpdateFailMalformedHTLC this_ptr_conv;
13741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13742 this_ptr_conv.is_owned = false;
13743 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
13747 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
13748 LDKUpdateFailMalformedHTLC this_ptr_conv;
13749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13750 this_ptr_conv.is_owned = false;
13751 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
13754 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
13755 LDKUpdateFailMalformedHTLC orig_conv;
13756 orig_conv.inner = (void*)(orig & (~1));
13757 orig_conv.is_owned = false;
13758 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
13759 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13760 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13761 long ret_ref = (long)ret_var.inner;
13762 if (ret_var.is_owned) {
13768 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_obj) {
13769 LDKCommitmentSigned this_obj_conv;
13770 this_obj_conv.inner = (void*)(this_obj & (~1));
13771 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13772 CommitmentSigned_free(this_obj_conv);
13775 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
13776 LDKCommitmentSigned this_ptr_conv;
13777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13778 this_ptr_conv.is_owned = false;
13779 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13780 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
13784 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13785 LDKCommitmentSigned this_ptr_conv;
13786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13787 this_ptr_conv.is_owned = false;
13788 LDKThirtyTwoBytes val_ref;
13789 CHECK(*((uint32_t*)val) == 32);
13790 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13791 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
13794 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
13795 LDKCommitmentSigned this_ptr_conv;
13796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13797 this_ptr_conv.is_owned = false;
13798 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13799 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
13803 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
13804 LDKCommitmentSigned this_ptr_conv;
13805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13806 this_ptr_conv.is_owned = false;
13807 LDKSignature val_ref;
13808 CHECK(*((uint32_t*)val) == 64);
13809 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13810 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
13813 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
13814 LDKCommitmentSigned this_ptr_conv;
13815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13816 this_ptr_conv.is_owned = false;
13817 LDKCVec_SignatureZ val_constr;
13818 val_constr.datalen = *((uint32_t*)val);
13819 if (val_constr.datalen > 0)
13820 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13822 val_constr.data = NULL;
13823 int8_tArray* val_vals = (int8_tArray*)(val + 4);
13824 for (size_t m = 0; m < val_constr.datalen; m++) {
13825 int8_tArray val_conv_12 = val_vals[m];
13826 LDKSignature val_conv_12_ref;
13827 CHECK(*((uint32_t*)val_conv_12) == 64);
13828 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
13829 val_constr.data[m] = val_conv_12_ref;
13831 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
13834 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
13835 LDKThirtyTwoBytes channel_id_arg_ref;
13836 CHECK(*((uint32_t*)channel_id_arg) == 32);
13837 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13838 LDKSignature signature_arg_ref;
13839 CHECK(*((uint32_t*)signature_arg) == 64);
13840 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
13841 LDKCVec_SignatureZ htlc_signatures_arg_constr;
13842 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
13843 if (htlc_signatures_arg_constr.datalen > 0)
13844 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13846 htlc_signatures_arg_constr.data = NULL;
13847 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
13848 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
13849 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
13850 LDKSignature htlc_signatures_arg_conv_12_ref;
13851 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
13852 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
13853 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
13855 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
13856 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13857 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13858 long ret_ref = (long)ret_var.inner;
13859 if (ret_var.is_owned) {
13865 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
13866 LDKCommitmentSigned orig_conv;
13867 orig_conv.inner = (void*)(orig & (~1));
13868 orig_conv.is_owned = false;
13869 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
13870 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13871 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13872 long ret_ref = (long)ret_var.inner;
13873 if (ret_var.is_owned) {
13879 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
13880 LDKRevokeAndACK this_obj_conv;
13881 this_obj_conv.inner = (void*)(this_obj & (~1));
13882 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13883 RevokeAndACK_free(this_obj_conv);
13886 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
13887 LDKRevokeAndACK this_ptr_conv;
13888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13889 this_ptr_conv.is_owned = false;
13890 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13891 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
13895 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13896 LDKRevokeAndACK this_ptr_conv;
13897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13898 this_ptr_conv.is_owned = false;
13899 LDKThirtyTwoBytes val_ref;
13900 CHECK(*((uint32_t*)val) == 32);
13901 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13902 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
13905 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
13906 LDKRevokeAndACK this_ptr_conv;
13907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13908 this_ptr_conv.is_owned = false;
13909 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13910 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
13914 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
13915 LDKRevokeAndACK this_ptr_conv;
13916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13917 this_ptr_conv.is_owned = false;
13918 LDKThirtyTwoBytes val_ref;
13919 CHECK(*((uint32_t*)val) == 32);
13920 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13921 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
13924 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
13925 LDKRevokeAndACK this_ptr_conv;
13926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13927 this_ptr_conv.is_owned = false;
13928 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13929 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
13933 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
13934 LDKRevokeAndACK this_ptr_conv;
13935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13936 this_ptr_conv.is_owned = false;
13937 LDKPublicKey val_ref;
13938 CHECK(*((uint32_t*)val) == 33);
13939 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13940 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
13943 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) {
13944 LDKThirtyTwoBytes channel_id_arg_ref;
13945 CHECK(*((uint32_t*)channel_id_arg) == 32);
13946 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13947 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
13948 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
13949 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
13950 LDKPublicKey next_per_commitment_point_arg_ref;
13951 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
13952 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
13953 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
13954 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13955 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13956 long ret_ref = (long)ret_var.inner;
13957 if (ret_var.is_owned) {
13963 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
13964 LDKRevokeAndACK orig_conv;
13965 orig_conv.inner = (void*)(orig & (~1));
13966 orig_conv.is_owned = false;
13967 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
13968 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13969 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13970 long ret_ref = (long)ret_var.inner;
13971 if (ret_var.is_owned) {
13977 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
13978 LDKUpdateFee this_obj_conv;
13979 this_obj_conv.inner = (void*)(this_obj & (~1));
13980 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13981 UpdateFee_free(this_obj_conv);
13984 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
13985 LDKUpdateFee this_ptr_conv;
13986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13987 this_ptr_conv.is_owned = false;
13988 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13989 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
13993 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13994 LDKUpdateFee this_ptr_conv;
13995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13996 this_ptr_conv.is_owned = false;
13997 LDKThirtyTwoBytes val_ref;
13998 CHECK(*((uint32_t*)val) == 32);
13999 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14000 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
14003 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
14004 LDKUpdateFee this_ptr_conv;
14005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14006 this_ptr_conv.is_owned = false;
14007 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
14011 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
14012 LDKUpdateFee this_ptr_conv;
14013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14014 this_ptr_conv.is_owned = false;
14015 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
14018 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
14019 LDKThirtyTwoBytes channel_id_arg_ref;
14020 CHECK(*((uint32_t*)channel_id_arg) == 32);
14021 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
14022 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
14023 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14024 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14025 long ret_ref = (long)ret_var.inner;
14026 if (ret_var.is_owned) {
14032 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
14033 LDKUpdateFee orig_conv;
14034 orig_conv.inner = (void*)(orig & (~1));
14035 orig_conv.is_owned = false;
14036 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
14037 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14038 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14039 long ret_ref = (long)ret_var.inner;
14040 if (ret_var.is_owned) {
14046 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
14047 LDKDataLossProtect this_obj_conv;
14048 this_obj_conv.inner = (void*)(this_obj & (~1));
14049 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14050 DataLossProtect_free(this_obj_conv);
14053 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
14054 LDKDataLossProtect this_ptr_conv;
14055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14056 this_ptr_conv.is_owned = false;
14057 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14058 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
14062 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
14063 LDKDataLossProtect this_ptr_conv;
14064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14065 this_ptr_conv.is_owned = false;
14066 LDKThirtyTwoBytes val_ref;
14067 CHECK(*((uint32_t*)val) == 32);
14068 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14069 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
14072 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
14073 LDKDataLossProtect this_ptr_conv;
14074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14075 this_ptr_conv.is_owned = false;
14076 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14077 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
14081 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
14082 LDKDataLossProtect this_ptr_conv;
14083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14084 this_ptr_conv.is_owned = false;
14085 LDKPublicKey val_ref;
14086 CHECK(*((uint32_t*)val) == 33);
14087 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14088 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
14091 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
14092 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
14093 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
14094 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
14095 LDKPublicKey my_current_per_commitment_point_arg_ref;
14096 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
14097 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
14098 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
14099 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14100 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14101 long ret_ref = (long)ret_var.inner;
14102 if (ret_var.is_owned) {
14108 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
14109 LDKDataLossProtect orig_conv;
14110 orig_conv.inner = (void*)(orig & (~1));
14111 orig_conv.is_owned = false;
14112 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
14113 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14114 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14115 long ret_ref = (long)ret_var.inner;
14116 if (ret_var.is_owned) {
14122 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
14123 LDKChannelReestablish this_obj_conv;
14124 this_obj_conv.inner = (void*)(this_obj & (~1));
14125 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14126 ChannelReestablish_free(this_obj_conv);
14129 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
14130 LDKChannelReestablish this_ptr_conv;
14131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14132 this_ptr_conv.is_owned = false;
14133 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14134 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
14138 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
14139 LDKChannelReestablish this_ptr_conv;
14140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14141 this_ptr_conv.is_owned = false;
14142 LDKThirtyTwoBytes val_ref;
14143 CHECK(*((uint32_t*)val) == 32);
14144 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14145 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
14148 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
14149 LDKChannelReestablish this_ptr_conv;
14150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14151 this_ptr_conv.is_owned = false;
14152 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
14156 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
14157 LDKChannelReestablish this_ptr_conv;
14158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14159 this_ptr_conv.is_owned = false;
14160 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
14163 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
14164 LDKChannelReestablish this_ptr_conv;
14165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14166 this_ptr_conv.is_owned = false;
14167 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
14171 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
14172 LDKChannelReestablish this_ptr_conv;
14173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14174 this_ptr_conv.is_owned = false;
14175 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
14178 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
14179 LDKChannelReestablish orig_conv;
14180 orig_conv.inner = (void*)(orig & (~1));
14181 orig_conv.is_owned = false;
14182 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
14183 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14184 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14185 long ret_ref = (long)ret_var.inner;
14186 if (ret_var.is_owned) {
14192 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
14193 LDKAnnouncementSignatures this_obj_conv;
14194 this_obj_conv.inner = (void*)(this_obj & (~1));
14195 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14196 AnnouncementSignatures_free(this_obj_conv);
14199 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
14200 LDKAnnouncementSignatures this_ptr_conv;
14201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14202 this_ptr_conv.is_owned = false;
14203 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14204 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
14208 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
14209 LDKAnnouncementSignatures this_ptr_conv;
14210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14211 this_ptr_conv.is_owned = false;
14212 LDKThirtyTwoBytes val_ref;
14213 CHECK(*((uint32_t*)val) == 32);
14214 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14215 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
14218 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
14219 LDKAnnouncementSignatures this_ptr_conv;
14220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14221 this_ptr_conv.is_owned = false;
14222 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
14226 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
14227 LDKAnnouncementSignatures this_ptr_conv;
14228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14229 this_ptr_conv.is_owned = false;
14230 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
14233 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
14234 LDKAnnouncementSignatures this_ptr_conv;
14235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14236 this_ptr_conv.is_owned = false;
14237 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14238 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
14242 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
14243 LDKAnnouncementSignatures this_ptr_conv;
14244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14245 this_ptr_conv.is_owned = false;
14246 LDKSignature val_ref;
14247 CHECK(*((uint32_t*)val) == 64);
14248 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14249 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
14252 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
14253 LDKAnnouncementSignatures this_ptr_conv;
14254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14255 this_ptr_conv.is_owned = false;
14256 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14257 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
14261 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
14262 LDKAnnouncementSignatures this_ptr_conv;
14263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14264 this_ptr_conv.is_owned = false;
14265 LDKSignature val_ref;
14266 CHECK(*((uint32_t*)val) == 64);
14267 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14268 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
14271 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) {
14272 LDKThirtyTwoBytes channel_id_arg_ref;
14273 CHECK(*((uint32_t*)channel_id_arg) == 32);
14274 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
14275 LDKSignature node_signature_arg_ref;
14276 CHECK(*((uint32_t*)node_signature_arg) == 64);
14277 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
14278 LDKSignature bitcoin_signature_arg_ref;
14279 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
14280 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
14281 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
14282 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14283 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14284 long ret_ref = (long)ret_var.inner;
14285 if (ret_var.is_owned) {
14291 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
14292 LDKAnnouncementSignatures orig_conv;
14293 orig_conv.inner = (void*)(orig & (~1));
14294 orig_conv.is_owned = false;
14295 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
14296 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14297 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14298 long ret_ref = (long)ret_var.inner;
14299 if (ret_var.is_owned) {
14305 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
14306 if ((this_ptr & 1) != 0) return;
14307 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
14308 FREE((void*)this_ptr);
14309 NetAddress_free(this_ptr_conv);
14312 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
14313 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
14314 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
14315 *ret_copy = NetAddress_clone(orig_conv);
14316 long ret_ref = (long)ret_copy;
14320 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
14321 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
14322 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
14323 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14324 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14325 CVec_u8Z_free(ret_var);
14329 uint32_t __attribute__((visibility("default"))) TS_Result_read(int8_tArray ser) {
14330 LDKu8slice ser_ref;
14331 ser_ref.datalen = *((uint32_t*)ser);
14332 ser_ref.data = (int8_t*)(ser + 4);
14333 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
14334 *ret_conv = Result_read(ser_ref);
14335 return (long)ret_conv;
14338 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
14339 LDKUnsignedNodeAnnouncement this_obj_conv;
14340 this_obj_conv.inner = (void*)(this_obj & (~1));
14341 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14342 UnsignedNodeAnnouncement_free(this_obj_conv);
14345 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
14346 LDKUnsignedNodeAnnouncement this_ptr_conv;
14347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14348 this_ptr_conv.is_owned = false;
14349 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
14350 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14351 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14352 long ret_ref = (long)ret_var.inner;
14353 if (ret_var.is_owned) {
14359 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
14360 LDKUnsignedNodeAnnouncement this_ptr_conv;
14361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14362 this_ptr_conv.is_owned = false;
14363 LDKNodeFeatures val_conv;
14364 val_conv.inner = (void*)(val & (~1));
14365 val_conv.is_owned = (val & 1) || (val == 0);
14366 val_conv = NodeFeatures_clone(&val_conv);
14367 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
14370 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
14371 LDKUnsignedNodeAnnouncement this_ptr_conv;
14372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14373 this_ptr_conv.is_owned = false;
14374 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
14378 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
14379 LDKUnsignedNodeAnnouncement this_ptr_conv;
14380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14381 this_ptr_conv.is_owned = false;
14382 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
14385 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
14386 LDKUnsignedNodeAnnouncement this_ptr_conv;
14387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14388 this_ptr_conv.is_owned = false;
14389 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14390 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
14394 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
14395 LDKUnsignedNodeAnnouncement this_ptr_conv;
14396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14397 this_ptr_conv.is_owned = false;
14398 LDKPublicKey val_ref;
14399 CHECK(*((uint32_t*)val) == 33);
14400 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14401 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
14404 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
14405 LDKUnsignedNodeAnnouncement this_ptr_conv;
14406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14407 this_ptr_conv.is_owned = false;
14408 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
14409 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
14413 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
14414 LDKUnsignedNodeAnnouncement this_ptr_conv;
14415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14416 this_ptr_conv.is_owned = false;
14417 LDKThreeBytes val_ref;
14418 CHECK(*((uint32_t*)val) == 3);
14419 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
14420 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
14423 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
14424 LDKUnsignedNodeAnnouncement this_ptr_conv;
14425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14426 this_ptr_conv.is_owned = false;
14427 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14428 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
14432 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
14433 LDKUnsignedNodeAnnouncement this_ptr_conv;
14434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14435 this_ptr_conv.is_owned = false;
14436 LDKThirtyTwoBytes val_ref;
14437 CHECK(*((uint32_t*)val) == 32);
14438 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14439 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
14442 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
14443 LDKUnsignedNodeAnnouncement this_ptr_conv;
14444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14445 this_ptr_conv.is_owned = false;
14446 LDKCVec_NetAddressZ val_constr;
14447 val_constr.datalen = *((uint32_t*)val);
14448 if (val_constr.datalen > 0)
14449 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14451 val_constr.data = NULL;
14452 uint32_t* val_vals = (uint32_t*)(val + 4);
14453 for (size_t m = 0; m < val_constr.datalen; m++) {
14454 uint32_t val_conv_12 = val_vals[m];
14455 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
14456 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
14457 val_constr.data[m] = val_conv_12_conv;
14459 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
14462 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
14463 LDKUnsignedNodeAnnouncement orig_conv;
14464 orig_conv.inner = (void*)(orig & (~1));
14465 orig_conv.is_owned = false;
14466 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
14467 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14468 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14469 long ret_ref = (long)ret_var.inner;
14470 if (ret_var.is_owned) {
14476 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
14477 LDKNodeAnnouncement this_obj_conv;
14478 this_obj_conv.inner = (void*)(this_obj & (~1));
14479 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14480 NodeAnnouncement_free(this_obj_conv);
14483 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
14484 LDKNodeAnnouncement this_ptr_conv;
14485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14486 this_ptr_conv.is_owned = false;
14487 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14488 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
14492 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
14493 LDKNodeAnnouncement this_ptr_conv;
14494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14495 this_ptr_conv.is_owned = false;
14496 LDKSignature val_ref;
14497 CHECK(*((uint32_t*)val) == 64);
14498 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14499 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
14502 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
14503 LDKNodeAnnouncement this_ptr_conv;
14504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14505 this_ptr_conv.is_owned = false;
14506 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
14507 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14508 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14509 long ret_ref = (long)ret_var.inner;
14510 if (ret_var.is_owned) {
14516 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
14517 LDKNodeAnnouncement this_ptr_conv;
14518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14519 this_ptr_conv.is_owned = false;
14520 LDKUnsignedNodeAnnouncement val_conv;
14521 val_conv.inner = (void*)(val & (~1));
14522 val_conv.is_owned = (val & 1) || (val == 0);
14523 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
14524 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
14527 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
14528 LDKSignature signature_arg_ref;
14529 CHECK(*((uint32_t*)signature_arg) == 64);
14530 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
14531 LDKUnsignedNodeAnnouncement contents_arg_conv;
14532 contents_arg_conv.inner = (void*)(contents_arg & (~1));
14533 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
14534 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
14535 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
14536 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14537 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14538 long ret_ref = (long)ret_var.inner;
14539 if (ret_var.is_owned) {
14545 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
14546 LDKNodeAnnouncement orig_conv;
14547 orig_conv.inner = (void*)(orig & (~1));
14548 orig_conv.is_owned = false;
14549 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
14550 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14551 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14552 long ret_ref = (long)ret_var.inner;
14553 if (ret_var.is_owned) {
14559 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
14560 LDKUnsignedChannelAnnouncement this_obj_conv;
14561 this_obj_conv.inner = (void*)(this_obj & (~1));
14562 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14563 UnsignedChannelAnnouncement_free(this_obj_conv);
14566 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
14567 LDKUnsignedChannelAnnouncement this_ptr_conv;
14568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14569 this_ptr_conv.is_owned = false;
14570 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
14571 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14572 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14573 long ret_ref = (long)ret_var.inner;
14574 if (ret_var.is_owned) {
14580 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
14581 LDKUnsignedChannelAnnouncement this_ptr_conv;
14582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14583 this_ptr_conv.is_owned = false;
14584 LDKChannelFeatures val_conv;
14585 val_conv.inner = (void*)(val & (~1));
14586 val_conv.is_owned = (val & 1) || (val == 0);
14587 val_conv = ChannelFeatures_clone(&val_conv);
14588 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
14591 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
14592 LDKUnsignedChannelAnnouncement this_ptr_conv;
14593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14594 this_ptr_conv.is_owned = false;
14595 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14596 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
14600 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14601 LDKUnsignedChannelAnnouncement this_ptr_conv;
14602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14603 this_ptr_conv.is_owned = false;
14604 LDKThirtyTwoBytes val_ref;
14605 CHECK(*((uint32_t*)val) == 32);
14606 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14607 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
14610 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
14611 LDKUnsignedChannelAnnouncement this_ptr_conv;
14612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14613 this_ptr_conv.is_owned = false;
14614 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
14618 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
14619 LDKUnsignedChannelAnnouncement this_ptr_conv;
14620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14621 this_ptr_conv.is_owned = false;
14622 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
14625 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
14626 LDKUnsignedChannelAnnouncement this_ptr_conv;
14627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14628 this_ptr_conv.is_owned = false;
14629 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14630 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
14634 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
14635 LDKUnsignedChannelAnnouncement this_ptr_conv;
14636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14637 this_ptr_conv.is_owned = false;
14638 LDKPublicKey val_ref;
14639 CHECK(*((uint32_t*)val) == 33);
14640 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14641 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
14644 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
14645 LDKUnsignedChannelAnnouncement this_ptr_conv;
14646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14647 this_ptr_conv.is_owned = false;
14648 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14649 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
14653 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
14654 LDKUnsignedChannelAnnouncement this_ptr_conv;
14655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14656 this_ptr_conv.is_owned = false;
14657 LDKPublicKey val_ref;
14658 CHECK(*((uint32_t*)val) == 33);
14659 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14660 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
14663 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
14664 LDKUnsignedChannelAnnouncement this_ptr_conv;
14665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14666 this_ptr_conv.is_owned = false;
14667 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14668 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
14672 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
14673 LDKUnsignedChannelAnnouncement this_ptr_conv;
14674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14675 this_ptr_conv.is_owned = false;
14676 LDKPublicKey val_ref;
14677 CHECK(*((uint32_t*)val) == 33);
14678 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14679 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
14682 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
14683 LDKUnsignedChannelAnnouncement this_ptr_conv;
14684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14685 this_ptr_conv.is_owned = false;
14686 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14687 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
14691 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
14692 LDKUnsignedChannelAnnouncement this_ptr_conv;
14693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14694 this_ptr_conv.is_owned = false;
14695 LDKPublicKey val_ref;
14696 CHECK(*((uint32_t*)val) == 33);
14697 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14698 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
14701 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
14702 LDKUnsignedChannelAnnouncement orig_conv;
14703 orig_conv.inner = (void*)(orig & (~1));
14704 orig_conv.is_owned = false;
14705 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
14706 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14707 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14708 long ret_ref = (long)ret_var.inner;
14709 if (ret_var.is_owned) {
14715 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
14716 LDKChannelAnnouncement this_obj_conv;
14717 this_obj_conv.inner = (void*)(this_obj & (~1));
14718 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14719 ChannelAnnouncement_free(this_obj_conv);
14722 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
14723 LDKChannelAnnouncement this_ptr_conv;
14724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14725 this_ptr_conv.is_owned = false;
14726 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14727 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
14731 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
14732 LDKChannelAnnouncement this_ptr_conv;
14733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14734 this_ptr_conv.is_owned = false;
14735 LDKSignature val_ref;
14736 CHECK(*((uint32_t*)val) == 64);
14737 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14738 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
14741 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
14742 LDKChannelAnnouncement this_ptr_conv;
14743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14744 this_ptr_conv.is_owned = false;
14745 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14746 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
14750 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
14751 LDKChannelAnnouncement this_ptr_conv;
14752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14753 this_ptr_conv.is_owned = false;
14754 LDKSignature val_ref;
14755 CHECK(*((uint32_t*)val) == 64);
14756 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14757 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
14760 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
14761 LDKChannelAnnouncement this_ptr_conv;
14762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14763 this_ptr_conv.is_owned = false;
14764 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14765 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
14769 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
14770 LDKChannelAnnouncement this_ptr_conv;
14771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14772 this_ptr_conv.is_owned = false;
14773 LDKSignature val_ref;
14774 CHECK(*((uint32_t*)val) == 64);
14775 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14776 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
14779 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
14780 LDKChannelAnnouncement this_ptr_conv;
14781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14782 this_ptr_conv.is_owned = false;
14783 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14784 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
14788 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
14789 LDKChannelAnnouncement this_ptr_conv;
14790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14791 this_ptr_conv.is_owned = false;
14792 LDKSignature val_ref;
14793 CHECK(*((uint32_t*)val) == 64);
14794 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14795 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
14798 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
14799 LDKChannelAnnouncement this_ptr_conv;
14800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14801 this_ptr_conv.is_owned = false;
14802 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
14803 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14804 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14805 long ret_ref = (long)ret_var.inner;
14806 if (ret_var.is_owned) {
14812 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
14813 LDKChannelAnnouncement this_ptr_conv;
14814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14815 this_ptr_conv.is_owned = false;
14816 LDKUnsignedChannelAnnouncement val_conv;
14817 val_conv.inner = (void*)(val & (~1));
14818 val_conv.is_owned = (val & 1) || (val == 0);
14819 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
14820 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
14823 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) {
14824 LDKSignature node_signature_1_arg_ref;
14825 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
14826 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
14827 LDKSignature node_signature_2_arg_ref;
14828 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
14829 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
14830 LDKSignature bitcoin_signature_1_arg_ref;
14831 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
14832 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
14833 LDKSignature bitcoin_signature_2_arg_ref;
14834 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
14835 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
14836 LDKUnsignedChannelAnnouncement contents_arg_conv;
14837 contents_arg_conv.inner = (void*)(contents_arg & (~1));
14838 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
14839 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
14840 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);
14841 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14842 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14843 long ret_ref = (long)ret_var.inner;
14844 if (ret_var.is_owned) {
14850 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
14851 LDKChannelAnnouncement orig_conv;
14852 orig_conv.inner = (void*)(orig & (~1));
14853 orig_conv.is_owned = false;
14854 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
14855 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14856 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14857 long ret_ref = (long)ret_var.inner;
14858 if (ret_var.is_owned) {
14864 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
14865 LDKUnsignedChannelUpdate this_obj_conv;
14866 this_obj_conv.inner = (void*)(this_obj & (~1));
14867 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14868 UnsignedChannelUpdate_free(this_obj_conv);
14871 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
14872 LDKUnsignedChannelUpdate this_ptr_conv;
14873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14874 this_ptr_conv.is_owned = false;
14875 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14876 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
14880 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14881 LDKUnsignedChannelUpdate this_ptr_conv;
14882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14883 this_ptr_conv.is_owned = false;
14884 LDKThirtyTwoBytes val_ref;
14885 CHECK(*((uint32_t*)val) == 32);
14886 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14887 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
14890 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
14891 LDKUnsignedChannelUpdate this_ptr_conv;
14892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14893 this_ptr_conv.is_owned = false;
14894 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
14898 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
14899 LDKUnsignedChannelUpdate this_ptr_conv;
14900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14901 this_ptr_conv.is_owned = false;
14902 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
14905 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
14906 LDKUnsignedChannelUpdate this_ptr_conv;
14907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14908 this_ptr_conv.is_owned = false;
14909 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
14913 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
14914 LDKUnsignedChannelUpdate this_ptr_conv;
14915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14916 this_ptr_conv.is_owned = false;
14917 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
14920 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
14921 LDKUnsignedChannelUpdate this_ptr_conv;
14922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14923 this_ptr_conv.is_owned = false;
14924 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
14928 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
14929 LDKUnsignedChannelUpdate this_ptr_conv;
14930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14931 this_ptr_conv.is_owned = false;
14932 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
14935 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
14936 LDKUnsignedChannelUpdate this_ptr_conv;
14937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14938 this_ptr_conv.is_owned = false;
14939 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
14943 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
14944 LDKUnsignedChannelUpdate this_ptr_conv;
14945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14946 this_ptr_conv.is_owned = false;
14947 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
14950 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
14951 LDKUnsignedChannelUpdate this_ptr_conv;
14952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14953 this_ptr_conv.is_owned = false;
14954 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
14958 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
14959 LDKUnsignedChannelUpdate this_ptr_conv;
14960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14961 this_ptr_conv.is_owned = false;
14962 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
14965 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
14966 LDKUnsignedChannelUpdate this_ptr_conv;
14967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14968 this_ptr_conv.is_owned = false;
14969 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
14973 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
14974 LDKUnsignedChannelUpdate this_ptr_conv;
14975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14976 this_ptr_conv.is_owned = false;
14977 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
14980 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
14981 LDKUnsignedChannelUpdate this_ptr_conv;
14982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14983 this_ptr_conv.is_owned = false;
14984 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
14988 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
14989 LDKUnsignedChannelUpdate this_ptr_conv;
14990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14991 this_ptr_conv.is_owned = false;
14992 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
14995 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
14996 LDKUnsignedChannelUpdate orig_conv;
14997 orig_conv.inner = (void*)(orig & (~1));
14998 orig_conv.is_owned = false;
14999 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
15000 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15001 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15002 long ret_ref = (long)ret_var.inner;
15003 if (ret_var.is_owned) {
15009 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
15010 LDKChannelUpdate this_obj_conv;
15011 this_obj_conv.inner = (void*)(this_obj & (~1));
15012 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15013 ChannelUpdate_free(this_obj_conv);
15016 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
15017 LDKChannelUpdate this_ptr_conv;
15018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15019 this_ptr_conv.is_owned = false;
15020 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
15021 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
15025 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
15026 LDKChannelUpdate this_ptr_conv;
15027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15028 this_ptr_conv.is_owned = false;
15029 LDKSignature val_ref;
15030 CHECK(*((uint32_t*)val) == 64);
15031 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
15032 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
15035 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
15036 LDKChannelUpdate this_ptr_conv;
15037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15038 this_ptr_conv.is_owned = false;
15039 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
15040 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15041 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15042 long ret_ref = (long)ret_var.inner;
15043 if (ret_var.is_owned) {
15049 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
15050 LDKChannelUpdate this_ptr_conv;
15051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15052 this_ptr_conv.is_owned = false;
15053 LDKUnsignedChannelUpdate val_conv;
15054 val_conv.inner = (void*)(val & (~1));
15055 val_conv.is_owned = (val & 1) || (val == 0);
15056 val_conv = UnsignedChannelUpdate_clone(&val_conv);
15057 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
15060 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
15061 LDKSignature signature_arg_ref;
15062 CHECK(*((uint32_t*)signature_arg) == 64);
15063 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
15064 LDKUnsignedChannelUpdate contents_arg_conv;
15065 contents_arg_conv.inner = (void*)(contents_arg & (~1));
15066 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
15067 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
15068 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
15069 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15070 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15071 long ret_ref = (long)ret_var.inner;
15072 if (ret_var.is_owned) {
15078 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
15079 LDKChannelUpdate orig_conv;
15080 orig_conv.inner = (void*)(orig & (~1));
15081 orig_conv.is_owned = false;
15082 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
15083 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15084 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15085 long ret_ref = (long)ret_var.inner;
15086 if (ret_var.is_owned) {
15092 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
15093 LDKQueryChannelRange this_obj_conv;
15094 this_obj_conv.inner = (void*)(this_obj & (~1));
15095 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15096 QueryChannelRange_free(this_obj_conv);
15099 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
15100 LDKQueryChannelRange this_ptr_conv;
15101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15102 this_ptr_conv.is_owned = false;
15103 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15104 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
15108 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
15109 LDKQueryChannelRange this_ptr_conv;
15110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15111 this_ptr_conv.is_owned = false;
15112 LDKThirtyTwoBytes val_ref;
15113 CHECK(*((uint32_t*)val) == 32);
15114 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15115 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
15118 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
15119 LDKQueryChannelRange this_ptr_conv;
15120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15121 this_ptr_conv.is_owned = false;
15122 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
15126 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
15127 LDKQueryChannelRange this_ptr_conv;
15128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15129 this_ptr_conv.is_owned = false;
15130 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
15133 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
15134 LDKQueryChannelRange this_ptr_conv;
15135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15136 this_ptr_conv.is_owned = false;
15137 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
15141 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
15142 LDKQueryChannelRange this_ptr_conv;
15143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15144 this_ptr_conv.is_owned = false;
15145 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
15148 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
15149 LDKThirtyTwoBytes chain_hash_arg_ref;
15150 CHECK(*((uint32_t*)chain_hash_arg) == 32);
15151 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
15152 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
15153 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15154 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15155 long ret_ref = (long)ret_var.inner;
15156 if (ret_var.is_owned) {
15162 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
15163 LDKQueryChannelRange orig_conv;
15164 orig_conv.inner = (void*)(orig & (~1));
15165 orig_conv.is_owned = false;
15166 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
15167 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15168 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15169 long ret_ref = (long)ret_var.inner;
15170 if (ret_var.is_owned) {
15176 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
15177 LDKReplyChannelRange this_obj_conv;
15178 this_obj_conv.inner = (void*)(this_obj & (~1));
15179 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15180 ReplyChannelRange_free(this_obj_conv);
15183 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
15184 LDKReplyChannelRange this_ptr_conv;
15185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15186 this_ptr_conv.is_owned = false;
15187 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15188 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
15192 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
15193 LDKReplyChannelRange this_ptr_conv;
15194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15195 this_ptr_conv.is_owned = false;
15196 LDKThirtyTwoBytes val_ref;
15197 CHECK(*((uint32_t*)val) == 32);
15198 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15199 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
15202 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
15203 LDKReplyChannelRange this_ptr_conv;
15204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15205 this_ptr_conv.is_owned = false;
15206 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
15210 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
15211 LDKReplyChannelRange this_ptr_conv;
15212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15213 this_ptr_conv.is_owned = false;
15214 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
15217 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
15218 LDKReplyChannelRange this_ptr_conv;
15219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15220 this_ptr_conv.is_owned = false;
15221 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
15225 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
15226 LDKReplyChannelRange this_ptr_conv;
15227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15228 this_ptr_conv.is_owned = false;
15229 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
15232 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
15233 LDKReplyChannelRange this_ptr_conv;
15234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15235 this_ptr_conv.is_owned = false;
15236 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
15240 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
15241 LDKReplyChannelRange this_ptr_conv;
15242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15243 this_ptr_conv.is_owned = false;
15244 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
15247 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
15248 LDKReplyChannelRange this_ptr_conv;
15249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15250 this_ptr_conv.is_owned = false;
15251 LDKCVec_u64Z val_constr;
15252 val_constr.datalen = *((uint32_t*)val);
15253 if (val_constr.datalen > 0)
15254 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15256 val_constr.data = NULL;
15257 int64_t* val_vals = (int64_t*)(val + 4);
15258 for (size_t i = 0; i < val_constr.datalen; i++) {
15259 int64_t val_conv_8 = val_vals[i];
15260 val_constr.data[i] = val_conv_8;
15262 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
15265 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) {
15266 LDKThirtyTwoBytes chain_hash_arg_ref;
15267 CHECK(*((uint32_t*)chain_hash_arg) == 32);
15268 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
15269 LDKCVec_u64Z short_channel_ids_arg_constr;
15270 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
15271 if (short_channel_ids_arg_constr.datalen > 0)
15272 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15274 short_channel_ids_arg_constr.data = NULL;
15275 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
15276 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
15277 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
15278 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
15280 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
15281 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15282 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15283 long ret_ref = (long)ret_var.inner;
15284 if (ret_var.is_owned) {
15290 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
15291 LDKReplyChannelRange orig_conv;
15292 orig_conv.inner = (void*)(orig & (~1));
15293 orig_conv.is_owned = false;
15294 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
15295 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15296 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15297 long ret_ref = (long)ret_var.inner;
15298 if (ret_var.is_owned) {
15304 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
15305 LDKQueryShortChannelIds this_obj_conv;
15306 this_obj_conv.inner = (void*)(this_obj & (~1));
15307 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15308 QueryShortChannelIds_free(this_obj_conv);
15311 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
15312 LDKQueryShortChannelIds this_ptr_conv;
15313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15314 this_ptr_conv.is_owned = false;
15315 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15316 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
15320 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
15321 LDKQueryShortChannelIds this_ptr_conv;
15322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15323 this_ptr_conv.is_owned = false;
15324 LDKThirtyTwoBytes val_ref;
15325 CHECK(*((uint32_t*)val) == 32);
15326 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15327 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
15330 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
15331 LDKQueryShortChannelIds this_ptr_conv;
15332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15333 this_ptr_conv.is_owned = false;
15334 LDKCVec_u64Z val_constr;
15335 val_constr.datalen = *((uint32_t*)val);
15336 if (val_constr.datalen > 0)
15337 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15339 val_constr.data = NULL;
15340 int64_t* val_vals = (int64_t*)(val + 4);
15341 for (size_t i = 0; i < val_constr.datalen; i++) {
15342 int64_t val_conv_8 = val_vals[i];
15343 val_constr.data[i] = val_conv_8;
15345 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
15348 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
15349 LDKThirtyTwoBytes chain_hash_arg_ref;
15350 CHECK(*((uint32_t*)chain_hash_arg) == 32);
15351 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
15352 LDKCVec_u64Z short_channel_ids_arg_constr;
15353 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
15354 if (short_channel_ids_arg_constr.datalen > 0)
15355 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15357 short_channel_ids_arg_constr.data = NULL;
15358 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
15359 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
15360 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
15361 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
15363 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
15364 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15365 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15366 long ret_ref = (long)ret_var.inner;
15367 if (ret_var.is_owned) {
15373 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
15374 LDKQueryShortChannelIds orig_conv;
15375 orig_conv.inner = (void*)(orig & (~1));
15376 orig_conv.is_owned = false;
15377 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
15378 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15379 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15380 long ret_ref = (long)ret_var.inner;
15381 if (ret_var.is_owned) {
15387 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
15388 LDKReplyShortChannelIdsEnd this_obj_conv;
15389 this_obj_conv.inner = (void*)(this_obj & (~1));
15390 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15391 ReplyShortChannelIdsEnd_free(this_obj_conv);
15394 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
15395 LDKReplyShortChannelIdsEnd this_ptr_conv;
15396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15397 this_ptr_conv.is_owned = false;
15398 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15399 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
15403 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
15404 LDKReplyShortChannelIdsEnd this_ptr_conv;
15405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15406 this_ptr_conv.is_owned = false;
15407 LDKThirtyTwoBytes val_ref;
15408 CHECK(*((uint32_t*)val) == 32);
15409 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15410 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
15413 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
15414 LDKReplyShortChannelIdsEnd this_ptr_conv;
15415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15416 this_ptr_conv.is_owned = false;
15417 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
15421 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
15422 LDKReplyShortChannelIdsEnd this_ptr_conv;
15423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15424 this_ptr_conv.is_owned = false;
15425 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
15428 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
15429 LDKThirtyTwoBytes chain_hash_arg_ref;
15430 CHECK(*((uint32_t*)chain_hash_arg) == 32);
15431 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
15432 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
15433 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15434 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15435 long ret_ref = (long)ret_var.inner;
15436 if (ret_var.is_owned) {
15442 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
15443 LDKReplyShortChannelIdsEnd orig_conv;
15444 orig_conv.inner = (void*)(orig & (~1));
15445 orig_conv.is_owned = false;
15446 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
15447 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15448 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15449 long ret_ref = (long)ret_var.inner;
15450 if (ret_var.is_owned) {
15456 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
15457 LDKGossipTimestampFilter this_obj_conv;
15458 this_obj_conv.inner = (void*)(this_obj & (~1));
15459 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15460 GossipTimestampFilter_free(this_obj_conv);
15463 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
15464 LDKGossipTimestampFilter this_ptr_conv;
15465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15466 this_ptr_conv.is_owned = false;
15467 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15468 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
15472 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
15473 LDKGossipTimestampFilter this_ptr_conv;
15474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15475 this_ptr_conv.is_owned = false;
15476 LDKThirtyTwoBytes val_ref;
15477 CHECK(*((uint32_t*)val) == 32);
15478 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15479 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
15482 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
15483 LDKGossipTimestampFilter this_ptr_conv;
15484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15485 this_ptr_conv.is_owned = false;
15486 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
15490 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
15491 LDKGossipTimestampFilter this_ptr_conv;
15492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15493 this_ptr_conv.is_owned = false;
15494 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
15497 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
15498 LDKGossipTimestampFilter this_ptr_conv;
15499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15500 this_ptr_conv.is_owned = false;
15501 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
15505 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
15506 LDKGossipTimestampFilter this_ptr_conv;
15507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15508 this_ptr_conv.is_owned = false;
15509 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
15512 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
15513 LDKThirtyTwoBytes chain_hash_arg_ref;
15514 CHECK(*((uint32_t*)chain_hash_arg) == 32);
15515 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
15516 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
15517 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15518 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15519 long ret_ref = (long)ret_var.inner;
15520 if (ret_var.is_owned) {
15526 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
15527 LDKGossipTimestampFilter orig_conv;
15528 orig_conv.inner = (void*)(orig & (~1));
15529 orig_conv.is_owned = false;
15530 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
15531 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15532 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15533 long ret_ref = (long)ret_var.inner;
15534 if (ret_var.is_owned) {
15540 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
15541 if ((this_ptr & 1) != 0) return;
15542 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
15543 FREE((void*)this_ptr);
15544 ErrorAction_free(this_ptr_conv);
15547 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
15548 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
15549 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
15550 *ret_copy = ErrorAction_clone(orig_conv);
15551 long ret_ref = (long)ret_copy;
15555 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
15556 LDKLightningError this_obj_conv;
15557 this_obj_conv.inner = (void*)(this_obj & (~1));
15558 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15559 LightningError_free(this_obj_conv);
15562 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
15563 LDKLightningError this_ptr_conv;
15564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15565 this_ptr_conv.is_owned = false;
15566 LDKStr _str = LightningError_get_err(&this_ptr_conv);
15567 jstring _conv = str_ref_to_ts(_str.chars, _str.len);
15571 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, int8_tArray val) {
15572 LDKLightningError this_ptr_conv;
15573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15574 this_ptr_conv.is_owned = false;
15575 LDKCVec_u8Z val_ref;
15576 val_ref.datalen = *((uint32_t*)val);
15577 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
15578 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
15579 LightningError_set_err(&this_ptr_conv, val_ref);
15582 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
15583 LDKLightningError this_ptr_conv;
15584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15585 this_ptr_conv.is_owned = false;
15586 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
15587 *ret_copy = LightningError_get_action(&this_ptr_conv);
15588 long ret_ref = (long)ret_copy;
15592 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
15593 LDKLightningError this_ptr_conv;
15594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15595 this_ptr_conv.is_owned = false;
15596 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
15598 LightningError_set_action(&this_ptr_conv, val_conv);
15601 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(int8_tArray err_arg, uint32_t action_arg) {
15602 LDKCVec_u8Z err_arg_ref;
15603 err_arg_ref.datalen = *((uint32_t*)err_arg);
15604 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
15605 memcpy(err_arg_ref.data, (uint8_t*)(err_arg + 4), err_arg_ref.datalen);
15606 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
15607 FREE((void*)action_arg);
15608 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
15609 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15610 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15611 long ret_ref = (long)ret_var.inner;
15612 if (ret_var.is_owned) {
15618 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
15619 LDKLightningError orig_conv;
15620 orig_conv.inner = (void*)(orig & (~1));
15621 orig_conv.is_owned = false;
15622 LDKLightningError ret_var = LightningError_clone(&orig_conv);
15623 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15624 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15625 long ret_ref = (long)ret_var.inner;
15626 if (ret_var.is_owned) {
15632 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
15633 LDKCommitmentUpdate this_obj_conv;
15634 this_obj_conv.inner = (void*)(this_obj & (~1));
15635 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15636 CommitmentUpdate_free(this_obj_conv);
15639 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
15640 LDKCommitmentUpdate this_ptr_conv;
15641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15642 this_ptr_conv.is_owned = false;
15643 LDKCVec_UpdateAddHTLCZ val_constr;
15644 val_constr.datalen = *((uint32_t*)val);
15645 if (val_constr.datalen > 0)
15646 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
15648 val_constr.data = NULL;
15649 uint32_t* val_vals = (uint32_t*)(val + 4);
15650 for (size_t p = 0; p < val_constr.datalen; p++) {
15651 uint32_t val_conv_15 = val_vals[p];
15652 LDKUpdateAddHTLC val_conv_15_conv;
15653 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
15654 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
15655 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
15656 val_constr.data[p] = val_conv_15_conv;
15658 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
15661 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
15662 LDKCommitmentUpdate this_ptr_conv;
15663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15664 this_ptr_conv.is_owned = false;
15665 LDKCVec_UpdateFulfillHTLCZ val_constr;
15666 val_constr.datalen = *((uint32_t*)val);
15667 if (val_constr.datalen > 0)
15668 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
15670 val_constr.data = NULL;
15671 uint32_t* val_vals = (uint32_t*)(val + 4);
15672 for (size_t t = 0; t < val_constr.datalen; t++) {
15673 uint32_t val_conv_19 = val_vals[t];
15674 LDKUpdateFulfillHTLC val_conv_19_conv;
15675 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
15676 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
15677 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
15678 val_constr.data[t] = val_conv_19_conv;
15680 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
15683 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
15684 LDKCommitmentUpdate this_ptr_conv;
15685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15686 this_ptr_conv.is_owned = false;
15687 LDKCVec_UpdateFailHTLCZ val_constr;
15688 val_constr.datalen = *((uint32_t*)val);
15689 if (val_constr.datalen > 0)
15690 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
15692 val_constr.data = NULL;
15693 uint32_t* val_vals = (uint32_t*)(val + 4);
15694 for (size_t q = 0; q < val_constr.datalen; q++) {
15695 uint32_t val_conv_16 = val_vals[q];
15696 LDKUpdateFailHTLC val_conv_16_conv;
15697 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
15698 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
15699 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
15700 val_constr.data[q] = val_conv_16_conv;
15702 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
15705 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
15706 LDKCommitmentUpdate this_ptr_conv;
15707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15708 this_ptr_conv.is_owned = false;
15709 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
15710 val_constr.datalen = *((uint32_t*)val);
15711 if (val_constr.datalen > 0)
15712 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
15714 val_constr.data = NULL;
15715 uint32_t* val_vals = (uint32_t*)(val + 4);
15716 for (size_t z = 0; z < val_constr.datalen; z++) {
15717 uint32_t val_conv_25 = val_vals[z];
15718 LDKUpdateFailMalformedHTLC val_conv_25_conv;
15719 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
15720 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
15721 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
15722 val_constr.data[z] = val_conv_25_conv;
15724 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
15727 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
15728 LDKCommitmentUpdate this_ptr_conv;
15729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15730 this_ptr_conv.is_owned = false;
15731 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
15732 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15733 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15734 long ret_ref = (long)ret_var.inner;
15735 if (ret_var.is_owned) {
15741 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
15742 LDKCommitmentUpdate this_ptr_conv;
15743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15744 this_ptr_conv.is_owned = false;
15745 LDKUpdateFee val_conv;
15746 val_conv.inner = (void*)(val & (~1));
15747 val_conv.is_owned = (val & 1) || (val == 0);
15748 val_conv = UpdateFee_clone(&val_conv);
15749 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
15752 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
15753 LDKCommitmentUpdate this_ptr_conv;
15754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15755 this_ptr_conv.is_owned = false;
15756 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
15757 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15758 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15759 long ret_ref = (long)ret_var.inner;
15760 if (ret_var.is_owned) {
15766 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
15767 LDKCommitmentUpdate this_ptr_conv;
15768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15769 this_ptr_conv.is_owned = false;
15770 LDKCommitmentSigned val_conv;
15771 val_conv.inner = (void*)(val & (~1));
15772 val_conv.is_owned = (val & 1) || (val == 0);
15773 val_conv = CommitmentSigned_clone(&val_conv);
15774 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
15777 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) {
15778 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
15779 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
15780 if (update_add_htlcs_arg_constr.datalen > 0)
15781 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
15783 update_add_htlcs_arg_constr.data = NULL;
15784 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
15785 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
15786 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
15787 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
15788 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
15789 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
15790 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
15791 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
15793 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
15794 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
15795 if (update_fulfill_htlcs_arg_constr.datalen > 0)
15796 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
15798 update_fulfill_htlcs_arg_constr.data = NULL;
15799 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
15800 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
15801 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
15802 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
15803 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
15804 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
15805 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
15806 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
15808 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
15809 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
15810 if (update_fail_htlcs_arg_constr.datalen > 0)
15811 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
15813 update_fail_htlcs_arg_constr.data = NULL;
15814 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
15815 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
15816 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
15817 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
15818 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
15819 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
15820 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
15821 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
15823 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
15824 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
15825 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
15826 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
15828 update_fail_malformed_htlcs_arg_constr.data = NULL;
15829 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
15830 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
15831 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
15832 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
15833 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
15834 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);
15835 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
15836 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
15838 LDKUpdateFee update_fee_arg_conv;
15839 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
15840 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
15841 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
15842 LDKCommitmentSigned commitment_signed_arg_conv;
15843 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
15844 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
15845 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
15846 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);
15847 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15848 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15849 long ret_ref = (long)ret_var.inner;
15850 if (ret_var.is_owned) {
15856 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
15857 LDKCommitmentUpdate orig_conv;
15858 orig_conv.inner = (void*)(orig & (~1));
15859 orig_conv.is_owned = false;
15860 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
15861 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15862 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15863 long ret_ref = (long)ret_var.inner;
15864 if (ret_var.is_owned) {
15870 void __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_free(uint32_t this_ptr) {
15871 if ((this_ptr & 1) != 0) return;
15872 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
15873 FREE((void*)this_ptr);
15874 HTLCFailChannelUpdate_free(this_ptr_conv);
15877 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_clone(uint32_t orig) {
15878 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
15879 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
15880 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
15881 long ret_ref = (long)ret_copy;
15885 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
15886 if ((this_ptr & 1) != 0) return;
15887 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
15888 FREE((void*)this_ptr);
15889 ChannelMessageHandler_free(this_ptr_conv);
15892 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
15893 if ((this_ptr & 1) != 0) return;
15894 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
15895 FREE((void*)this_ptr);
15896 RoutingMessageHandler_free(this_ptr_conv);
15899 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
15900 LDKAcceptChannel obj_conv;
15901 obj_conv.inner = (void*)(obj & (~1));
15902 obj_conv.is_owned = false;
15903 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
15904 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15905 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15906 CVec_u8Z_free(ret_var);
15910 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
15911 LDKu8slice ser_ref;
15912 ser_ref.datalen = *((uint32_t*)ser);
15913 ser_ref.data = (int8_t*)(ser + 4);
15914 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
15915 *ret_conv = AcceptChannel_read(ser_ref);
15916 return (long)ret_conv;
15919 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
15920 LDKAnnouncementSignatures obj_conv;
15921 obj_conv.inner = (void*)(obj & (~1));
15922 obj_conv.is_owned = false;
15923 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
15924 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15925 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15926 CVec_u8Z_free(ret_var);
15930 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
15931 LDKu8slice ser_ref;
15932 ser_ref.datalen = *((uint32_t*)ser);
15933 ser_ref.data = (int8_t*)(ser + 4);
15934 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
15935 *ret_conv = AnnouncementSignatures_read(ser_ref);
15936 return (long)ret_conv;
15939 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
15940 LDKChannelReestablish obj_conv;
15941 obj_conv.inner = (void*)(obj & (~1));
15942 obj_conv.is_owned = false;
15943 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
15944 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15945 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15946 CVec_u8Z_free(ret_var);
15950 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
15951 LDKu8slice ser_ref;
15952 ser_ref.datalen = *((uint32_t*)ser);
15953 ser_ref.data = (int8_t*)(ser + 4);
15954 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
15955 *ret_conv = ChannelReestablish_read(ser_ref);
15956 return (long)ret_conv;
15959 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
15960 LDKClosingSigned obj_conv;
15961 obj_conv.inner = (void*)(obj & (~1));
15962 obj_conv.is_owned = false;
15963 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
15964 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15965 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15966 CVec_u8Z_free(ret_var);
15970 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
15971 LDKu8slice ser_ref;
15972 ser_ref.datalen = *((uint32_t*)ser);
15973 ser_ref.data = (int8_t*)(ser + 4);
15974 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
15975 *ret_conv = ClosingSigned_read(ser_ref);
15976 return (long)ret_conv;
15979 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
15980 LDKCommitmentSigned obj_conv;
15981 obj_conv.inner = (void*)(obj & (~1));
15982 obj_conv.is_owned = false;
15983 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
15984 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15985 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15986 CVec_u8Z_free(ret_var);
15990 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
15991 LDKu8slice ser_ref;
15992 ser_ref.datalen = *((uint32_t*)ser);
15993 ser_ref.data = (int8_t*)(ser + 4);
15994 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
15995 *ret_conv = CommitmentSigned_read(ser_ref);
15996 return (long)ret_conv;
15999 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
16000 LDKFundingCreated obj_conv;
16001 obj_conv.inner = (void*)(obj & (~1));
16002 obj_conv.is_owned = false;
16003 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
16004 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16005 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16006 CVec_u8Z_free(ret_var);
16010 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
16011 LDKu8slice ser_ref;
16012 ser_ref.datalen = *((uint32_t*)ser);
16013 ser_ref.data = (int8_t*)(ser + 4);
16014 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
16015 *ret_conv = FundingCreated_read(ser_ref);
16016 return (long)ret_conv;
16019 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
16020 LDKFundingSigned obj_conv;
16021 obj_conv.inner = (void*)(obj & (~1));
16022 obj_conv.is_owned = false;
16023 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
16024 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16025 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16026 CVec_u8Z_free(ret_var);
16030 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
16031 LDKu8slice ser_ref;
16032 ser_ref.datalen = *((uint32_t*)ser);
16033 ser_ref.data = (int8_t*)(ser + 4);
16034 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
16035 *ret_conv = FundingSigned_read(ser_ref);
16036 return (long)ret_conv;
16039 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
16040 LDKFundingLocked obj_conv;
16041 obj_conv.inner = (void*)(obj & (~1));
16042 obj_conv.is_owned = false;
16043 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
16044 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16045 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16046 CVec_u8Z_free(ret_var);
16050 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
16051 LDKu8slice ser_ref;
16052 ser_ref.datalen = *((uint32_t*)ser);
16053 ser_ref.data = (int8_t*)(ser + 4);
16054 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
16055 *ret_conv = FundingLocked_read(ser_ref);
16056 return (long)ret_conv;
16059 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
16061 obj_conv.inner = (void*)(obj & (~1));
16062 obj_conv.is_owned = false;
16063 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
16064 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16065 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16066 CVec_u8Z_free(ret_var);
16070 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
16071 LDKu8slice ser_ref;
16072 ser_ref.datalen = *((uint32_t*)ser);
16073 ser_ref.data = (int8_t*)(ser + 4);
16074 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
16075 *ret_conv = Init_read(ser_ref);
16076 return (long)ret_conv;
16079 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
16080 LDKOpenChannel obj_conv;
16081 obj_conv.inner = (void*)(obj & (~1));
16082 obj_conv.is_owned = false;
16083 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
16084 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16085 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16086 CVec_u8Z_free(ret_var);
16090 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
16091 LDKu8slice ser_ref;
16092 ser_ref.datalen = *((uint32_t*)ser);
16093 ser_ref.data = (int8_t*)(ser + 4);
16094 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
16095 *ret_conv = OpenChannel_read(ser_ref);
16096 return (long)ret_conv;
16099 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
16100 LDKRevokeAndACK obj_conv;
16101 obj_conv.inner = (void*)(obj & (~1));
16102 obj_conv.is_owned = false;
16103 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
16104 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16105 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16106 CVec_u8Z_free(ret_var);
16110 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
16111 LDKu8slice ser_ref;
16112 ser_ref.datalen = *((uint32_t*)ser);
16113 ser_ref.data = (int8_t*)(ser + 4);
16114 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
16115 *ret_conv = RevokeAndACK_read(ser_ref);
16116 return (long)ret_conv;
16119 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
16120 LDKShutdown obj_conv;
16121 obj_conv.inner = (void*)(obj & (~1));
16122 obj_conv.is_owned = false;
16123 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
16124 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16125 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16126 CVec_u8Z_free(ret_var);
16130 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
16131 LDKu8slice ser_ref;
16132 ser_ref.datalen = *((uint32_t*)ser);
16133 ser_ref.data = (int8_t*)(ser + 4);
16134 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
16135 *ret_conv = Shutdown_read(ser_ref);
16136 return (long)ret_conv;
16139 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
16140 LDKUpdateFailHTLC obj_conv;
16141 obj_conv.inner = (void*)(obj & (~1));
16142 obj_conv.is_owned = false;
16143 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
16144 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16145 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16146 CVec_u8Z_free(ret_var);
16150 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
16151 LDKu8slice ser_ref;
16152 ser_ref.datalen = *((uint32_t*)ser);
16153 ser_ref.data = (int8_t*)(ser + 4);
16154 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
16155 *ret_conv = UpdateFailHTLC_read(ser_ref);
16156 return (long)ret_conv;
16159 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
16160 LDKUpdateFailMalformedHTLC obj_conv;
16161 obj_conv.inner = (void*)(obj & (~1));
16162 obj_conv.is_owned = false;
16163 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
16164 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16165 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16166 CVec_u8Z_free(ret_var);
16170 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
16171 LDKu8slice ser_ref;
16172 ser_ref.datalen = *((uint32_t*)ser);
16173 ser_ref.data = (int8_t*)(ser + 4);
16174 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
16175 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
16176 return (long)ret_conv;
16179 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
16180 LDKUpdateFee obj_conv;
16181 obj_conv.inner = (void*)(obj & (~1));
16182 obj_conv.is_owned = false;
16183 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
16184 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16185 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16186 CVec_u8Z_free(ret_var);
16190 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
16191 LDKu8slice ser_ref;
16192 ser_ref.datalen = *((uint32_t*)ser);
16193 ser_ref.data = (int8_t*)(ser + 4);
16194 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
16195 *ret_conv = UpdateFee_read(ser_ref);
16196 return (long)ret_conv;
16199 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
16200 LDKUpdateFulfillHTLC obj_conv;
16201 obj_conv.inner = (void*)(obj & (~1));
16202 obj_conv.is_owned = false;
16203 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
16204 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16205 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16206 CVec_u8Z_free(ret_var);
16210 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
16211 LDKu8slice ser_ref;
16212 ser_ref.datalen = *((uint32_t*)ser);
16213 ser_ref.data = (int8_t*)(ser + 4);
16214 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
16215 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
16216 return (long)ret_conv;
16219 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
16220 LDKUpdateAddHTLC obj_conv;
16221 obj_conv.inner = (void*)(obj & (~1));
16222 obj_conv.is_owned = false;
16223 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
16224 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16225 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16226 CVec_u8Z_free(ret_var);
16230 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
16231 LDKu8slice ser_ref;
16232 ser_ref.datalen = *((uint32_t*)ser);
16233 ser_ref.data = (int8_t*)(ser + 4);
16234 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
16235 *ret_conv = UpdateAddHTLC_read(ser_ref);
16236 return (long)ret_conv;
16239 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
16241 obj_conv.inner = (void*)(obj & (~1));
16242 obj_conv.is_owned = false;
16243 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
16244 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16245 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16246 CVec_u8Z_free(ret_var);
16250 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
16251 LDKu8slice ser_ref;
16252 ser_ref.datalen = *((uint32_t*)ser);
16253 ser_ref.data = (int8_t*)(ser + 4);
16254 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
16255 *ret_conv = Ping_read(ser_ref);
16256 return (long)ret_conv;
16259 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
16261 obj_conv.inner = (void*)(obj & (~1));
16262 obj_conv.is_owned = false;
16263 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
16264 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16265 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16266 CVec_u8Z_free(ret_var);
16270 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
16271 LDKu8slice ser_ref;
16272 ser_ref.datalen = *((uint32_t*)ser);
16273 ser_ref.data = (int8_t*)(ser + 4);
16274 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
16275 *ret_conv = Pong_read(ser_ref);
16276 return (long)ret_conv;
16279 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
16280 LDKUnsignedChannelAnnouncement obj_conv;
16281 obj_conv.inner = (void*)(obj & (~1));
16282 obj_conv.is_owned = false;
16283 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
16284 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16285 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16286 CVec_u8Z_free(ret_var);
16290 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
16291 LDKu8slice ser_ref;
16292 ser_ref.datalen = *((uint32_t*)ser);
16293 ser_ref.data = (int8_t*)(ser + 4);
16294 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
16295 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
16296 return (long)ret_conv;
16299 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
16300 LDKChannelAnnouncement obj_conv;
16301 obj_conv.inner = (void*)(obj & (~1));
16302 obj_conv.is_owned = false;
16303 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
16304 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16305 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16306 CVec_u8Z_free(ret_var);
16310 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
16311 LDKu8slice ser_ref;
16312 ser_ref.datalen = *((uint32_t*)ser);
16313 ser_ref.data = (int8_t*)(ser + 4);
16314 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
16315 *ret_conv = ChannelAnnouncement_read(ser_ref);
16316 return (long)ret_conv;
16319 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
16320 LDKUnsignedChannelUpdate obj_conv;
16321 obj_conv.inner = (void*)(obj & (~1));
16322 obj_conv.is_owned = false;
16323 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
16324 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16325 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16326 CVec_u8Z_free(ret_var);
16330 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
16331 LDKu8slice ser_ref;
16332 ser_ref.datalen = *((uint32_t*)ser);
16333 ser_ref.data = (int8_t*)(ser + 4);
16334 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
16335 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
16336 return (long)ret_conv;
16339 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
16340 LDKChannelUpdate obj_conv;
16341 obj_conv.inner = (void*)(obj & (~1));
16342 obj_conv.is_owned = false;
16343 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
16344 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16345 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16346 CVec_u8Z_free(ret_var);
16350 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
16351 LDKu8slice ser_ref;
16352 ser_ref.datalen = *((uint32_t*)ser);
16353 ser_ref.data = (int8_t*)(ser + 4);
16354 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
16355 *ret_conv = ChannelUpdate_read(ser_ref);
16356 return (long)ret_conv;
16359 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
16360 LDKErrorMessage obj_conv;
16361 obj_conv.inner = (void*)(obj & (~1));
16362 obj_conv.is_owned = false;
16363 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
16364 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16365 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16366 CVec_u8Z_free(ret_var);
16370 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
16371 LDKu8slice ser_ref;
16372 ser_ref.datalen = *((uint32_t*)ser);
16373 ser_ref.data = (int8_t*)(ser + 4);
16374 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
16375 *ret_conv = ErrorMessage_read(ser_ref);
16376 return (long)ret_conv;
16379 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
16380 LDKUnsignedNodeAnnouncement obj_conv;
16381 obj_conv.inner = (void*)(obj & (~1));
16382 obj_conv.is_owned = false;
16383 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
16384 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16385 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16386 CVec_u8Z_free(ret_var);
16390 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
16391 LDKu8slice ser_ref;
16392 ser_ref.datalen = *((uint32_t*)ser);
16393 ser_ref.data = (int8_t*)(ser + 4);
16394 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
16395 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
16396 return (long)ret_conv;
16399 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
16400 LDKNodeAnnouncement obj_conv;
16401 obj_conv.inner = (void*)(obj & (~1));
16402 obj_conv.is_owned = false;
16403 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
16404 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16405 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16406 CVec_u8Z_free(ret_var);
16410 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
16411 LDKu8slice ser_ref;
16412 ser_ref.datalen = *((uint32_t*)ser);
16413 ser_ref.data = (int8_t*)(ser + 4);
16414 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
16415 *ret_conv = NodeAnnouncement_read(ser_ref);
16416 return (long)ret_conv;
16419 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
16420 LDKu8slice ser_ref;
16421 ser_ref.datalen = *((uint32_t*)ser);
16422 ser_ref.data = (int8_t*)(ser + 4);
16423 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
16424 *ret_conv = QueryShortChannelIds_read(ser_ref);
16425 return (long)ret_conv;
16428 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
16429 LDKQueryShortChannelIds obj_conv;
16430 obj_conv.inner = (void*)(obj & (~1));
16431 obj_conv.is_owned = false;
16432 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
16433 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16434 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16435 CVec_u8Z_free(ret_var);
16439 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
16440 LDKu8slice ser_ref;
16441 ser_ref.datalen = *((uint32_t*)ser);
16442 ser_ref.data = (int8_t*)(ser + 4);
16443 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
16444 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
16445 return (long)ret_conv;
16448 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
16449 LDKReplyShortChannelIdsEnd obj_conv;
16450 obj_conv.inner = (void*)(obj & (~1));
16451 obj_conv.is_owned = false;
16452 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
16453 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16454 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16455 CVec_u8Z_free(ret_var);
16459 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
16460 LDKQueryChannelRange this_arg_conv;
16461 this_arg_conv.inner = (void*)(this_arg & (~1));
16462 this_arg_conv.is_owned = false;
16463 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
16467 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
16468 LDKu8slice ser_ref;
16469 ser_ref.datalen = *((uint32_t*)ser);
16470 ser_ref.data = (int8_t*)(ser + 4);
16471 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
16472 *ret_conv = QueryChannelRange_read(ser_ref);
16473 return (long)ret_conv;
16476 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
16477 LDKQueryChannelRange obj_conv;
16478 obj_conv.inner = (void*)(obj & (~1));
16479 obj_conv.is_owned = false;
16480 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
16481 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16482 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16483 CVec_u8Z_free(ret_var);
16487 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
16488 LDKu8slice ser_ref;
16489 ser_ref.datalen = *((uint32_t*)ser);
16490 ser_ref.data = (int8_t*)(ser + 4);
16491 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
16492 *ret_conv = ReplyChannelRange_read(ser_ref);
16493 return (long)ret_conv;
16496 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
16497 LDKReplyChannelRange obj_conv;
16498 obj_conv.inner = (void*)(obj & (~1));
16499 obj_conv.is_owned = false;
16500 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
16501 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16502 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16503 CVec_u8Z_free(ret_var);
16507 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
16508 LDKu8slice ser_ref;
16509 ser_ref.datalen = *((uint32_t*)ser);
16510 ser_ref.data = (int8_t*)(ser + 4);
16511 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
16512 *ret_conv = GossipTimestampFilter_read(ser_ref);
16513 return (long)ret_conv;
16516 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
16517 LDKGossipTimestampFilter obj_conv;
16518 obj_conv.inner = (void*)(obj & (~1));
16519 obj_conv.is_owned = false;
16520 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
16521 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16522 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16523 CVec_u8Z_free(ret_var);
16527 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
16528 LDKIgnoringMessageHandler this_obj_conv;
16529 this_obj_conv.inner = (void*)(this_obj & (~1));
16530 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16531 IgnoringMessageHandler_free(this_obj_conv);
16534 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
16535 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
16536 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16537 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16538 long ret_ref = (long)ret_var.inner;
16539 if (ret_var.is_owned) {
16545 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
16546 LDKIgnoringMessageHandler this_arg_conv;
16547 this_arg_conv.inner = (void*)(this_arg & (~1));
16548 this_arg_conv.is_owned = false;
16549 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16550 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
16554 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
16555 LDKIgnoringMessageHandler this_arg_conv;
16556 this_arg_conv.inner = (void*)(this_arg & (~1));
16557 this_arg_conv.is_owned = false;
16558 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
16559 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
16563 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
16564 LDKErroringMessageHandler this_obj_conv;
16565 this_obj_conv.inner = (void*)(this_obj & (~1));
16566 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16567 ErroringMessageHandler_free(this_obj_conv);
16570 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
16571 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
16572 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16573 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16574 long ret_ref = (long)ret_var.inner;
16575 if (ret_var.is_owned) {
16581 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
16582 LDKErroringMessageHandler this_arg_conv;
16583 this_arg_conv.inner = (void*)(this_arg & (~1));
16584 this_arg_conv.is_owned = false;
16585 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16586 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
16590 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
16591 LDKErroringMessageHandler this_arg_conv;
16592 this_arg_conv.inner = (void*)(this_arg & (~1));
16593 this_arg_conv.is_owned = false;
16594 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
16595 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
16599 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
16600 LDKMessageHandler this_obj_conv;
16601 this_obj_conv.inner = (void*)(this_obj & (~1));
16602 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16603 MessageHandler_free(this_obj_conv);
16606 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
16607 LDKMessageHandler this_ptr_conv;
16608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16609 this_ptr_conv.is_owned = false;
16610 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
16614 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
16615 LDKMessageHandler this_ptr_conv;
16616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16617 this_ptr_conv.is_owned = false;
16618 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
16619 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
16622 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
16623 LDKMessageHandler this_ptr_conv;
16624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16625 this_ptr_conv.is_owned = false;
16626 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
16630 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
16631 LDKMessageHandler this_ptr_conv;
16632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16633 this_ptr_conv.is_owned = false;
16634 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
16635 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
16638 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
16639 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
16640 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
16641 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
16642 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16643 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16644 long ret_ref = (long)ret_var.inner;
16645 if (ret_var.is_owned) {
16651 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
16652 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
16653 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
16654 *ret = SocketDescriptor_clone(orig_conv);
16658 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
16659 if ((this_ptr & 1) != 0) return;
16660 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
16661 FREE((void*)this_ptr);
16662 SocketDescriptor_free(this_ptr_conv);
16665 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
16666 LDKPeerHandleError this_obj_conv;
16667 this_obj_conv.inner = (void*)(this_obj & (~1));
16668 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16669 PeerHandleError_free(this_obj_conv);
16672 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
16673 LDKPeerHandleError this_ptr_conv;
16674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16675 this_ptr_conv.is_owned = false;
16676 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
16680 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
16681 LDKPeerHandleError this_ptr_conv;
16682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16683 this_ptr_conv.is_owned = false;
16684 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
16687 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
16688 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
16689 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16690 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16691 long ret_ref = (long)ret_var.inner;
16692 if (ret_var.is_owned) {
16698 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
16699 LDKPeerHandleError orig_conv;
16700 orig_conv.inner = (void*)(orig & (~1));
16701 orig_conv.is_owned = false;
16702 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
16703 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16704 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16705 long ret_ref = (long)ret_var.inner;
16706 if (ret_var.is_owned) {
16712 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
16713 LDKPeerManager this_obj_conv;
16714 this_obj_conv.inner = (void*)(this_obj & (~1));
16715 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16716 PeerManager_free(this_obj_conv);
16719 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) {
16720 LDKMessageHandler message_handler_conv;
16721 message_handler_conv.inner = (void*)(message_handler & (~1));
16722 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
16723 // Warning: we need a move here but no clone is available for LDKMessageHandler
16724 LDKSecretKey our_node_secret_ref;
16725 CHECK(*((uint32_t*)our_node_secret) == 32);
16726 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
16727 unsigned char ephemeral_random_data_arr[32];
16728 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
16729 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
16730 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
16731 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16732 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
16733 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16734 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16735 long ret_ref = (long)ret_var.inner;
16736 if (ret_var.is_owned) {
16742 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
16743 LDKPeerManager this_arg_conv;
16744 this_arg_conv.inner = (void*)(this_arg & (~1));
16745 this_arg_conv.is_owned = false;
16746 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
16747 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
16748 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
16749 for (size_t m = 0; m < ret_var.datalen; m++) {
16750 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16751 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
16752 ret_arr_ptr[m] = ret_conv_12_arr;
16754 FREE(ret_var.data);
16758 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
16759 LDKPeerManager this_arg_conv;
16760 this_arg_conv.inner = (void*)(this_arg & (~1));
16761 this_arg_conv.is_owned = false;
16762 LDKPublicKey their_node_id_ref;
16763 CHECK(*((uint32_t*)their_node_id) == 33);
16764 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
16765 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16766 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
16767 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
16768 return (long)ret_conv;
16771 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
16772 LDKPeerManager this_arg_conv;
16773 this_arg_conv.inner = (void*)(this_arg & (~1));
16774 this_arg_conv.is_owned = false;
16775 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16776 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16777 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
16778 return (long)ret_conv;
16781 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
16782 LDKPeerManager this_arg_conv;
16783 this_arg_conv.inner = (void*)(this_arg & (~1));
16784 this_arg_conv.is_owned = false;
16785 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16786 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16787 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
16788 return (long)ret_conv;
16791 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
16792 LDKPeerManager this_arg_conv;
16793 this_arg_conv.inner = (void*)(this_arg & (~1));
16794 this_arg_conv.is_owned = false;
16795 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
16796 LDKu8slice data_ref;
16797 data_ref.datalen = *((uint32_t*)data);
16798 data_ref.data = (int8_t*)(data + 4);
16799 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
16800 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
16801 return (long)ret_conv;
16804 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
16805 LDKPeerManager this_arg_conv;
16806 this_arg_conv.inner = (void*)(this_arg & (~1));
16807 this_arg_conv.is_owned = false;
16808 PeerManager_process_events(&this_arg_conv);
16811 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
16812 LDKPeerManager this_arg_conv;
16813 this_arg_conv.inner = (void*)(this_arg & (~1));
16814 this_arg_conv.is_owned = false;
16815 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16816 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
16819 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
16820 LDKPeerManager this_arg_conv;
16821 this_arg_conv.inner = (void*)(this_arg & (~1));
16822 this_arg_conv.is_owned = false;
16823 LDKPublicKey node_id_ref;
16824 CHECK(*((uint32_t*)node_id) == 33);
16825 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16826 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
16829 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
16830 LDKPeerManager this_arg_conv;
16831 this_arg_conv.inner = (void*)(this_arg & (~1));
16832 this_arg_conv.is_owned = false;
16833 PeerManager_timer_tick_occurred(&this_arg_conv);
16836 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
16837 unsigned char commitment_seed_arr[32];
16838 CHECK(*((uint32_t*)commitment_seed) == 32);
16839 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
16840 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
16841 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16842 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
16846 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
16847 LDKPublicKey per_commitment_point_ref;
16848 CHECK(*((uint32_t*)per_commitment_point) == 33);
16849 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16850 unsigned char base_secret_arr[32];
16851 CHECK(*((uint32_t*)base_secret) == 32);
16852 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
16853 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
16854 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
16855 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
16856 return (long)ret_conv;
16859 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
16860 LDKPublicKey per_commitment_point_ref;
16861 CHECK(*((uint32_t*)per_commitment_point) == 33);
16862 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16863 LDKPublicKey base_point_ref;
16864 CHECK(*((uint32_t*)base_point) == 33);
16865 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
16866 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
16867 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
16868 return (long)ret_conv;
16871 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
16872 unsigned char per_commitment_secret_arr[32];
16873 CHECK(*((uint32_t*)per_commitment_secret) == 32);
16874 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
16875 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
16876 unsigned char countersignatory_revocation_base_secret_arr[32];
16877 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
16878 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
16879 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
16880 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
16881 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
16882 return (long)ret_conv;
16885 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
16886 LDKPublicKey per_commitment_point_ref;
16887 CHECK(*((uint32_t*)per_commitment_point) == 33);
16888 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16889 LDKPublicKey countersignatory_revocation_base_point_ref;
16890 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
16891 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
16892 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
16893 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
16894 return (long)ret_conv;
16897 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
16898 LDKTxCreationKeys this_obj_conv;
16899 this_obj_conv.inner = (void*)(this_obj & (~1));
16900 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16901 TxCreationKeys_free(this_obj_conv);
16904 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
16905 LDKTxCreationKeys this_ptr_conv;
16906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16907 this_ptr_conv.is_owned = false;
16908 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16909 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16913 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16914 LDKTxCreationKeys this_ptr_conv;
16915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16916 this_ptr_conv.is_owned = false;
16917 LDKPublicKey val_ref;
16918 CHECK(*((uint32_t*)val) == 33);
16919 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16920 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
16923 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
16924 LDKTxCreationKeys this_ptr_conv;
16925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16926 this_ptr_conv.is_owned = false;
16927 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16928 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
16932 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
16933 LDKTxCreationKeys this_ptr_conv;
16934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16935 this_ptr_conv.is_owned = false;
16936 LDKPublicKey val_ref;
16937 CHECK(*((uint32_t*)val) == 33);
16938 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16939 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
16942 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
16943 LDKTxCreationKeys this_ptr_conv;
16944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16945 this_ptr_conv.is_owned = false;
16946 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16947 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
16951 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
16952 LDKTxCreationKeys this_ptr_conv;
16953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16954 this_ptr_conv.is_owned = false;
16955 LDKPublicKey val_ref;
16956 CHECK(*((uint32_t*)val) == 33);
16957 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16958 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
16961 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
16962 LDKTxCreationKeys this_ptr_conv;
16963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16964 this_ptr_conv.is_owned = false;
16965 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16966 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
16970 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
16971 LDKTxCreationKeys this_ptr_conv;
16972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16973 this_ptr_conv.is_owned = false;
16974 LDKPublicKey val_ref;
16975 CHECK(*((uint32_t*)val) == 33);
16976 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16977 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
16980 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
16981 LDKTxCreationKeys this_ptr_conv;
16982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16983 this_ptr_conv.is_owned = false;
16984 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16985 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
16989 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
16990 LDKTxCreationKeys this_ptr_conv;
16991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16992 this_ptr_conv.is_owned = false;
16993 LDKPublicKey val_ref;
16994 CHECK(*((uint32_t*)val) == 33);
16995 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16996 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
16999 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) {
17000 LDKPublicKey per_commitment_point_arg_ref;
17001 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
17002 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
17003 LDKPublicKey revocation_key_arg_ref;
17004 CHECK(*((uint32_t*)revocation_key_arg) == 33);
17005 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
17006 LDKPublicKey broadcaster_htlc_key_arg_ref;
17007 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
17008 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
17009 LDKPublicKey countersignatory_htlc_key_arg_ref;
17010 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
17011 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
17012 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
17013 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
17014 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
17015 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);
17016 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17017 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17018 long ret_ref = (long)ret_var.inner;
17019 if (ret_var.is_owned) {
17025 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
17026 LDKTxCreationKeys orig_conv;
17027 orig_conv.inner = (void*)(orig & (~1));
17028 orig_conv.is_owned = false;
17029 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
17030 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17031 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17032 long ret_ref = (long)ret_var.inner;
17033 if (ret_var.is_owned) {
17039 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
17040 LDKTxCreationKeys obj_conv;
17041 obj_conv.inner = (void*)(obj & (~1));
17042 obj_conv.is_owned = false;
17043 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
17044 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17045 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17046 CVec_u8Z_free(ret_var);
17050 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
17051 LDKu8slice ser_ref;
17052 ser_ref.datalen = *((uint32_t*)ser);
17053 ser_ref.data = (int8_t*)(ser + 4);
17054 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
17055 *ret_conv = TxCreationKeys_read(ser_ref);
17056 return (long)ret_conv;
17059 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
17060 LDKChannelPublicKeys this_obj_conv;
17061 this_obj_conv.inner = (void*)(this_obj & (~1));
17062 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17063 ChannelPublicKeys_free(this_obj_conv);
17066 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
17067 LDKChannelPublicKeys this_ptr_conv;
17068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17069 this_ptr_conv.is_owned = false;
17070 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17071 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
17075 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
17076 LDKChannelPublicKeys this_ptr_conv;
17077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17078 this_ptr_conv.is_owned = false;
17079 LDKPublicKey val_ref;
17080 CHECK(*((uint32_t*)val) == 33);
17081 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17082 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
17085 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
17086 LDKChannelPublicKeys this_ptr_conv;
17087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17088 this_ptr_conv.is_owned = false;
17089 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17090 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
17094 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
17095 LDKChannelPublicKeys this_ptr_conv;
17096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17097 this_ptr_conv.is_owned = false;
17098 LDKPublicKey val_ref;
17099 CHECK(*((uint32_t*)val) == 33);
17100 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17101 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
17104 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
17105 LDKChannelPublicKeys this_ptr_conv;
17106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17107 this_ptr_conv.is_owned = false;
17108 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17109 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
17113 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
17114 LDKChannelPublicKeys this_ptr_conv;
17115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17116 this_ptr_conv.is_owned = false;
17117 LDKPublicKey val_ref;
17118 CHECK(*((uint32_t*)val) == 33);
17119 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17120 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
17123 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
17124 LDKChannelPublicKeys this_ptr_conv;
17125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17126 this_ptr_conv.is_owned = false;
17127 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17128 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
17132 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
17133 LDKChannelPublicKeys this_ptr_conv;
17134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17135 this_ptr_conv.is_owned = false;
17136 LDKPublicKey val_ref;
17137 CHECK(*((uint32_t*)val) == 33);
17138 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17139 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
17142 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
17143 LDKChannelPublicKeys this_ptr_conv;
17144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17145 this_ptr_conv.is_owned = false;
17146 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17147 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
17151 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
17152 LDKChannelPublicKeys this_ptr_conv;
17153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17154 this_ptr_conv.is_owned = false;
17155 LDKPublicKey val_ref;
17156 CHECK(*((uint32_t*)val) == 33);
17157 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17158 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
17161 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) {
17162 LDKPublicKey funding_pubkey_arg_ref;
17163 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
17164 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
17165 LDKPublicKey revocation_basepoint_arg_ref;
17166 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
17167 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
17168 LDKPublicKey payment_point_arg_ref;
17169 CHECK(*((uint32_t*)payment_point_arg) == 33);
17170 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
17171 LDKPublicKey delayed_payment_basepoint_arg_ref;
17172 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
17173 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
17174 LDKPublicKey htlc_basepoint_arg_ref;
17175 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
17176 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
17177 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);
17178 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17179 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17180 long ret_ref = (long)ret_var.inner;
17181 if (ret_var.is_owned) {
17187 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
17188 LDKChannelPublicKeys orig_conv;
17189 orig_conv.inner = (void*)(orig & (~1));
17190 orig_conv.is_owned = false;
17191 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
17192 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17193 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17194 long ret_ref = (long)ret_var.inner;
17195 if (ret_var.is_owned) {
17201 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
17202 LDKChannelPublicKeys obj_conv;
17203 obj_conv.inner = (void*)(obj & (~1));
17204 obj_conv.is_owned = false;
17205 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
17206 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17207 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17208 CVec_u8Z_free(ret_var);
17212 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
17213 LDKu8slice ser_ref;
17214 ser_ref.datalen = *((uint32_t*)ser);
17215 ser_ref.data = (int8_t*)(ser + 4);
17216 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
17217 *ret_conv = ChannelPublicKeys_read(ser_ref);
17218 return (long)ret_conv;
17221 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) {
17222 LDKPublicKey per_commitment_point_ref;
17223 CHECK(*((uint32_t*)per_commitment_point) == 33);
17224 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
17225 LDKPublicKey broadcaster_delayed_payment_base_ref;
17226 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
17227 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
17228 LDKPublicKey broadcaster_htlc_base_ref;
17229 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
17230 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
17231 LDKPublicKey countersignatory_revocation_base_ref;
17232 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
17233 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
17234 LDKPublicKey countersignatory_htlc_base_ref;
17235 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
17236 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
17237 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
17238 *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);
17239 return (long)ret_conv;
17242 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
17243 LDKPublicKey per_commitment_point_ref;
17244 CHECK(*((uint32_t*)per_commitment_point) == 33);
17245 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
17246 LDKChannelPublicKeys broadcaster_keys_conv;
17247 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
17248 broadcaster_keys_conv.is_owned = false;
17249 LDKChannelPublicKeys countersignatory_keys_conv;
17250 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
17251 countersignatory_keys_conv.is_owned = false;
17252 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
17253 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
17254 return (long)ret_conv;
17257 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
17258 LDKPublicKey revocation_key_ref;
17259 CHECK(*((uint32_t*)revocation_key) == 33);
17260 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
17261 LDKPublicKey broadcaster_delayed_payment_key_ref;
17262 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
17263 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
17264 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
17265 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17266 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17267 CVec_u8Z_free(ret_var);
17271 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
17272 LDKHTLCOutputInCommitment this_obj_conv;
17273 this_obj_conv.inner = (void*)(this_obj & (~1));
17274 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17275 HTLCOutputInCommitment_free(this_obj_conv);
17278 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
17279 LDKHTLCOutputInCommitment this_ptr_conv;
17280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17281 this_ptr_conv.is_owned = false;
17282 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
17286 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
17287 LDKHTLCOutputInCommitment this_ptr_conv;
17288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17289 this_ptr_conv.is_owned = false;
17290 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
17293 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
17294 LDKHTLCOutputInCommitment this_ptr_conv;
17295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17296 this_ptr_conv.is_owned = false;
17297 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
17301 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
17302 LDKHTLCOutputInCommitment this_ptr_conv;
17303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17304 this_ptr_conv.is_owned = false;
17305 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
17308 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
17309 LDKHTLCOutputInCommitment this_ptr_conv;
17310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17311 this_ptr_conv.is_owned = false;
17312 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
17316 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
17317 LDKHTLCOutputInCommitment this_ptr_conv;
17318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17319 this_ptr_conv.is_owned = false;
17320 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
17323 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
17324 LDKHTLCOutputInCommitment this_ptr_conv;
17325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17326 this_ptr_conv.is_owned = false;
17327 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17328 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
17332 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
17333 LDKHTLCOutputInCommitment this_ptr_conv;
17334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17335 this_ptr_conv.is_owned = false;
17336 LDKThirtyTwoBytes val_ref;
17337 CHECK(*((uint32_t*)val) == 32);
17338 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17339 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
17342 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
17343 LDKHTLCOutputInCommitment this_ptr_conv;
17344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17345 this_ptr_conv.is_owned = false;
17346 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17347 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
17348 long ret_ref = (long)ret_copy;
17352 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
17353 LDKHTLCOutputInCommitment this_ptr_conv;
17354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17355 this_ptr_conv.is_owned = false;
17356 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
17358 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
17361 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) {
17362 LDKThirtyTwoBytes payment_hash_arg_ref;
17363 CHECK(*((uint32_t*)payment_hash_arg) == 32);
17364 memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
17365 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
17366 FREE((void*)transaction_output_index_arg);
17367 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
17368 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17369 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17370 long ret_ref = (long)ret_var.inner;
17371 if (ret_var.is_owned) {
17377 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
17378 LDKHTLCOutputInCommitment orig_conv;
17379 orig_conv.inner = (void*)(orig & (~1));
17380 orig_conv.is_owned = false;
17381 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
17382 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17383 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17384 long ret_ref = (long)ret_var.inner;
17385 if (ret_var.is_owned) {
17391 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
17392 LDKHTLCOutputInCommitment obj_conv;
17393 obj_conv.inner = (void*)(obj & (~1));
17394 obj_conv.is_owned = false;
17395 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
17396 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17397 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17398 CVec_u8Z_free(ret_var);
17402 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
17403 LDKu8slice ser_ref;
17404 ser_ref.datalen = *((uint32_t*)ser);
17405 ser_ref.data = (int8_t*)(ser + 4);
17406 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
17407 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
17408 return (long)ret_conv;
17411 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
17412 LDKHTLCOutputInCommitment htlc_conv;
17413 htlc_conv.inner = (void*)(htlc & (~1));
17414 htlc_conv.is_owned = false;
17415 LDKTxCreationKeys keys_conv;
17416 keys_conv.inner = (void*)(keys & (~1));
17417 keys_conv.is_owned = false;
17418 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
17419 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17420 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17421 CVec_u8Z_free(ret_var);
17425 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
17426 LDKPublicKey broadcaster_ref;
17427 CHECK(*((uint32_t*)broadcaster) == 33);
17428 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
17429 LDKPublicKey countersignatory_ref;
17430 CHECK(*((uint32_t*)countersignatory) == 33);
17431 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
17432 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
17433 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17434 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17435 CVec_u8Z_free(ret_var);
17439 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) {
17440 unsigned char prev_hash_arr[32];
17441 CHECK(*((uint32_t*)prev_hash) == 32);
17442 memcpy(prev_hash_arr, (uint8_t*)(prev_hash + 4), 32);
17443 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
17444 LDKHTLCOutputInCommitment htlc_conv;
17445 htlc_conv.inner = (void*)(htlc & (~1));
17446 htlc_conv.is_owned = false;
17447 LDKPublicKey broadcaster_delayed_payment_key_ref;
17448 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
17449 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
17450 LDKPublicKey revocation_key_ref;
17451 CHECK(*((uint32_t*)revocation_key) == 33);
17452 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
17453 LDKTransaction ret_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
17454 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17455 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17456 Transaction_free(ret_var);
17460 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
17461 LDKChannelTransactionParameters this_obj_conv;
17462 this_obj_conv.inner = (void*)(this_obj & (~1));
17463 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17464 ChannelTransactionParameters_free(this_obj_conv);
17467 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
17468 LDKChannelTransactionParameters this_ptr_conv;
17469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17470 this_ptr_conv.is_owned = false;
17471 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
17472 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17473 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17474 long ret_ref = (long)ret_var.inner;
17475 if (ret_var.is_owned) {
17481 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
17482 LDKChannelTransactionParameters this_ptr_conv;
17483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17484 this_ptr_conv.is_owned = false;
17485 LDKChannelPublicKeys val_conv;
17486 val_conv.inner = (void*)(val & (~1));
17487 val_conv.is_owned = (val & 1) || (val == 0);
17488 val_conv = ChannelPublicKeys_clone(&val_conv);
17489 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
17492 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
17493 LDKChannelTransactionParameters this_ptr_conv;
17494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17495 this_ptr_conv.is_owned = false;
17496 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
17500 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
17501 LDKChannelTransactionParameters this_ptr_conv;
17502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17503 this_ptr_conv.is_owned = false;
17504 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
17507 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
17508 LDKChannelTransactionParameters this_ptr_conv;
17509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17510 this_ptr_conv.is_owned = false;
17511 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
17515 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
17516 LDKChannelTransactionParameters this_ptr_conv;
17517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17518 this_ptr_conv.is_owned = false;
17519 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
17522 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
17523 LDKChannelTransactionParameters this_ptr_conv;
17524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17525 this_ptr_conv.is_owned = false;
17526 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
17527 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17528 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17529 long ret_ref = (long)ret_var.inner;
17530 if (ret_var.is_owned) {
17536 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
17537 LDKChannelTransactionParameters this_ptr_conv;
17538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17539 this_ptr_conv.is_owned = false;
17540 LDKCounterpartyChannelTransactionParameters val_conv;
17541 val_conv.inner = (void*)(val & (~1));
17542 val_conv.is_owned = (val & 1) || (val == 0);
17543 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
17544 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
17547 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
17548 LDKChannelTransactionParameters this_ptr_conv;
17549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17550 this_ptr_conv.is_owned = false;
17551 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
17552 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17553 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17554 long ret_ref = (long)ret_var.inner;
17555 if (ret_var.is_owned) {
17561 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
17562 LDKChannelTransactionParameters this_ptr_conv;
17563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17564 this_ptr_conv.is_owned = false;
17565 LDKOutPoint val_conv;
17566 val_conv.inner = (void*)(val & (~1));
17567 val_conv.is_owned = (val & 1) || (val == 0);
17568 val_conv = OutPoint_clone(&val_conv);
17569 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
17572 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) {
17573 LDKChannelPublicKeys holder_pubkeys_arg_conv;
17574 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
17575 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
17576 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
17577 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
17578 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
17579 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
17580 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
17581 LDKOutPoint funding_outpoint_arg_conv;
17582 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
17583 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
17584 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
17585 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);
17586 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17587 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17588 long ret_ref = (long)ret_var.inner;
17589 if (ret_var.is_owned) {
17595 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
17596 LDKChannelTransactionParameters orig_conv;
17597 orig_conv.inner = (void*)(orig & (~1));
17598 orig_conv.is_owned = false;
17599 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
17600 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17601 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17602 long ret_ref = (long)ret_var.inner;
17603 if (ret_var.is_owned) {
17609 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
17610 LDKCounterpartyChannelTransactionParameters this_obj_conv;
17611 this_obj_conv.inner = (void*)(this_obj & (~1));
17612 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17613 CounterpartyChannelTransactionParameters_free(this_obj_conv);
17616 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
17617 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17619 this_ptr_conv.is_owned = false;
17620 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
17621 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17622 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17623 long ret_ref = (long)ret_var.inner;
17624 if (ret_var.is_owned) {
17630 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
17631 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17633 this_ptr_conv.is_owned = false;
17634 LDKChannelPublicKeys val_conv;
17635 val_conv.inner = (void*)(val & (~1));
17636 val_conv.is_owned = (val & 1) || (val == 0);
17637 val_conv = ChannelPublicKeys_clone(&val_conv);
17638 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
17641 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
17642 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17644 this_ptr_conv.is_owned = false;
17645 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
17649 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
17650 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17652 this_ptr_conv.is_owned = false;
17653 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
17656 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
17657 LDKChannelPublicKeys pubkeys_arg_conv;
17658 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
17659 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
17660 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
17661 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
17662 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17663 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17664 long ret_ref = (long)ret_var.inner;
17665 if (ret_var.is_owned) {
17671 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
17672 LDKCounterpartyChannelTransactionParameters orig_conv;
17673 orig_conv.inner = (void*)(orig & (~1));
17674 orig_conv.is_owned = false;
17675 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
17676 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17677 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17678 long ret_ref = (long)ret_var.inner;
17679 if (ret_var.is_owned) {
17685 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
17686 LDKChannelTransactionParameters this_arg_conv;
17687 this_arg_conv.inner = (void*)(this_arg & (~1));
17688 this_arg_conv.is_owned = false;
17689 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
17693 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
17694 LDKChannelTransactionParameters this_arg_conv;
17695 this_arg_conv.inner = (void*)(this_arg & (~1));
17696 this_arg_conv.is_owned = false;
17697 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
17698 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17699 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17700 long ret_ref = (long)ret_var.inner;
17701 if (ret_var.is_owned) {
17707 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
17708 LDKChannelTransactionParameters this_arg_conv;
17709 this_arg_conv.inner = (void*)(this_arg & (~1));
17710 this_arg_conv.is_owned = false;
17711 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
17712 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17713 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17714 long ret_ref = (long)ret_var.inner;
17715 if (ret_var.is_owned) {
17721 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
17722 LDKCounterpartyChannelTransactionParameters obj_conv;
17723 obj_conv.inner = (void*)(obj & (~1));
17724 obj_conv.is_owned = false;
17725 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
17726 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17727 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17728 CVec_u8Z_free(ret_var);
17732 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
17733 LDKu8slice ser_ref;
17734 ser_ref.datalen = *((uint32_t*)ser);
17735 ser_ref.data = (int8_t*)(ser + 4);
17736 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
17737 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
17738 return (long)ret_conv;
17741 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
17742 LDKChannelTransactionParameters obj_conv;
17743 obj_conv.inner = (void*)(obj & (~1));
17744 obj_conv.is_owned = false;
17745 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
17746 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17747 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17748 CVec_u8Z_free(ret_var);
17752 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
17753 LDKu8slice ser_ref;
17754 ser_ref.datalen = *((uint32_t*)ser);
17755 ser_ref.data = (int8_t*)(ser + 4);
17756 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
17757 *ret_conv = ChannelTransactionParameters_read(ser_ref);
17758 return (long)ret_conv;
17761 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
17762 LDKDirectedChannelTransactionParameters this_obj_conv;
17763 this_obj_conv.inner = (void*)(this_obj & (~1));
17764 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17765 DirectedChannelTransactionParameters_free(this_obj_conv);
17768 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
17769 LDKDirectedChannelTransactionParameters this_arg_conv;
17770 this_arg_conv.inner = (void*)(this_arg & (~1));
17771 this_arg_conv.is_owned = false;
17772 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
17773 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17774 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17775 long ret_ref = (long)ret_var.inner;
17776 if (ret_var.is_owned) {
17782 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
17783 LDKDirectedChannelTransactionParameters this_arg_conv;
17784 this_arg_conv.inner = (void*)(this_arg & (~1));
17785 this_arg_conv.is_owned = false;
17786 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
17787 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17788 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17789 long ret_ref = (long)ret_var.inner;
17790 if (ret_var.is_owned) {
17796 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
17797 LDKDirectedChannelTransactionParameters this_arg_conv;
17798 this_arg_conv.inner = (void*)(this_arg & (~1));
17799 this_arg_conv.is_owned = false;
17800 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
17804 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
17805 LDKDirectedChannelTransactionParameters this_arg_conv;
17806 this_arg_conv.inner = (void*)(this_arg & (~1));
17807 this_arg_conv.is_owned = false;
17808 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
17812 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
17813 LDKDirectedChannelTransactionParameters this_arg_conv;
17814 this_arg_conv.inner = (void*)(this_arg & (~1));
17815 this_arg_conv.is_owned = false;
17816 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
17817 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17818 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17819 long ret_ref = (long)ret_var.inner;
17820 if (ret_var.is_owned) {
17826 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
17827 LDKHolderCommitmentTransaction this_obj_conv;
17828 this_obj_conv.inner = (void*)(this_obj & (~1));
17829 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17830 HolderCommitmentTransaction_free(this_obj_conv);
17833 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
17834 LDKHolderCommitmentTransaction this_ptr_conv;
17835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17836 this_ptr_conv.is_owned = false;
17837 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17838 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
17842 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
17843 LDKHolderCommitmentTransaction this_ptr_conv;
17844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17845 this_ptr_conv.is_owned = false;
17846 LDKSignature val_ref;
17847 CHECK(*((uint32_t*)val) == 64);
17848 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17849 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
17852 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
17853 LDKHolderCommitmentTransaction this_ptr_conv;
17854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17855 this_ptr_conv.is_owned = false;
17856 LDKCVec_SignatureZ val_constr;
17857 val_constr.datalen = *((uint32_t*)val);
17858 if (val_constr.datalen > 0)
17859 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17861 val_constr.data = NULL;
17862 int8_tArray* val_vals = (int8_tArray*)(val + 4);
17863 for (size_t m = 0; m < val_constr.datalen; m++) {
17864 int8_tArray val_conv_12 = val_vals[m];
17865 LDKSignature val_conv_12_ref;
17866 CHECK(*((uint32_t*)val_conv_12) == 64);
17867 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
17868 val_constr.data[m] = val_conv_12_ref;
17870 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
17873 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
17874 LDKHolderCommitmentTransaction orig_conv;
17875 orig_conv.inner = (void*)(orig & (~1));
17876 orig_conv.is_owned = false;
17877 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
17878 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17879 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17880 long ret_ref = (long)ret_var.inner;
17881 if (ret_var.is_owned) {
17887 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
17888 LDKHolderCommitmentTransaction obj_conv;
17889 obj_conv.inner = (void*)(obj & (~1));
17890 obj_conv.is_owned = false;
17891 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
17892 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17893 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17894 CVec_u8Z_free(ret_var);
17898 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
17899 LDKu8slice ser_ref;
17900 ser_ref.datalen = *((uint32_t*)ser);
17901 ser_ref.data = (int8_t*)(ser + 4);
17902 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
17903 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
17904 return (long)ret_conv;
17907 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) {
17908 LDKCommitmentTransaction commitment_tx_conv;
17909 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
17910 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
17911 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
17912 LDKSignature counterparty_sig_ref;
17913 CHECK(*((uint32_t*)counterparty_sig) == 64);
17914 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
17915 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
17916 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
17917 if (counterparty_htlc_sigs_constr.datalen > 0)
17918 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17920 counterparty_htlc_sigs_constr.data = NULL;
17921 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
17922 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
17923 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
17924 LDKSignature counterparty_htlc_sigs_conv_12_ref;
17925 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
17926 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
17927 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
17929 LDKPublicKey holder_funding_key_ref;
17930 CHECK(*((uint32_t*)holder_funding_key) == 33);
17931 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
17932 LDKPublicKey counterparty_funding_key_ref;
17933 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
17934 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
17935 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
17936 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17937 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17938 long ret_ref = (long)ret_var.inner;
17939 if (ret_var.is_owned) {
17945 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
17946 LDKBuiltCommitmentTransaction this_obj_conv;
17947 this_obj_conv.inner = (void*)(this_obj & (~1));
17948 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17949 BuiltCommitmentTransaction_free(this_obj_conv);
17952 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
17953 LDKBuiltCommitmentTransaction this_ptr_conv;
17954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17955 this_ptr_conv.is_owned = false;
17956 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
17957 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17958 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17959 Transaction_free(ret_var);
17963 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
17964 LDKBuiltCommitmentTransaction this_ptr_conv;
17965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17966 this_ptr_conv.is_owned = false;
17967 LDKTransaction val_ref;
17968 val_ref.datalen = *((uint32_t*)val);
17969 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
17970 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
17971 val_ref.data_is_owned = true;
17972 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
17975 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
17976 LDKBuiltCommitmentTransaction this_ptr_conv;
17977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17978 this_ptr_conv.is_owned = false;
17979 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17980 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
17984 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
17985 LDKBuiltCommitmentTransaction this_ptr_conv;
17986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17987 this_ptr_conv.is_owned = false;
17988 LDKThirtyTwoBytes val_ref;
17989 CHECK(*((uint32_t*)val) == 32);
17990 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17991 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
17994 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
17995 LDKTransaction transaction_arg_ref;
17996 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
17997 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
17998 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
17999 transaction_arg_ref.data_is_owned = true;
18000 LDKThirtyTwoBytes txid_arg_ref;
18001 CHECK(*((uint32_t*)txid_arg) == 32);
18002 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
18003 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
18004 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18005 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18006 long ret_ref = (long)ret_var.inner;
18007 if (ret_var.is_owned) {
18013 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
18014 LDKBuiltCommitmentTransaction orig_conv;
18015 orig_conv.inner = (void*)(orig & (~1));
18016 orig_conv.is_owned = false;
18017 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
18018 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18019 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18020 long ret_ref = (long)ret_var.inner;
18021 if (ret_var.is_owned) {
18027 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
18028 LDKBuiltCommitmentTransaction obj_conv;
18029 obj_conv.inner = (void*)(obj & (~1));
18030 obj_conv.is_owned = false;
18031 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
18032 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18033 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18034 CVec_u8Z_free(ret_var);
18038 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
18039 LDKu8slice ser_ref;
18040 ser_ref.datalen = *((uint32_t*)ser);
18041 ser_ref.data = (int8_t*)(ser + 4);
18042 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
18043 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
18044 return (long)ret_conv;
18047 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
18048 LDKBuiltCommitmentTransaction this_arg_conv;
18049 this_arg_conv.inner = (void*)(this_arg & (~1));
18050 this_arg_conv.is_owned = false;
18051 LDKu8slice funding_redeemscript_ref;
18052 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
18053 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
18054 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18055 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
18059 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) {
18060 LDKBuiltCommitmentTransaction this_arg_conv;
18061 this_arg_conv.inner = (void*)(this_arg & (~1));
18062 this_arg_conv.is_owned = false;
18063 unsigned char funding_key_arr[32];
18064 CHECK(*((uint32_t*)funding_key) == 32);
18065 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
18066 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
18067 LDKu8slice funding_redeemscript_ref;
18068 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
18069 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
18070 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18071 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
18075 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
18076 LDKCommitmentTransaction this_obj_conv;
18077 this_obj_conv.inner = (void*)(this_obj & (~1));
18078 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18079 CommitmentTransaction_free(this_obj_conv);
18082 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
18083 LDKCommitmentTransaction orig_conv;
18084 orig_conv.inner = (void*)(orig & (~1));
18085 orig_conv.is_owned = false;
18086 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
18087 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18088 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18089 long ret_ref = (long)ret_var.inner;
18090 if (ret_var.is_owned) {
18096 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
18097 LDKCommitmentTransaction obj_conv;
18098 obj_conv.inner = (void*)(obj & (~1));
18099 obj_conv.is_owned = false;
18100 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
18101 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18102 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18103 CVec_u8Z_free(ret_var);
18107 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
18108 LDKu8slice ser_ref;
18109 ser_ref.datalen = *((uint32_t*)ser);
18110 ser_ref.data = (int8_t*)(ser + 4);
18111 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
18112 *ret_conv = CommitmentTransaction_read(ser_ref);
18113 return (long)ret_conv;
18116 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
18117 LDKCommitmentTransaction this_arg_conv;
18118 this_arg_conv.inner = (void*)(this_arg & (~1));
18119 this_arg_conv.is_owned = false;
18120 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
18124 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
18125 LDKCommitmentTransaction this_arg_conv;
18126 this_arg_conv.inner = (void*)(this_arg & (~1));
18127 this_arg_conv.is_owned = false;
18128 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
18132 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
18133 LDKCommitmentTransaction this_arg_conv;
18134 this_arg_conv.inner = (void*)(this_arg & (~1));
18135 this_arg_conv.is_owned = false;
18136 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
18140 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
18141 LDKCommitmentTransaction this_arg_conv;
18142 this_arg_conv.inner = (void*)(this_arg & (~1));
18143 this_arg_conv.is_owned = false;
18144 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
18148 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
18149 LDKCommitmentTransaction this_arg_conv;
18150 this_arg_conv.inner = (void*)(this_arg & (~1));
18151 this_arg_conv.is_owned = false;
18152 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
18153 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18154 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18155 long ret_ref = (long)ret_var.inner;
18156 if (ret_var.is_owned) {
18162 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
18163 LDKCommitmentTransaction this_arg_conv;
18164 this_arg_conv.inner = (void*)(this_arg & (~1));
18165 this_arg_conv.is_owned = false;
18166 LDKDirectedChannelTransactionParameters channel_parameters_conv;
18167 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
18168 channel_parameters_conv.is_owned = false;
18169 LDKChannelPublicKeys broadcaster_keys_conv;
18170 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
18171 broadcaster_keys_conv.is_owned = false;
18172 LDKChannelPublicKeys countersignatory_keys_conv;
18173 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
18174 countersignatory_keys_conv.is_owned = false;
18175 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
18176 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
18177 return (long)ret_conv;
18180 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
18181 LDKTrustedCommitmentTransaction this_obj_conv;
18182 this_obj_conv.inner = (void*)(this_obj & (~1));
18183 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18184 TrustedCommitmentTransaction_free(this_obj_conv);
18187 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
18188 LDKTrustedCommitmentTransaction this_arg_conv;
18189 this_arg_conv.inner = (void*)(this_arg & (~1));
18190 this_arg_conv.is_owned = false;
18191 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18192 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
18196 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
18197 LDKTrustedCommitmentTransaction this_arg_conv;
18198 this_arg_conv.inner = (void*)(this_arg & (~1));
18199 this_arg_conv.is_owned = false;
18200 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
18201 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18202 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18203 long ret_ref = (long)ret_var.inner;
18204 if (ret_var.is_owned) {
18210 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
18211 LDKTrustedCommitmentTransaction this_arg_conv;
18212 this_arg_conv.inner = (void*)(this_arg & (~1));
18213 this_arg_conv.is_owned = false;
18214 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
18215 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18216 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18217 long ret_ref = (long)ret_var.inner;
18218 if (ret_var.is_owned) {
18224 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
18225 LDKTrustedCommitmentTransaction this_arg_conv;
18226 this_arg_conv.inner = (void*)(this_arg & (~1));
18227 this_arg_conv.is_owned = false;
18228 unsigned char htlc_base_key_arr[32];
18229 CHECK(*((uint32_t*)htlc_base_key) == 32);
18230 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
18231 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
18232 LDKDirectedChannelTransactionParameters channel_parameters_conv;
18233 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
18234 channel_parameters_conv.is_owned = false;
18235 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
18236 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
18237 return (long)ret_conv;
18240 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) {
18241 LDKPublicKey broadcaster_payment_basepoint_ref;
18242 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
18243 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
18244 LDKPublicKey countersignatory_payment_basepoint_ref;
18245 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
18246 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
18247 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
18251 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
18252 LDKInitFeatures orig_conv;
18253 orig_conv.inner = (void*)(orig & (~1));
18254 orig_conv.is_owned = false;
18255 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
18256 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18257 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18258 long ret_ref = (long)ret_var.inner;
18259 if (ret_var.is_owned) {
18265 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
18266 LDKNodeFeatures orig_conv;
18267 orig_conv.inner = (void*)(orig & (~1));
18268 orig_conv.is_owned = false;
18269 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
18270 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18271 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18272 long ret_ref = (long)ret_var.inner;
18273 if (ret_var.is_owned) {
18279 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
18280 LDKChannelFeatures orig_conv;
18281 orig_conv.inner = (void*)(orig & (~1));
18282 orig_conv.is_owned = false;
18283 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
18284 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18285 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18286 long ret_ref = (long)ret_var.inner;
18287 if (ret_var.is_owned) {
18293 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
18294 LDKInvoiceFeatures orig_conv;
18295 orig_conv.inner = (void*)(orig & (~1));
18296 orig_conv.is_owned = false;
18297 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
18298 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18299 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18300 long ret_ref = (long)ret_var.inner;
18301 if (ret_var.is_owned) {
18307 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
18308 LDKInitFeatures this_obj_conv;
18309 this_obj_conv.inner = (void*)(this_obj & (~1));
18310 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18311 InitFeatures_free(this_obj_conv);
18314 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
18315 LDKNodeFeatures this_obj_conv;
18316 this_obj_conv.inner = (void*)(this_obj & (~1));
18317 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18318 NodeFeatures_free(this_obj_conv);
18321 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
18322 LDKChannelFeatures this_obj_conv;
18323 this_obj_conv.inner = (void*)(this_obj & (~1));
18324 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18325 ChannelFeatures_free(this_obj_conv);
18328 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
18329 LDKInvoiceFeatures this_obj_conv;
18330 this_obj_conv.inner = (void*)(this_obj & (~1));
18331 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18332 InvoiceFeatures_free(this_obj_conv);
18335 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
18336 LDKInitFeatures ret_var = InitFeatures_empty();
18337 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18338 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18339 long ret_ref = (long)ret_var.inner;
18340 if (ret_var.is_owned) {
18346 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
18347 LDKInitFeatures ret_var = InitFeatures_known();
18348 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18349 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18350 long ret_ref = (long)ret_var.inner;
18351 if (ret_var.is_owned) {
18357 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
18358 LDKNodeFeatures ret_var = NodeFeatures_empty();
18359 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18360 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18361 long ret_ref = (long)ret_var.inner;
18362 if (ret_var.is_owned) {
18368 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
18369 LDKNodeFeatures ret_var = NodeFeatures_known();
18370 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18371 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18372 long ret_ref = (long)ret_var.inner;
18373 if (ret_var.is_owned) {
18379 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
18380 LDKChannelFeatures ret_var = ChannelFeatures_empty();
18381 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18382 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18383 long ret_ref = (long)ret_var.inner;
18384 if (ret_var.is_owned) {
18390 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
18391 LDKChannelFeatures ret_var = ChannelFeatures_known();
18392 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18393 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18394 long ret_ref = (long)ret_var.inner;
18395 if (ret_var.is_owned) {
18401 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
18402 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
18403 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18404 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18405 long ret_ref = (long)ret_var.inner;
18406 if (ret_var.is_owned) {
18412 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
18413 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
18414 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18415 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18416 long ret_ref = (long)ret_var.inner;
18417 if (ret_var.is_owned) {
18423 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
18424 LDKInitFeatures obj_conv;
18425 obj_conv.inner = (void*)(obj & (~1));
18426 obj_conv.is_owned = false;
18427 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
18428 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18429 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18430 CVec_u8Z_free(ret_var);
18434 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
18435 LDKNodeFeatures obj_conv;
18436 obj_conv.inner = (void*)(obj & (~1));
18437 obj_conv.is_owned = false;
18438 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
18439 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18440 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18441 CVec_u8Z_free(ret_var);
18445 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
18446 LDKChannelFeatures obj_conv;
18447 obj_conv.inner = (void*)(obj & (~1));
18448 obj_conv.is_owned = false;
18449 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
18450 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18451 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18452 CVec_u8Z_free(ret_var);
18456 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
18457 LDKInvoiceFeatures obj_conv;
18458 obj_conv.inner = (void*)(obj & (~1));
18459 obj_conv.is_owned = false;
18460 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
18461 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18462 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18463 CVec_u8Z_free(ret_var);
18467 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
18468 LDKu8slice ser_ref;
18469 ser_ref.datalen = *((uint32_t*)ser);
18470 ser_ref.data = (int8_t*)(ser + 4);
18471 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18472 *ret_conv = InitFeatures_read(ser_ref);
18473 return (long)ret_conv;
18476 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
18477 LDKu8slice ser_ref;
18478 ser_ref.datalen = *((uint32_t*)ser);
18479 ser_ref.data = (int8_t*)(ser + 4);
18480 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18481 *ret_conv = NodeFeatures_read(ser_ref);
18482 return (long)ret_conv;
18485 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
18486 LDKu8slice ser_ref;
18487 ser_ref.datalen = *((uint32_t*)ser);
18488 ser_ref.data = (int8_t*)(ser + 4);
18489 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18490 *ret_conv = ChannelFeatures_read(ser_ref);
18491 return (long)ret_conv;
18494 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
18495 LDKu8slice ser_ref;
18496 ser_ref.datalen = *((uint32_t*)ser);
18497 ser_ref.data = (int8_t*)(ser + 4);
18498 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
18499 *ret_conv = InvoiceFeatures_read(ser_ref);
18500 return (long)ret_conv;
18503 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
18504 LDKRouteHop this_obj_conv;
18505 this_obj_conv.inner = (void*)(this_obj & (~1));
18506 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18507 RouteHop_free(this_obj_conv);
18510 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
18511 LDKRouteHop this_ptr_conv;
18512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18513 this_ptr_conv.is_owned = false;
18514 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18515 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
18519 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
18520 LDKRouteHop this_ptr_conv;
18521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18522 this_ptr_conv.is_owned = false;
18523 LDKPublicKey val_ref;
18524 CHECK(*((uint32_t*)val) == 33);
18525 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18526 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
18529 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
18530 LDKRouteHop this_ptr_conv;
18531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18532 this_ptr_conv.is_owned = false;
18533 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
18534 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18535 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18536 long ret_ref = (long)ret_var.inner;
18537 if (ret_var.is_owned) {
18543 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
18544 LDKRouteHop this_ptr_conv;
18545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18546 this_ptr_conv.is_owned = false;
18547 LDKNodeFeatures val_conv;
18548 val_conv.inner = (void*)(val & (~1));
18549 val_conv.is_owned = (val & 1) || (val == 0);
18550 val_conv = NodeFeatures_clone(&val_conv);
18551 RouteHop_set_node_features(&this_ptr_conv, val_conv);
18554 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
18555 LDKRouteHop this_ptr_conv;
18556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18557 this_ptr_conv.is_owned = false;
18558 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
18562 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
18563 LDKRouteHop this_ptr_conv;
18564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18565 this_ptr_conv.is_owned = false;
18566 RouteHop_set_short_channel_id(&this_ptr_conv, val);
18569 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
18570 LDKRouteHop this_ptr_conv;
18571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18572 this_ptr_conv.is_owned = false;
18573 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
18574 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18575 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18576 long ret_ref = (long)ret_var.inner;
18577 if (ret_var.is_owned) {
18583 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
18584 LDKRouteHop this_ptr_conv;
18585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18586 this_ptr_conv.is_owned = false;
18587 LDKChannelFeatures val_conv;
18588 val_conv.inner = (void*)(val & (~1));
18589 val_conv.is_owned = (val & 1) || (val == 0);
18590 val_conv = ChannelFeatures_clone(&val_conv);
18591 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
18594 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
18595 LDKRouteHop this_ptr_conv;
18596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18597 this_ptr_conv.is_owned = false;
18598 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
18602 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
18603 LDKRouteHop this_ptr_conv;
18604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18605 this_ptr_conv.is_owned = false;
18606 RouteHop_set_fee_msat(&this_ptr_conv, val);
18609 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
18610 LDKRouteHop this_ptr_conv;
18611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18612 this_ptr_conv.is_owned = false;
18613 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
18617 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
18618 LDKRouteHop this_ptr_conv;
18619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18620 this_ptr_conv.is_owned = false;
18621 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
18624 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) {
18625 LDKPublicKey pubkey_arg_ref;
18626 CHECK(*((uint32_t*)pubkey_arg) == 33);
18627 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
18628 LDKNodeFeatures node_features_arg_conv;
18629 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
18630 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
18631 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
18632 LDKChannelFeatures channel_features_arg_conv;
18633 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
18634 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
18635 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
18636 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);
18637 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18638 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18639 long ret_ref = (long)ret_var.inner;
18640 if (ret_var.is_owned) {
18646 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
18647 LDKRouteHop orig_conv;
18648 orig_conv.inner = (void*)(orig & (~1));
18649 orig_conv.is_owned = false;
18650 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
18651 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18652 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18653 long ret_ref = (long)ret_var.inner;
18654 if (ret_var.is_owned) {
18660 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
18661 LDKRoute this_obj_conv;
18662 this_obj_conv.inner = (void*)(this_obj & (~1));
18663 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18664 Route_free(this_obj_conv);
18667 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
18668 LDKRoute this_ptr_conv;
18669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18670 this_ptr_conv.is_owned = false;
18671 LDKCVec_CVec_RouteHopZZ val_constr;
18672 val_constr.datalen = *((uint32_t*)val);
18673 if (val_constr.datalen > 0)
18674 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
18676 val_constr.data = NULL;
18677 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
18678 for (size_t m = 0; m < val_constr.datalen; m++) {
18679 uint32_tArray val_conv_12 = val_vals[m];
18680 LDKCVec_RouteHopZ val_conv_12_constr;
18681 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
18682 if (val_conv_12_constr.datalen > 0)
18683 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
18685 val_conv_12_constr.data = NULL;
18686 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
18687 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
18688 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
18689 LDKRouteHop val_conv_12_conv_10_conv;
18690 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
18691 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
18692 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
18693 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
18695 val_constr.data[m] = val_conv_12_constr;
18697 Route_set_paths(&this_ptr_conv, val_constr);
18700 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) {
18701 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
18702 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
18703 if (paths_arg_constr.datalen > 0)
18704 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
18706 paths_arg_constr.data = NULL;
18707 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
18708 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
18709 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
18710 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
18711 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
18712 if (paths_arg_conv_12_constr.datalen > 0)
18713 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
18715 paths_arg_conv_12_constr.data = NULL;
18716 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
18717 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
18718 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
18719 LDKRouteHop paths_arg_conv_12_conv_10_conv;
18720 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
18721 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
18722 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
18723 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
18725 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
18727 LDKRoute ret_var = Route_new(paths_arg_constr);
18728 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18729 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18730 long ret_ref = (long)ret_var.inner;
18731 if (ret_var.is_owned) {
18737 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
18738 LDKRoute orig_conv;
18739 orig_conv.inner = (void*)(orig & (~1));
18740 orig_conv.is_owned = false;
18741 LDKRoute ret_var = Route_clone(&orig_conv);
18742 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18743 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18744 long ret_ref = (long)ret_var.inner;
18745 if (ret_var.is_owned) {
18751 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
18753 obj_conv.inner = (void*)(obj & (~1));
18754 obj_conv.is_owned = false;
18755 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
18756 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18757 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18758 CVec_u8Z_free(ret_var);
18762 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
18763 LDKu8slice ser_ref;
18764 ser_ref.datalen = *((uint32_t*)ser);
18765 ser_ref.data = (int8_t*)(ser + 4);
18766 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
18767 *ret_conv = Route_read(ser_ref);
18768 return (long)ret_conv;
18771 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
18772 LDKRouteHint this_obj_conv;
18773 this_obj_conv.inner = (void*)(this_obj & (~1));
18774 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18775 RouteHint_free(this_obj_conv);
18778 int8_tArray __attribute__((visibility("default"))) TS_RouteHint_get_src_node_id(uint32_t this_ptr) {
18779 LDKRouteHint this_ptr_conv;
18780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18781 this_ptr_conv.is_owned = false;
18782 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18783 memcpy((uint8_t*)(ret_arr + 4), RouteHint_get_src_node_id(&this_ptr_conv).compressed_form, 33);
18787 void __attribute__((visibility("default"))) TS_RouteHint_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
18788 LDKRouteHint this_ptr_conv;
18789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18790 this_ptr_conv.is_owned = false;
18791 LDKPublicKey val_ref;
18792 CHECK(*((uint32_t*)val) == 33);
18793 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18794 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
18797 int64_t __attribute__((visibility("default"))) TS_RouteHint_get_short_channel_id(uint32_t this_ptr) {
18798 LDKRouteHint this_ptr_conv;
18799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18800 this_ptr_conv.is_owned = false;
18801 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
18805 void __attribute__((visibility("default"))) TS_RouteHint_set_short_channel_id(uint32_t this_ptr, int64_t val) {
18806 LDKRouteHint this_ptr_conv;
18807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18808 this_ptr_conv.is_owned = false;
18809 RouteHint_set_short_channel_id(&this_ptr_conv, val);
18812 uint32_t __attribute__((visibility("default"))) TS_RouteHint_get_fees(uint32_t this_ptr) {
18813 LDKRouteHint this_ptr_conv;
18814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18815 this_ptr_conv.is_owned = false;
18816 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
18817 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18818 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18819 long ret_ref = (long)ret_var.inner;
18820 if (ret_var.is_owned) {
18826 void __attribute__((visibility("default"))) TS_RouteHint_set_fees(uint32_t this_ptr, uint32_t val) {
18827 LDKRouteHint this_ptr_conv;
18828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18829 this_ptr_conv.is_owned = false;
18830 LDKRoutingFees val_conv;
18831 val_conv.inner = (void*)(val & (~1));
18832 val_conv.is_owned = (val & 1) || (val == 0);
18833 val_conv = RoutingFees_clone(&val_conv);
18834 RouteHint_set_fees(&this_ptr_conv, val_conv);
18837 int16_t __attribute__((visibility("default"))) TS_RouteHint_get_cltv_expiry_delta(uint32_t this_ptr) {
18838 LDKRouteHint this_ptr_conv;
18839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18840 this_ptr_conv.is_owned = false;
18841 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
18845 void __attribute__((visibility("default"))) TS_RouteHint_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
18846 LDKRouteHint this_ptr_conv;
18847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18848 this_ptr_conv.is_owned = false;
18849 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
18852 uint32_t __attribute__((visibility("default"))) TS_RouteHint_get_htlc_minimum_msat(uint32_t this_ptr) {
18853 LDKRouteHint this_ptr_conv;
18854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18855 this_ptr_conv.is_owned = false;
18856 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18857 *ret_copy = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
18858 long ret_ref = (long)ret_copy;
18862 void __attribute__((visibility("default"))) TS_RouteHint_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
18863 LDKRouteHint this_ptr_conv;
18864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18865 this_ptr_conv.is_owned = false;
18866 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
18868 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
18871 uint32_t __attribute__((visibility("default"))) TS_RouteHint_get_htlc_maximum_msat(uint32_t this_ptr) {
18872 LDKRouteHint this_ptr_conv;
18873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18874 this_ptr_conv.is_owned = false;
18875 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18876 *ret_copy = RouteHint_get_htlc_maximum_msat(&this_ptr_conv);
18877 long ret_ref = (long)ret_copy;
18881 void __attribute__((visibility("default"))) TS_RouteHint_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
18882 LDKRouteHint this_ptr_conv;
18883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18884 this_ptr_conv.is_owned = false;
18885 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
18887 RouteHint_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
18890 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) {
18891 LDKPublicKey src_node_id_arg_ref;
18892 CHECK(*((uint32_t*)src_node_id_arg) == 33);
18893 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
18894 LDKRoutingFees fees_arg_conv;
18895 fees_arg_conv.inner = (void*)(fees_arg & (~1));
18896 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
18897 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
18898 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
18899 FREE((void*)htlc_minimum_msat_arg);
18900 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
18901 FREE((void*)htlc_maximum_msat_arg);
18902 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);
18903 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18904 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18905 long ret_ref = (long)ret_var.inner;
18906 if (ret_var.is_owned) {
18912 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
18913 LDKRouteHint orig_conv;
18914 orig_conv.inner = (void*)(orig & (~1));
18915 orig_conv.is_owned = false;
18916 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
18917 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18918 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18919 long ret_ref = (long)ret_var.inner;
18920 if (ret_var.is_owned) {
18926 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) {
18927 LDKPublicKey our_node_id_ref;
18928 CHECK(*((uint32_t*)our_node_id) == 33);
18929 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
18930 LDKNetworkGraph network_conv;
18931 network_conv.inner = (void*)(network & (~1));
18932 network_conv.is_owned = false;
18933 LDKPublicKey payee_ref;
18934 CHECK(*((uint32_t*)payee) == 33);
18935 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
18936 LDKInvoiceFeatures payee_features_conv;
18937 payee_features_conv.inner = (void*)(payee_features & (~1));
18938 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
18939 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
18940 LDKCVec_ChannelDetailsZ first_hops_constr;
18941 first_hops_constr.datalen = *((uint32_t*)first_hops);
18942 if (first_hops_constr.datalen > 0)
18943 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18945 first_hops_constr.data = NULL;
18946 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
18947 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
18948 uint32_t first_hops_conv_16 = first_hops_vals[q];
18949 LDKChannelDetails first_hops_conv_16_conv;
18950 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
18951 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
18952 first_hops_constr.data[q] = first_hops_conv_16_conv;
18954 LDKCVec_RouteHintZ last_hops_constr;
18955 last_hops_constr.datalen = *((uint32_t*)last_hops);
18956 if (last_hops_constr.datalen > 0)
18957 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
18959 last_hops_constr.data = NULL;
18960 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
18961 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
18962 uint32_t last_hops_conv_11 = last_hops_vals[l];
18963 LDKRouteHint last_hops_conv_11_conv;
18964 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
18965 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
18966 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
18967 last_hops_constr.data[l] = last_hops_conv_11_conv;
18969 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
18970 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18971 *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);
18972 FREE(first_hops_constr.data);
18973 return (long)ret_conv;
18976 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
18977 LDKNetworkGraph this_obj_conv;
18978 this_obj_conv.inner = (void*)(this_obj & (~1));
18979 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18980 NetworkGraph_free(this_obj_conv);
18983 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
18984 LDKNetworkGraph orig_conv;
18985 orig_conv.inner = (void*)(orig & (~1));
18986 orig_conv.is_owned = false;
18987 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
18988 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18989 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18990 long ret_ref = (long)ret_var.inner;
18991 if (ret_var.is_owned) {
18997 void __attribute__((visibility("default"))) TS_LockedNetworkGraph_free(uint32_t this_obj) {
18998 LDKLockedNetworkGraph this_obj_conv;
18999 this_obj_conv.inner = (void*)(this_obj & (~1));
19000 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19001 LockedNetworkGraph_free(this_obj_conv);
19004 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
19005 LDKNetGraphMsgHandler this_obj_conv;
19006 this_obj_conv.inner = (void*)(this_obj & (~1));
19007 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19008 NetGraphMsgHandler_free(this_obj_conv);
19011 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(int8_tArray genesis_hash, uint32_t chain_access, uint32_t logger) {
19012 LDKThirtyTwoBytes genesis_hash_ref;
19013 CHECK(*((uint32_t*)genesis_hash) == 32);
19014 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
19015 LDKAccess *chain_access_conv_ptr = NULL;
19016 if (chain_access != 0) {
19017 LDKAccess chain_access_conv;
19018 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19019 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19020 *chain_access_conv_ptr = chain_access_conv;
19022 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19023 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
19024 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19025 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19026 long ret_ref = (long)ret_var.inner;
19027 if (ret_var.is_owned) {
19033 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_from_net_graph(uint32_t chain_access, uint32_t logger, uint32_t network_graph) {
19034 LDKAccess *chain_access_conv_ptr = NULL;
19035 if (chain_access != 0) {
19036 LDKAccess chain_access_conv;
19037 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19038 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19039 *chain_access_conv_ptr = chain_access_conv;
19041 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19042 LDKNetworkGraph network_graph_conv;
19043 network_graph_conv.inner = (void*)(network_graph & (~1));
19044 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
19045 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
19046 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
19047 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19048 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19049 long ret_ref = (long)ret_var.inner;
19050 if (ret_var.is_owned) {
19056 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
19057 LDKNetGraphMsgHandler this_arg_conv;
19058 this_arg_conv.inner = (void*)(this_arg & (~1));
19059 this_arg_conv.is_owned = false;
19060 LDKAccess *chain_access_conv_ptr = NULL;
19061 if (chain_access != 0) {
19062 LDKAccess chain_access_conv;
19063 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19064 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19065 *chain_access_conv_ptr = chain_access_conv;
19067 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
19070 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_read_locked_graph(uint32_t this_arg) {
19071 LDKNetGraphMsgHandler this_arg_conv;
19072 this_arg_conv.inner = (void*)(this_arg & (~1));
19073 this_arg_conv.is_owned = false;
19074 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
19075 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19076 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19077 long ret_ref = (long)ret_var.inner;
19078 if (ret_var.is_owned) {
19084 uint32_t __attribute__((visibility("default"))) TS_LockedNetworkGraph_graph(uint32_t this_arg) {
19085 LDKLockedNetworkGraph this_arg_conv;
19086 this_arg_conv.inner = (void*)(this_arg & (~1));
19087 this_arg_conv.is_owned = false;
19088 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
19089 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19090 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19091 long ret_ref = (long)ret_var.inner;
19092 if (ret_var.is_owned) {
19098 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
19099 LDKNetGraphMsgHandler this_arg_conv;
19100 this_arg_conv.inner = (void*)(this_arg & (~1));
19101 this_arg_conv.is_owned = false;
19102 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
19103 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
19107 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
19108 LDKNetGraphMsgHandler this_arg_conv;
19109 this_arg_conv.inner = (void*)(this_arg & (~1));
19110 this_arg_conv.is_owned = false;
19111 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
19112 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
19116 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
19117 LDKDirectionalChannelInfo this_obj_conv;
19118 this_obj_conv.inner = (void*)(this_obj & (~1));
19119 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19120 DirectionalChannelInfo_free(this_obj_conv);
19123 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
19124 LDKDirectionalChannelInfo this_ptr_conv;
19125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19126 this_ptr_conv.is_owned = false;
19127 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
19131 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
19132 LDKDirectionalChannelInfo this_ptr_conv;
19133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19134 this_ptr_conv.is_owned = false;
19135 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
19138 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
19139 LDKDirectionalChannelInfo this_ptr_conv;
19140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19141 this_ptr_conv.is_owned = false;
19142 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
19146 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
19147 LDKDirectionalChannelInfo this_ptr_conv;
19148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19149 this_ptr_conv.is_owned = false;
19150 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
19153 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
19154 LDKDirectionalChannelInfo this_ptr_conv;
19155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19156 this_ptr_conv.is_owned = false;
19157 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
19161 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
19162 LDKDirectionalChannelInfo this_ptr_conv;
19163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19164 this_ptr_conv.is_owned = false;
19165 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
19168 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
19169 LDKDirectionalChannelInfo this_ptr_conv;
19170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19171 this_ptr_conv.is_owned = false;
19172 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
19176 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
19177 LDKDirectionalChannelInfo this_ptr_conv;
19178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19179 this_ptr_conv.is_owned = false;
19180 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
19183 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
19184 LDKDirectionalChannelInfo this_ptr_conv;
19185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19186 this_ptr_conv.is_owned = false;
19187 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19188 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
19189 long ret_ref = (long)ret_copy;
19193 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
19194 LDKDirectionalChannelInfo this_ptr_conv;
19195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19196 this_ptr_conv.is_owned = false;
19197 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
19199 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
19202 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
19203 LDKDirectionalChannelInfo this_ptr_conv;
19204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19205 this_ptr_conv.is_owned = false;
19206 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
19207 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19208 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19209 long ret_ref = (long)ret_var.inner;
19210 if (ret_var.is_owned) {
19216 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
19217 LDKDirectionalChannelInfo this_ptr_conv;
19218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19219 this_ptr_conv.is_owned = false;
19220 LDKRoutingFees val_conv;
19221 val_conv.inner = (void*)(val & (~1));
19222 val_conv.is_owned = (val & 1) || (val == 0);
19223 val_conv = RoutingFees_clone(&val_conv);
19224 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
19227 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
19228 LDKDirectionalChannelInfo this_ptr_conv;
19229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19230 this_ptr_conv.is_owned = false;
19231 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
19232 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19233 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19234 long ret_ref = (long)ret_var.inner;
19235 if (ret_var.is_owned) {
19241 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
19242 LDKDirectionalChannelInfo this_ptr_conv;
19243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19244 this_ptr_conv.is_owned = false;
19245 LDKChannelUpdate val_conv;
19246 val_conv.inner = (void*)(val & (~1));
19247 val_conv.is_owned = (val & 1) || (val == 0);
19248 val_conv = ChannelUpdate_clone(&val_conv);
19249 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
19252 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) {
19253 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
19254 FREE((void*)htlc_maximum_msat_arg);
19255 LDKRoutingFees fees_arg_conv;
19256 fees_arg_conv.inner = (void*)(fees_arg & (~1));
19257 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
19258 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
19259 LDKChannelUpdate last_update_message_arg_conv;
19260 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
19261 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
19262 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
19263 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);
19264 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19265 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19266 long ret_ref = (long)ret_var.inner;
19267 if (ret_var.is_owned) {
19273 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
19274 LDKDirectionalChannelInfo orig_conv;
19275 orig_conv.inner = (void*)(orig & (~1));
19276 orig_conv.is_owned = false;
19277 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
19278 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19279 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19280 long ret_ref = (long)ret_var.inner;
19281 if (ret_var.is_owned) {
19287 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
19288 LDKDirectionalChannelInfo obj_conv;
19289 obj_conv.inner = (void*)(obj & (~1));
19290 obj_conv.is_owned = false;
19291 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
19292 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19293 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19294 CVec_u8Z_free(ret_var);
19298 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
19299 LDKu8slice ser_ref;
19300 ser_ref.datalen = *((uint32_t*)ser);
19301 ser_ref.data = (int8_t*)(ser + 4);
19302 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
19303 *ret_conv = DirectionalChannelInfo_read(ser_ref);
19304 return (long)ret_conv;
19307 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
19308 LDKChannelInfo this_obj_conv;
19309 this_obj_conv.inner = (void*)(this_obj & (~1));
19310 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19311 ChannelInfo_free(this_obj_conv);
19314 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
19315 LDKChannelInfo this_ptr_conv;
19316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19317 this_ptr_conv.is_owned = false;
19318 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
19319 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19320 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19321 long ret_ref = (long)ret_var.inner;
19322 if (ret_var.is_owned) {
19328 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
19329 LDKChannelInfo this_ptr_conv;
19330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19331 this_ptr_conv.is_owned = false;
19332 LDKChannelFeatures val_conv;
19333 val_conv.inner = (void*)(val & (~1));
19334 val_conv.is_owned = (val & 1) || (val == 0);
19335 val_conv = ChannelFeatures_clone(&val_conv);
19336 ChannelInfo_set_features(&this_ptr_conv, val_conv);
19339 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
19340 LDKChannelInfo this_ptr_conv;
19341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19342 this_ptr_conv.is_owned = false;
19343 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19344 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
19348 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, int8_tArray val) {
19349 LDKChannelInfo this_ptr_conv;
19350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19351 this_ptr_conv.is_owned = false;
19352 LDKPublicKey val_ref;
19353 CHECK(*((uint32_t*)val) == 33);
19354 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19355 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
19358 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
19359 LDKChannelInfo this_ptr_conv;
19360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19361 this_ptr_conv.is_owned = false;
19362 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
19363 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19364 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19365 long ret_ref = (long)ret_var.inner;
19366 if (ret_var.is_owned) {
19372 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
19373 LDKChannelInfo this_ptr_conv;
19374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19375 this_ptr_conv.is_owned = false;
19376 LDKDirectionalChannelInfo val_conv;
19377 val_conv.inner = (void*)(val & (~1));
19378 val_conv.is_owned = (val & 1) || (val == 0);
19379 val_conv = DirectionalChannelInfo_clone(&val_conv);
19380 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
19383 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
19384 LDKChannelInfo this_ptr_conv;
19385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19386 this_ptr_conv.is_owned = false;
19387 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19388 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
19392 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, int8_tArray val) {
19393 LDKChannelInfo this_ptr_conv;
19394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19395 this_ptr_conv.is_owned = false;
19396 LDKPublicKey val_ref;
19397 CHECK(*((uint32_t*)val) == 33);
19398 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19399 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
19402 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
19403 LDKChannelInfo this_ptr_conv;
19404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19405 this_ptr_conv.is_owned = false;
19406 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
19407 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19408 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19409 long ret_ref = (long)ret_var.inner;
19410 if (ret_var.is_owned) {
19416 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
19417 LDKChannelInfo this_ptr_conv;
19418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19419 this_ptr_conv.is_owned = false;
19420 LDKDirectionalChannelInfo val_conv;
19421 val_conv.inner = (void*)(val & (~1));
19422 val_conv.is_owned = (val & 1) || (val == 0);
19423 val_conv = DirectionalChannelInfo_clone(&val_conv);
19424 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
19427 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
19428 LDKChannelInfo this_ptr_conv;
19429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19430 this_ptr_conv.is_owned = false;
19431 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19432 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
19433 long ret_ref = (long)ret_copy;
19437 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
19438 LDKChannelInfo this_ptr_conv;
19439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19440 this_ptr_conv.is_owned = false;
19441 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
19443 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
19446 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
19447 LDKChannelInfo this_ptr_conv;
19448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19449 this_ptr_conv.is_owned = false;
19450 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
19451 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19452 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19453 long ret_ref = (long)ret_var.inner;
19454 if (ret_var.is_owned) {
19460 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
19461 LDKChannelInfo this_ptr_conv;
19462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19463 this_ptr_conv.is_owned = false;
19464 LDKChannelAnnouncement val_conv;
19465 val_conv.inner = (void*)(val & (~1));
19466 val_conv.is_owned = (val & 1) || (val == 0);
19467 val_conv = ChannelAnnouncement_clone(&val_conv);
19468 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
19471 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) {
19472 LDKChannelFeatures features_arg_conv;
19473 features_arg_conv.inner = (void*)(features_arg & (~1));
19474 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
19475 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
19476 LDKPublicKey node_one_arg_ref;
19477 CHECK(*((uint32_t*)node_one_arg) == 33);
19478 memcpy(node_one_arg_ref.compressed_form, (uint8_t*)(node_one_arg + 4), 33);
19479 LDKDirectionalChannelInfo one_to_two_arg_conv;
19480 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
19481 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
19482 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
19483 LDKPublicKey node_two_arg_ref;
19484 CHECK(*((uint32_t*)node_two_arg) == 33);
19485 memcpy(node_two_arg_ref.compressed_form, (uint8_t*)(node_two_arg + 4), 33);
19486 LDKDirectionalChannelInfo two_to_one_arg_conv;
19487 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
19488 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
19489 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
19490 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
19491 FREE((void*)capacity_sats_arg);
19492 LDKChannelAnnouncement announcement_message_arg_conv;
19493 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
19494 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
19495 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
19496 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);
19497 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19498 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19499 long ret_ref = (long)ret_var.inner;
19500 if (ret_var.is_owned) {
19506 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
19507 LDKChannelInfo orig_conv;
19508 orig_conv.inner = (void*)(orig & (~1));
19509 orig_conv.is_owned = false;
19510 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
19511 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19512 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19513 long ret_ref = (long)ret_var.inner;
19514 if (ret_var.is_owned) {
19520 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
19521 LDKChannelInfo obj_conv;
19522 obj_conv.inner = (void*)(obj & (~1));
19523 obj_conv.is_owned = false;
19524 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
19525 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19526 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19527 CVec_u8Z_free(ret_var);
19531 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
19532 LDKu8slice ser_ref;
19533 ser_ref.datalen = *((uint32_t*)ser);
19534 ser_ref.data = (int8_t*)(ser + 4);
19535 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19536 *ret_conv = ChannelInfo_read(ser_ref);
19537 return (long)ret_conv;
19540 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
19541 LDKRoutingFees this_obj_conv;
19542 this_obj_conv.inner = (void*)(this_obj & (~1));
19543 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19544 RoutingFees_free(this_obj_conv);
19547 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
19548 LDKRoutingFees this_ptr_conv;
19549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19550 this_ptr_conv.is_owned = false;
19551 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
19555 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
19556 LDKRoutingFees this_ptr_conv;
19557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19558 this_ptr_conv.is_owned = false;
19559 RoutingFees_set_base_msat(&this_ptr_conv, val);
19562 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
19563 LDKRoutingFees this_ptr_conv;
19564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19565 this_ptr_conv.is_owned = false;
19566 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
19570 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
19571 LDKRoutingFees this_ptr_conv;
19572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19573 this_ptr_conv.is_owned = false;
19574 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
19577 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
19578 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
19579 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19580 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19581 long ret_ref = (long)ret_var.inner;
19582 if (ret_var.is_owned) {
19588 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
19589 LDKRoutingFees orig_conv;
19590 orig_conv.inner = (void*)(orig & (~1));
19591 orig_conv.is_owned = false;
19592 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
19593 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19594 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19595 long ret_ref = (long)ret_var.inner;
19596 if (ret_var.is_owned) {
19602 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
19603 LDKu8slice ser_ref;
19604 ser_ref.datalen = *((uint32_t*)ser);
19605 ser_ref.data = (int8_t*)(ser + 4);
19606 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19607 *ret_conv = RoutingFees_read(ser_ref);
19608 return (long)ret_conv;
19611 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
19612 LDKRoutingFees obj_conv;
19613 obj_conv.inner = (void*)(obj & (~1));
19614 obj_conv.is_owned = false;
19615 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
19616 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19617 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19618 CVec_u8Z_free(ret_var);
19622 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
19623 LDKNodeAnnouncementInfo this_obj_conv;
19624 this_obj_conv.inner = (void*)(this_obj & (~1));
19625 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19626 NodeAnnouncementInfo_free(this_obj_conv);
19629 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
19630 LDKNodeAnnouncementInfo this_ptr_conv;
19631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19632 this_ptr_conv.is_owned = false;
19633 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
19634 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19635 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19636 long ret_ref = (long)ret_var.inner;
19637 if (ret_var.is_owned) {
19643 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
19644 LDKNodeAnnouncementInfo this_ptr_conv;
19645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19646 this_ptr_conv.is_owned = false;
19647 LDKNodeFeatures val_conv;
19648 val_conv.inner = (void*)(val & (~1));
19649 val_conv.is_owned = (val & 1) || (val == 0);
19650 val_conv = NodeFeatures_clone(&val_conv);
19651 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
19654 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
19655 LDKNodeAnnouncementInfo this_ptr_conv;
19656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19657 this_ptr_conv.is_owned = false;
19658 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
19662 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
19663 LDKNodeAnnouncementInfo this_ptr_conv;
19664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19665 this_ptr_conv.is_owned = false;
19666 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
19669 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
19670 LDKNodeAnnouncementInfo this_ptr_conv;
19671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19672 this_ptr_conv.is_owned = false;
19673 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
19674 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
19678 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
19679 LDKNodeAnnouncementInfo this_ptr_conv;
19680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19681 this_ptr_conv.is_owned = false;
19682 LDKThreeBytes val_ref;
19683 CHECK(*((uint32_t*)val) == 3);
19684 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
19685 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
19688 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
19689 LDKNodeAnnouncementInfo this_ptr_conv;
19690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19691 this_ptr_conv.is_owned = false;
19692 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19693 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
19697 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
19698 LDKNodeAnnouncementInfo this_ptr_conv;
19699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19700 this_ptr_conv.is_owned = false;
19701 LDKThirtyTwoBytes val_ref;
19702 CHECK(*((uint32_t*)val) == 32);
19703 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19704 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
19707 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
19708 LDKNodeAnnouncementInfo this_ptr_conv;
19709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19710 this_ptr_conv.is_owned = false;
19711 LDKCVec_NetAddressZ val_constr;
19712 val_constr.datalen = *((uint32_t*)val);
19713 if (val_constr.datalen > 0)
19714 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19716 val_constr.data = NULL;
19717 uint32_t* val_vals = (uint32_t*)(val + 4);
19718 for (size_t m = 0; m < val_constr.datalen; m++) {
19719 uint32_t val_conv_12 = val_vals[m];
19720 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
19721 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
19722 val_constr.data[m] = val_conv_12_conv;
19724 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
19727 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
19728 LDKNodeAnnouncementInfo this_ptr_conv;
19729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19730 this_ptr_conv.is_owned = false;
19731 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
19732 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19733 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19734 long ret_ref = (long)ret_var.inner;
19735 if (ret_var.is_owned) {
19741 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
19742 LDKNodeAnnouncementInfo this_ptr_conv;
19743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19744 this_ptr_conv.is_owned = false;
19745 LDKNodeAnnouncement val_conv;
19746 val_conv.inner = (void*)(val & (~1));
19747 val_conv.is_owned = (val & 1) || (val == 0);
19748 val_conv = NodeAnnouncement_clone(&val_conv);
19749 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
19752 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) {
19753 LDKNodeFeatures features_arg_conv;
19754 features_arg_conv.inner = (void*)(features_arg & (~1));
19755 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
19756 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
19757 LDKThreeBytes rgb_arg_ref;
19758 CHECK(*((uint32_t*)rgb_arg) == 3);
19759 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
19760 LDKThirtyTwoBytes alias_arg_ref;
19761 CHECK(*((uint32_t*)alias_arg) == 32);
19762 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
19763 LDKCVec_NetAddressZ addresses_arg_constr;
19764 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
19765 if (addresses_arg_constr.datalen > 0)
19766 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19768 addresses_arg_constr.data = NULL;
19769 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
19770 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
19771 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
19772 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
19773 FREE((void*)addresses_arg_conv_12);
19774 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
19776 LDKNodeAnnouncement announcement_message_arg_conv;
19777 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
19778 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
19779 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
19780 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
19781 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19782 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19783 long ret_ref = (long)ret_var.inner;
19784 if (ret_var.is_owned) {
19790 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
19791 LDKNodeAnnouncementInfo orig_conv;
19792 orig_conv.inner = (void*)(orig & (~1));
19793 orig_conv.is_owned = false;
19794 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
19795 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19796 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19797 long ret_ref = (long)ret_var.inner;
19798 if (ret_var.is_owned) {
19804 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
19805 LDKNodeAnnouncementInfo obj_conv;
19806 obj_conv.inner = (void*)(obj & (~1));
19807 obj_conv.is_owned = false;
19808 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
19809 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19810 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19811 CVec_u8Z_free(ret_var);
19815 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
19816 LDKu8slice ser_ref;
19817 ser_ref.datalen = *((uint32_t*)ser);
19818 ser_ref.data = (int8_t*)(ser + 4);
19819 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19820 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
19821 return (long)ret_conv;
19824 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
19825 LDKNodeInfo this_obj_conv;
19826 this_obj_conv.inner = (void*)(this_obj & (~1));
19827 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19828 NodeInfo_free(this_obj_conv);
19831 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
19832 LDKNodeInfo this_ptr_conv;
19833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19834 this_ptr_conv.is_owned = false;
19835 LDKCVec_u64Z val_constr;
19836 val_constr.datalen = *((uint32_t*)val);
19837 if (val_constr.datalen > 0)
19838 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19840 val_constr.data = NULL;
19841 int64_t* val_vals = (int64_t*)(val + 4);
19842 for (size_t i = 0; i < val_constr.datalen; i++) {
19843 int64_t val_conv_8 = val_vals[i];
19844 val_constr.data[i] = val_conv_8;
19846 NodeInfo_set_channels(&this_ptr_conv, val_constr);
19849 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
19850 LDKNodeInfo this_ptr_conv;
19851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19852 this_ptr_conv.is_owned = false;
19853 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
19854 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19855 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19856 long ret_ref = (long)ret_var.inner;
19857 if (ret_var.is_owned) {
19863 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
19864 LDKNodeInfo this_ptr_conv;
19865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19866 this_ptr_conv.is_owned = false;
19867 LDKRoutingFees val_conv;
19868 val_conv.inner = (void*)(val & (~1));
19869 val_conv.is_owned = (val & 1) || (val == 0);
19870 val_conv = RoutingFees_clone(&val_conv);
19871 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
19874 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
19875 LDKNodeInfo this_ptr_conv;
19876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19877 this_ptr_conv.is_owned = false;
19878 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
19879 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19880 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19881 long ret_ref = (long)ret_var.inner;
19882 if (ret_var.is_owned) {
19888 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
19889 LDKNodeInfo this_ptr_conv;
19890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19891 this_ptr_conv.is_owned = false;
19892 LDKNodeAnnouncementInfo val_conv;
19893 val_conv.inner = (void*)(val & (~1));
19894 val_conv.is_owned = (val & 1) || (val == 0);
19895 val_conv = NodeAnnouncementInfo_clone(&val_conv);
19896 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
19899 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
19900 LDKCVec_u64Z channels_arg_constr;
19901 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
19902 if (channels_arg_constr.datalen > 0)
19903 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19905 channels_arg_constr.data = NULL;
19906 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
19907 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
19908 int64_t channels_arg_conv_8 = channels_arg_vals[i];
19909 channels_arg_constr.data[i] = channels_arg_conv_8;
19911 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
19912 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
19913 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
19914 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
19915 LDKNodeAnnouncementInfo announcement_info_arg_conv;
19916 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
19917 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
19918 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
19919 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
19920 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19921 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19922 long ret_ref = (long)ret_var.inner;
19923 if (ret_var.is_owned) {
19929 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
19930 LDKNodeInfo orig_conv;
19931 orig_conv.inner = (void*)(orig & (~1));
19932 orig_conv.is_owned = false;
19933 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
19934 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19935 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19936 long ret_ref = (long)ret_var.inner;
19937 if (ret_var.is_owned) {
19943 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
19944 LDKNodeInfo obj_conv;
19945 obj_conv.inner = (void*)(obj & (~1));
19946 obj_conv.is_owned = false;
19947 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
19948 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19949 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19950 CVec_u8Z_free(ret_var);
19954 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
19955 LDKu8slice ser_ref;
19956 ser_ref.datalen = *((uint32_t*)ser);
19957 ser_ref.data = (int8_t*)(ser + 4);
19958 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19959 *ret_conv = NodeInfo_read(ser_ref);
19960 return (long)ret_conv;
19963 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
19964 LDKNetworkGraph obj_conv;
19965 obj_conv.inner = (void*)(obj & (~1));
19966 obj_conv.is_owned = false;
19967 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
19968 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19969 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19970 CVec_u8Z_free(ret_var);
19974 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
19975 LDKu8slice ser_ref;
19976 ser_ref.datalen = *((uint32_t*)ser);
19977 ser_ref.data = (int8_t*)(ser + 4);
19978 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19979 *ret_conv = NetworkGraph_read(ser_ref);
19980 return (long)ret_conv;
19983 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
19984 LDKThirtyTwoBytes genesis_hash_ref;
19985 CHECK(*((uint32_t*)genesis_hash) == 32);
19986 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
19987 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
19988 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19989 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19990 long ret_ref = (long)ret_var.inner;
19991 if (ret_var.is_owned) {
19997 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
19998 LDKNetworkGraph this_arg_conv;
19999 this_arg_conv.inner = (void*)(this_arg & (~1));
20000 this_arg_conv.is_owned = false;
20001 LDKNodeAnnouncement msg_conv;
20002 msg_conv.inner = (void*)(msg & (~1));
20003 msg_conv.is_owned = false;
20004 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20005 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
20006 return (long)ret_conv;
20009 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
20010 LDKNetworkGraph this_arg_conv;
20011 this_arg_conv.inner = (void*)(this_arg & (~1));
20012 this_arg_conv.is_owned = false;
20013 LDKUnsignedNodeAnnouncement msg_conv;
20014 msg_conv.inner = (void*)(msg & (~1));
20015 msg_conv.is_owned = false;
20016 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20017 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
20018 return (long)ret_conv;
20021 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
20022 LDKNetworkGraph this_arg_conv;
20023 this_arg_conv.inner = (void*)(this_arg & (~1));
20024 this_arg_conv.is_owned = false;
20025 LDKChannelAnnouncement msg_conv;
20026 msg_conv.inner = (void*)(msg & (~1));
20027 msg_conv.is_owned = false;
20028 LDKAccess *chain_access_conv_ptr = NULL;
20029 if (chain_access != 0) {
20030 LDKAccess chain_access_conv;
20031 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
20032 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
20033 *chain_access_conv_ptr = chain_access_conv;
20035 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20036 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
20037 return (long)ret_conv;
20040 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
20041 LDKNetworkGraph this_arg_conv;
20042 this_arg_conv.inner = (void*)(this_arg & (~1));
20043 this_arg_conv.is_owned = false;
20044 LDKUnsignedChannelAnnouncement msg_conv;
20045 msg_conv.inner = (void*)(msg & (~1));
20046 msg_conv.is_owned = false;
20047 LDKAccess *chain_access_conv_ptr = NULL;
20048 if (chain_access != 0) {
20049 LDKAccess chain_access_conv;
20050 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
20051 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
20052 *chain_access_conv_ptr = chain_access_conv;
20054 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20055 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
20056 return (long)ret_conv;
20059 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
20060 LDKNetworkGraph this_arg_conv;
20061 this_arg_conv.inner = (void*)(this_arg & (~1));
20062 this_arg_conv.is_owned = false;
20063 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
20066 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
20067 LDKNetworkGraph this_arg_conv;
20068 this_arg_conv.inner = (void*)(this_arg & (~1));
20069 this_arg_conv.is_owned = false;
20070 LDKChannelUpdate msg_conv;
20071 msg_conv.inner = (void*)(msg & (~1));
20072 msg_conv.is_owned = false;
20073 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20074 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
20075 return (long)ret_conv;
20078 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
20079 LDKNetworkGraph this_arg_conv;
20080 this_arg_conv.inner = (void*)(this_arg & (~1));
20081 this_arg_conv.is_owned = false;
20082 LDKUnsignedChannelUpdate msg_conv;
20083 msg_conv.inner = (void*)(msg & (~1));
20084 msg_conv.is_owned = false;
20085 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20086 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
20087 return (long)ret_conv;
20090 void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) {
20091 LDKFilesystemPersister this_obj_conv;
20092 this_obj_conv.inner = (void*)(this_obj & (~1));
20093 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20094 FilesystemPersister_free(this_obj_conv);
20097 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_new(int8_tArray path_to_channel_data) {
20098 LDKCVec_u8Z path_to_channel_data_ref;
20099 path_to_channel_data_ref.datalen = *((uint32_t*)path_to_channel_data);
20100 path_to_channel_data_ref.data = MALLOC(path_to_channel_data_ref.datalen, "LDKCVec_u8Z Bytes");
20101 memcpy(path_to_channel_data_ref.data, (uint8_t*)(path_to_channel_data + 4), path_to_channel_data_ref.datalen);
20102 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_ref);
20103 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20104 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20105 long ret_ref = (long)ret_var.inner;
20106 if (ret_var.is_owned) {
20112 int8_tArray __attribute__((visibility("default"))) TS_FilesystemPersister_get_data_dir(uint32_t this_arg) {
20113 LDKFilesystemPersister this_arg_conv;
20114 this_arg_conv.inner = (void*)(this_arg & (~1));
20115 this_arg_conv.is_owned = false;
20116 LDKCVec_u8Z ret_var = FilesystemPersister_get_data_dir(&this_arg_conv);
20117 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20118 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20119 CVec_u8Z_free(ret_var);
20123 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_persist_manager(int8_tArray data_dir, uint32_t manager) {
20124 LDKCVec_u8Z data_dir_ref;
20125 data_dir_ref.datalen = *((uint32_t*)data_dir);
20126 data_dir_ref.data = MALLOC(data_dir_ref.datalen, "LDKCVec_u8Z Bytes");
20127 memcpy(data_dir_ref.data, (uint8_t*)(data_dir + 4), data_dir_ref.datalen);
20128 LDKChannelManager manager_conv;
20129 manager_conv.inner = (void*)(manager & (~1));
20130 manager_conv.is_owned = false;
20131 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
20132 *ret_conv = FilesystemPersister_persist_manager(data_dir_ref, &manager_conv);
20133 return (long)ret_conv;
20136 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_read_channelmonitors(uint32_t this_arg, uint32_t keys_manager) {
20137 LDKFilesystemPersister this_arg_conv;
20138 this_arg_conv.inner = (void*)(this_arg & (~1));
20139 this_arg_conv.is_owned = false;
20140 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
20141 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
20142 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
20143 return (long)ret_conv;
20146 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_as_Persist(uint32_t this_arg) {
20147 LDKFilesystemPersister this_arg_conv;
20148 this_arg_conv.inner = (void*)(this_arg & (~1));
20149 this_arg_conv.is_owned = false;
20150 LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
20151 *ret = FilesystemPersister_as_Persist(&this_arg_conv);