1 #include <rust_types.h>
6 // These should be provided...somehow...
7 void *memset(void *s, int c, size_t n);
8 void *memcpy(void *dest, const void *src, size_t n);
9 int memcmp(const void *s1, const void *s2, size_t n);
11 void __attribute__((noreturn)) abort(void);
12 static inline void assert(bool expression) {
13 if (!expression) { abort(); }
16 void *malloc(size_t size);
19 #define MALLOC(a, _) malloc(a)
20 #define FREE(p) if ((long)(p) > 1024) { free(p); }
21 #define DO_ASSERT(a) (void)(a)
24 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
25 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
26 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
27 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
29 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
31 typedef uint32_t int64_tArray;
32 typedef uint32_t int8_tArray;
33 typedef uint32_t uint32_tArray;
34 typedef uint32_t ptrArray;
35 typedef uint32_t jstring;
37 static inline uint32_t init_arr(size_t arr_len, size_t elem_size, const char *type_desc) {
38 uint32_t *elems = (uint32_t*)MALLOC(arr_len * elem_size + 4, type_desc);
40 return (uint32_t)elems;
43 jstring str_ref_to_ts(const char* chars, size_t len) {
44 char* err_buf = MALLOC(len + 4, "str conv buf");
45 *((uint32_t*)err_buf) = len;
46 memcpy(err_buf + 4, chars, len);
47 return (uint32_t) err_buf;
50 typedef bool jboolean;
52 uint32_t __attribute__((visibility("default"))) TS_malloc(uint32_t size) {
53 return (uint32_t)MALLOC(size, "JS-Called malloc");
55 void __attribute__((visibility("default"))) TS_free(uint32_t ptr) {
58 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
59 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
61 case 0: return LDKAccessError_UnknownChain;
62 case 1: return LDKAccessError_UnknownTx;
66 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
68 case LDKAccessError_UnknownChain: return 0;
69 case LDKAccessError_UnknownTx: return 1;
73 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
75 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
76 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
80 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
82 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
83 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
87 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
89 case 0: return LDKConfirmationTarget_Background;
90 case 1: return LDKConfirmationTarget_Normal;
91 case 2: return LDKConfirmationTarget_HighPriority;
95 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
97 case LDKConfirmationTarget_Background: return 0;
98 case LDKConfirmationTarget_Normal: return 1;
99 case LDKConfirmationTarget_HighPriority: return 2;
103 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
105 case 0: return LDKLevel_Off;
106 case 1: return LDKLevel_Error;
107 case 2: return LDKLevel_Warn;
108 case 3: return LDKLevel_Info;
109 case 4: return LDKLevel_Debug;
110 case 5: return LDKLevel_Trace;
114 static inline int32_t LDKLevel_to_js(LDKLevel val) {
116 case LDKLevel_Off: return 0;
117 case LDKLevel_Error: return 1;
118 case LDKLevel_Warn: return 2;
119 case LDKLevel_Info: return 3;
120 case LDKLevel_Debug: return 4;
121 case LDKLevel_Trace: return 5;
125 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
127 case 0: return LDKNetwork_Bitcoin;
128 case 1: return LDKNetwork_Testnet;
129 case 2: return LDKNetwork_Regtest;
133 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
135 case LDKNetwork_Bitcoin: return 0;
136 case LDKNetwork_Testnet: return 1;
137 case LDKNetwork_Regtest: return 2;
141 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
143 case 0: return LDKSecp256k1Error_IncorrectSignature;
144 case 1: return LDKSecp256k1Error_InvalidMessage;
145 case 2: return LDKSecp256k1Error_InvalidPublicKey;
146 case 3: return LDKSecp256k1Error_InvalidSignature;
147 case 4: return LDKSecp256k1Error_InvalidSecretKey;
148 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
149 case 6: return LDKSecp256k1Error_InvalidTweak;
150 case 7: return LDKSecp256k1Error_NotEnoughMemory;
151 case 8: return LDKSecp256k1Error_CallbackPanicked;
155 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
157 case LDKSecp256k1Error_IncorrectSignature: return 0;
158 case LDKSecp256k1Error_InvalidMessage: return 1;
159 case LDKSecp256k1Error_InvalidPublicKey: return 2;
160 case LDKSecp256k1Error_InvalidSignature: return 3;
161 case LDKSecp256k1Error_InvalidSecretKey: return 4;
162 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
163 case LDKSecp256k1Error_InvalidTweak: return 6;
164 case LDKSecp256k1Error_NotEnoughMemory: return 7;
165 case LDKSecp256k1Error_CallbackPanicked: return 8;
169 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u8Z_new(int8_tArray elems) {
170 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
171 ret->datalen = *((uint32_t*)elems);
172 if (ret->datalen == 0) {
175 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
176 int8_t *java_elems = (int8_t*)(elems + 4);
177 for (size_t i = 0; i < ret->datalen; i++) {
178 ret->data[i] = java_elems[i];
183 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
184 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
185 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
188 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_result_ok(uint32_t arg) {
189 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
191 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_ok(uint32_t arg) {
192 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
193 CHECK(val->result_ok);
194 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
195 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).bytes, 32);
198 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_err(uint32_t arg) {
199 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
200 CHECK(!val->result_ok);
201 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
204 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_result_ok(uint32_t arg) {
205 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
207 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_ok(uint32_t arg) {
208 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
209 CHECK(val->result_ok);
210 int8_tArray res_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
211 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compressed_form, 33);
214 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_err(uint32_t arg) {
215 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
216 CHECK(!val->result_ok);
217 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
220 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_result_ok(uint32_t arg) {
221 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
223 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t arg) {
224 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
225 CHECK(val->result_ok);
226 LDKTxCreationKeys res_var = (*val->contents.result);
227 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
228 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
229 long res_ref = (long)res_var.inner & ~1;
232 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t arg) {
233 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
234 CHECK(!val->result_ok);
235 LDKDecodeError err_var = (*val->contents.err);
236 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
237 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
238 long err_ref = (long)err_var.inner & ~1;
241 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_result_ok(uint32_t arg) {
242 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
244 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t arg) {
245 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
246 CHECK(val->result_ok);
247 LDKChannelPublicKeys res_var = (*val->contents.result);
248 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
249 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
250 long res_ref = (long)res_var.inner & ~1;
253 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t arg) {
254 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
255 CHECK(!val->result_ok);
256 LDKDecodeError err_var = (*val->contents.err);
257 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
258 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
259 long err_ref = (long)err_var.inner & ~1;
262 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_result_ok(uint32_t arg) {
263 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
265 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_ok(uint32_t arg) {
266 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
267 CHECK(val->result_ok);
268 LDKTxCreationKeys res_var = (*val->contents.result);
269 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
270 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
271 long res_ref = (long)res_var.inner & ~1;
274 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_err(uint32_t arg) {
275 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
276 CHECK(!val->result_ok);
277 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
280 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_result_ok(uint32_t arg) {
281 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
283 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
284 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
285 CHECK(val->result_ok);
286 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
287 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
288 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
289 long res_ref = (long)res_var.inner & ~1;
292 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
293 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
294 CHECK(!val->result_ok);
295 LDKDecodeError err_var = (*val->contents.err);
296 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
297 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
298 long err_ref = (long)err_var.inner & ~1;
301 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
302 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
304 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
305 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
306 CHECK(val->result_ok);
307 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
308 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
309 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
310 long res_ref = (long)res_var.inner & ~1;
313 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
314 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
315 CHECK(!val->result_ok);
316 LDKDecodeError err_var = (*val->contents.err);
317 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
318 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
319 long err_ref = (long)err_var.inner & ~1;
322 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
323 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
325 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
326 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
327 CHECK(val->result_ok);
328 LDKChannelTransactionParameters res_var = (*val->contents.result);
329 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
330 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
331 long res_ref = (long)res_var.inner & ~1;
334 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
335 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
336 CHECK(!val->result_ok);
337 LDKDecodeError err_var = (*val->contents.err);
338 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
339 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
340 long err_ref = (long)err_var.inner & ~1;
343 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
344 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
346 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
347 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
348 CHECK(val->result_ok);
349 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
350 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
351 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
352 long res_ref = (long)res_var.inner & ~1;
355 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
356 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
357 CHECK(!val->result_ok);
358 LDKDecodeError err_var = (*val->contents.err);
359 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
360 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
361 long err_ref = (long)err_var.inner & ~1;
364 jboolean __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
365 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
367 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
368 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
369 CHECK(val->result_ok);
370 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
371 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
372 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
373 long res_ref = (long)res_var.inner & ~1;
376 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
377 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
378 CHECK(!val->result_ok);
379 LDKDecodeError err_var = (*val->contents.err);
380 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
381 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
382 long err_ref = (long)err_var.inner & ~1;
385 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
386 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
388 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
389 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
390 CHECK(val->result_ok);
391 LDKCommitmentTransaction res_var = (*val->contents.result);
392 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
393 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
394 long res_ref = (long)res_var.inner & ~1;
397 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
398 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
399 CHECK(!val->result_ok);
400 LDKDecodeError err_var = (*val->contents.err);
401 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
402 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
403 long err_ref = (long)err_var.inner & ~1;
406 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_result_ok(uint32_t arg) {
407 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
409 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
410 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
411 CHECK(val->result_ok);
412 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
413 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
414 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
415 long res_ref = (long)res_var.inner & ~1;
418 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
419 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
420 CHECK(!val->result_ok);
421 return *val->contents.err;
423 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_result_ok(uint32_t arg) {
424 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
426 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
427 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
428 CHECK(val->result_ok);
429 LDKCVec_SignatureZ res_var = (*val->contents.result);
430 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
431 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
432 for (size_t m = 0; m < res_var.datalen; m++) {
433 int8_tArray arr_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
434 memcpy((uint8_t*)(arr_conv_12_arr + 4), res_var.data[m].compact_form, 64);
435 res_arr_ptr[m] = arr_conv_12_arr;
439 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
440 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
441 CHECK(!val->result_ok);
442 return *val->contents.err;
444 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
445 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
447 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
448 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
449 CHECK(val->result_ok);
450 LDKCVec_u8Z res_var = (*val->contents.result);
451 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
452 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
455 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
456 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
457 CHECK(!val->result_ok);
458 LDKPeerHandleError err_var = (*val->contents.err);
459 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
460 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
461 long err_ref = (long)err_var.inner & ~1;
464 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
465 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
467 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
468 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
469 CHECK(val->result_ok);
470 return *val->contents.result;
472 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
473 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
474 CHECK(!val->result_ok);
475 LDKPeerHandleError err_var = (*val->contents.err);
476 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
477 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
478 long err_ref = (long)err_var.inner & ~1;
481 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
482 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
484 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
485 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
486 CHECK(val->result_ok);
487 return *val->contents.result;
489 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
490 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
491 CHECK(!val->result_ok);
492 LDKPeerHandleError err_var = (*val->contents.err);
493 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
494 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
495 long err_ref = (long)err_var.inner & ~1;
498 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
499 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
501 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
502 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
503 CHECK(val->result_ok);
504 LDKInitFeatures res_var = (*val->contents.result);
505 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
506 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
507 long res_ref = (long)res_var.inner & ~1;
510 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
511 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
512 CHECK(!val->result_ok);
513 LDKDecodeError err_var = (*val->contents.err);
514 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
515 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
516 long err_ref = (long)err_var.inner & ~1;
519 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
520 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
522 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
523 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
524 CHECK(val->result_ok);
525 LDKNodeFeatures res_var = (*val->contents.result);
526 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
527 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
528 long res_ref = (long)res_var.inner & ~1;
531 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
532 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
533 CHECK(!val->result_ok);
534 LDKDecodeError err_var = (*val->contents.err);
535 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
536 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
537 long err_ref = (long)err_var.inner & ~1;
540 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
541 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
543 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
544 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
545 CHECK(val->result_ok);
546 LDKChannelFeatures res_var = (*val->contents.result);
547 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
548 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
549 long res_ref = (long)res_var.inner & ~1;
552 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
553 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
554 CHECK(!val->result_ok);
555 LDKDecodeError err_var = (*val->contents.err);
556 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
557 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
558 long err_ref = (long)err_var.inner & ~1;
561 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
562 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
564 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
565 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
566 CHECK(val->result_ok);
567 LDKChannelConfig res_var = (*val->contents.result);
568 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
569 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
570 long res_ref = (long)res_var.inner & ~1;
573 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
574 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
575 CHECK(!val->result_ok);
576 LDKDecodeError err_var = (*val->contents.err);
577 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
578 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
579 long err_ref = (long)err_var.inner & ~1;
582 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
583 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
585 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
586 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
587 CHECK(val->result_ok);
588 return *val->contents.result;
590 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
591 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
592 CHECK(!val->result_ok);
593 LDKLightningError err_var = (*val->contents.err);
594 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
595 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
596 long err_ref = (long)err_var.inner & ~1;
599 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
600 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
601 LDKChannelAnnouncement a_conv;
602 a_conv.inner = (void*)(a & (~1));
603 a_conv.is_owned = (a & 1) || (a == 0);
604 a_conv = ChannelAnnouncement_clone(&a_conv);
606 LDKChannelUpdate b_conv;
607 b_conv.inner = (void*)(b & (~1));
608 b_conv.is_owned = (b & 1) || (b == 0);
609 b_conv = ChannelUpdate_clone(&b_conv);
611 LDKChannelUpdate c_conv;
612 c_conv.inner = (void*)(c & (~1));
613 c_conv.is_owned = (c & 1) || (c == 0);
614 c_conv = ChannelUpdate_clone(&c_conv);
618 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t ptr) {
619 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
620 LDKChannelAnnouncement a_var = tuple->a;
621 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
622 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
623 long a_ref = (long)a_var.inner & ~1;
626 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t ptr) {
627 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
628 LDKChannelUpdate b_var = tuple->b;
629 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
630 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
631 long b_ref = (long)b_var.inner & ~1;
634 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t ptr) {
635 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
636 LDKChannelUpdate c_var = tuple->c;
637 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
638 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
639 long c_ref = (long)c_var.inner & ~1;
642 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
643 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
644 ret->datalen = *((uint32_t*)elems);
645 if (ret->datalen == 0) {
648 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
649 uint32_t *java_elems = (uint32_t*)(elems + 4);
650 for (size_t i = 0; i < ret->datalen; i++) {
651 uint32_t arr_elem = java_elems[i];
652 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
653 FREE((void*)arr_elem);
654 ret->data[i] = arr_elem_conv;
659 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
660 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
661 for (size_t i = 0; i < ret.datalen; i++) {
662 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
666 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
667 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
668 ret->datalen = *((uint32_t*)elems);
669 if (ret->datalen == 0) {
672 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
673 uint32_t *java_elems = (uint32_t*)(elems + 4);
674 for (size_t i = 0; i < ret->datalen; i++) {
675 uint32_t arr_elem = java_elems[i];
676 LDKNodeAnnouncement arr_elem_conv;
677 arr_elem_conv.inner = (void*)(arr_elem & (~1));
678 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
679 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
680 ret->data[i] = arr_elem_conv;
685 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
686 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
687 for (size_t i = 0; i < ret.datalen; i++) {
688 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
692 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
693 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
695 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
696 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
697 CHECK(val->result_ok);
698 return *val->contents.result;
700 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
701 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
702 CHECK(!val->result_ok);
703 LDKLightningError err_var = (*val->contents.err);
704 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
705 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
706 long err_ref = (long)err_var.inner & ~1;
709 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
710 LDKErrorAction *obj = (LDKErrorAction*)ptr;
712 case LDKErrorAction_DisconnectPeer: {
713 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
714 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
715 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
716 long msg_ref = (long)msg_var.inner & ~1;
717 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
719 case LDKErrorAction_IgnoreError: {
720 return 0 /* LDKErrorAction - IgnoreError */;
722 case LDKErrorAction_SendErrorMessage: {
723 LDKErrorMessage msg_var = obj->send_error_message.msg;
724 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
725 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
726 long msg_ref = (long)msg_var.inner & ~1;
727 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
732 uint32_t __attribute__((visibility("default"))) TS_LDKHTLCFailChannelUpdate_ref_from_ptr(uint32_t ptr) {
733 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
735 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
736 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
737 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
738 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
739 long msg_ref = (long)msg_var.inner & ~1;
740 return 0 /* LDKHTLCFailChannelUpdate - ChannelUpdateMessage */; (void) msg_ref;
742 case LDKHTLCFailChannelUpdate_ChannelClosed: {
743 return 0 /* LDKHTLCFailChannelUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
745 case LDKHTLCFailChannelUpdate_NodeFailure: {
746 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
747 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
748 return 0 /* LDKHTLCFailChannelUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
753 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
754 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
756 case LDKMessageSendEvent_SendAcceptChannel: {
757 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
758 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
759 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
760 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
761 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
762 long msg_ref = (long)msg_var.inner & ~1;
763 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
765 case LDKMessageSendEvent_SendOpenChannel: {
766 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
767 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
768 LDKOpenChannel msg_var = obj->send_open_channel.msg;
769 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
770 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
771 long msg_ref = (long)msg_var.inner & ~1;
772 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
774 case LDKMessageSendEvent_SendFundingCreated: {
775 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
776 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
777 LDKFundingCreated msg_var = obj->send_funding_created.msg;
778 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
779 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
780 long msg_ref = (long)msg_var.inner & ~1;
781 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
783 case LDKMessageSendEvent_SendFundingSigned: {
784 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
785 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
786 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
787 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
788 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
789 long msg_ref = (long)msg_var.inner & ~1;
790 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
792 case LDKMessageSendEvent_SendFundingLocked: {
793 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
794 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
795 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
796 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
797 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
798 long msg_ref = (long)msg_var.inner & ~1;
799 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
801 case LDKMessageSendEvent_SendAnnouncementSignatures: {
802 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
803 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
804 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
805 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
806 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
807 long msg_ref = (long)msg_var.inner & ~1;
808 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
810 case LDKMessageSendEvent_UpdateHTLCs: {
811 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
812 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
813 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
814 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
815 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
816 long updates_ref = (long)updates_var.inner & ~1;
817 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
819 case LDKMessageSendEvent_SendRevokeAndACK: {
820 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
821 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
822 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
823 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
824 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
825 long msg_ref = (long)msg_var.inner & ~1;
826 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
828 case LDKMessageSendEvent_SendClosingSigned: {
829 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
830 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
831 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
832 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
833 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
834 long msg_ref = (long)msg_var.inner & ~1;
835 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
837 case LDKMessageSendEvent_SendShutdown: {
838 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
839 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
840 LDKShutdown msg_var = obj->send_shutdown.msg;
841 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
842 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
843 long msg_ref = (long)msg_var.inner & ~1;
844 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
846 case LDKMessageSendEvent_SendChannelReestablish: {
847 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
848 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
849 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
850 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
851 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
852 long msg_ref = (long)msg_var.inner & ~1;
853 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
855 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
856 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
857 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
858 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
859 long msg_ref = (long)msg_var.inner & ~1;
860 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
861 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
862 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
863 long update_msg_ref = (long)update_msg_var.inner & ~1;
864 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
866 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
867 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
868 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
869 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
870 long msg_ref = (long)msg_var.inner & ~1;
871 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
873 case LDKMessageSendEvent_BroadcastChannelUpdate: {
874 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
875 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
876 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
877 long msg_ref = (long)msg_var.inner & ~1;
878 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
880 case LDKMessageSendEvent_HandleError: {
881 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
882 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
883 long action_ref = ((long)&obj->handle_error.action) | 1;
884 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
886 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
887 long update_ref = ((long)&obj->payment_failure_network_update.update) | 1;
888 return 0 /* LDKMessageSendEvent - PaymentFailureNetworkUpdate */; (void) update_ref;
890 case LDKMessageSendEvent_SendChannelRangeQuery: {
891 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
892 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
893 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
894 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
895 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
896 long msg_ref = (long)msg_var.inner & ~1;
897 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
899 case LDKMessageSendEvent_SendShortIdsQuery: {
900 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
901 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
902 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
903 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
904 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
905 long msg_ref = (long)msg_var.inner & ~1;
906 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
911 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MessageSendEventZ_new(uint32_tArray elems) {
912 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
913 ret->datalen = *((uint32_t*)elems);
914 if (ret->datalen == 0) {
917 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
918 uint32_t *java_elems = (uint32_t*)(elems + 4);
919 for (size_t i = 0; i < ret->datalen; i++) {
920 uint32_t arr_elem = java_elems[i];
921 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
922 FREE((void*)arr_elem);
923 ret->data[i] = arr_elem_conv;
928 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
929 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
930 for (size_t i = 0; i < ret.datalen; i++) {
931 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
935 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
936 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
938 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
939 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
940 CHECK(val->result_ok);
941 LDKDirectionalChannelInfo res_var = (*val->contents.result);
942 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
943 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
944 long res_ref = (long)res_var.inner & ~1;
947 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
948 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
949 CHECK(!val->result_ok);
950 LDKDecodeError err_var = (*val->contents.err);
951 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
952 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
953 long err_ref = (long)err_var.inner & ~1;
956 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
957 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
959 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
960 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
961 CHECK(val->result_ok);
962 LDKChannelInfo res_var = (*val->contents.result);
963 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
964 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
965 long res_ref = (long)res_var.inner & ~1;
968 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
969 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
970 CHECK(!val->result_ok);
971 LDKDecodeError err_var = (*val->contents.err);
972 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
973 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
974 long err_ref = (long)err_var.inner & ~1;
977 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
978 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
980 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
981 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
982 CHECK(val->result_ok);
983 LDKRoutingFees res_var = (*val->contents.result);
984 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
985 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
986 long res_ref = (long)res_var.inner & ~1;
989 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
990 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
991 CHECK(!val->result_ok);
992 LDKDecodeError err_var = (*val->contents.err);
993 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
994 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
995 long err_ref = (long)err_var.inner & ~1;
998 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
999 LDKNetAddress *obj = (LDKNetAddress*)ptr;
1001 case LDKNetAddress_IPv4: {
1002 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
1003 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
1004 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
1006 case LDKNetAddress_IPv6: {
1007 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
1008 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
1009 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
1011 case LDKNetAddress_OnionV2: {
1012 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
1013 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
1014 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
1016 case LDKNetAddress_OnionV3: {
1017 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1018 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
1019 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
1024 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
1025 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
1026 ret->datalen = *((uint32_t*)elems);
1027 if (ret->datalen == 0) {
1030 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
1031 uint32_t *java_elems = (uint32_t*)(elems + 4);
1032 for (size_t i = 0; i < ret->datalen; i++) {
1033 uint32_t arr_elem = java_elems[i];
1034 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
1035 FREE((void*)arr_elem);
1036 ret->data[i] = arr_elem_conv;
1041 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
1042 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
1043 for (size_t i = 0; i < ret.datalen; i++) {
1044 ret.data[i] = NetAddress_clone(&orig->data[i]);
1048 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
1049 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
1051 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
1052 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1053 CHECK(val->result_ok);
1054 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
1055 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1056 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1057 long res_ref = (long)res_var.inner & ~1;
1060 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
1061 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1062 CHECK(!val->result_ok);
1063 LDKDecodeError err_var = (*val->contents.err);
1064 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1065 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1066 long err_ref = (long)err_var.inner & ~1;
1069 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
1070 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
1071 ret->datalen = *((uint32_t*)elems);
1072 if (ret->datalen == 0) {
1075 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
1076 int64_t *java_elems = (int64_t*)(elems + 4);
1077 for (size_t i = 0; i < ret->datalen; i++) {
1078 ret->data[i] = java_elems[i];
1083 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1084 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1085 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1088 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
1089 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
1091 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
1092 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1093 CHECK(val->result_ok);
1094 LDKNodeInfo res_var = (*val->contents.result);
1095 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1096 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1097 long res_ref = (long)res_var.inner & ~1;
1100 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
1101 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1102 CHECK(!val->result_ok);
1103 LDKDecodeError err_var = (*val->contents.err);
1104 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1105 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1106 long err_ref = (long)err_var.inner & ~1;
1109 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
1110 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
1112 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
1113 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1114 CHECK(val->result_ok);
1115 LDKNetworkGraph res_var = (*val->contents.result);
1116 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1117 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1118 long res_ref = (long)res_var.inner & ~1;
1121 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
1122 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1123 CHECK(!val->result_ok);
1124 LDKDecodeError err_var = (*val->contents.err);
1125 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1126 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1127 long err_ref = (long)err_var.inner & ~1;
1130 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
1131 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1133 LDKTransaction b_ref;
1134 b_ref.datalen = *((uint32_t*)b);
1135 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1136 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
1137 b_ref.data_is_owned = false;
1141 int64_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_a(uint32_t ptr) {
1142 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1145 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_b(uint32_t ptr) {
1146 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1147 LDKTransaction b_var = tuple->b;
1148 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1149 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
1152 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_usizeTransactionZZ_new(uint32_tArray elems) {
1153 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1154 ret->datalen = *((uint32_t*)elems);
1155 if (ret->datalen == 0) {
1158 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1159 uint32_t *java_elems = (uint32_t*)(elems + 4);
1160 for (size_t i = 0; i < ret->datalen; i++) {
1161 uint32_t arr_elem = java_elems[i];
1162 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1163 FREE((void*)arr_elem);
1164 ret->data[i] = arr_elem_conv;
1169 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(uint32_t arg) {
1170 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1172 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
1173 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1174 CHECK(val->result_ok);
1175 return *val->contents.result;
1177 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
1178 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1179 CHECK(!val->result_ok);
1180 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
1183 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) {
1184 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1185 ret->datalen = *((uint32_t*)elems);
1186 if (ret->datalen == 0) {
1189 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1190 uint32_t *java_elems = (uint32_t*)(elems + 4);
1191 for (size_t i = 0; i < ret->datalen; i++) {
1192 uint32_t arr_elem = java_elems[i];
1193 LDKMonitorEvent arr_elem_conv;
1194 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1195 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1196 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
1197 ret->data[i] = arr_elem_conv;
1202 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1203 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1204 for (size_t i = 0; i < ret.datalen; i++) {
1205 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1209 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u64u64Z_new(int64_t a, int64_t b) {
1210 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1215 int64_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u64u64Z_get_a(uint32_t ptr) {
1216 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)(ptr & ~1);
1219 int64_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u64u64Z_get_b(uint32_t ptr) {
1220 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)(ptr & ~1);
1223 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
1224 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
1226 case LDKSpendableOutputDescriptor_StaticOutput: {
1227 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1228 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1229 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1230 long outpoint_ref = (long)outpoint_var.inner & ~1;
1231 long output_ref = ((long)&obj->static_output.output) | 1;
1232 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (long)output_ref;
1234 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
1235 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
1236 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1237 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1238 long outpoint_ref = (long)outpoint_var.inner & ~1;
1239 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1240 memcpy((uint8_t*)(per_commitment_point_arr + 4), obj->dynamic_output_p2wsh.per_commitment_point.compressed_form, 33);
1241 long output_ref = ((long)&obj->dynamic_output_p2wsh.output) | 1;
1242 long key_derivation_params_ref = (long)(&obj->dynamic_output_p2wsh.key_derivation_params) | 1;
1243 int8_tArray revocation_pubkey_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1244 memcpy((uint8_t*)(revocation_pubkey_arr + 4), obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form, 33);
1245 return 0 /* LDKSpendableOutputDescriptor - DynamicOutputP2WSH */; (void) outpoint_ref; (void) per_commitment_point_arr; (void) obj->dynamic_output_p2wsh.to_self_delay; (void) (long)output_ref; (void) key_derivation_params_ref; (void) revocation_pubkey_arr;
1247 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
1248 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
1249 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1250 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1251 long outpoint_ref = (long)outpoint_var.inner & ~1;
1252 long output_ref = ((long)&obj->static_output_counterparty_payment.output) | 1;
1253 long key_derivation_params_ref = (long)(&obj->static_output_counterparty_payment.key_derivation_params) | 1;
1254 return 0 /* LDKSpendableOutputDescriptor - StaticOutputCounterpartyPayment */; (void) outpoint_ref; (void) (long)output_ref; (void) key_derivation_params_ref;
1259 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_SpendableOutputDescriptorZ_new(uint32_tArray elems) {
1260 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1261 ret->datalen = *((uint32_t*)elems);
1262 if (ret->datalen == 0) {
1265 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1266 uint32_t *java_elems = (uint32_t*)(elems + 4);
1267 for (size_t i = 0; i < ret->datalen; i++) {
1268 uint32_t arr_elem = java_elems[i];
1269 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1270 FREE((void*)arr_elem);
1271 ret->data[i] = arr_elem_conv;
1276 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1277 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1278 for (size_t i = 0; i < ret.datalen; i++) {
1279 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1283 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
1284 LDKEvent *obj = (LDKEvent*)ptr;
1286 case LDKEvent_FundingGenerationReady: {
1287 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1288 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
1289 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1290 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1291 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
1292 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;
1294 case LDKEvent_FundingBroadcastSafe: {
1295 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1296 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1297 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1298 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1299 return 0 /* LDKEvent - FundingBroadcastSafe */; (void) funding_txo_ref; (void) obj->funding_broadcast_safe.user_channel_id;
1301 case LDKEvent_PaymentReceived: {
1302 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1303 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
1304 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1305 memcpy((uint8_t*)(payment_secret_arr + 4), obj->payment_received.payment_secret.data, 32);
1306 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) payment_secret_arr; (void) obj->payment_received.amt;
1308 case LDKEvent_PaymentSent: {
1309 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1310 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
1311 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
1313 case LDKEvent_PaymentFailed: {
1314 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1315 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_failed.payment_hash.data, 32);
1316 return 0 /* LDKEvent - PaymentFailed */; (void) payment_hash_arr; (void) obj->payment_failed.rejected_by_dest;
1318 case LDKEvent_PendingHTLCsForwardable: {
1319 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
1321 case LDKEvent_SpendableOutputs: {
1322 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1323 uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1324 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
1325 for (size_t b = 0; b < outputs_var.datalen; b++) {
1326 long arr_conv_27_ref = ((long)&outputs_var.data[b]) | 1;
1327 outputs_arr_ptr[b] = arr_conv_27_ref;
1329 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
1334 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
1335 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1336 ret->datalen = *((uint32_t*)elems);
1337 if (ret->datalen == 0) {
1340 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
1341 uint32_t *java_elems = (uint32_t*)(elems + 4);
1342 for (size_t i = 0; i < ret->datalen; i++) {
1343 uint32_t arr_elem = java_elems[i];
1344 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
1345 FREE((void*)arr_elem);
1346 ret->data[i] = arr_elem_conv;
1351 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1352 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1353 for (size_t i = 0; i < ret.datalen; i++) {
1354 ret.data[i] = Event_clone(&orig->data[i]);
1358 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
1359 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
1361 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
1362 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1363 CHECK(val->result_ok);
1364 LDKOutPoint res_var = (*val->contents.result);
1365 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1366 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1367 long res_ref = (long)res_var.inner & ~1;
1370 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
1371 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1372 CHECK(!val->result_ok);
1373 LDKDecodeError err_var = (*val->contents.err);
1374 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1375 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1376 long err_ref = (long)err_var.inner & ~1;
1379 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
1380 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
1382 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
1383 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1384 CHECK(val->result_ok);
1385 LDKChannelMonitorUpdate res_var = (*val->contents.result);
1386 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1387 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1388 long res_ref = (long)res_var.inner & ~1;
1391 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
1392 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1393 CHECK(!val->result_ok);
1394 LDKDecodeError err_var = (*val->contents.err);
1395 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1396 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1397 long err_ref = (long)err_var.inner & ~1;
1400 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
1401 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
1403 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
1404 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1405 CHECK(val->result_ok);
1406 LDKHTLCUpdate res_var = (*val->contents.result);
1407 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1408 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1409 long res_ref = (long)res_var.inner & ~1;
1412 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
1413 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1414 CHECK(!val->result_ok);
1415 LDKDecodeError err_var = (*val->contents.err);
1416 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1417 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1418 long err_ref = (long)err_var.inner & ~1;
1421 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
1422 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
1424 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
1425 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1426 CHECK(val->result_ok);
1427 return *val->contents.result;
1429 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
1430 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1431 CHECK(!val->result_ok);
1432 LDKMonitorUpdateError err_var = (*val->contents.err);
1433 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1434 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1435 long err_ref = (long)err_var.inner & ~1;
1438 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
1439 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
1441 a_conv.inner = (void*)(a & (~1));
1442 a_conv.is_owned = (a & 1) || (a == 0);
1443 a_conv = OutPoint_clone(&a_conv);
1446 b_ref.datalen = *((uint32_t*)b);
1447 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
1448 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
1452 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_a(uint32_t ptr) {
1453 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1454 LDKOutPoint a_var = tuple->a;
1455 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1456 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1457 long a_ref = (long)a_var.inner & ~1;
1460 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_b(uint32_t ptr) {
1461 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1462 LDKCVec_u8Z b_var = tuple->b;
1463 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1464 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
1467 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
1468 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
1470 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
1475 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_a(uint32_t ptr) {
1476 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1479 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_b(uint32_t ptr) {
1480 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1481 long b_ref = ((long)&tuple->b) | 1;
1484 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
1485 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
1486 ret->datalen = *((uint32_t*)elems);
1487 if (ret->datalen == 0) {
1490 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
1491 uint32_t *java_elems = (uint32_t*)(elems + 4);
1492 for (size_t i = 0; i < ret->datalen; i++) {
1493 uint32_t arr_elem = java_elems[i];
1494 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
1495 FREE((void*)arr_elem);
1496 ret->data[i] = arr_elem_conv;
1501 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
1502 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
1503 for (size_t i = 0; i < ret.datalen; i++) {
1504 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
1508 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
1509 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
1510 LDKThirtyTwoBytes a_ref;
1511 CHECK(*((uint32_t*)a) == 32);
1512 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
1514 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
1515 b_constr.datalen = *((uint32_t*)b);
1516 if (b_constr.datalen > 0)
1517 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
1519 b_constr.data = NULL;
1520 uint32_t* b_vals = (uint32_t*)(b + 4);
1521 for (size_t z = 0; z < b_constr.datalen; z++) {
1522 uint32_t arr_conv_25 = b_vals[z];
1523 LDKC2Tuple_u32TxOutZ arr_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_25) & ~1);
1524 FREE((void*)arr_conv_25);
1525 b_constr.data[z] = arr_conv_25_conv;
1530 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t ptr) {
1531 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
1532 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1533 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
1536 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t ptr) {
1537 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
1538 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
1539 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1540 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
1541 for (size_t z = 0; z < b_var.datalen; z++) {
1542 long arr_conv_25_ref = (long)(&b_var.data[z]) | 1;
1543 b_arr_ptr[z] = arr_conv_25_ref;
1547 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
1548 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
1549 ret->datalen = *((uint32_t*)elems);
1550 if (ret->datalen == 0) {
1553 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
1554 uint32_t *java_elems = (uint32_t*)(elems + 4);
1555 for (size_t i = 0; i < ret->datalen; i++) {
1556 uint32_t arr_elem = java_elems[i];
1557 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
1558 FREE((void*)arr_elem);
1559 ret->data[i] = arr_elem_conv;
1564 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
1565 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1567 CHECK(*((uint32_t*)a) == 64);
1568 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
1570 LDKCVec_SignatureZ b_constr;
1571 b_constr.datalen = *((uint32_t*)b);
1572 if (b_constr.datalen > 0)
1573 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1575 b_constr.data = NULL;
1576 int8_tArray* b_vals = (int8_tArray*)(b + 4);
1577 for (size_t m = 0; m < b_constr.datalen; m++) {
1578 int8_tArray arr_conv_12 = b_vals[m];
1579 LDKSignature arr_conv_12_ref;
1580 CHECK(*((uint32_t*)arr_conv_12) == 64);
1581 memcpy(arr_conv_12_ref.compact_form, (uint8_t*)(arr_conv_12 + 4), 64);
1582 b_constr.data[m] = arr_conv_12_ref;
1587 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t ptr) {
1588 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1589 int8_tArray a_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1590 memcpy((uint8_t*)(a_arr + 4), tuple->a.compact_form, 64);
1593 ptrArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t ptr) {
1594 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1595 LDKCVec_SignatureZ b_var = tuple->b;
1596 ptrArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1597 int8_tArray *b_arr_ptr = (int8_tArray*)(b_arr + 4);
1598 for (size_t m = 0; m < b_var.datalen; m++) {
1599 int8_tArray arr_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1600 memcpy((uint8_t*)(arr_conv_12_arr + 4), b_var.data[m].compact_form, 64);
1601 b_arr_ptr[m] = arr_conv_12_arr;
1605 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(uint32_t arg) {
1606 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1608 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1609 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1610 CHECK(val->result_ok);
1611 long res_ref = (long)(&(*val->contents.result)) | 1;
1614 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1615 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1616 CHECK(!val->result_ok);
1617 return *val->contents.err;
1619 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_result_ok(uint32_t arg) {
1620 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1622 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1623 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1624 CHECK(val->result_ok);
1625 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1626 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1629 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1630 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1631 CHECK(!val->result_ok);
1632 return *val->contents.err;
1634 typedef struct LDKChannelKeys_JCalls {
1635 atomic_size_t refcnt;
1636 uint32_t get_per_commitment_point_meth;
1637 uint32_t release_commitment_secret_meth;
1638 uint32_t key_derivation_params_meth;
1639 uint32_t sign_counterparty_commitment_meth;
1640 uint32_t sign_holder_commitment_and_htlcs_meth;
1641 uint32_t sign_justice_transaction_meth;
1642 uint32_t sign_counterparty_htlc_transaction_meth;
1643 uint32_t sign_closing_transaction_meth;
1644 uint32_t sign_channel_announcement_meth;
1645 uint32_t ready_channel_meth;
1646 uint32_t write_meth;
1647 } LDKChannelKeys_JCalls;
1648 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1649 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1650 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1651 js_free(j_calls->get_per_commitment_point_meth);
1652 js_free(j_calls->release_commitment_secret_meth);
1653 js_free(j_calls->key_derivation_params_meth);
1654 js_free(j_calls->sign_counterparty_commitment_meth);
1655 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1656 js_free(j_calls->sign_justice_transaction_meth);
1657 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1658 js_free(j_calls->sign_closing_transaction_meth);
1659 js_free(j_calls->sign_channel_announcement_meth);
1660 js_free(j_calls->ready_channel_meth);
1661 js_free(j_calls->write_meth);
1665 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1666 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1667 int8_tArray arg = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1668 LDKPublicKey arg_ref;
1669 CHECK(*((uint32_t*)arg) == 33);
1670 memcpy(arg_ref.compressed_form, (uint8_t*)(arg + 4), 33);
1673 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1674 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1675 int8_tArray arg = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1676 LDKThirtyTwoBytes arg_ref;
1677 CHECK(*((uint32_t*)arg) == 32);
1678 memcpy(arg_ref.data, (uint8_t*)(arg + 4), 32);
1681 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1682 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1683 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)js_invoke_function_0(j_calls->key_derivation_params_meth);
1684 LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)ret) & ~1);
1685 ret_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)ret);
1688 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1689 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1690 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1691 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1692 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1693 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1694 long commitment_tx_ref = (long)commitment_tx_var.inner;
1695 if (commitment_tx_var.is_owned) {
1696 commitment_tx_ref |= 1;
1698 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1699 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1700 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
1703 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1704 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1705 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1706 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1707 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1708 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1709 long commitment_tx_ref = (long)commitment_tx_var.inner;
1710 if (commitment_tx_var.is_owned) {
1711 commitment_tx_ref |= 1;
1713 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1714 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1715 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
1718 LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
1719 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1720 LDKTransaction justice_tx_var = justice_tx;
1721 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1722 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1723 Transaction_free(justice_tx_var);
1724 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1725 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1726 LDKHTLCOutputInCommitment htlc_var = *htlc;
1727 htlc_var = HTLCOutputInCommitment_clone(htlc);
1728 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1729 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1730 long htlc_ref = (long)htlc_var.inner;
1731 if (htlc_var.is_owned) {
1734 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);
1735 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1736 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1739 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
1740 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1741 LDKTransaction htlc_tx_var = htlc_tx;
1742 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1743 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1744 Transaction_free(htlc_tx_var);
1745 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1746 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1747 LDKHTLCOutputInCommitment htlc_var = *htlc;
1748 htlc_var = HTLCOutputInCommitment_clone(htlc);
1749 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1750 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1751 long htlc_ref = (long)htlc_var.inner;
1752 if (htlc_var.is_owned) {
1755 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);
1756 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1757 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1760 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1761 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1762 LDKTransaction closing_tx_var = closing_tx;
1763 int8_tArray closing_tx_arr = init_arr(closing_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1764 memcpy((uint8_t*)(closing_tx_arr + 4), closing_tx_var.data, closing_tx_var.datalen);
1765 Transaction_free(closing_tx_var);
1766 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_arr);
1767 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1768 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1771 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1772 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1773 LDKUnsignedChannelAnnouncement msg_var = *msg;
1774 msg_var = UnsignedChannelAnnouncement_clone(msg);
1775 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1776 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1777 long msg_ref = (long)msg_var.inner;
1778 if (msg_var.is_owned) {
1781 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
1782 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1783 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1786 void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1787 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1788 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1789 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1790 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1791 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1792 long channel_parameters_ref = (long)channel_parameters_var.inner;
1793 if (channel_parameters_var.is_owned) {
1794 channel_parameters_ref |= 1;
1796 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
1798 LDKCVec_u8Z write_jcall(const void* this_arg) {
1799 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1800 int8_tArray arg = js_invoke_function_0(j_calls->write_meth);
1801 LDKCVec_u8Z arg_ref;
1802 arg_ref.datalen = *((uint32_t*)arg);
1803 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
1804 memcpy(arg_ref.data, (uint8_t*)(arg + 4), arg_ref.datalen);
1807 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1808 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1809 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1810 return (void*) this_arg;
1812 static inline LDKChannelKeys LDKChannelKeys_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1813 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1814 atomic_init(&calls->refcnt, 1);
1815 //TODO: Assign calls->o from o
1817 LDKChannelPublicKeys pubkeys_conv;
1818 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1819 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1820 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1822 LDKChannelKeys ret = {
1823 .this_arg = (void*) calls,
1824 .get_per_commitment_point = get_per_commitment_point_jcall,
1825 .release_commitment_secret = release_commitment_secret_jcall,
1826 .key_derivation_params = key_derivation_params_jcall,
1827 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1828 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_jcall,
1829 .sign_justice_transaction = sign_justice_transaction_jcall,
1830 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1831 .sign_closing_transaction = sign_closing_transaction_jcall,
1832 .sign_channel_announcement = sign_channel_announcement_jcall,
1833 .ready_channel = ready_channel_jcall,
1834 .clone = LDKChannelKeys_JCalls_clone,
1835 .write = write_jcall,
1836 .free = LDKChannelKeys_JCalls_free,
1837 .pubkeys = pubkeys_conv,
1838 .set_pubkeys = NULL,
1842 long __attribute__((visibility("default"))) TS_LDKChannelKeys_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1843 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1844 *res_ptr = LDKChannelKeys_init(o, pubkeys);
1845 return (long)res_ptr;
1847 int8_tArray __attribute__((visibility("default"))) TS_ChannelKeys_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
1848 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1849 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1850 memcpy((uint8_t*)(arg_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1854 int8_tArray __attribute__((visibility("default"))) TS_ChannelKeys_release_commitment_secret(uint32_t this_arg, int64_t idx) {
1855 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1856 int8_tArray arg_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1857 memcpy((uint8_t*)(arg_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1861 uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_key_derivation_params(uint32_t this_arg) {
1862 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1863 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1864 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1865 return (long)ret_ref;
1868 uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
1869 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1870 LDKCommitmentTransaction commitment_tx_conv;
1871 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1872 commitment_tx_conv.is_owned = false;
1873 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1874 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1875 return (long)ret_conv;
1878 uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
1879 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1880 LDKHolderCommitmentTransaction commitment_tx_conv;
1881 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1882 commitment_tx_conv.is_owned = false;
1883 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1884 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1885 return (long)ret_conv;
1888 uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_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) {
1889 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1890 LDKTransaction justice_tx_ref;
1891 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1892 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1893 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1894 justice_tx_ref.data_is_owned = true;
1895 unsigned char per_commitment_key_arr[32];
1896 CHECK(*((uint32_t*)per_commitment_key) == 32);
1897 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1898 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1899 LDKHTLCOutputInCommitment htlc_conv;
1900 htlc_conv.inner = (void*)(htlc & (~1));
1901 htlc_conv.is_owned = false;
1902 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1903 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
1904 return (long)ret_conv;
1907 uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_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) {
1908 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1909 LDKTransaction htlc_tx_ref;
1910 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
1911 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1912 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
1913 htlc_tx_ref.data_is_owned = true;
1914 LDKPublicKey per_commitment_point_ref;
1915 CHECK(*((uint32_t*)per_commitment_point) == 33);
1916 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
1917 LDKHTLCOutputInCommitment htlc_conv;
1918 htlc_conv.inner = (void*)(htlc & (~1));
1919 htlc_conv.is_owned = false;
1920 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1921 *ret_conv = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, amount, per_commitment_point_ref, &htlc_conv);
1922 return (long)ret_conv;
1925 uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_sign_closing_transaction(uint32_t this_arg, int8_tArray closing_tx) {
1926 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1927 LDKTransaction closing_tx_ref;
1928 closing_tx_ref.datalen = *((uint32_t*)closing_tx);
1929 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
1930 memcpy(closing_tx_ref.data, (uint8_t*)(closing_tx + 4), closing_tx_ref.datalen);
1931 closing_tx_ref.data_is_owned = true;
1932 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1933 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
1934 return (long)ret_conv;
1937 uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
1938 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1939 LDKUnsignedChannelAnnouncement msg_conv;
1940 msg_conv.inner = (void*)(msg & (~1));
1941 msg_conv.is_owned = false;
1942 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1943 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1944 return (long)ret_conv;
1947 void __attribute__((visibility("default"))) TS_ChannelKeys_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
1948 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1949 LDKChannelTransactionParameters channel_parameters_conv;
1950 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1951 channel_parameters_conv.is_owned = false;
1952 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1955 int8_tArray __attribute__((visibility("default"))) TS_ChannelKeys_write(uint32_t this_arg) {
1956 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1957 LDKCVec_u8Z arg_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1958 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1959 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
1960 CVec_u8Z_free(arg_var);
1964 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
1965 if (this_arg->set_pubkeys != NULL)
1966 this_arg->set_pubkeys(this_arg);
1967 return this_arg->pubkeys;
1969 uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_get_pubkeys(uint32_t this_arg) {
1970 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1971 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
1972 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1973 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1974 long ret_ref = (long)ret_var.inner;
1975 if (ret_var.is_owned) {
1981 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
1982 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
1983 LDKThirtyTwoBytes a_ref;
1984 CHECK(*((uint32_t*)a) == 32);
1985 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
1987 LDKChannelMonitor b_conv;
1988 b_conv.inner = (void*)(b & (~1));
1989 b_conv.is_owned = (b & 1) || (b == 0);
1990 b_conv = ChannelMonitor_clone(&b_conv);
1994 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t ptr) {
1995 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
1996 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1997 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2000 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t ptr) {
2001 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2002 LDKChannelMonitor b_var = tuple->b;
2003 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2004 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2005 long b_ref = (long)b_var.inner & ~1;
2008 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
2009 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
2011 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
2012 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2013 CHECK(val->result_ok);
2014 long res_ref = (long)(&(*val->contents.result)) | 1;
2017 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
2018 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2019 CHECK(!val->result_ok);
2020 LDKDecodeError err_var = (*val->contents.err);
2021 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2022 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2023 long err_ref = (long)err_var.inner & ~1;
2026 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_result_ok(uint32_t arg) {
2027 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
2029 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
2030 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2031 CHECK(val->result_ok);
2032 long res_ref = ((long)&(*val->contents.result)) | 1;
2033 return (long)res_ref;
2035 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
2036 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2037 CHECK(!val->result_ok);
2038 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
2041 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2042 LDKAPIError *obj = (LDKAPIError*)ptr;
2044 case LDKAPIError_APIMisuseError: {
2045 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
2046 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2047 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
2048 return 0 /* LDKAPIError - APIMisuseError */; (void) err_arr;
2050 case LDKAPIError_FeeRateTooHigh: {
2051 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
2052 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2053 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
2054 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_arr; (void) obj->fee_rate_too_high.feerate;
2056 case LDKAPIError_RouteError: {
2057 LDKStr err_str = obj->route_error.err;
2058 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2059 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2061 case LDKAPIError_ChannelUnavailable: {
2062 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
2063 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2064 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
2065 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_arr;
2067 case LDKAPIError_MonitorUpdateFailed: {
2068 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2073 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
2074 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2076 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2077 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2078 CHECK(val->result_ok);
2079 return *val->contents.result;
2081 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2082 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2083 CHECK(!val->result_ok);
2084 long err_ref = ((long)&(*val->contents.err)) | 1;
2087 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) {
2088 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
2089 ret->datalen = *((uint32_t*)elems);
2090 if (ret->datalen == 0) {
2093 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
2094 uint32_t *java_elems = (uint32_t*)(elems + 4);
2095 for (size_t i = 0; i < ret->datalen; i++) {
2096 uint32_t arr_elem = java_elems[i];
2097 LDKChannelDetails arr_elem_conv;
2098 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2099 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2100 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2101 ret->data[i] = arr_elem_conv;
2106 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2107 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2108 for (size_t i = 0; i < ret.datalen; i++) {
2109 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2113 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
2114 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2116 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2117 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2118 CHECK(val->result_ok);
2119 return *val->contents.result;
2121 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2122 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2123 CHECK(!val->result_ok);
2124 LDKPaymentSendFailure err_var = (*val->contents.err);
2125 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2126 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2127 long err_ref = (long)err_var.inner & ~1;
2130 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
2131 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2132 ret->datalen = *((uint32_t*)elems);
2133 if (ret->datalen == 0) {
2136 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2137 uint32_t *java_elems = (uint32_t*)(elems + 4);
2138 for (size_t i = 0; i < ret->datalen; i++) {
2139 uint32_t arr_elem = java_elems[i];
2140 LDKChannelMonitor arr_elem_conv;
2141 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2142 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2143 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2144 ret->data[i] = arr_elem_conv;
2149 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2150 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2151 for (size_t i = 0; i < ret.datalen; i++) {
2152 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2156 typedef struct LDKWatch_JCalls {
2157 atomic_size_t refcnt;
2158 uint32_t watch_channel_meth;
2159 uint32_t update_channel_meth;
2160 uint32_t release_pending_monitor_events_meth;
2162 static void LDKWatch_JCalls_free(void* this_arg) {
2163 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2164 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2165 js_free(j_calls->watch_channel_meth);
2166 js_free(j_calls->update_channel_meth);
2167 js_free(j_calls->release_pending_monitor_events_meth);
2171 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2172 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2173 LDKOutPoint funding_txo_var = funding_txo;
2174 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2175 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2176 long funding_txo_ref = (long)funding_txo_var.inner;
2177 if (funding_txo_var.is_owned) {
2178 funding_txo_ref |= 1;
2180 LDKChannelMonitor monitor_var = monitor;
2181 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2182 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2183 long monitor_ref = (long)monitor_var.inner;
2184 if (monitor_var.is_owned) {
2187 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2188 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2189 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2192 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2193 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2194 LDKOutPoint funding_txo_var = funding_txo;
2195 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2196 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2197 long funding_txo_ref = (long)funding_txo_var.inner;
2198 if (funding_txo_var.is_owned) {
2199 funding_txo_ref |= 1;
2201 LDKChannelMonitorUpdate update_var = update;
2202 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2203 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2204 long update_ref = (long)update_var.inner;
2205 if (update_var.is_owned) {
2208 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2209 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2210 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2213 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2214 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2215 uint32_tArray arg = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2216 LDKCVec_MonitorEventZ arg_constr;
2217 arg_constr.datalen = *((uint32_t*)arg);
2218 if (arg_constr.datalen > 0)
2219 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2221 arg_constr.data = NULL;
2222 uint32_t* arg_vals = (uint32_t*)(arg + 4);
2223 for (size_t o = 0; o < arg_constr.datalen; o++) {
2224 uint32_t arr_conv_14 = arg_vals[o];
2225 LDKMonitorEvent arr_conv_14_conv;
2226 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2227 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2228 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
2229 arg_constr.data[o] = arr_conv_14_conv;
2233 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2234 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2235 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2236 return (void*) this_arg;
2238 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2239 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2240 atomic_init(&calls->refcnt, 1);
2241 //TODO: Assign calls->o from o
2244 .this_arg = (void*) calls,
2245 .watch_channel = watch_channel_jcall,
2246 .update_channel = update_channel_jcall,
2247 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2248 .free = LDKWatch_JCalls_free,
2252 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2253 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2254 *res_ptr = LDKWatch_init(o);
2255 return (long)res_ptr;
2257 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2258 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2259 LDKOutPoint funding_txo_conv;
2260 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2261 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2262 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2263 LDKChannelMonitor monitor_conv;
2264 monitor_conv.inner = (void*)(monitor & (~1));
2265 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2266 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2267 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2268 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2269 return (long)ret_conv;
2272 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
2273 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2274 LDKOutPoint funding_txo_conv;
2275 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2276 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2277 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2278 LDKChannelMonitorUpdate update_conv;
2279 update_conv.inner = (void*)(update & (~1));
2280 update_conv.is_owned = (update & 1) || (update == 0);
2281 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2282 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2283 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2284 return (long)ret_conv;
2287 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
2288 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2289 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2290 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2291 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
2292 for (size_t o = 0; o < ret_var.datalen; o++) {
2293 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2294 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2295 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2296 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
2297 if (arr_conv_14_var.is_owned) {
2298 arr_conv_14_ref |= 1;
2300 ret_arr_ptr[o] = arr_conv_14_ref;
2306 typedef struct LDKBroadcasterInterface_JCalls {
2307 atomic_size_t refcnt;
2308 uint32_t broadcast_transaction_meth;
2309 } LDKBroadcasterInterface_JCalls;
2310 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2311 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2312 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2313 js_free(j_calls->broadcast_transaction_meth);
2317 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2318 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2319 LDKTransaction tx_var = tx;
2320 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2321 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
2322 Transaction_free(tx_var);
2323 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
2325 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2326 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2327 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2328 return (void*) this_arg;
2330 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
2331 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2332 atomic_init(&calls->refcnt, 1);
2333 //TODO: Assign calls->o from o
2335 LDKBroadcasterInterface ret = {
2336 .this_arg = (void*) calls,
2337 .broadcast_transaction = broadcast_transaction_jcall,
2338 .free = LDKBroadcasterInterface_JCalls_free,
2342 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
2343 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2344 *res_ptr = LDKBroadcasterInterface_init(o);
2345 return (long)res_ptr;
2347 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
2348 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2349 LDKTransaction tx_ref;
2350 tx_ref.datalen = *((uint32_t*)tx);
2351 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2352 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
2353 tx_ref.data_is_owned = true;
2354 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2357 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelKeysDecodeErrorZ_result_ok(uint32_t arg) {
2358 return ((LDKCResult_ChannelKeysDecodeErrorZ*)arg)->result_ok;
2360 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelKeysDecodeErrorZ_get_ok(uint32_t arg) {
2361 LDKCResult_ChannelKeysDecodeErrorZ *val = (LDKCResult_ChannelKeysDecodeErrorZ*)(arg & ~1);
2362 CHECK(val->result_ok);
2363 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2364 *ret = ChannelKeys_clone(&(*val->contents.result));
2367 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelKeysDecodeErrorZ_get_err(uint32_t arg) {
2368 LDKCResult_ChannelKeysDecodeErrorZ *val = (LDKCResult_ChannelKeysDecodeErrorZ*)(arg & ~1);
2369 CHECK(!val->result_ok);
2370 LDKDecodeError err_var = (*val->contents.err);
2371 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2372 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2373 long err_ref = (long)err_var.inner & ~1;
2376 typedef struct LDKKeysInterface_JCalls {
2377 atomic_size_t refcnt;
2378 uint32_t get_node_secret_meth;
2379 uint32_t get_destination_script_meth;
2380 uint32_t get_shutdown_pubkey_meth;
2381 uint32_t get_channel_keys_meth;
2382 uint32_t get_secure_random_bytes_meth;
2383 uint32_t read_chan_signer_meth;
2384 } LDKKeysInterface_JCalls;
2385 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2386 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2387 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2388 js_free(j_calls->get_node_secret_meth);
2389 js_free(j_calls->get_destination_script_meth);
2390 js_free(j_calls->get_shutdown_pubkey_meth);
2391 js_free(j_calls->get_channel_keys_meth);
2392 js_free(j_calls->get_secure_random_bytes_meth);
2393 js_free(j_calls->read_chan_signer_meth);
2397 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2398 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2399 int8_tArray arg = js_invoke_function_0(j_calls->get_node_secret_meth);
2400 LDKSecretKey arg_ref;
2401 CHECK(*((uint32_t*)arg) == 32);
2402 memcpy(arg_ref.bytes, (uint8_t*)(arg + 4), 32);
2405 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2406 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2407 int8_tArray arg = js_invoke_function_0(j_calls->get_destination_script_meth);
2408 LDKCVec_u8Z arg_ref;
2409 arg_ref.datalen = *((uint32_t*)arg);
2410 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
2411 memcpy(arg_ref.data, (uint8_t*)(arg + 4), arg_ref.datalen);
2414 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2415 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2416 int8_tArray arg = js_invoke_function_0(j_calls->get_shutdown_pubkey_meth);
2417 LDKPublicKey arg_ref;
2418 CHECK(*((uint32_t*)arg) == 33);
2419 memcpy(arg_ref.compressed_form, (uint8_t*)(arg + 4), 33);
2422 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2423 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2424 LDKChannelKeys* ret = (LDKChannelKeys*)js_invoke_function_2(j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2425 LDKChannelKeys ret_conv = *(LDKChannelKeys*)(((uint64_t)ret) & ~1);
2426 ret_conv = ChannelKeys_clone(ret);
2429 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2430 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2431 int8_tArray arg = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
2432 LDKThirtyTwoBytes arg_ref;
2433 CHECK(*((uint32_t*)arg) == 32);
2434 memcpy(arg_ref.data, (uint8_t*)(arg + 4), 32);
2437 LDKCResult_ChannelKeysDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) {
2438 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2439 LDKu8slice reader_var = reader;
2440 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2441 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
2442 LDKCResult_ChannelKeysDecodeErrorZ* ret = (LDKCResult_ChannelKeysDecodeErrorZ*)js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
2443 LDKCResult_ChannelKeysDecodeErrorZ ret_conv = *(LDKCResult_ChannelKeysDecodeErrorZ*)(((uint64_t)ret) & ~1);
2444 ret_conv = CResult_ChannelKeysDecodeErrorZ_clone((LDKCResult_ChannelKeysDecodeErrorZ*)ret);
2447 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2448 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2449 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2450 return (void*) this_arg;
2452 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
2453 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2454 atomic_init(&calls->refcnt, 1);
2455 //TODO: Assign calls->o from o
2457 LDKKeysInterface ret = {
2458 .this_arg = (void*) calls,
2459 .get_node_secret = get_node_secret_jcall,
2460 .get_destination_script = get_destination_script_jcall,
2461 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2462 .get_channel_keys = get_channel_keys_jcall,
2463 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2464 .read_chan_signer = read_chan_signer_jcall,
2465 .free = LDKKeysInterface_JCalls_free,
2469 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
2470 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2471 *res_ptr = LDKKeysInterface_init(o);
2472 return (long)res_ptr;
2474 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
2475 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2476 int8_tArray arg_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2477 memcpy((uint8_t*)(arg_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
2481 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
2482 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2483 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2484 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2485 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
2486 CVec_u8Z_free(arg_var);
2490 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_pubkey(uint32_t this_arg) {
2491 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2492 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
2493 memcpy((uint8_t*)(arg_arr + 4), (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form, 33);
2497 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_keys(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2498 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2499 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2500 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2504 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
2505 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2506 int8_tArray arg_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2507 memcpy((uint8_t*)(arg_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
2511 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
2512 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2513 LDKu8slice reader_ref;
2514 reader_ref.datalen = *((uint32_t*)reader);
2515 reader_ref.data = (int8_t*)(reader + 4);
2516 LDKCResult_ChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelKeysDecodeErrorZ), "LDKCResult_ChannelKeysDecodeErrorZ");
2517 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2518 return (long)ret_conv;
2521 typedef struct LDKFeeEstimator_JCalls {
2522 atomic_size_t refcnt;
2523 uint32_t get_est_sat_per_1000_weight_meth;
2524 } LDKFeeEstimator_JCalls;
2525 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2526 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2527 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2528 js_free(j_calls->get_est_sat_per_1000_weight_meth);
2532 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2533 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2534 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
2535 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2537 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2538 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2539 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2540 return (void*) this_arg;
2542 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
2543 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2544 atomic_init(&calls->refcnt, 1);
2545 //TODO: Assign calls->o from o
2547 LDKFeeEstimator ret = {
2548 .this_arg = (void*) calls,
2549 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2550 .free = LDKFeeEstimator_JCalls_free,
2554 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
2555 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2556 *res_ptr = LDKFeeEstimator_init(o);
2557 return (long)res_ptr;
2559 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
2560 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2561 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
2562 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2566 typedef struct LDKLogger_JCalls {
2567 atomic_size_t refcnt;
2570 static void LDKLogger_JCalls_free(void* this_arg) {
2571 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2572 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2573 js_free(j_calls->log_meth);
2577 void log_jcall(const void* this_arg, const char* record) {
2578 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2579 const char* record_str = record;
2580 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
2581 js_invoke_function_1(j_calls->log_meth, record_conv);
2583 static void* LDKLogger_JCalls_clone(const void* this_arg) {
2584 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2585 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2586 return (void*) this_arg;
2588 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
2589 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2590 atomic_init(&calls->refcnt, 1);
2591 //TODO: Assign calls->o from o
2594 .this_arg = (void*) calls,
2596 .free = LDKLogger_JCalls_free,
2600 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
2601 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2602 *res_ptr = LDKLogger_init(o);
2603 return (long)res_ptr;
2605 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
2606 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2607 LDKThirtyTwoBytes a_ref;
2608 CHECK(*((uint32_t*)a) == 32);
2609 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2611 LDKChannelManager b_conv;
2612 b_conv.inner = (void*)(b & (~1));
2613 b_conv.is_owned = (b & 1) || (b == 0);
2614 // Warning: we need a move here but no clone is available for LDKChannelManager
2618 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_a(uint32_t ptr) {
2619 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2620 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2621 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2624 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_b(uint32_t ptr) {
2625 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2626 LDKChannelManager b_var = tuple->b;
2627 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2628 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2629 long b_ref = (long)b_var.inner & ~1;
2632 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
2633 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2635 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
2636 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2637 CHECK(val->result_ok);
2638 long res_ref = (long)(&(*val->contents.result)) | 1;
2641 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
2642 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2643 CHECK(!val->result_ok);
2644 LDKDecodeError err_var = (*val->contents.err);
2645 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2646 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2647 long err_ref = (long)err_var.inner & ~1;
2650 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
2651 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2653 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
2654 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2655 CHECK(val->result_ok);
2656 long res_ref = ((long)&(*val->contents.result)) | 1;
2659 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
2660 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2661 CHECK(!val->result_ok);
2662 LDKDecodeError err_var = (*val->contents.err);
2663 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2664 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2665 long err_ref = (long)err_var.inner & ~1;
2668 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemoryChannelKeysDecodeErrorZ_result_ok(uint32_t arg) {
2669 return ((LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg)->result_ok;
2671 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemoryChannelKeysDecodeErrorZ_get_ok(uint32_t arg) {
2672 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(arg & ~1);
2673 CHECK(val->result_ok);
2674 LDKInMemoryChannelKeys res_var = (*val->contents.result);
2675 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2676 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2677 long res_ref = (long)res_var.inner & ~1;
2680 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemoryChannelKeysDecodeErrorZ_get_err(uint32_t arg) {
2681 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(arg & ~1);
2682 CHECK(!val->result_ok);
2683 LDKDecodeError err_var = (*val->contents.err);
2684 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2685 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2686 long err_ref = (long)err_var.inner & ~1;
2689 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) {
2690 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
2691 ret->datalen = *((uint32_t*)elems);
2692 if (ret->datalen == 0) {
2695 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
2696 uint32_t *java_elems = (uint32_t*)(elems + 4);
2697 for (size_t i = 0; i < ret->datalen; i++) {
2698 uint32_t arr_elem = java_elems[i];
2699 LDKRouteHop arr_elem_conv;
2700 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2701 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2702 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
2703 ret->data[i] = arr_elem_conv;
2708 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2709 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2710 for (size_t i = 0; i < ret.datalen; i++) {
2711 ret.data[i] = RouteHop_clone(&orig->data[i]);
2715 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
2716 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
2717 for (size_t i = 0; i < ret.datalen; i++) {
2718 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
2722 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_result_ok(uint32_t arg) {
2723 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
2725 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
2726 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
2727 CHECK(val->result_ok);
2728 LDKRoute res_var = (*val->contents.result);
2729 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2730 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2731 long res_ref = (long)res_var.inner & ~1;
2734 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
2735 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
2736 CHECK(!val->result_ok);
2737 LDKDecodeError err_var = (*val->contents.err);
2738 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2739 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2740 long err_ref = (long)err_var.inner & ~1;
2743 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintZ_new(uint32_tArray elems) {
2744 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
2745 ret->datalen = *((uint32_t*)elems);
2746 if (ret->datalen == 0) {
2749 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
2750 uint32_t *java_elems = (uint32_t*)(elems + 4);
2751 for (size_t i = 0; i < ret->datalen; i++) {
2752 uint32_t arr_elem = java_elems[i];
2753 LDKRouteHint arr_elem_conv;
2754 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2755 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2756 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
2757 ret->data[i] = arr_elem_conv;
2762 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2763 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2764 for (size_t i = 0; i < ret.datalen; i++) {
2765 ret.data[i] = RouteHint_clone(&orig->data[i]);
2769 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_result_ok(uint32_t arg) {
2770 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
2772 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
2773 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
2774 CHECK(val->result_ok);
2775 LDKRoute res_var = (*val->contents.result);
2776 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2777 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2778 long res_ref = (long)res_var.inner & ~1;
2781 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
2782 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
2783 CHECK(!val->result_ok);
2784 LDKLightningError err_var = (*val->contents.err);
2785 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2786 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2787 long err_ref = (long)err_var.inner & ~1;
2790 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) {
2791 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
2793 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_ok(uint32_t arg) {
2794 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
2795 CHECK(val->result_ok);
2796 long res_ref = ((long)&(*val->contents.result)) | 1;
2799 int8_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_err(uint32_t arg) {
2800 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
2801 CHECK(!val->result_ok);
2802 return *val->contents.err;
2804 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_result_ok(uint32_t arg) {
2805 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
2807 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_ok(uint32_t arg) {
2808 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
2809 CHECK(val->result_ok);
2810 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
2811 *res_conv = (*val->contents.result);
2812 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
2813 return (long)res_conv;
2815 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_err(uint32_t arg) {
2816 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
2817 CHECK(!val->result_ok);
2818 LDKDecodeError err_var = (*val->contents.err);
2819 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2820 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2821 long err_ref = (long)err_var.inner & ~1;
2824 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
2825 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
2826 ret->datalen = *((uint32_t*)elems);
2827 if (ret->datalen == 0) {
2830 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
2831 uint32_t *java_elems = (uint32_t*)(elems + 4);
2832 for (size_t i = 0; i < ret->datalen; i++) {
2833 uint32_t arr_elem = java_elems[i];
2834 LDKUpdateAddHTLC arr_elem_conv;
2835 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2836 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2837 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
2838 ret->data[i] = arr_elem_conv;
2843 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
2844 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
2845 for (size_t i = 0; i < ret.datalen; i++) {
2846 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
2850 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
2851 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
2852 ret->datalen = *((uint32_t*)elems);
2853 if (ret->datalen == 0) {
2856 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
2857 uint32_t *java_elems = (uint32_t*)(elems + 4);
2858 for (size_t i = 0; i < ret->datalen; i++) {
2859 uint32_t arr_elem = java_elems[i];
2860 LDKUpdateFulfillHTLC arr_elem_conv;
2861 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2862 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2863 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
2864 ret->data[i] = arr_elem_conv;
2869 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
2870 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
2871 for (size_t i = 0; i < ret.datalen; i++) {
2872 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
2876 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
2877 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
2878 ret->datalen = *((uint32_t*)elems);
2879 if (ret->datalen == 0) {
2882 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
2883 uint32_t *java_elems = (uint32_t*)(elems + 4);
2884 for (size_t i = 0; i < ret->datalen; i++) {
2885 uint32_t arr_elem = java_elems[i];
2886 LDKUpdateFailHTLC arr_elem_conv;
2887 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2888 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2889 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
2890 ret->data[i] = arr_elem_conv;
2895 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
2896 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
2897 for (size_t i = 0; i < ret.datalen; i++) {
2898 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
2902 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
2903 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
2904 ret->datalen = *((uint32_t*)elems);
2905 if (ret->datalen == 0) {
2908 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
2909 uint32_t *java_elems = (uint32_t*)(elems + 4);
2910 for (size_t i = 0; i < ret->datalen; i++) {
2911 uint32_t arr_elem = java_elems[i];
2912 LDKUpdateFailMalformedHTLC arr_elem_conv;
2913 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2914 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2915 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
2916 ret->data[i] = arr_elem_conv;
2921 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
2922 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
2923 for (size_t i = 0; i < ret.datalen; i++) {
2924 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
2928 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
2929 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
2931 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
2932 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
2933 CHECK(val->result_ok);
2934 LDKAcceptChannel res_var = (*val->contents.result);
2935 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2936 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2937 long res_ref = (long)res_var.inner & ~1;
2940 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
2941 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
2942 CHECK(!val->result_ok);
2943 LDKDecodeError err_var = (*val->contents.err);
2944 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2945 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2946 long err_ref = (long)err_var.inner & ~1;
2949 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
2950 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
2952 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
2953 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
2954 CHECK(val->result_ok);
2955 LDKAnnouncementSignatures res_var = (*val->contents.result);
2956 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2957 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2958 long res_ref = (long)res_var.inner & ~1;
2961 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
2962 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
2963 CHECK(!val->result_ok);
2964 LDKDecodeError err_var = (*val->contents.err);
2965 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2966 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2967 long err_ref = (long)err_var.inner & ~1;
2970 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
2971 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
2973 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
2974 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
2975 CHECK(val->result_ok);
2976 LDKChannelReestablish res_var = (*val->contents.result);
2977 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2978 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2979 long res_ref = (long)res_var.inner & ~1;
2982 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
2983 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
2984 CHECK(!val->result_ok);
2985 LDKDecodeError err_var = (*val->contents.err);
2986 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2987 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2988 long err_ref = (long)err_var.inner & ~1;
2991 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
2992 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
2994 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
2995 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
2996 CHECK(val->result_ok);
2997 LDKClosingSigned res_var = (*val->contents.result);
2998 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2999 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3000 long res_ref = (long)res_var.inner & ~1;
3003 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
3004 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
3005 CHECK(!val->result_ok);
3006 LDKDecodeError err_var = (*val->contents.err);
3007 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3008 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3009 long err_ref = (long)err_var.inner & ~1;
3012 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
3013 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
3015 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
3016 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
3017 CHECK(val->result_ok);
3018 LDKCommitmentSigned res_var = (*val->contents.result);
3019 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3020 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3021 long res_ref = (long)res_var.inner & ~1;
3024 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
3025 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
3026 CHECK(!val->result_ok);
3027 LDKDecodeError err_var = (*val->contents.err);
3028 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3029 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3030 long err_ref = (long)err_var.inner & ~1;
3033 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
3034 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
3036 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
3037 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
3038 CHECK(val->result_ok);
3039 LDKFundingCreated res_var = (*val->contents.result);
3040 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3041 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3042 long res_ref = (long)res_var.inner & ~1;
3045 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
3046 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
3047 CHECK(!val->result_ok);
3048 LDKDecodeError err_var = (*val->contents.err);
3049 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3050 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3051 long err_ref = (long)err_var.inner & ~1;
3054 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
3055 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
3057 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
3058 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
3059 CHECK(val->result_ok);
3060 LDKFundingSigned res_var = (*val->contents.result);
3061 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3062 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3063 long res_ref = (long)res_var.inner & ~1;
3066 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
3067 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
3068 CHECK(!val->result_ok);
3069 LDKDecodeError err_var = (*val->contents.err);
3070 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3071 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3072 long err_ref = (long)err_var.inner & ~1;
3075 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
3076 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
3078 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
3079 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
3080 CHECK(val->result_ok);
3081 LDKFundingLocked res_var = (*val->contents.result);
3082 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3083 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3084 long res_ref = (long)res_var.inner & ~1;
3087 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
3088 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
3089 CHECK(!val->result_ok);
3090 LDKDecodeError err_var = (*val->contents.err);
3091 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3092 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3093 long err_ref = (long)err_var.inner & ~1;
3096 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_result_ok(uint32_t arg) {
3097 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
3099 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
3100 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
3101 CHECK(val->result_ok);
3102 LDKInit res_var = (*val->contents.result);
3103 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3104 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3105 long res_ref = (long)res_var.inner & ~1;
3108 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
3109 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
3110 CHECK(!val->result_ok);
3111 LDKDecodeError err_var = (*val->contents.err);
3112 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3113 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3114 long err_ref = (long)err_var.inner & ~1;
3117 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
3118 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
3120 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
3121 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
3122 CHECK(val->result_ok);
3123 LDKOpenChannel res_var = (*val->contents.result);
3124 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3125 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3126 long res_ref = (long)res_var.inner & ~1;
3129 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
3130 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
3131 CHECK(!val->result_ok);
3132 LDKDecodeError err_var = (*val->contents.err);
3133 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3134 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3135 long err_ref = (long)err_var.inner & ~1;
3138 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
3139 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
3141 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
3142 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
3143 CHECK(val->result_ok);
3144 LDKRevokeAndACK res_var = (*val->contents.result);
3145 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3146 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3147 long res_ref = (long)res_var.inner & ~1;
3150 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
3151 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
3152 CHECK(!val->result_ok);
3153 LDKDecodeError err_var = (*val->contents.err);
3154 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3155 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3156 long err_ref = (long)err_var.inner & ~1;
3159 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
3160 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
3162 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
3163 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
3164 CHECK(val->result_ok);
3165 LDKShutdown res_var = (*val->contents.result);
3166 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3167 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3168 long res_ref = (long)res_var.inner & ~1;
3171 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
3172 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
3173 CHECK(!val->result_ok);
3174 LDKDecodeError err_var = (*val->contents.err);
3175 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3176 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3177 long err_ref = (long)err_var.inner & ~1;
3180 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3181 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
3183 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3184 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
3185 CHECK(val->result_ok);
3186 LDKUpdateFailHTLC res_var = (*val->contents.result);
3187 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3188 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3189 long res_ref = (long)res_var.inner & ~1;
3192 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
3193 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
3194 CHECK(!val->result_ok);
3195 LDKDecodeError err_var = (*val->contents.err);
3196 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3197 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3198 long err_ref = (long)err_var.inner & ~1;
3201 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3202 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
3204 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3205 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
3206 CHECK(val->result_ok);
3207 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
3208 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3209 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3210 long res_ref = (long)res_var.inner & ~1;
3213 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
3214 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(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_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
3223 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
3225 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
3226 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
3227 CHECK(val->result_ok);
3228 LDKUpdateFee res_var = (*val->contents.result);
3229 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3230 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3231 long res_ref = (long)res_var.inner & ~1;
3234 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
3235 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
3236 CHECK(!val->result_ok);
3237 LDKDecodeError err_var = (*val->contents.err);
3238 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3239 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3240 long err_ref = (long)err_var.inner & ~1;
3243 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3244 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
3246 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3247 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
3248 CHECK(val->result_ok);
3249 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
3250 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3251 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3252 long res_ref = (long)res_var.inner & ~1;
3255 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
3256 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
3257 CHECK(!val->result_ok);
3258 LDKDecodeError err_var = (*val->contents.err);
3259 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3260 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3261 long err_ref = (long)err_var.inner & ~1;
3264 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3265 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
3267 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3268 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
3269 CHECK(val->result_ok);
3270 LDKUpdateAddHTLC res_var = (*val->contents.result);
3271 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3272 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3273 long res_ref = (long)res_var.inner & ~1;
3276 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
3277 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
3278 CHECK(!val->result_ok);
3279 LDKDecodeError err_var = (*val->contents.err);
3280 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3281 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3282 long err_ref = (long)err_var.inner & ~1;
3285 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_result_ok(uint32_t arg) {
3286 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
3288 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
3289 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
3290 CHECK(val->result_ok);
3291 LDKPing res_var = (*val->contents.result);
3292 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3293 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3294 long res_ref = (long)res_var.inner & ~1;
3297 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
3298 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
3299 CHECK(!val->result_ok);
3300 LDKDecodeError err_var = (*val->contents.err);
3301 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3302 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3303 long err_ref = (long)err_var.inner & ~1;
3306 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_result_ok(uint32_t arg) {
3307 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
3309 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
3310 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
3311 CHECK(val->result_ok);
3312 LDKPong res_var = (*val->contents.result);
3313 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3314 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3315 long res_ref = (long)res_var.inner & ~1;
3318 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
3319 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
3320 CHECK(!val->result_ok);
3321 LDKDecodeError err_var = (*val->contents.err);
3322 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3323 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3324 long err_ref = (long)err_var.inner & ~1;
3327 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3328 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
3330 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3331 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3332 CHECK(val->result_ok);
3333 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
3334 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3335 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3336 long res_ref = (long)res_var.inner & ~1;
3339 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3340 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3341 CHECK(!val->result_ok);
3342 LDKDecodeError err_var = (*val->contents.err);
3343 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3344 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3345 long err_ref = (long)err_var.inner & ~1;
3348 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3349 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
3351 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3352 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3353 CHECK(val->result_ok);
3354 LDKChannelAnnouncement res_var = (*val->contents.result);
3355 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3356 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3357 long res_ref = (long)res_var.inner & ~1;
3360 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3361 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3362 CHECK(!val->result_ok);
3363 LDKDecodeError err_var = (*val->contents.err);
3364 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3365 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3366 long err_ref = (long)err_var.inner & ~1;
3369 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3370 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
3372 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3373 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
3374 CHECK(val->result_ok);
3375 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
3376 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3377 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3378 long res_ref = (long)res_var.inner & ~1;
3381 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
3382 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
3383 CHECK(!val->result_ok);
3384 LDKDecodeError err_var = (*val->contents.err);
3385 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3386 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3387 long err_ref = (long)err_var.inner & ~1;
3390 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3391 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
3393 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3394 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
3395 CHECK(val->result_ok);
3396 LDKChannelUpdate res_var = (*val->contents.result);
3397 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3398 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3399 long res_ref = (long)res_var.inner & ~1;
3402 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
3403 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
3404 CHECK(!val->result_ok);
3405 LDKDecodeError err_var = (*val->contents.err);
3406 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3407 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3408 long err_ref = (long)err_var.inner & ~1;
3411 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
3412 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
3414 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
3415 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3416 CHECK(val->result_ok);
3417 LDKErrorMessage res_var = (*val->contents.result);
3418 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3419 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3420 long res_ref = (long)res_var.inner & ~1;
3423 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
3424 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3425 CHECK(!val->result_ok);
3426 LDKDecodeError err_var = (*val->contents.err);
3427 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3428 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3429 long err_ref = (long)err_var.inner & ~1;
3432 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3433 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3435 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3436 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3437 CHECK(val->result_ok);
3438 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
3439 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3440 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3441 long res_ref = (long)res_var.inner & ~1;
3444 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3445 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3446 CHECK(!val->result_ok);
3447 LDKDecodeError err_var = (*val->contents.err);
3448 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3449 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3450 long err_ref = (long)err_var.inner & ~1;
3453 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3454 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3456 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3457 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
3458 CHECK(val->result_ok);
3459 LDKNodeAnnouncement res_var = (*val->contents.result);
3460 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3461 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3462 long res_ref = (long)res_var.inner & ~1;
3465 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3466 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
3467 CHECK(!val->result_ok);
3468 LDKDecodeError err_var = (*val->contents.err);
3469 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3470 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3471 long err_ref = (long)err_var.inner & ~1;
3474 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
3475 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
3477 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
3478 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3479 CHECK(val->result_ok);
3480 LDKQueryShortChannelIds res_var = (*val->contents.result);
3481 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3482 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3483 long res_ref = (long)res_var.inner & ~1;
3486 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
3487 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3488 CHECK(!val->result_ok);
3489 LDKDecodeError err_var = (*val->contents.err);
3490 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3491 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3492 long err_ref = (long)err_var.inner & ~1;
3495 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
3496 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
3498 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
3499 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3500 CHECK(val->result_ok);
3501 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
3502 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3503 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3504 long res_ref = (long)res_var.inner & ~1;
3507 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
3508 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3509 CHECK(!val->result_ok);
3510 LDKDecodeError err_var = (*val->contents.err);
3511 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3512 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3513 long err_ref = (long)err_var.inner & ~1;
3516 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
3517 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
3519 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
3520 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3521 CHECK(val->result_ok);
3522 LDKQueryChannelRange res_var = (*val->contents.result);
3523 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3524 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3525 long res_ref = (long)res_var.inner & ~1;
3528 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
3529 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3530 CHECK(!val->result_ok);
3531 LDKDecodeError err_var = (*val->contents.err);
3532 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3533 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3534 long err_ref = (long)err_var.inner & ~1;
3537 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
3538 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
3540 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
3541 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3542 CHECK(val->result_ok);
3543 LDKReplyChannelRange res_var = (*val->contents.result);
3544 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3545 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3546 long res_ref = (long)res_var.inner & ~1;
3549 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
3550 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3551 CHECK(!val->result_ok);
3552 LDKDecodeError err_var = (*val->contents.err);
3553 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3554 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3555 long err_ref = (long)err_var.inner & ~1;
3558 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
3559 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
3561 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
3562 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3563 CHECK(val->result_ok);
3564 LDKGossipTimestampFilter res_var = (*val->contents.result);
3565 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3566 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3567 long res_ref = (long)res_var.inner & ~1;
3570 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
3571 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3572 CHECK(!val->result_ok);
3573 LDKDecodeError err_var = (*val->contents.err);
3574 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3575 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3576 long err_ref = (long)err_var.inner & ~1;
3579 typedef struct LDKMessageSendEventsProvider_JCalls {
3580 atomic_size_t refcnt;
3581 uint32_t get_and_clear_pending_msg_events_meth;
3582 } LDKMessageSendEventsProvider_JCalls;
3583 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
3584 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3585 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3586 js_free(j_calls->get_and_clear_pending_msg_events_meth);
3590 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
3591 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3592 uint32_tArray arg = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
3593 LDKCVec_MessageSendEventZ arg_constr;
3594 arg_constr.datalen = *((uint32_t*)arg);
3595 if (arg_constr.datalen > 0)
3596 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
3598 arg_constr.data = NULL;
3599 uint32_t* arg_vals = (uint32_t*)(arg + 4);
3600 for (size_t s = 0; s < arg_constr.datalen; s++) {
3601 uint32_t arr_conv_18 = arg_vals[s];
3602 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_conv_18) & ~1);
3603 FREE((void*)arr_conv_18);
3604 arg_constr.data[s] = arr_conv_18_conv;
3608 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
3609 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3610 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3611 return (void*) this_arg;
3613 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
3614 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
3615 atomic_init(&calls->refcnt, 1);
3616 //TODO: Assign calls->o from o
3618 LDKMessageSendEventsProvider ret = {
3619 .this_arg = (void*) calls,
3620 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
3621 .free = LDKMessageSendEventsProvider_JCalls_free,
3625 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
3626 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
3627 *res_ptr = LDKMessageSendEventsProvider_init(o);
3628 return (long)res_ptr;
3630 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
3631 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
3632 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
3633 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3634 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3635 for (size_t s = 0; s < ret_var.datalen; s++) {
3636 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
3637 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
3638 long arr_conv_18_ref = (long)arr_conv_18_copy;
3639 ret_arr_ptr[s] = arr_conv_18_ref;
3645 typedef struct LDKEventsProvider_JCalls {
3646 atomic_size_t refcnt;
3647 uint32_t get_and_clear_pending_events_meth;
3648 } LDKEventsProvider_JCalls;
3649 static void LDKEventsProvider_JCalls_free(void* this_arg) {
3650 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3651 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3652 js_free(j_calls->get_and_clear_pending_events_meth);
3656 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
3657 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3658 uint32_tArray arg = js_invoke_function_0(j_calls->get_and_clear_pending_events_meth);
3659 LDKCVec_EventZ arg_constr;
3660 arg_constr.datalen = *((uint32_t*)arg);
3661 if (arg_constr.datalen > 0)
3662 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
3664 arg_constr.data = NULL;
3665 uint32_t* arg_vals = (uint32_t*)(arg + 4);
3666 for (size_t h = 0; h < arg_constr.datalen; h++) {
3667 uint32_t arr_conv_7 = arg_vals[h];
3668 LDKEvent arr_conv_7_conv = *(LDKEvent*)(((uint64_t)arr_conv_7) & ~1);
3669 FREE((void*)arr_conv_7);
3670 arg_constr.data[h] = arr_conv_7_conv;
3674 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
3675 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3676 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3677 return (void*) this_arg;
3679 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
3680 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
3681 atomic_init(&calls->refcnt, 1);
3682 //TODO: Assign calls->o from o
3684 LDKEventsProvider ret = {
3685 .this_arg = (void*) calls,
3686 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
3687 .free = LDKEventsProvider_JCalls_free,
3691 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
3692 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
3693 *res_ptr = LDKEventsProvider_init(o);
3694 return (long)res_ptr;
3696 uint32_tArray __attribute__((visibility("default"))) TS_EventsProvider_get_and_clear_pending_events(uint32_t this_arg) {
3697 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
3698 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
3699 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3700 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3701 for (size_t h = 0; h < ret_var.datalen; h++) {
3702 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
3703 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
3704 long arr_conv_7_ref = (long)arr_conv_7_copy;
3705 ret_arr_ptr[h] = arr_conv_7_ref;
3711 typedef struct LDKAccess_JCalls {
3712 atomic_size_t refcnt;
3713 uint32_t get_utxo_meth;
3715 static void LDKAccess_JCalls_free(void* this_arg) {
3716 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3717 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3718 js_free(j_calls->get_utxo_meth);
3722 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3723 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3724 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3725 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
3726 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
3727 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
3728 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)ret);
3731 static void* LDKAccess_JCalls_clone(const void* this_arg) {
3732 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3733 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3734 return (void*) this_arg;
3736 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
3737 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3738 atomic_init(&calls->refcnt, 1);
3739 //TODO: Assign calls->o from o
3742 .this_arg = (void*) calls,
3743 .get_utxo = get_utxo_jcall,
3744 .free = LDKAccess_JCalls_free,
3748 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
3749 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3750 *res_ptr = LDKAccess_init(o);
3751 return (long)res_ptr;
3753 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
3754 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
3755 unsigned char genesis_hash_arr[32];
3756 CHECK(*((uint32_t*)genesis_hash) == 32);
3757 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
3758 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3759 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3760 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3761 return (long)ret_conv;
3764 typedef struct LDKFilter_JCalls {
3765 atomic_size_t refcnt;
3766 uint32_t register_tx_meth;
3767 uint32_t register_output_meth;
3769 static void LDKFilter_JCalls_free(void* this_arg) {
3770 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3771 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3772 js_free(j_calls->register_tx_meth);
3773 js_free(j_calls->register_output_meth);
3777 void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
3778 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3779 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3780 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
3781 LDKu8slice script_pubkey_var = script_pubkey;
3782 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3783 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
3784 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
3786 void register_output_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) {
3787 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3788 LDKOutPoint outpoint_var = *outpoint;
3789 outpoint_var = OutPoint_clone(outpoint);
3790 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3791 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3792 long outpoint_ref = (long)outpoint_var.inner;
3793 if (outpoint_var.is_owned) {
3796 LDKu8slice script_pubkey_var = script_pubkey;
3797 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3798 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
3799 js_invoke_function_2(j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
3801 static void* LDKFilter_JCalls_clone(const void* this_arg) {
3802 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3803 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3804 return (void*) this_arg;
3806 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
3807 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
3808 atomic_init(&calls->refcnt, 1);
3809 //TODO: Assign calls->o from o
3812 .this_arg = (void*) calls,
3813 .register_tx = register_tx_jcall,
3814 .register_output = register_output_jcall,
3815 .free = LDKFilter_JCalls_free,
3819 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
3820 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
3821 *res_ptr = LDKFilter_init(o);
3822 return (long)res_ptr;
3824 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
3825 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
3826 unsigned char txid_arr[32];
3827 CHECK(*((uint32_t*)txid) == 32);
3828 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
3829 unsigned char (*txid_ref)[32] = &txid_arr;
3830 LDKu8slice script_pubkey_ref;
3831 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
3832 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
3833 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
3836 void __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t outpoint, int8_tArray script_pubkey) {
3837 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
3838 LDKOutPoint outpoint_conv;
3839 outpoint_conv.inner = (void*)(outpoint & (~1));
3840 outpoint_conv.is_owned = false;
3841 LDKu8slice script_pubkey_ref;
3842 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
3843 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
3844 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
3847 typedef struct LDKPersist_JCalls {
3848 atomic_size_t refcnt;
3849 uint32_t persist_new_channel_meth;
3850 uint32_t update_persisted_channel_meth;
3851 } LDKPersist_JCalls;
3852 static void LDKPersist_JCalls_free(void* this_arg) {
3853 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
3854 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3855 js_free(j_calls->persist_new_channel_meth);
3856 js_free(j_calls->update_persisted_channel_meth);
3860 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
3861 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
3862 LDKOutPoint id_var = id;
3863 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3864 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3865 long id_ref = (long)id_var.inner;
3866 if (id_var.is_owned) {
3869 LDKChannelMonitor data_var = *data;
3870 data_var = ChannelMonitor_clone(data);
3871 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3872 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3873 long data_ref = (long)data_var.inner;
3874 if (data_var.is_owned) {
3877 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
3878 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3879 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
3882 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
3883 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
3884 LDKOutPoint id_var = id;
3885 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3886 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3887 long id_ref = (long)id_var.inner;
3888 if (id_var.is_owned) {
3891 LDKChannelMonitorUpdate update_var = *update;
3892 update_var = ChannelMonitorUpdate_clone(update);
3893 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3894 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3895 long update_ref = (long)update_var.inner;
3896 if (update_var.is_owned) {
3899 LDKChannelMonitor data_var = *data;
3900 data_var = ChannelMonitor_clone(data);
3901 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3902 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3903 long data_ref = (long)data_var.inner;
3904 if (data_var.is_owned) {
3907 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
3908 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3909 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
3912 static void* LDKPersist_JCalls_clone(const void* this_arg) {
3913 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
3914 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3915 return (void*) this_arg;
3917 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
3918 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
3919 atomic_init(&calls->refcnt, 1);
3920 //TODO: Assign calls->o from o
3923 .this_arg = (void*) calls,
3924 .persist_new_channel = persist_new_channel_jcall,
3925 .update_persisted_channel = update_persisted_channel_jcall,
3926 .free = LDKPersist_JCalls_free,
3930 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
3931 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
3932 *res_ptr = LDKPersist_init(o);
3933 return (long)res_ptr;
3935 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t id, uint32_t data) {
3936 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
3937 LDKOutPoint id_conv;
3938 id_conv.inner = (void*)(id & (~1));
3939 id_conv.is_owned = (id & 1) || (id == 0);
3940 id_conv = OutPoint_clone(&id_conv);
3941 LDKChannelMonitor data_conv;
3942 data_conv.inner = (void*)(data & (~1));
3943 data_conv.is_owned = false;
3944 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3945 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
3946 return (long)ret_conv;
3949 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
3950 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
3951 LDKOutPoint id_conv;
3952 id_conv.inner = (void*)(id & (~1));
3953 id_conv.is_owned = (id & 1) || (id == 0);
3954 id_conv = OutPoint_clone(&id_conv);
3955 LDKChannelMonitorUpdate update_conv;
3956 update_conv.inner = (void*)(update & (~1));
3957 update_conv.is_owned = false;
3958 LDKChannelMonitor data_conv;
3959 data_conv.inner = (void*)(data & (~1));
3960 data_conv.is_owned = false;
3961 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3962 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
3963 return (long)ret_conv;
3966 typedef struct LDKChannelMessageHandler_JCalls {
3967 atomic_size_t refcnt;
3968 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
3969 uint32_t handle_open_channel_meth;
3970 uint32_t handle_accept_channel_meth;
3971 uint32_t handle_funding_created_meth;
3972 uint32_t handle_funding_signed_meth;
3973 uint32_t handle_funding_locked_meth;
3974 uint32_t handle_shutdown_meth;
3975 uint32_t handle_closing_signed_meth;
3976 uint32_t handle_update_add_htlc_meth;
3977 uint32_t handle_update_fulfill_htlc_meth;
3978 uint32_t handle_update_fail_htlc_meth;
3979 uint32_t handle_update_fail_malformed_htlc_meth;
3980 uint32_t handle_commitment_signed_meth;
3981 uint32_t handle_revoke_and_ack_meth;
3982 uint32_t handle_update_fee_meth;
3983 uint32_t handle_announcement_signatures_meth;
3984 uint32_t peer_disconnected_meth;
3985 uint32_t peer_connected_meth;
3986 uint32_t handle_channel_reestablish_meth;
3987 uint32_t handle_error_meth;
3988 } LDKChannelMessageHandler_JCalls;
3989 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3990 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3991 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3992 js_free(j_calls->handle_open_channel_meth);
3993 js_free(j_calls->handle_accept_channel_meth);
3994 js_free(j_calls->handle_funding_created_meth);
3995 js_free(j_calls->handle_funding_signed_meth);
3996 js_free(j_calls->handle_funding_locked_meth);
3997 js_free(j_calls->handle_shutdown_meth);
3998 js_free(j_calls->handle_closing_signed_meth);
3999 js_free(j_calls->handle_update_add_htlc_meth);
4000 js_free(j_calls->handle_update_fulfill_htlc_meth);
4001 js_free(j_calls->handle_update_fail_htlc_meth);
4002 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
4003 js_free(j_calls->handle_commitment_signed_meth);
4004 js_free(j_calls->handle_revoke_and_ack_meth);
4005 js_free(j_calls->handle_update_fee_meth);
4006 js_free(j_calls->handle_announcement_signatures_meth);
4007 js_free(j_calls->peer_disconnected_meth);
4008 js_free(j_calls->peer_connected_meth);
4009 js_free(j_calls->handle_channel_reestablish_meth);
4010 js_free(j_calls->handle_error_meth);
4014 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
4015 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4016 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4017 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4018 LDKInitFeatures their_features_var = their_features;
4019 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4020 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4021 long their_features_ref = (long)their_features_var.inner;
4022 if (their_features_var.is_owned) {
4023 their_features_ref |= 1;
4025 LDKOpenChannel msg_var = *msg;
4026 msg_var = OpenChannel_clone(msg);
4027 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4028 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4029 long msg_ref = (long)msg_var.inner;
4030 if (msg_var.is_owned) {
4033 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4035 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
4036 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4037 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4038 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4039 LDKInitFeatures their_features_var = their_features;
4040 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4041 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4042 long their_features_ref = (long)their_features_var.inner;
4043 if (their_features_var.is_owned) {
4044 their_features_ref |= 1;
4046 LDKAcceptChannel msg_var = *msg;
4047 msg_var = AcceptChannel_clone(msg);
4048 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4049 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4050 long msg_ref = (long)msg_var.inner;
4051 if (msg_var.is_owned) {
4054 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4056 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
4057 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4058 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4059 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4060 LDKFundingCreated msg_var = *msg;
4061 msg_var = FundingCreated_clone(msg);
4062 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4063 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4064 long msg_ref = (long)msg_var.inner;
4065 if (msg_var.is_owned) {
4068 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
4070 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
4071 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4072 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4073 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4074 LDKFundingSigned msg_var = *msg;
4075 msg_var = FundingSigned_clone(msg);
4076 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4077 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4078 long msg_ref = (long)msg_var.inner;
4079 if (msg_var.is_owned) {
4082 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
4084 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
4085 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4086 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4087 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4088 LDKFundingLocked msg_var = *msg;
4089 msg_var = FundingLocked_clone(msg);
4090 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4091 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4092 long msg_ref = (long)msg_var.inner;
4093 if (msg_var.is_owned) {
4096 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
4098 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
4099 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4100 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4101 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4102 LDKShutdown msg_var = *msg;
4103 msg_var = Shutdown_clone(msg);
4104 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4105 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4106 long msg_ref = (long)msg_var.inner;
4107 if (msg_var.is_owned) {
4110 js_invoke_function_2(j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
4112 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
4113 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4114 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4115 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4116 LDKClosingSigned msg_var = *msg;
4117 msg_var = ClosingSigned_clone(msg);
4118 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4119 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4120 long msg_ref = (long)msg_var.inner;
4121 if (msg_var.is_owned) {
4124 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
4126 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
4127 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4128 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4129 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4130 LDKUpdateAddHTLC msg_var = *msg;
4131 msg_var = UpdateAddHTLC_clone(msg);
4132 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4133 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4134 long msg_ref = (long)msg_var.inner;
4135 if (msg_var.is_owned) {
4138 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
4140 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
4141 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4142 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4143 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4144 LDKUpdateFulfillHTLC msg_var = *msg;
4145 msg_var = UpdateFulfillHTLC_clone(msg);
4146 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4147 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4148 long msg_ref = (long)msg_var.inner;
4149 if (msg_var.is_owned) {
4152 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
4154 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
4155 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4156 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4157 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4158 LDKUpdateFailHTLC msg_var = *msg;
4159 msg_var = UpdateFailHTLC_clone(msg);
4160 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4161 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4162 long msg_ref = (long)msg_var.inner;
4163 if (msg_var.is_owned) {
4166 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
4168 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
4169 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4170 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4171 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4172 LDKUpdateFailMalformedHTLC msg_var = *msg;
4173 msg_var = UpdateFailMalformedHTLC_clone(msg);
4174 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4175 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4176 long msg_ref = (long)msg_var.inner;
4177 if (msg_var.is_owned) {
4180 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
4182 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
4183 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4184 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4185 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4186 LDKCommitmentSigned msg_var = *msg;
4187 msg_var = CommitmentSigned_clone(msg);
4188 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4189 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4190 long msg_ref = (long)msg_var.inner;
4191 if (msg_var.is_owned) {
4194 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
4196 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
4197 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4198 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4199 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4200 LDKRevokeAndACK msg_var = *msg;
4201 msg_var = RevokeAndACK_clone(msg);
4202 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4203 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4204 long msg_ref = (long)msg_var.inner;
4205 if (msg_var.is_owned) {
4208 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
4210 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
4211 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4212 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4213 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4214 LDKUpdateFee msg_var = *msg;
4215 msg_var = UpdateFee_clone(msg);
4216 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4217 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4218 long msg_ref = (long)msg_var.inner;
4219 if (msg_var.is_owned) {
4222 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
4224 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
4225 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4226 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4227 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4228 LDKAnnouncementSignatures msg_var = *msg;
4229 msg_var = AnnouncementSignatures_clone(msg);
4230 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4231 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4232 long msg_ref = (long)msg_var.inner;
4233 if (msg_var.is_owned) {
4236 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
4238 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
4239 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4240 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4241 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4242 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
4244 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
4245 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4246 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4247 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4248 LDKInit msg_var = *msg;
4249 msg_var = Init_clone(msg);
4250 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4251 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4252 long msg_ref = (long)msg_var.inner;
4253 if (msg_var.is_owned) {
4256 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
4258 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
4259 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4260 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4261 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4262 LDKChannelReestablish msg_var = *msg;
4263 msg_var = ChannelReestablish_clone(msg);
4264 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4265 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4266 long msg_ref = (long)msg_var.inner;
4267 if (msg_var.is_owned) {
4270 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
4272 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
4273 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4274 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4275 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4276 LDKErrorMessage msg_var = *msg;
4277 msg_var = ErrorMessage_clone(msg);
4278 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4279 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4280 long msg_ref = (long)msg_var.inner;
4281 if (msg_var.is_owned) {
4284 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
4286 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
4287 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4288 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4289 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4290 return (void*) this_arg;
4292 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
4293 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
4294 atomic_init(&calls->refcnt, 1);
4295 //TODO: Assign calls->o from o
4297 LDKChannelMessageHandler ret = {
4298 .this_arg = (void*) calls,
4299 .handle_open_channel = handle_open_channel_jcall,
4300 .handle_accept_channel = handle_accept_channel_jcall,
4301 .handle_funding_created = handle_funding_created_jcall,
4302 .handle_funding_signed = handle_funding_signed_jcall,
4303 .handle_funding_locked = handle_funding_locked_jcall,
4304 .handle_shutdown = handle_shutdown_jcall,
4305 .handle_closing_signed = handle_closing_signed_jcall,
4306 .handle_update_add_htlc = handle_update_add_htlc_jcall,
4307 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
4308 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
4309 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
4310 .handle_commitment_signed = handle_commitment_signed_jcall,
4311 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
4312 .handle_update_fee = handle_update_fee_jcall,
4313 .handle_announcement_signatures = handle_announcement_signatures_jcall,
4314 .peer_disconnected = peer_disconnected_jcall,
4315 .peer_connected = peer_connected_jcall,
4316 .handle_channel_reestablish = handle_channel_reestablish_jcall,
4317 .handle_error = handle_error_jcall,
4318 .free = LDKChannelMessageHandler_JCalls_free,
4319 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
4321 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
4324 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
4325 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
4326 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
4327 return (long)res_ptr;
4329 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) {
4330 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4331 LDKPublicKey their_node_id_ref;
4332 CHECK(*((uint32_t*)their_node_id) == 33);
4333 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4334 LDKInitFeatures their_features_conv;
4335 their_features_conv.inner = (void*)(their_features & (~1));
4336 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4337 their_features_conv = InitFeatures_clone(&their_features_conv);
4338 LDKOpenChannel msg_conv;
4339 msg_conv.inner = (void*)(msg & (~1));
4340 msg_conv.is_owned = false;
4341 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4344 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) {
4345 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4346 LDKPublicKey their_node_id_ref;
4347 CHECK(*((uint32_t*)their_node_id) == 33);
4348 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4349 LDKInitFeatures their_features_conv;
4350 their_features_conv.inner = (void*)(their_features & (~1));
4351 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4352 their_features_conv = InitFeatures_clone(&their_features_conv);
4353 LDKAcceptChannel msg_conv;
4354 msg_conv.inner = (void*)(msg & (~1));
4355 msg_conv.is_owned = false;
4356 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4359 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4360 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4361 LDKPublicKey their_node_id_ref;
4362 CHECK(*((uint32_t*)their_node_id) == 33);
4363 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4364 LDKFundingCreated msg_conv;
4365 msg_conv.inner = (void*)(msg & (~1));
4366 msg_conv.is_owned = false;
4367 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4370 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4371 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4372 LDKPublicKey their_node_id_ref;
4373 CHECK(*((uint32_t*)their_node_id) == 33);
4374 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4375 LDKFundingSigned msg_conv;
4376 msg_conv.inner = (void*)(msg & (~1));
4377 msg_conv.is_owned = false;
4378 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4381 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4382 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4383 LDKPublicKey their_node_id_ref;
4384 CHECK(*((uint32_t*)their_node_id) == 33);
4385 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4386 LDKFundingLocked msg_conv;
4387 msg_conv.inner = (void*)(msg & (~1));
4388 msg_conv.is_owned = false;
4389 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4392 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4393 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4394 LDKPublicKey their_node_id_ref;
4395 CHECK(*((uint32_t*)their_node_id) == 33);
4396 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4397 LDKShutdown msg_conv;
4398 msg_conv.inner = (void*)(msg & (~1));
4399 msg_conv.is_owned = false;
4400 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4403 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4404 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4405 LDKPublicKey their_node_id_ref;
4406 CHECK(*((uint32_t*)their_node_id) == 33);
4407 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4408 LDKClosingSigned msg_conv;
4409 msg_conv.inner = (void*)(msg & (~1));
4410 msg_conv.is_owned = false;
4411 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4414 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4415 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4416 LDKPublicKey their_node_id_ref;
4417 CHECK(*((uint32_t*)their_node_id) == 33);
4418 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4419 LDKUpdateAddHTLC msg_conv;
4420 msg_conv.inner = (void*)(msg & (~1));
4421 msg_conv.is_owned = false;
4422 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4425 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4426 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4427 LDKPublicKey their_node_id_ref;
4428 CHECK(*((uint32_t*)their_node_id) == 33);
4429 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4430 LDKUpdateFulfillHTLC msg_conv;
4431 msg_conv.inner = (void*)(msg & (~1));
4432 msg_conv.is_owned = false;
4433 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4436 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4437 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4438 LDKPublicKey their_node_id_ref;
4439 CHECK(*((uint32_t*)their_node_id) == 33);
4440 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4441 LDKUpdateFailHTLC msg_conv;
4442 msg_conv.inner = (void*)(msg & (~1));
4443 msg_conv.is_owned = false;
4444 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4447 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4448 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4449 LDKPublicKey their_node_id_ref;
4450 CHECK(*((uint32_t*)their_node_id) == 33);
4451 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4452 LDKUpdateFailMalformedHTLC msg_conv;
4453 msg_conv.inner = (void*)(msg & (~1));
4454 msg_conv.is_owned = false;
4455 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4458 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4459 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4460 LDKPublicKey their_node_id_ref;
4461 CHECK(*((uint32_t*)their_node_id) == 33);
4462 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4463 LDKCommitmentSigned msg_conv;
4464 msg_conv.inner = (void*)(msg & (~1));
4465 msg_conv.is_owned = false;
4466 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4469 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4470 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4471 LDKPublicKey their_node_id_ref;
4472 CHECK(*((uint32_t*)their_node_id) == 33);
4473 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4474 LDKRevokeAndACK msg_conv;
4475 msg_conv.inner = (void*)(msg & (~1));
4476 msg_conv.is_owned = false;
4477 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4480 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4481 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4482 LDKPublicKey their_node_id_ref;
4483 CHECK(*((uint32_t*)their_node_id) == 33);
4484 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4485 LDKUpdateFee msg_conv;
4486 msg_conv.inner = (void*)(msg & (~1));
4487 msg_conv.is_owned = false;
4488 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4491 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4492 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4493 LDKPublicKey their_node_id_ref;
4494 CHECK(*((uint32_t*)their_node_id) == 33);
4495 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4496 LDKAnnouncementSignatures msg_conv;
4497 msg_conv.inner = (void*)(msg & (~1));
4498 msg_conv.is_owned = false;
4499 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4502 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
4503 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4504 LDKPublicKey their_node_id_ref;
4505 CHECK(*((uint32_t*)their_node_id) == 33);
4506 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4507 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
4510 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4511 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4512 LDKPublicKey their_node_id_ref;
4513 CHECK(*((uint32_t*)their_node_id) == 33);
4514 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4516 msg_conv.inner = (void*)(msg & (~1));
4517 msg_conv.is_owned = false;
4518 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4521 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4522 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4523 LDKPublicKey their_node_id_ref;
4524 CHECK(*((uint32_t*)their_node_id) == 33);
4525 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4526 LDKChannelReestablish msg_conv;
4527 msg_conv.inner = (void*)(msg & (~1));
4528 msg_conv.is_owned = false;
4529 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4532 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4533 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4534 LDKPublicKey their_node_id_ref;
4535 CHECK(*((uint32_t*)their_node_id) == 33);
4536 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4537 LDKErrorMessage msg_conv;
4538 msg_conv.inner = (void*)(msg & (~1));
4539 msg_conv.is_owned = false;
4540 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4543 typedef struct LDKRoutingMessageHandler_JCalls {
4544 atomic_size_t refcnt;
4545 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4546 uint32_t handle_node_announcement_meth;
4547 uint32_t handle_channel_announcement_meth;
4548 uint32_t handle_channel_update_meth;
4549 uint32_t handle_htlc_fail_channel_update_meth;
4550 uint32_t get_next_channel_announcements_meth;
4551 uint32_t get_next_node_announcements_meth;
4552 uint32_t sync_routing_table_meth;
4553 uint32_t handle_reply_channel_range_meth;
4554 uint32_t handle_reply_short_channel_ids_end_meth;
4555 uint32_t handle_query_channel_range_meth;
4556 uint32_t handle_query_short_channel_ids_meth;
4557 } LDKRoutingMessageHandler_JCalls;
4558 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
4559 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4560 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4561 js_free(j_calls->handle_node_announcement_meth);
4562 js_free(j_calls->handle_channel_announcement_meth);
4563 js_free(j_calls->handle_channel_update_meth);
4564 js_free(j_calls->handle_htlc_fail_channel_update_meth);
4565 js_free(j_calls->get_next_channel_announcements_meth);
4566 js_free(j_calls->get_next_node_announcements_meth);
4567 js_free(j_calls->sync_routing_table_meth);
4568 js_free(j_calls->handle_reply_channel_range_meth);
4569 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
4570 js_free(j_calls->handle_query_channel_range_meth);
4571 js_free(j_calls->handle_query_short_channel_ids_meth);
4575 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
4576 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4577 LDKNodeAnnouncement msg_var = *msg;
4578 msg_var = NodeAnnouncement_clone(msg);
4579 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4580 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4581 long msg_ref = (long)msg_var.inner;
4582 if (msg_var.is_owned) {
4585 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
4586 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4587 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4590 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
4591 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4592 LDKChannelAnnouncement msg_var = *msg;
4593 msg_var = ChannelAnnouncement_clone(msg);
4594 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4595 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4596 long msg_ref = (long)msg_var.inner;
4597 if (msg_var.is_owned) {
4600 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
4601 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4602 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4605 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
4606 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4607 LDKChannelUpdate msg_var = *msg;
4608 msg_var = ChannelUpdate_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 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
4616 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4617 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4620 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
4621 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4622 long ret_update = (long)update;
4623 js_invoke_function_1(j_calls->handle_htlc_fail_channel_update_meth, ret_update);
4625 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
4626 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4627 uint32_tArray arg = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
4628 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4629 arg_constr.datalen = *((uint32_t*)arg);
4630 if (arg_constr.datalen > 0)
4631 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4633 arg_constr.data = NULL;
4634 uint32_t* arg_vals = (uint32_t*)(arg + 4);
4635 for (size_t l = 0; l < arg_constr.datalen; l++) {
4636 uint32_t arr_conv_63 = arg_vals[l];
4637 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_conv_63) & ~1);
4638 FREE((void*)arr_conv_63);
4639 arg_constr.data[l] = arr_conv_63_conv;
4643 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
4644 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4645 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4646 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
4647 uint32_tArray arg = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
4648 LDKCVec_NodeAnnouncementZ arg_constr;
4649 arg_constr.datalen = *((uint32_t*)arg);
4650 if (arg_constr.datalen > 0)
4651 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4653 arg_constr.data = NULL;
4654 uint32_t* arg_vals = (uint32_t*)(arg + 4);
4655 for (size_t s = 0; s < arg_constr.datalen; s++) {
4656 uint32_t arr_conv_18 = arg_vals[s];
4657 LDKNodeAnnouncement arr_conv_18_conv;
4658 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4659 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4660 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
4661 arg_constr.data[s] = arr_conv_18_conv;
4665 void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
4666 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4667 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4668 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4669 LDKInit init_var = *init;
4670 init_var = Init_clone(init);
4671 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4672 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4673 long init_ref = (long)init_var.inner;
4674 if (init_var.is_owned) {
4677 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
4679 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
4680 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4681 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4682 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4683 LDKReplyChannelRange msg_var = msg;
4684 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4685 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4686 long msg_ref = (long)msg_var.inner;
4687 if (msg_var.is_owned) {
4690 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
4691 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
4692 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
4695 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
4696 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_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 LDKReplyShortChannelIdsEnd msg_var = msg;
4700 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4701 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4702 long msg_ref = (long)msg_var.inner;
4703 if (msg_var.is_owned) {
4706 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
4707 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
4708 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
4711 LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
4712 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4713 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4714 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4715 LDKQueryChannelRange msg_var = msg;
4716 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4717 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4718 long msg_ref = (long)msg_var.inner;
4719 if (msg_var.is_owned) {
4722 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
4723 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
4724 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
4727 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
4728 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4729 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4730 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4731 LDKQueryShortChannelIds msg_var = msg;
4732 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4733 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4734 long msg_ref = (long)msg_var.inner;
4735 if (msg_var.is_owned) {
4738 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
4739 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
4740 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
4743 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
4744 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4745 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4746 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4747 return (void*) this_arg;
4749 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
4750 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
4751 atomic_init(&calls->refcnt, 1);
4752 //TODO: Assign calls->o from o
4754 LDKRoutingMessageHandler ret = {
4755 .this_arg = (void*) calls,
4756 .handle_node_announcement = handle_node_announcement_jcall,
4757 .handle_channel_announcement = handle_channel_announcement_jcall,
4758 .handle_channel_update = handle_channel_update_jcall,
4759 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
4760 .get_next_channel_announcements = get_next_channel_announcements_jcall,
4761 .get_next_node_announcements = get_next_node_announcements_jcall,
4762 .sync_routing_table = sync_routing_table_jcall,
4763 .handle_reply_channel_range = handle_reply_channel_range_jcall,
4764 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_jcall,
4765 .handle_query_channel_range = handle_query_channel_range_jcall,
4766 .handle_query_short_channel_ids = handle_query_short_channel_ids_jcall,
4767 .free = LDKRoutingMessageHandler_JCalls_free,
4768 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
4770 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
4773 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
4774 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
4775 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
4776 return (long)res_ptr;
4778 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
4779 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4780 LDKNodeAnnouncement msg_conv;
4781 msg_conv.inner = (void*)(msg & (~1));
4782 msg_conv.is_owned = false;
4783 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4784 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
4785 return (long)ret_conv;
4788 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
4789 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4790 LDKChannelAnnouncement msg_conv;
4791 msg_conv.inner = (void*)(msg & (~1));
4792 msg_conv.is_owned = false;
4793 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4794 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4795 return (long)ret_conv;
4798 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
4799 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4800 LDKChannelUpdate msg_conv;
4801 msg_conv.inner = (void*)(msg & (~1));
4802 msg_conv.is_owned = false;
4803 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4804 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
4805 return (long)ret_conv;
4808 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_htlc_fail_channel_update(uint32_t this_arg, uint32_t update) {
4809 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4810 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
4811 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
4814 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
4815 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4816 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
4817 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4818 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
4819 for (size_t l = 0; l < ret_var.datalen; l++) {
4820 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4821 *arr_conv_63_ref = ret_var.data[l];
4822 ret_arr_ptr[l] = (long)arr_conv_63_ref;
4828 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
4829 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4830 LDKPublicKey starting_point_ref;
4831 CHECK(*((uint32_t*)starting_point) == 33);
4832 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
4833 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
4834 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4835 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
4836 for (size_t s = 0; s < ret_var.datalen; s++) {
4837 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
4838 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4839 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4840 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
4841 if (arr_conv_18_var.is_owned) {
4842 arr_conv_18_ref |= 1;
4844 ret_arr_ptr[s] = arr_conv_18_ref;
4850 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
4851 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4852 LDKPublicKey their_node_id_ref;
4853 CHECK(*((uint32_t*)their_node_id) == 33);
4854 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4856 init_conv.inner = (void*)(init & (~1));
4857 init_conv.is_owned = false;
4858 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
4861 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4862 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4863 LDKPublicKey their_node_id_ref;
4864 CHECK(*((uint32_t*)their_node_id) == 33);
4865 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4866 LDKReplyChannelRange msg_conv;
4867 msg_conv.inner = (void*)(msg & (~1));
4868 msg_conv.is_owned = (msg & 1) || (msg == 0);
4869 msg_conv = ReplyChannelRange_clone(&msg_conv);
4870 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
4871 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
4872 return (long)ret_conv;
4875 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) {
4876 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4877 LDKPublicKey their_node_id_ref;
4878 CHECK(*((uint32_t*)their_node_id) == 33);
4879 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4880 LDKReplyShortChannelIdsEnd msg_conv;
4881 msg_conv.inner = (void*)(msg & (~1));
4882 msg_conv.is_owned = (msg & 1) || (msg == 0);
4883 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
4884 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
4885 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
4886 return (long)ret_conv;
4889 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4890 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4891 LDKPublicKey their_node_id_ref;
4892 CHECK(*((uint32_t*)their_node_id) == 33);
4893 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4894 LDKQueryChannelRange msg_conv;
4895 msg_conv.inner = (void*)(msg & (~1));
4896 msg_conv.is_owned = (msg & 1) || (msg == 0);
4897 msg_conv = QueryChannelRange_clone(&msg_conv);
4898 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
4899 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
4900 return (long)ret_conv;
4903 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4904 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4905 LDKPublicKey their_node_id_ref;
4906 CHECK(*((uint32_t*)their_node_id) == 33);
4907 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4908 LDKQueryShortChannelIds msg_conv;
4909 msg_conv.inner = (void*)(msg & (~1));
4910 msg_conv.is_owned = (msg & 1) || (msg == 0);
4911 msg_conv = QueryShortChannelIds_clone(&msg_conv);
4912 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
4913 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
4914 return (long)ret_conv;
4917 typedef struct LDKSocketDescriptor_JCalls {
4918 atomic_size_t refcnt;
4919 uint32_t send_data_meth;
4920 uint32_t disconnect_socket_meth;
4923 } LDKSocketDescriptor_JCalls;
4924 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
4925 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4926 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4927 js_free(j_calls->send_data_meth);
4928 js_free(j_calls->disconnect_socket_meth);
4929 js_free(j_calls->eq_meth);
4930 js_free(j_calls->hash_meth);
4934 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
4935 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4936 LDKu8slice data_var = data;
4937 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4938 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
4939 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
4941 void disconnect_socket_jcall(void* this_arg) {
4942 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4943 js_invoke_function_0(j_calls->disconnect_socket_meth);
4945 bool eq_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
4946 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4947 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4948 *other_arg_clone = SocketDescriptor_clone(other_arg);
4949 return js_invoke_function_1(j_calls->eq_meth, (long)other_arg_clone);
4951 uint64_t hash_jcall(const void* this_arg) {
4952 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4953 return js_invoke_function_0(j_calls->hash_meth);
4955 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
4956 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4957 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4958 return (void*) this_arg;
4960 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
4961 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
4962 atomic_init(&calls->refcnt, 1);
4963 //TODO: Assign calls->o from o
4965 LDKSocketDescriptor ret = {
4966 .this_arg = (void*) calls,
4967 .send_data = send_data_jcall,
4968 .disconnect_socket = disconnect_socket_jcall,
4971 .clone = LDKSocketDescriptor_JCalls_clone,
4972 .free = LDKSocketDescriptor_JCalls_free,
4976 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
4977 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4978 *res_ptr = LDKSocketDescriptor_init(o);
4979 return (long)res_ptr;
4981 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
4982 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4983 LDKu8slice data_ref;
4984 data_ref.datalen = *((uint32_t*)data);
4985 data_ref.data = (int8_t*)(data + 4);
4986 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
4990 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
4991 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4992 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4995 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
4996 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4997 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
5001 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
5002 LDKTransaction _res_ref;
5003 _res_ref.datalen = *((uint32_t*)_res);
5004 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5005 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
5006 _res_ref.data_is_owned = true;
5007 Transaction_free(_res_ref);
5010 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
5011 if ((_res & 1) != 0) return;
5012 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
5014 TxOut_free(_res_conv);
5017 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
5018 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
5019 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5020 *ret_ref = TxOut_clone(orig_conv);
5021 return (long)ret_ref;
5024 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
5026 CHECK(*((uint32_t*)o) == 32);
5027 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
5028 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
5029 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
5030 return (long)ret_conv;
5033 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
5034 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5035 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
5036 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
5037 return (long)ret_conv;
5040 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
5041 if ((_res & 1) != 0) return;
5042 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
5044 CResult_SecretKeyErrorZ_free(_res_conv);
5047 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
5049 CHECK(*((uint32_t*)o) == 33);
5050 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
5051 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
5052 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
5053 return (long)ret_conv;
5056 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
5057 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5058 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
5059 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
5060 return (long)ret_conv;
5063 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
5064 if ((_res & 1) != 0) return;
5065 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
5067 CResult_PublicKeyErrorZ_free(_res_conv);
5070 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
5071 LDKTxCreationKeys o_conv;
5072 o_conv.inner = (void*)(o & (~1));
5073 o_conv.is_owned = (o & 1) || (o == 0);
5074 o_conv = TxCreationKeys_clone(&o_conv);
5075 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5076 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
5077 return (long)ret_conv;
5080 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
5081 LDKDecodeError e_conv;
5082 e_conv.inner = (void*)(e & (~1));
5083 e_conv.is_owned = (e & 1) || (e == 0);
5084 e_conv = DecodeError_clone(&e_conv);
5085 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5086 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
5087 return (long)ret_conv;
5090 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
5091 if ((_res & 1) != 0) return;
5092 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
5094 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
5097 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
5098 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
5099 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5100 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
5101 return (long)ret_conv;
5104 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
5105 LDKChannelPublicKeys o_conv;
5106 o_conv.inner = (void*)(o & (~1));
5107 o_conv.is_owned = (o & 1) || (o == 0);
5108 o_conv = ChannelPublicKeys_clone(&o_conv);
5109 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5110 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
5111 return (long)ret_conv;
5114 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
5115 LDKDecodeError e_conv;
5116 e_conv.inner = (void*)(e & (~1));
5117 e_conv.is_owned = (e & 1) || (e == 0);
5118 e_conv = DecodeError_clone(&e_conv);
5119 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5120 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
5121 return (long)ret_conv;
5124 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
5125 if ((_res & 1) != 0) return;
5126 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
5128 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
5131 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
5132 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
5133 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5134 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
5135 return (long)ret_conv;
5138 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
5139 LDKTxCreationKeys o_conv;
5140 o_conv.inner = (void*)(o & (~1));
5141 o_conv.is_owned = (o & 1) || (o == 0);
5142 o_conv = TxCreationKeys_clone(&o_conv);
5143 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
5144 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
5145 return (long)ret_conv;
5148 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
5149 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5150 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
5151 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
5152 return (long)ret_conv;
5155 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
5156 if ((_res & 1) != 0) return;
5157 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
5159 CResult_TxCreationKeysErrorZ_free(_res_conv);
5162 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
5163 LDKHTLCOutputInCommitment o_conv;
5164 o_conv.inner = (void*)(o & (~1));
5165 o_conv.is_owned = (o & 1) || (o == 0);
5166 o_conv = HTLCOutputInCommitment_clone(&o_conv);
5167 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5168 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
5169 return (long)ret_conv;
5172 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
5173 LDKDecodeError e_conv;
5174 e_conv.inner = (void*)(e & (~1));
5175 e_conv.is_owned = (e & 1) || (e == 0);
5176 e_conv = DecodeError_clone(&e_conv);
5177 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5178 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
5179 return (long)ret_conv;
5182 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
5183 if ((_res & 1) != 0) return;
5184 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
5186 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
5189 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
5190 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
5191 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5192 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
5193 return (long)ret_conv;
5196 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
5197 LDKCounterpartyChannelTransactionParameters o_conv;
5198 o_conv.inner = (void*)(o & (~1));
5199 o_conv.is_owned = (o & 1) || (o == 0);
5200 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
5201 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5202 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
5203 return (long)ret_conv;
5206 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
5207 LDKDecodeError e_conv;
5208 e_conv.inner = (void*)(e & (~1));
5209 e_conv.is_owned = (e & 1) || (e == 0);
5210 e_conv = DecodeError_clone(&e_conv);
5211 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5212 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
5213 return (long)ret_conv;
5216 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
5217 if ((_res & 1) != 0) return;
5218 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
5220 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
5223 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
5224 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
5225 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5226 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
5227 return (long)ret_conv;
5230 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
5231 LDKChannelTransactionParameters o_conv;
5232 o_conv.inner = (void*)(o & (~1));
5233 o_conv.is_owned = (o & 1) || (o == 0);
5234 o_conv = ChannelTransactionParameters_clone(&o_conv);
5235 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5236 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
5237 return (long)ret_conv;
5240 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
5241 LDKDecodeError e_conv;
5242 e_conv.inner = (void*)(e & (~1));
5243 e_conv.is_owned = (e & 1) || (e == 0);
5244 e_conv = DecodeError_clone(&e_conv);
5245 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5246 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
5247 return (long)ret_conv;
5250 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
5251 if ((_res & 1) != 0) return;
5252 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
5254 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
5257 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
5258 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
5259 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5260 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
5261 return (long)ret_conv;
5264 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
5265 LDKCVec_SignatureZ _res_constr;
5266 _res_constr.datalen = *((uint32_t*)_res);
5267 if (_res_constr.datalen > 0)
5268 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5270 _res_constr.data = NULL;
5271 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
5272 for (size_t m = 0; m < _res_constr.datalen; m++) {
5273 int8_tArray arr_conv_12 = _res_vals[m];
5274 LDKSignature arr_conv_12_ref;
5275 CHECK(*((uint32_t*)arr_conv_12) == 64);
5276 memcpy(arr_conv_12_ref.compact_form, (uint8_t*)(arr_conv_12 + 4), 64);
5277 _res_constr.data[m] = arr_conv_12_ref;
5279 CVec_SignatureZ_free(_res_constr);
5282 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5283 LDKHolderCommitmentTransaction o_conv;
5284 o_conv.inner = (void*)(o & (~1));
5285 o_conv.is_owned = (o & 1) || (o == 0);
5286 o_conv = HolderCommitmentTransaction_clone(&o_conv);
5287 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5288 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
5289 return (long)ret_conv;
5292 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5293 LDKDecodeError e_conv;
5294 e_conv.inner = (void*)(e & (~1));
5295 e_conv.is_owned = (e & 1) || (e == 0);
5296 e_conv = DecodeError_clone(&e_conv);
5297 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5298 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
5299 return (long)ret_conv;
5302 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5303 if ((_res & 1) != 0) return;
5304 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5306 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
5309 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5310 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
5311 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5312 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
5313 return (long)ret_conv;
5316 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5317 LDKBuiltCommitmentTransaction o_conv;
5318 o_conv.inner = (void*)(o & (~1));
5319 o_conv.is_owned = (o & 1) || (o == 0);
5320 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
5321 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5322 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
5323 return (long)ret_conv;
5326 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5327 LDKDecodeError e_conv;
5328 e_conv.inner = (void*)(e & (~1));
5329 e_conv.is_owned = (e & 1) || (e == 0);
5330 e_conv = DecodeError_clone(&e_conv);
5331 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5332 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
5333 return (long)ret_conv;
5336 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5337 if ((_res & 1) != 0) return;
5338 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5340 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
5343 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5344 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
5345 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5346 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
5347 return (long)ret_conv;
5350 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5351 LDKCommitmentTransaction o_conv;
5352 o_conv.inner = (void*)(o & (~1));
5353 o_conv.is_owned = (o & 1) || (o == 0);
5354 o_conv = CommitmentTransaction_clone(&o_conv);
5355 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
5356 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
5357 return (long)ret_conv;
5360 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5361 LDKDecodeError e_conv;
5362 e_conv.inner = (void*)(e & (~1));
5363 e_conv.is_owned = (e & 1) || (e == 0);
5364 e_conv = DecodeError_clone(&e_conv);
5365 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
5366 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
5367 return (long)ret_conv;
5370 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5371 if ((_res & 1) != 0) return;
5372 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5374 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
5377 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5378 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
5379 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
5380 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
5381 return (long)ret_conv;
5384 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
5385 LDKTrustedCommitmentTransaction o_conv;
5386 o_conv.inner = (void*)(o & (~1));
5387 o_conv.is_owned = (o & 1) || (o == 0);
5388 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
5389 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
5390 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
5391 return (long)ret_conv;
5394 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
5395 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
5396 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
5397 return (long)ret_conv;
5400 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
5401 if ((_res & 1) != 0) return;
5402 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
5404 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
5407 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
5408 LDKCVec_SignatureZ o_constr;
5409 o_constr.datalen = *((uint32_t*)o);
5410 if (o_constr.datalen > 0)
5411 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5413 o_constr.data = NULL;
5414 int8_tArray* o_vals = (int8_tArray*)(o + 4);
5415 for (size_t m = 0; m < o_constr.datalen; m++) {
5416 int8_tArray arr_conv_12 = o_vals[m];
5417 LDKSignature arr_conv_12_ref;
5418 CHECK(*((uint32_t*)arr_conv_12) == 64);
5419 memcpy(arr_conv_12_ref.compact_form, (uint8_t*)(arr_conv_12 + 4), 64);
5420 o_constr.data[m] = arr_conv_12_ref;
5422 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5423 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
5424 return (long)ret_conv;
5427 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
5428 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5429 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
5430 return (long)ret_conv;
5433 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
5434 if ((_res & 1) != 0) return;
5435 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
5437 CResult_CVec_SignatureZNoneZ_free(_res_conv);
5440 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
5441 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
5442 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5443 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
5444 return (long)ret_conv;
5447 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
5448 LDKCVec_PublicKeyZ _res_constr;
5449 _res_constr.datalen = *((uint32_t*)_res);
5450 if (_res_constr.datalen > 0)
5451 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
5453 _res_constr.data = NULL;
5454 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
5455 for (size_t m = 0; m < _res_constr.datalen; m++) {
5456 int8_tArray arr_conv_12 = _res_vals[m];
5457 LDKPublicKey arr_conv_12_ref;
5458 CHECK(*((uint32_t*)arr_conv_12) == 33);
5459 memcpy(arr_conv_12_ref.compressed_form, (uint8_t*)(arr_conv_12 + 4), 33);
5460 _res_constr.data[m] = arr_conv_12_ref;
5462 CVec_PublicKeyZ_free(_res_constr);
5465 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
5466 LDKCVec_u8Z _res_ref;
5467 _res_ref.datalen = *((uint32_t*)_res);
5468 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
5469 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
5470 CVec_u8Z_free(_res_ref);
5473 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
5475 o_ref.datalen = *((uint32_t*)o);
5476 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
5477 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
5478 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5479 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
5480 return (long)ret_conv;
5483 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
5484 LDKPeerHandleError e_conv;
5485 e_conv.inner = (void*)(e & (~1));
5486 e_conv.is_owned = (e & 1) || (e == 0);
5487 e_conv = PeerHandleError_clone(&e_conv);
5488 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5489 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
5490 return (long)ret_conv;
5493 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
5494 if ((_res & 1) != 0) return;
5495 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
5497 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
5500 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
5501 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
5502 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5503 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
5504 return (long)ret_conv;
5507 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
5508 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5509 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
5510 return (long)ret_conv;
5513 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
5514 LDKPeerHandleError e_conv;
5515 e_conv.inner = (void*)(e & (~1));
5516 e_conv.is_owned = (e & 1) || (e == 0);
5517 e_conv = PeerHandleError_clone(&e_conv);
5518 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5519 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
5520 return (long)ret_conv;
5523 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
5524 if ((_res & 1) != 0) return;
5525 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
5527 CResult_NonePeerHandleErrorZ_free(_res_conv);
5530 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
5531 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
5532 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5533 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
5534 return (long)ret_conv;
5537 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
5538 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
5539 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
5540 return (long)ret_conv;
5543 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
5544 LDKPeerHandleError e_conv;
5545 e_conv.inner = (void*)(e & (~1));
5546 e_conv.is_owned = (e & 1) || (e == 0);
5547 e_conv = PeerHandleError_clone(&e_conv);
5548 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
5549 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
5550 return (long)ret_conv;
5553 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
5554 if ((_res & 1) != 0) return;
5555 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
5557 CResult_boolPeerHandleErrorZ_free(_res_conv);
5560 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
5561 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
5562 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
5563 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
5564 return (long)ret_conv;
5567 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
5568 LDKInitFeatures o_conv;
5569 o_conv.inner = (void*)(o & (~1));
5570 o_conv.is_owned = (o & 1) || (o == 0);
5571 o_conv = InitFeatures_clone(&o_conv);
5572 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
5573 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
5574 return (long)ret_conv;
5577 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
5578 LDKDecodeError e_conv;
5579 e_conv.inner = (void*)(e & (~1));
5580 e_conv.is_owned = (e & 1) || (e == 0);
5581 e_conv = DecodeError_clone(&e_conv);
5582 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
5583 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
5584 return (long)ret_conv;
5587 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
5588 if ((_res & 1) != 0) return;
5589 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
5591 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
5594 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
5595 LDKNodeFeatures o_conv;
5596 o_conv.inner = (void*)(o & (~1));
5597 o_conv.is_owned = (o & 1) || (o == 0);
5598 o_conv = NodeFeatures_clone(&o_conv);
5599 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
5600 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
5601 return (long)ret_conv;
5604 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
5605 LDKDecodeError e_conv;
5606 e_conv.inner = (void*)(e & (~1));
5607 e_conv.is_owned = (e & 1) || (e == 0);
5608 e_conv = DecodeError_clone(&e_conv);
5609 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
5610 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
5611 return (long)ret_conv;
5614 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
5615 if ((_res & 1) != 0) return;
5616 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
5618 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
5621 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
5622 LDKChannelFeatures o_conv;
5623 o_conv.inner = (void*)(o & (~1));
5624 o_conv.is_owned = (o & 1) || (o == 0);
5625 o_conv = ChannelFeatures_clone(&o_conv);
5626 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
5627 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
5628 return (long)ret_conv;
5631 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
5632 LDKDecodeError e_conv;
5633 e_conv.inner = (void*)(e & (~1));
5634 e_conv.is_owned = (e & 1) || (e == 0);
5635 e_conv = DecodeError_clone(&e_conv);
5636 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
5637 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
5638 return (long)ret_conv;
5641 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
5642 if ((_res & 1) != 0) return;
5643 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
5645 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
5648 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
5649 LDKChannelConfig o_conv;
5650 o_conv.inner = (void*)(o & (~1));
5651 o_conv.is_owned = (o & 1) || (o == 0);
5652 o_conv = ChannelConfig_clone(&o_conv);
5653 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
5654 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
5655 return (long)ret_conv;
5658 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
5659 LDKDecodeError e_conv;
5660 e_conv.inner = (void*)(e & (~1));
5661 e_conv.is_owned = (e & 1) || (e == 0);
5662 e_conv = DecodeError_clone(&e_conv);
5663 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
5664 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
5665 return (long)ret_conv;
5668 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
5669 if ((_res & 1) != 0) return;
5670 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
5672 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
5675 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
5676 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
5677 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
5678 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
5679 return (long)ret_conv;
5682 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
5683 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5684 *ret_conv = CResult_boolLightningErrorZ_ok(o);
5685 return (long)ret_conv;
5688 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
5689 LDKLightningError e_conv;
5690 e_conv.inner = (void*)(e & (~1));
5691 e_conv.is_owned = (e & 1) || (e == 0);
5692 e_conv = LightningError_clone(&e_conv);
5693 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5694 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
5695 return (long)ret_conv;
5698 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
5699 if ((_res & 1) != 0) return;
5700 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
5702 CResult_boolLightningErrorZ_free(_res_conv);
5705 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
5706 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
5707 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5708 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
5709 return (long)ret_conv;
5712 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
5713 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
5714 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5715 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
5716 return (long)ret_ref;
5719 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
5720 LDKChannelAnnouncement a_conv;
5721 a_conv.inner = (void*)(a & (~1));
5722 a_conv.is_owned = (a & 1) || (a == 0);
5723 a_conv = ChannelAnnouncement_clone(&a_conv);
5724 LDKChannelUpdate b_conv;
5725 b_conv.inner = (void*)(b & (~1));
5726 b_conv.is_owned = (b & 1) || (b == 0);
5727 b_conv = ChannelUpdate_clone(&b_conv);
5728 LDKChannelUpdate c_conv;
5729 c_conv.inner = (void*)(c & (~1));
5730 c_conv.is_owned = (c & 1) || (c == 0);
5731 c_conv = ChannelUpdate_clone(&c_conv);
5732 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5733 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5734 return (long)ret_ref;
5737 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
5738 if ((_res & 1) != 0) return;
5739 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
5741 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
5744 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
5745 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
5746 _res_constr.datalen = *((uint32_t*)_res);
5747 if (_res_constr.datalen > 0)
5748 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5750 _res_constr.data = NULL;
5751 uint32_t* _res_vals = (uint32_t*)(_res + 4);
5752 for (size_t l = 0; l < _res_constr.datalen; l++) {
5753 uint32_t arr_conv_63 = _res_vals[l];
5754 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_conv_63) & ~1);
5755 FREE((void*)arr_conv_63);
5756 _res_constr.data[l] = arr_conv_63_conv;
5758 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
5761 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
5762 LDKCVec_NodeAnnouncementZ _res_constr;
5763 _res_constr.datalen = *((uint32_t*)_res);
5764 if (_res_constr.datalen > 0)
5765 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5767 _res_constr.data = NULL;
5768 uint32_t* _res_vals = (uint32_t*)(_res + 4);
5769 for (size_t s = 0; s < _res_constr.datalen; s++) {
5770 uint32_t arr_conv_18 = _res_vals[s];
5771 LDKNodeAnnouncement arr_conv_18_conv;
5772 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
5773 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
5774 _res_constr.data[s] = arr_conv_18_conv;
5776 CVec_NodeAnnouncementZ_free(_res_constr);
5779 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
5780 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5781 *ret_conv = CResult_NoneLightningErrorZ_ok();
5782 return (long)ret_conv;
5785 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
5786 LDKLightningError e_conv;
5787 e_conv.inner = (void*)(e & (~1));
5788 e_conv.is_owned = (e & 1) || (e == 0);
5789 e_conv = LightningError_clone(&e_conv);
5790 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5791 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
5792 return (long)ret_conv;
5795 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
5796 if ((_res & 1) != 0) return;
5797 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
5799 CResult_NoneLightningErrorZ_free(_res_conv);
5802 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
5803 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
5804 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5805 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
5806 return (long)ret_conv;
5809 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
5810 LDKCVec_MessageSendEventZ _res_constr;
5811 _res_constr.datalen = *((uint32_t*)_res);
5812 if (_res_constr.datalen > 0)
5813 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5815 _res_constr.data = NULL;
5816 uint32_t* _res_vals = (uint32_t*)(_res + 4);
5817 for (size_t s = 0; s < _res_constr.datalen; s++) {
5818 uint32_t arr_conv_18 = _res_vals[s];
5819 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_conv_18) & ~1);
5820 FREE((void*)arr_conv_18);
5821 _res_constr.data[s] = arr_conv_18_conv;
5823 CVec_MessageSendEventZ_free(_res_constr);
5826 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
5827 LDKDirectionalChannelInfo o_conv;
5828 o_conv.inner = (void*)(o & (~1));
5829 o_conv.is_owned = (o & 1) || (o == 0);
5830 o_conv = DirectionalChannelInfo_clone(&o_conv);
5831 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
5832 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
5833 return (long)ret_conv;
5836 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
5837 LDKDecodeError e_conv;
5838 e_conv.inner = (void*)(e & (~1));
5839 e_conv.is_owned = (e & 1) || (e == 0);
5840 e_conv = DecodeError_clone(&e_conv);
5841 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
5842 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
5843 return (long)ret_conv;
5846 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
5847 if ((_res & 1) != 0) return;
5848 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
5850 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
5853 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
5854 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
5855 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
5856 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
5857 return (long)ret_conv;
5860 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
5861 LDKChannelInfo o_conv;
5862 o_conv.inner = (void*)(o & (~1));
5863 o_conv.is_owned = (o & 1) || (o == 0);
5864 // Warning: we need a move here but no clone is available for LDKChannelInfo
5865 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
5866 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
5867 return (long)ret_conv;
5870 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
5871 LDKDecodeError e_conv;
5872 e_conv.inner = (void*)(e & (~1));
5873 e_conv.is_owned = (e & 1) || (e == 0);
5874 e_conv = DecodeError_clone(&e_conv);
5875 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
5876 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
5877 return (long)ret_conv;
5880 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
5881 if ((_res & 1) != 0) return;
5882 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
5884 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
5887 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
5888 LDKRoutingFees o_conv;
5889 o_conv.inner = (void*)(o & (~1));
5890 o_conv.is_owned = (o & 1) || (o == 0);
5891 o_conv = RoutingFees_clone(&o_conv);
5892 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
5893 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
5894 return (long)ret_conv;
5897 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
5898 LDKDecodeError e_conv;
5899 e_conv.inner = (void*)(e & (~1));
5900 e_conv.is_owned = (e & 1) || (e == 0);
5901 e_conv = DecodeError_clone(&e_conv);
5902 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
5903 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
5904 return (long)ret_conv;
5907 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
5908 if ((_res & 1) != 0) return;
5909 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
5911 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
5914 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
5915 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
5916 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
5917 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
5918 return (long)ret_conv;
5921 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
5922 LDKCVec_NetAddressZ _res_constr;
5923 _res_constr.datalen = *((uint32_t*)_res);
5924 if (_res_constr.datalen > 0)
5925 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
5927 _res_constr.data = NULL;
5928 uint32_t* _res_vals = (uint32_t*)(_res + 4);
5929 for (size_t m = 0; m < _res_constr.datalen; m++) {
5930 uint32_t arr_conv_12 = _res_vals[m];
5931 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
5932 FREE((void*)arr_conv_12);
5933 _res_constr.data[m] = arr_conv_12_conv;
5935 CVec_NetAddressZ_free(_res_constr);
5938 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
5939 LDKNodeAnnouncementInfo o_conv;
5940 o_conv.inner = (void*)(o & (~1));
5941 o_conv.is_owned = (o & 1) || (o == 0);
5942 o_conv = NodeAnnouncementInfo_clone(&o_conv);
5943 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
5944 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
5945 return (long)ret_conv;
5948 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
5949 LDKDecodeError e_conv;
5950 e_conv.inner = (void*)(e & (~1));
5951 e_conv.is_owned = (e & 1) || (e == 0);
5952 e_conv = DecodeError_clone(&e_conv);
5953 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
5954 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
5955 return (long)ret_conv;
5958 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
5959 if ((_res & 1) != 0) return;
5960 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
5962 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
5965 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
5966 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
5967 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
5968 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
5969 return (long)ret_conv;
5972 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
5973 LDKCVec_u64Z _res_constr;
5974 _res_constr.datalen = *((uint32_t*)_res);
5975 if (_res_constr.datalen > 0)
5976 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
5978 _res_constr.data = NULL;
5979 int64_t* _res_vals = (int64_t*)(_res + 4);
5980 for (size_t i = 0; i < _res_constr.datalen; i++) {
5981 int64_t arr_conv_8 = _res_vals[i];
5982 _res_constr.data[i] = arr_conv_8;
5984 CVec_u64Z_free(_res_constr);
5987 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
5989 o_conv.inner = (void*)(o & (~1));
5990 o_conv.is_owned = (o & 1) || (o == 0);
5991 o_conv = NodeInfo_clone(&o_conv);
5992 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
5993 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
5994 return (long)ret_conv;
5997 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
5998 LDKDecodeError e_conv;
5999 e_conv.inner = (void*)(e & (~1));
6000 e_conv.is_owned = (e & 1) || (e == 0);
6001 e_conv = DecodeError_clone(&e_conv);
6002 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6003 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
6004 return (long)ret_conv;
6007 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
6008 if ((_res & 1) != 0) return;
6009 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6011 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
6014 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
6015 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
6016 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6017 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
6018 return (long)ret_conv;
6021 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
6022 LDKNetworkGraph o_conv;
6023 o_conv.inner = (void*)(o & (~1));
6024 o_conv.is_owned = (o & 1) || (o == 0);
6025 // Warning: we need a move here but no clone is available for LDKNetworkGraph
6026 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6027 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
6028 return (long)ret_conv;
6031 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
6032 LDKDecodeError e_conv;
6033 e_conv.inner = (void*)(e & (~1));
6034 e_conv.is_owned = (e & 1) || (e == 0);
6035 e_conv = DecodeError_clone(&e_conv);
6036 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6037 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
6038 return (long)ret_conv;
6041 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
6042 if ((_res & 1) != 0) return;
6043 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
6045 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
6048 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
6049 LDKTransaction b_ref;
6050 b_ref.datalen = *((uint32_t*)b);
6051 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
6052 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6053 b_ref.data_is_owned = true;
6054 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6055 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
6056 return (long)ret_ref;
6059 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
6060 if ((_res & 1) != 0) return;
6061 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
6063 C2Tuple_usizeTransactionZ_free(_res_conv);
6066 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
6067 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
6068 _res_constr.datalen = *((uint32_t*)_res);
6069 if (_res_constr.datalen > 0)
6070 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6072 _res_constr.data = NULL;
6073 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6074 for (size_t e = 0; e < _res_constr.datalen; e++) {
6075 uint32_t arr_conv_30 = _res_vals[e];
6076 LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_30) & ~1);
6077 FREE((void*)arr_conv_30);
6078 _res_constr.data[e] = arr_conv_30_conv;
6080 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
6083 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
6084 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6085 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
6086 return (long)ret_conv;
6089 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
6090 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
6091 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6092 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
6093 return (long)ret_conv;
6096 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
6097 if ((_res & 1) != 0) return;
6098 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
6100 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
6103 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
6104 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
6105 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6106 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
6107 return (long)ret_conv;
6110 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
6111 LDKCVec_MonitorEventZ _res_constr;
6112 _res_constr.datalen = *((uint32_t*)_res);
6113 if (_res_constr.datalen > 0)
6114 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
6116 _res_constr.data = NULL;
6117 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6118 for (size_t o = 0; o < _res_constr.datalen; o++) {
6119 uint32_t arr_conv_14 = _res_vals[o];
6120 LDKMonitorEvent arr_conv_14_conv;
6121 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
6122 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
6123 _res_constr.data[o] = arr_conv_14_conv;
6125 CVec_MonitorEventZ_free(_res_constr);
6128 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
6129 LDKCVec_EventZ _res_constr;
6130 _res_constr.datalen = *((uint32_t*)_res);
6131 if (_res_constr.datalen > 0)
6132 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
6134 _res_constr.data = NULL;
6135 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6136 for (size_t h = 0; h < _res_constr.datalen; h++) {
6137 uint32_t arr_conv_7 = _res_vals[h];
6138 LDKEvent arr_conv_7_conv = *(LDKEvent*)(((uint64_t)arr_conv_7) & ~1);
6139 FREE((void*)arr_conv_7);
6140 _res_constr.data[h] = arr_conv_7_conv;
6142 CVec_EventZ_free(_res_constr);
6145 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
6147 o_conv.inner = (void*)(o & (~1));
6148 o_conv.is_owned = (o & 1) || (o == 0);
6149 o_conv = OutPoint_clone(&o_conv);
6150 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
6151 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
6152 return (long)ret_conv;
6155 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
6156 LDKDecodeError e_conv;
6157 e_conv.inner = (void*)(e & (~1));
6158 e_conv.is_owned = (e & 1) || (e == 0);
6159 e_conv = DecodeError_clone(&e_conv);
6160 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
6161 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
6162 return (long)ret_conv;
6165 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
6166 if ((_res & 1) != 0) return;
6167 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
6169 CResult_OutPointDecodeErrorZ_free(_res_conv);
6172 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
6173 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
6174 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
6175 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
6176 return (long)ret_conv;
6179 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
6180 LDKChannelMonitorUpdate o_conv;
6181 o_conv.inner = (void*)(o & (~1));
6182 o_conv.is_owned = (o & 1) || (o == 0);
6183 o_conv = ChannelMonitorUpdate_clone(&o_conv);
6184 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6185 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
6186 return (long)ret_conv;
6189 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
6190 LDKDecodeError e_conv;
6191 e_conv.inner = (void*)(e & (~1));
6192 e_conv.is_owned = (e & 1) || (e == 0);
6193 e_conv = DecodeError_clone(&e_conv);
6194 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6195 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
6196 return (long)ret_conv;
6199 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
6200 if ((_res & 1) != 0) return;
6201 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
6203 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
6206 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
6207 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
6208 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6209 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
6210 return (long)ret_conv;
6213 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
6214 LDKHTLCUpdate o_conv;
6215 o_conv.inner = (void*)(o & (~1));
6216 o_conv.is_owned = (o & 1) || (o == 0);
6217 o_conv = HTLCUpdate_clone(&o_conv);
6218 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6219 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
6220 return (long)ret_conv;
6223 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
6224 LDKDecodeError e_conv;
6225 e_conv.inner = (void*)(e & (~1));
6226 e_conv.is_owned = (e & 1) || (e == 0);
6227 e_conv = DecodeError_clone(&e_conv);
6228 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6229 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
6230 return (long)ret_conv;
6233 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
6234 if ((_res & 1) != 0) return;
6235 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
6237 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
6240 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
6241 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
6242 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6243 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
6244 return (long)ret_conv;
6247 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
6248 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6249 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
6250 return (long)ret_conv;
6253 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
6254 LDKMonitorUpdateError e_conv;
6255 e_conv.inner = (void*)(e & (~1));
6256 e_conv.is_owned = (e & 1) || (e == 0);
6257 e_conv = MonitorUpdateError_clone(&e_conv);
6258 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6259 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
6260 return (long)ret_conv;
6263 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
6264 if ((_res & 1) != 0) return;
6265 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
6267 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
6270 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
6271 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
6272 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6273 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
6274 return (long)ret_conv;
6277 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
6278 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
6279 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6280 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
6281 return (long)ret_ref;
6284 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
6286 a_conv.inner = (void*)(a & (~1));
6287 a_conv.is_owned = (a & 1) || (a == 0);
6288 a_conv = OutPoint_clone(&a_conv);
6290 b_ref.datalen = *((uint32_t*)b);
6291 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
6292 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6293 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6294 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
6295 return (long)ret_ref;
6298 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
6299 if ((_res & 1) != 0) return;
6300 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
6302 C2Tuple_OutPointScriptZ_free(_res_conv);
6305 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
6306 LDKCVec_TransactionZ _res_constr;
6307 _res_constr.datalen = *((uint32_t*)_res);
6308 if (_res_constr.datalen > 0)
6309 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
6311 _res_constr.data = NULL;
6312 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
6313 for (size_t m = 0; m < _res_constr.datalen; m++) {
6314 int8_tArray arr_conv_12 = _res_vals[m];
6315 LDKTransaction arr_conv_12_ref;
6316 arr_conv_12_ref.datalen = *((uint32_t*)arr_conv_12);
6317 arr_conv_12_ref.data = MALLOC(arr_conv_12_ref.datalen, "LDKTransaction Bytes");
6318 memcpy(arr_conv_12_ref.data, (uint8_t*)(arr_conv_12 + 4), arr_conv_12_ref.datalen);
6319 arr_conv_12_ref.data_is_owned = true;
6320 _res_constr.data[m] = arr_conv_12_ref;
6322 CVec_TransactionZ_free(_res_constr);
6325 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
6326 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
6327 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6328 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
6329 return (long)ret_ref;
6332 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
6333 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
6335 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6336 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
6337 return (long)ret_ref;
6340 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
6341 if ((_res & 1) != 0) return;
6342 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
6344 C2Tuple_u32TxOutZ_free(_res_conv);
6347 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
6348 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
6349 _res_constr.datalen = *((uint32_t*)_res);
6350 if (_res_constr.datalen > 0)
6351 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
6353 _res_constr.data = NULL;
6354 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6355 for (size_t z = 0; z < _res_constr.datalen; z++) {
6356 uint32_t arr_conv_25 = _res_vals[z];
6357 LDKC2Tuple_u32TxOutZ arr_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_25) & ~1);
6358 FREE((void*)arr_conv_25);
6359 _res_constr.data[z] = arr_conv_25_conv;
6361 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
6364 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
6365 LDKThirtyTwoBytes a_ref;
6366 CHECK(*((uint32_t*)a) == 32);
6367 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6368 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
6369 b_constr.datalen = *((uint32_t*)b);
6370 if (b_constr.datalen > 0)
6371 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
6373 b_constr.data = NULL;
6374 uint32_t* b_vals = (uint32_t*)(b + 4);
6375 for (size_t z = 0; z < b_constr.datalen; z++) {
6376 uint32_t arr_conv_25 = b_vals[z];
6377 LDKC2Tuple_u32TxOutZ arr_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_25) & ~1);
6378 FREE((void*)arr_conv_25);
6379 b_constr.data[z] = arr_conv_25_conv;
6381 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
6382 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
6383 return (long)ret_ref;
6386 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
6387 if ((_res & 1) != 0) return;
6388 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
6390 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
6393 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
6394 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
6395 _res_constr.datalen = *((uint32_t*)_res);
6396 if (_res_constr.datalen > 0)
6397 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
6399 _res_constr.data = NULL;
6400 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6401 for (size_t x = 0; x < _res_constr.datalen; x++) {
6402 uint32_t arr_conv_49 = _res_vals[x];
6403 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_conv_49) & ~1);
6404 FREE((void*)arr_conv_49);
6405 _res_constr.data[x] = arr_conv_49_conv;
6407 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
6410 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
6411 LDKThirtyTwoBytes a_ref;
6412 CHECK(*((uint32_t*)a) == 32);
6413 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6414 LDKChannelMonitor b_conv;
6415 b_conv.inner = (void*)(b & (~1));
6416 b_conv.is_owned = (b & 1) || (b == 0);
6417 b_conv = ChannelMonitor_clone(&b_conv);
6418 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6419 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
6420 return (long)ret_ref;
6423 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
6424 if ((_res & 1) != 0) return;
6425 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
6427 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
6430 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
6431 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
6433 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
6434 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
6435 return (long)ret_conv;
6438 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
6439 LDKDecodeError e_conv;
6440 e_conv.inner = (void*)(e & (~1));
6441 e_conv.is_owned = (e & 1) || (e == 0);
6442 e_conv = DecodeError_clone(&e_conv);
6443 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
6444 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
6445 return (long)ret_conv;
6448 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
6449 if ((_res & 1) != 0) return;
6450 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
6452 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
6455 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
6456 LDKCVec_SpendableOutputDescriptorZ _res_constr;
6457 _res_constr.datalen = *((uint32_t*)_res);
6458 if (_res_constr.datalen > 0)
6459 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
6461 _res_constr.data = NULL;
6462 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6463 for (size_t b = 0; b < _res_constr.datalen; b++) {
6464 uint32_t arr_conv_27 = _res_vals[b];
6465 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_conv_27) & ~1);
6466 FREE((void*)arr_conv_27);
6467 _res_constr.data[b] = arr_conv_27_conv;
6469 CVec_SpendableOutputDescriptorZ_free(_res_constr);
6472 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
6473 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
6475 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6476 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
6477 return (long)ret_conv;
6480 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
6481 LDKAccessError e_conv = LDKAccessError_from_js(e);
6482 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6483 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
6484 return (long)ret_conv;
6487 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
6488 if ((_res & 1) != 0) return;
6489 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
6491 CResult_TxOutAccessErrorZ_free(_res_conv);
6494 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
6495 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
6496 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6497 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
6498 return (long)ret_conv;
6501 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
6502 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6503 *ret_conv = CResult_NoneAPIErrorZ_ok();
6504 return (long)ret_conv;
6507 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
6508 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
6510 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6511 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
6512 return (long)ret_conv;
6515 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
6516 if ((_res & 1) != 0) return;
6517 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
6519 CResult_NoneAPIErrorZ_free(_res_conv);
6522 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
6523 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
6524 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6525 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
6526 return (long)ret_conv;
6529 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
6530 LDKCVec_ChannelDetailsZ _res_constr;
6531 _res_constr.datalen = *((uint32_t*)_res);
6532 if (_res_constr.datalen > 0)
6533 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6535 _res_constr.data = NULL;
6536 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6537 for (size_t q = 0; q < _res_constr.datalen; q++) {
6538 uint32_t arr_conv_16 = _res_vals[q];
6539 LDKChannelDetails arr_conv_16_conv;
6540 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6541 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6542 _res_constr.data[q] = arr_conv_16_conv;
6544 CVec_ChannelDetailsZ_free(_res_constr);
6547 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
6548 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6549 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
6550 return (long)ret_conv;
6553 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
6554 LDKPaymentSendFailure e_conv;
6555 e_conv.inner = (void*)(e & (~1));
6556 e_conv.is_owned = (e & 1) || (e == 0);
6557 e_conv = PaymentSendFailure_clone(&e_conv);
6558 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6559 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
6560 return (long)ret_conv;
6563 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
6564 if ((_res & 1) != 0) return;
6565 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
6567 CResult_NonePaymentSendFailureZ_free(_res_conv);
6570 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
6571 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
6572 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6573 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
6574 return (long)ret_conv;
6577 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
6578 LDKCVec_ChannelMonitorZ _res_constr;
6579 _res_constr.datalen = *((uint32_t*)_res);
6580 if (_res_constr.datalen > 0)
6581 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
6583 _res_constr.data = NULL;
6584 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6585 for (size_t q = 0; q < _res_constr.datalen; q++) {
6586 uint32_t arr_conv_16 = _res_vals[q];
6587 LDKChannelMonitor arr_conv_16_conv;
6588 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6589 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6590 _res_constr.data[q] = arr_conv_16_conv;
6592 CVec_ChannelMonitorZ_free(_res_constr);
6595 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
6596 LDKThirtyTwoBytes a_ref;
6597 CHECK(*((uint32_t*)a) == 32);
6598 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6599 LDKChannelManager b_conv;
6600 b_conv.inner = (void*)(b & (~1));
6601 b_conv.is_owned = (b & 1) || (b == 0);
6602 // Warning: we need a move here but no clone is available for LDKChannelManager
6603 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
6604 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
6605 return (long)ret_ref;
6608 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
6609 if ((_res & 1) != 0) return;
6610 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
6612 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
6615 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
6616 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
6618 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6619 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
6620 return (long)ret_conv;
6623 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
6624 LDKDecodeError e_conv;
6625 e_conv.inner = (void*)(e & (~1));
6626 e_conv.is_owned = (e & 1) || (e == 0);
6627 e_conv = DecodeError_clone(&e_conv);
6628 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6629 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
6630 return (long)ret_conv;
6633 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
6634 if ((_res & 1) != 0) return;
6635 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
6637 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
6640 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u64u64Z_clone(uint32_t orig) {
6641 LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)(orig & ~1);
6642 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
6643 *ret_ref = C2Tuple_u64u64Z_clone(orig_conv);
6644 return (long)ret_ref;
6647 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
6648 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
6649 *ret_ref = C2Tuple_u64u64Z_new(a, b);
6650 return (long)ret_ref;
6653 void __attribute__((visibility("default"))) TS_C2Tuple_u64u64Z_free(uint32_t _res) {
6654 if ((_res & 1) != 0) return;
6655 LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)_res) & ~1);
6657 C2Tuple_u64u64Z_free(_res_conv);
6660 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
6661 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
6663 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
6664 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
6665 return (long)ret_conv;
6668 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
6669 LDKDecodeError e_conv;
6670 e_conv.inner = (void*)(e & (~1));
6671 e_conv.is_owned = (e & 1) || (e == 0);
6672 e_conv = DecodeError_clone(&e_conv);
6673 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
6674 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
6675 return (long)ret_conv;
6678 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
6679 if ((_res & 1) != 0) return;
6680 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
6682 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
6685 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
6686 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
6687 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
6688 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
6689 return (long)ret_conv;
6692 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
6693 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
6694 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
6695 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
6696 return (long)ret_ref;
6699 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
6701 CHECK(*((uint32_t*)a) == 64);
6702 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
6703 LDKCVec_SignatureZ b_constr;
6704 b_constr.datalen = *((uint32_t*)b);
6705 if (b_constr.datalen > 0)
6706 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6708 b_constr.data = NULL;
6709 int8_tArray* b_vals = (int8_tArray*)(b + 4);
6710 for (size_t m = 0; m < b_constr.datalen; m++) {
6711 int8_tArray arr_conv_12 = b_vals[m];
6712 LDKSignature arr_conv_12_ref;
6713 CHECK(*((uint32_t*)arr_conv_12) == 64);
6714 memcpy(arr_conv_12_ref.compact_form, (uint8_t*)(arr_conv_12 + 4), 64);
6715 b_constr.data[m] = arr_conv_12_ref;
6717 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
6718 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
6719 return (long)ret_ref;
6722 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
6723 if ((_res & 1) != 0) return;
6724 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
6726 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
6729 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
6730 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
6732 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
6733 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
6734 return (long)ret_conv;
6737 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
6738 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
6739 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
6740 return (long)ret_conv;
6743 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
6744 if ((_res & 1) != 0) return;
6745 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
6747 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
6750 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
6751 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
6752 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
6753 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
6754 return (long)ret_conv;
6757 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
6759 CHECK(*((uint32_t*)o) == 64);
6760 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
6761 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6762 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
6763 return (long)ret_conv;
6766 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
6767 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6768 *ret_conv = CResult_SignatureNoneZ_err();
6769 return (long)ret_conv;
6772 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
6773 if ((_res & 1) != 0) return;
6774 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
6776 CResult_SignatureNoneZ_free(_res_conv);
6779 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
6780 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
6781 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6782 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
6783 return (long)ret_conv;
6786 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelKeysDecodeErrorZ_ok(uint32_t o) {
6787 LDKChannelKeys o_conv = *(LDKChannelKeys*)(((uint64_t)o) & ~1);
6788 LDKCResult_ChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelKeysDecodeErrorZ), "LDKCResult_ChannelKeysDecodeErrorZ");
6789 *ret_conv = CResult_ChannelKeysDecodeErrorZ_ok(o_conv);
6790 return (long)ret_conv;
6793 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelKeysDecodeErrorZ_err(uint32_t e) {
6794 LDKDecodeError e_conv;
6795 e_conv.inner = (void*)(e & (~1));
6796 e_conv.is_owned = (e & 1) || (e == 0);
6797 e_conv = DecodeError_clone(&e_conv);
6798 LDKCResult_ChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelKeysDecodeErrorZ), "LDKCResult_ChannelKeysDecodeErrorZ");
6799 *ret_conv = CResult_ChannelKeysDecodeErrorZ_err(e_conv);
6800 return (long)ret_conv;
6803 void __attribute__((visibility("default"))) TS_CResult_ChannelKeysDecodeErrorZ_free(uint32_t _res) {
6804 if ((_res & 1) != 0) return;
6805 LDKCResult_ChannelKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6807 CResult_ChannelKeysDecodeErrorZ_free(_res_conv);
6810 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelKeysDecodeErrorZ_clone(uint32_t orig) {
6811 LDKCResult_ChannelKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelKeysDecodeErrorZ*)(orig & ~1);
6812 LDKCResult_ChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelKeysDecodeErrorZ), "LDKCResult_ChannelKeysDecodeErrorZ");
6813 *ret_conv = CResult_ChannelKeysDecodeErrorZ_clone(orig_conv);
6814 return (long)ret_conv;
6817 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemoryChannelKeysDecodeErrorZ_ok(uint32_t o) {
6818 LDKInMemoryChannelKeys o_conv;
6819 o_conv.inner = (void*)(o & (~1));
6820 o_conv.is_owned = (o & 1) || (o == 0);
6821 o_conv = InMemoryChannelKeys_clone(&o_conv);
6822 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
6823 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_ok(o_conv);
6824 return (long)ret_conv;
6827 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemoryChannelKeysDecodeErrorZ_err(uint32_t e) {
6828 LDKDecodeError e_conv;
6829 e_conv.inner = (void*)(e & (~1));
6830 e_conv.is_owned = (e & 1) || (e == 0);
6831 e_conv = DecodeError_clone(&e_conv);
6832 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
6833 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_err(e_conv);
6834 return (long)ret_conv;
6837 void __attribute__((visibility("default"))) TS_CResult_InMemoryChannelKeysDecodeErrorZ_free(uint32_t _res) {
6838 if ((_res & 1) != 0) return;
6839 LDKCResult_InMemoryChannelKeysDecodeErrorZ _res_conv = *(LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6841 CResult_InMemoryChannelKeysDecodeErrorZ_free(_res_conv);
6844 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemoryChannelKeysDecodeErrorZ_clone(uint32_t orig) {
6845 LDKCResult_InMemoryChannelKeysDecodeErrorZ* orig_conv = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(orig & ~1);
6846 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
6847 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_clone(orig_conv);
6848 return (long)ret_conv;
6851 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
6852 LDKCVec_RouteHopZ _res_constr;
6853 _res_constr.datalen = *((uint32_t*)_res);
6854 if (_res_constr.datalen > 0)
6855 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
6857 _res_constr.data = NULL;
6858 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6859 for (size_t k = 0; k < _res_constr.datalen; k++) {
6860 uint32_t arr_conv_10 = _res_vals[k];
6861 LDKRouteHop arr_conv_10_conv;
6862 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
6863 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
6864 _res_constr.data[k] = arr_conv_10_conv;
6866 CVec_RouteHopZ_free(_res_constr);
6869 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
6870 LDKCVec_CVec_RouteHopZZ _res_constr;
6871 _res_constr.datalen = *((uint32_t*)_res);
6872 if (_res_constr.datalen > 0)
6873 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
6875 _res_constr.data = NULL;
6876 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
6877 for (size_t m = 0; m < _res_constr.datalen; m++) {
6878 uint32_tArray arr_conv_12 = _res_vals[m];
6879 LDKCVec_RouteHopZ arr_conv_12_constr;
6880 arr_conv_12_constr.datalen = *((uint32_t*)arr_conv_12);
6881 if (arr_conv_12_constr.datalen > 0)
6882 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
6884 arr_conv_12_constr.data = NULL;
6885 uint32_t* arr_conv_12_vals = (uint32_t*)(arr_conv_12 + 4);
6886 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
6887 uint32_t arr_conv_10 = arr_conv_12_vals[k];
6888 LDKRouteHop arr_conv_10_conv;
6889 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
6890 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
6891 arr_conv_12_constr.data[k] = arr_conv_10_conv;
6893 _res_constr.data[m] = arr_conv_12_constr;
6895 CVec_CVec_RouteHopZZ_free(_res_constr);
6898 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
6900 o_conv.inner = (void*)(o & (~1));
6901 o_conv.is_owned = (o & 1) || (o == 0);
6902 o_conv = Route_clone(&o_conv);
6903 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
6904 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
6905 return (long)ret_conv;
6908 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
6909 LDKDecodeError e_conv;
6910 e_conv.inner = (void*)(e & (~1));
6911 e_conv.is_owned = (e & 1) || (e == 0);
6912 e_conv = DecodeError_clone(&e_conv);
6913 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
6914 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
6915 return (long)ret_conv;
6918 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
6919 if ((_res & 1) != 0) return;
6920 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
6922 CResult_RouteDecodeErrorZ_free(_res_conv);
6925 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
6926 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
6927 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
6928 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
6929 return (long)ret_conv;
6932 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
6933 LDKCVec_RouteHintZ _res_constr;
6934 _res_constr.datalen = *((uint32_t*)_res);
6935 if (_res_constr.datalen > 0)
6936 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
6938 _res_constr.data = NULL;
6939 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6940 for (size_t l = 0; l < _res_constr.datalen; l++) {
6941 uint32_t arr_conv_11 = _res_vals[l];
6942 LDKRouteHint arr_conv_11_conv;
6943 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
6944 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
6945 _res_constr.data[l] = arr_conv_11_conv;
6947 CVec_RouteHintZ_free(_res_constr);
6950 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
6952 o_conv.inner = (void*)(o & (~1));
6953 o_conv.is_owned = (o & 1) || (o == 0);
6954 o_conv = Route_clone(&o_conv);
6955 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6956 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
6957 return (long)ret_conv;
6960 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
6961 LDKLightningError e_conv;
6962 e_conv.inner = (void*)(e & (~1));
6963 e_conv.is_owned = (e & 1) || (e == 0);
6964 e_conv = LightningError_clone(&e_conv);
6965 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6966 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
6967 return (long)ret_conv;
6970 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
6971 if ((_res & 1) != 0) return;
6972 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
6974 CResult_RouteLightningErrorZ_free(_res_conv);
6977 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
6978 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
6979 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6980 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
6981 return (long)ret_conv;
6984 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
6985 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
6987 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6988 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
6989 return (long)ret_conv;
6992 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_err(int8_t e) {
6993 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6994 *ret_conv = CResult_NetAddressu8Z_err(e);
6995 return (long)ret_conv;
6998 void __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_free(uint32_t _res) {
6999 if ((_res & 1) != 0) return;
7000 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
7002 CResult_NetAddressu8Z_free(_res_conv);
7005 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_clone(uint32_t orig) {
7006 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
7007 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7008 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
7009 return (long)ret_conv;
7012 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
7013 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
7015 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7016 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
7017 return (long)ret_conv;
7020 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_err(uint32_t e) {
7021 LDKDecodeError e_conv;
7022 e_conv.inner = (void*)(e & (~1));
7023 e_conv.is_owned = (e & 1) || (e == 0);
7024 e_conv = DecodeError_clone(&e_conv);
7025 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7026 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
7027 return (long)ret_conv;
7030 void __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_free(uint32_t _res) {
7031 if ((_res & 1) != 0) return;
7032 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
7034 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
7037 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(uint32_t orig) {
7038 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
7039 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7040 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
7041 return (long)ret_conv;
7044 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
7045 LDKCVec_UpdateAddHTLCZ _res_constr;
7046 _res_constr.datalen = *((uint32_t*)_res);
7047 if (_res_constr.datalen > 0)
7048 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
7050 _res_constr.data = NULL;
7051 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7052 for (size_t p = 0; p < _res_constr.datalen; p++) {
7053 uint32_t arr_conv_15 = _res_vals[p];
7054 LDKUpdateAddHTLC arr_conv_15_conv;
7055 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
7056 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
7057 _res_constr.data[p] = arr_conv_15_conv;
7059 CVec_UpdateAddHTLCZ_free(_res_constr);
7062 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
7063 LDKCVec_UpdateFulfillHTLCZ _res_constr;
7064 _res_constr.datalen = *((uint32_t*)_res);
7065 if (_res_constr.datalen > 0)
7066 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
7068 _res_constr.data = NULL;
7069 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7070 for (size_t t = 0; t < _res_constr.datalen; t++) {
7071 uint32_t arr_conv_19 = _res_vals[t];
7072 LDKUpdateFulfillHTLC arr_conv_19_conv;
7073 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
7074 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
7075 _res_constr.data[t] = arr_conv_19_conv;
7077 CVec_UpdateFulfillHTLCZ_free(_res_constr);
7080 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
7081 LDKCVec_UpdateFailHTLCZ _res_constr;
7082 _res_constr.datalen = *((uint32_t*)_res);
7083 if (_res_constr.datalen > 0)
7084 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
7086 _res_constr.data = NULL;
7087 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7088 for (size_t q = 0; q < _res_constr.datalen; q++) {
7089 uint32_t arr_conv_16 = _res_vals[q];
7090 LDKUpdateFailHTLC arr_conv_16_conv;
7091 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7092 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7093 _res_constr.data[q] = arr_conv_16_conv;
7095 CVec_UpdateFailHTLCZ_free(_res_constr);
7098 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
7099 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
7100 _res_constr.datalen = *((uint32_t*)_res);
7101 if (_res_constr.datalen > 0)
7102 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
7104 _res_constr.data = NULL;
7105 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7106 for (size_t z = 0; z < _res_constr.datalen; z++) {
7107 uint32_t arr_conv_25 = _res_vals[z];
7108 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
7109 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
7110 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
7111 _res_constr.data[z] = arr_conv_25_conv;
7113 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
7116 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
7117 LDKAcceptChannel o_conv;
7118 o_conv.inner = (void*)(o & (~1));
7119 o_conv.is_owned = (o & 1) || (o == 0);
7120 o_conv = AcceptChannel_clone(&o_conv);
7121 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7122 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
7123 return (long)ret_conv;
7126 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
7127 LDKDecodeError e_conv;
7128 e_conv.inner = (void*)(e & (~1));
7129 e_conv.is_owned = (e & 1) || (e == 0);
7130 e_conv = DecodeError_clone(&e_conv);
7131 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7132 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
7133 return (long)ret_conv;
7136 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
7137 if ((_res & 1) != 0) return;
7138 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
7140 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
7143 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
7144 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
7145 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7146 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
7147 return (long)ret_conv;
7150 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
7151 LDKAnnouncementSignatures o_conv;
7152 o_conv.inner = (void*)(o & (~1));
7153 o_conv.is_owned = (o & 1) || (o == 0);
7154 o_conv = AnnouncementSignatures_clone(&o_conv);
7155 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7156 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
7157 return (long)ret_conv;
7160 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
7161 LDKDecodeError e_conv;
7162 e_conv.inner = (void*)(e & (~1));
7163 e_conv.is_owned = (e & 1) || (e == 0);
7164 e_conv = DecodeError_clone(&e_conv);
7165 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7166 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
7167 return (long)ret_conv;
7170 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
7171 if ((_res & 1) != 0) return;
7172 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7174 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
7177 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
7178 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
7179 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7180 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
7181 return (long)ret_conv;
7184 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
7185 LDKChannelReestablish o_conv;
7186 o_conv.inner = (void*)(o & (~1));
7187 o_conv.is_owned = (o & 1) || (o == 0);
7188 o_conv = ChannelReestablish_clone(&o_conv);
7189 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7190 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
7191 return (long)ret_conv;
7194 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
7195 LDKDecodeError e_conv;
7196 e_conv.inner = (void*)(e & (~1));
7197 e_conv.is_owned = (e & 1) || (e == 0);
7198 e_conv = DecodeError_clone(&e_conv);
7199 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7200 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
7201 return (long)ret_conv;
7204 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
7205 if ((_res & 1) != 0) return;
7206 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
7208 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
7211 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
7212 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
7213 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7214 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
7215 return (long)ret_conv;
7218 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
7219 LDKClosingSigned o_conv;
7220 o_conv.inner = (void*)(o & (~1));
7221 o_conv.is_owned = (o & 1) || (o == 0);
7222 o_conv = ClosingSigned_clone(&o_conv);
7223 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7224 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
7225 return (long)ret_conv;
7228 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
7229 LDKDecodeError e_conv;
7230 e_conv.inner = (void*)(e & (~1));
7231 e_conv.is_owned = (e & 1) || (e == 0);
7232 e_conv = DecodeError_clone(&e_conv);
7233 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7234 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
7235 return (long)ret_conv;
7238 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
7239 if ((_res & 1) != 0) return;
7240 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7242 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
7245 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
7246 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
7247 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7248 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
7249 return (long)ret_conv;
7252 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
7253 LDKCommitmentSigned o_conv;
7254 o_conv.inner = (void*)(o & (~1));
7255 o_conv.is_owned = (o & 1) || (o == 0);
7256 o_conv = CommitmentSigned_clone(&o_conv);
7257 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7258 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
7259 return (long)ret_conv;
7262 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
7263 LDKDecodeError e_conv;
7264 e_conv.inner = (void*)(e & (~1));
7265 e_conv.is_owned = (e & 1) || (e == 0);
7266 e_conv = DecodeError_clone(&e_conv);
7267 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7268 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
7269 return (long)ret_conv;
7272 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
7273 if ((_res & 1) != 0) return;
7274 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7276 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
7279 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
7280 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
7281 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7282 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
7283 return (long)ret_conv;
7286 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
7287 LDKFundingCreated o_conv;
7288 o_conv.inner = (void*)(o & (~1));
7289 o_conv.is_owned = (o & 1) || (o == 0);
7290 o_conv = FundingCreated_clone(&o_conv);
7291 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7292 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
7293 return (long)ret_conv;
7296 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
7297 LDKDecodeError e_conv;
7298 e_conv.inner = (void*)(e & (~1));
7299 e_conv.is_owned = (e & 1) || (e == 0);
7300 e_conv = DecodeError_clone(&e_conv);
7301 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7302 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
7303 return (long)ret_conv;
7306 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
7307 if ((_res & 1) != 0) return;
7308 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7310 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
7313 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
7314 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
7315 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7316 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
7317 return (long)ret_conv;
7320 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
7321 LDKFundingSigned o_conv;
7322 o_conv.inner = (void*)(o & (~1));
7323 o_conv.is_owned = (o & 1) || (o == 0);
7324 o_conv = FundingSigned_clone(&o_conv);
7325 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7326 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
7327 return (long)ret_conv;
7330 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
7331 LDKDecodeError e_conv;
7332 e_conv.inner = (void*)(e & (~1));
7333 e_conv.is_owned = (e & 1) || (e == 0);
7334 e_conv = DecodeError_clone(&e_conv);
7335 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7336 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
7337 return (long)ret_conv;
7340 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
7341 if ((_res & 1) != 0) return;
7342 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7344 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
7347 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
7348 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
7349 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7350 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
7351 return (long)ret_conv;
7354 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
7355 LDKFundingLocked o_conv;
7356 o_conv.inner = (void*)(o & (~1));
7357 o_conv.is_owned = (o & 1) || (o == 0);
7358 o_conv = FundingLocked_clone(&o_conv);
7359 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7360 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
7361 return (long)ret_conv;
7364 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
7365 LDKDecodeError e_conv;
7366 e_conv.inner = (void*)(e & (~1));
7367 e_conv.is_owned = (e & 1) || (e == 0);
7368 e_conv = DecodeError_clone(&e_conv);
7369 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7370 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
7371 return (long)ret_conv;
7374 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
7375 if ((_res & 1) != 0) return;
7376 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7378 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
7381 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
7382 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
7383 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7384 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
7385 return (long)ret_conv;
7388 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
7390 o_conv.inner = (void*)(o & (~1));
7391 o_conv.is_owned = (o & 1) || (o == 0);
7392 o_conv = Init_clone(&o_conv);
7393 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7394 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
7395 return (long)ret_conv;
7398 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
7399 LDKDecodeError e_conv;
7400 e_conv.inner = (void*)(e & (~1));
7401 e_conv.is_owned = (e & 1) || (e == 0);
7402 e_conv = DecodeError_clone(&e_conv);
7403 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7404 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
7405 return (long)ret_conv;
7408 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
7409 if ((_res & 1) != 0) return;
7410 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
7412 CResult_InitDecodeErrorZ_free(_res_conv);
7415 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
7416 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
7417 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7418 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
7419 return (long)ret_conv;
7422 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
7423 LDKOpenChannel o_conv;
7424 o_conv.inner = (void*)(o & (~1));
7425 o_conv.is_owned = (o & 1) || (o == 0);
7426 o_conv = OpenChannel_clone(&o_conv);
7427 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
7428 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
7429 return (long)ret_conv;
7432 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
7433 LDKDecodeError e_conv;
7434 e_conv.inner = (void*)(e & (~1));
7435 e_conv.is_owned = (e & 1) || (e == 0);
7436 e_conv = DecodeError_clone(&e_conv);
7437 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
7438 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
7439 return (long)ret_conv;
7442 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
7443 if ((_res & 1) != 0) return;
7444 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
7446 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
7449 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
7450 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
7451 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
7452 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
7453 return (long)ret_conv;
7456 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
7457 LDKRevokeAndACK o_conv;
7458 o_conv.inner = (void*)(o & (~1));
7459 o_conv.is_owned = (o & 1) || (o == 0);
7460 o_conv = RevokeAndACK_clone(&o_conv);
7461 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
7462 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
7463 return (long)ret_conv;
7466 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
7467 LDKDecodeError e_conv;
7468 e_conv.inner = (void*)(e & (~1));
7469 e_conv.is_owned = (e & 1) || (e == 0);
7470 e_conv = DecodeError_clone(&e_conv);
7471 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
7472 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
7473 return (long)ret_conv;
7476 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
7477 if ((_res & 1) != 0) return;
7478 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
7480 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
7483 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
7484 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
7485 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
7486 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
7487 return (long)ret_conv;
7490 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
7492 o_conv.inner = (void*)(o & (~1));
7493 o_conv.is_owned = (o & 1) || (o == 0);
7494 o_conv = Shutdown_clone(&o_conv);
7495 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
7496 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
7497 return (long)ret_conv;
7500 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
7501 LDKDecodeError e_conv;
7502 e_conv.inner = (void*)(e & (~1));
7503 e_conv.is_owned = (e & 1) || (e == 0);
7504 e_conv = DecodeError_clone(&e_conv);
7505 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
7506 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
7507 return (long)ret_conv;
7510 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
7511 if ((_res & 1) != 0) return;
7512 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
7514 CResult_ShutdownDecodeErrorZ_free(_res_conv);
7517 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
7518 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
7519 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
7520 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
7521 return (long)ret_conv;
7524 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
7525 LDKUpdateFailHTLC o_conv;
7526 o_conv.inner = (void*)(o & (~1));
7527 o_conv.is_owned = (o & 1) || (o == 0);
7528 o_conv = UpdateFailHTLC_clone(&o_conv);
7529 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
7530 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
7531 return (long)ret_conv;
7534 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
7535 LDKDecodeError e_conv;
7536 e_conv.inner = (void*)(e & (~1));
7537 e_conv.is_owned = (e & 1) || (e == 0);
7538 e_conv = DecodeError_clone(&e_conv);
7539 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
7540 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
7541 return (long)ret_conv;
7544 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
7545 if ((_res & 1) != 0) return;
7546 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
7548 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
7551 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
7552 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
7553 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
7554 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
7555 return (long)ret_conv;
7558 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
7559 LDKUpdateFailMalformedHTLC o_conv;
7560 o_conv.inner = (void*)(o & (~1));
7561 o_conv.is_owned = (o & 1) || (o == 0);
7562 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
7563 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
7564 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
7565 return (long)ret_conv;
7568 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
7569 LDKDecodeError e_conv;
7570 e_conv.inner = (void*)(e & (~1));
7571 e_conv.is_owned = (e & 1) || (e == 0);
7572 e_conv = DecodeError_clone(&e_conv);
7573 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
7574 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
7575 return (long)ret_conv;
7578 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
7579 if ((_res & 1) != 0) return;
7580 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
7582 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
7585 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
7586 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
7587 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
7588 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
7589 return (long)ret_conv;
7592 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
7593 LDKUpdateFee o_conv;
7594 o_conv.inner = (void*)(o & (~1));
7595 o_conv.is_owned = (o & 1) || (o == 0);
7596 o_conv = UpdateFee_clone(&o_conv);
7597 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
7598 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
7599 return (long)ret_conv;
7602 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
7603 LDKDecodeError e_conv;
7604 e_conv.inner = (void*)(e & (~1));
7605 e_conv.is_owned = (e & 1) || (e == 0);
7606 e_conv = DecodeError_clone(&e_conv);
7607 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
7608 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
7609 return (long)ret_conv;
7612 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
7613 if ((_res & 1) != 0) return;
7614 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
7616 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
7619 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
7620 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
7621 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
7622 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
7623 return (long)ret_conv;
7626 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
7627 LDKUpdateFulfillHTLC o_conv;
7628 o_conv.inner = (void*)(o & (~1));
7629 o_conv.is_owned = (o & 1) || (o == 0);
7630 o_conv = UpdateFulfillHTLC_clone(&o_conv);
7631 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
7632 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
7633 return (long)ret_conv;
7636 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
7637 LDKDecodeError e_conv;
7638 e_conv.inner = (void*)(e & (~1));
7639 e_conv.is_owned = (e & 1) || (e == 0);
7640 e_conv = DecodeError_clone(&e_conv);
7641 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
7642 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
7643 return (long)ret_conv;
7646 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
7647 if ((_res & 1) != 0) return;
7648 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
7650 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
7653 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
7654 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
7655 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
7656 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
7657 return (long)ret_conv;
7660 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
7661 LDKUpdateAddHTLC o_conv;
7662 o_conv.inner = (void*)(o & (~1));
7663 o_conv.is_owned = (o & 1) || (o == 0);
7664 o_conv = UpdateAddHTLC_clone(&o_conv);
7665 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
7666 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
7667 return (long)ret_conv;
7670 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
7671 LDKDecodeError e_conv;
7672 e_conv.inner = (void*)(e & (~1));
7673 e_conv.is_owned = (e & 1) || (e == 0);
7674 e_conv = DecodeError_clone(&e_conv);
7675 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
7676 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
7677 return (long)ret_conv;
7680 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
7681 if ((_res & 1) != 0) return;
7682 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
7684 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
7687 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
7688 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
7689 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
7690 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
7691 return (long)ret_conv;
7694 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
7696 o_conv.inner = (void*)(o & (~1));
7697 o_conv.is_owned = (o & 1) || (o == 0);
7698 o_conv = Ping_clone(&o_conv);
7699 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
7700 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
7701 return (long)ret_conv;
7704 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
7705 LDKDecodeError e_conv;
7706 e_conv.inner = (void*)(e & (~1));
7707 e_conv.is_owned = (e & 1) || (e == 0);
7708 e_conv = DecodeError_clone(&e_conv);
7709 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
7710 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
7711 return (long)ret_conv;
7714 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
7715 if ((_res & 1) != 0) return;
7716 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
7718 CResult_PingDecodeErrorZ_free(_res_conv);
7721 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
7722 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
7723 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
7724 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
7725 return (long)ret_conv;
7728 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
7730 o_conv.inner = (void*)(o & (~1));
7731 o_conv.is_owned = (o & 1) || (o == 0);
7732 o_conv = Pong_clone(&o_conv);
7733 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
7734 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
7735 return (long)ret_conv;
7738 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
7739 LDKDecodeError e_conv;
7740 e_conv.inner = (void*)(e & (~1));
7741 e_conv.is_owned = (e & 1) || (e == 0);
7742 e_conv = DecodeError_clone(&e_conv);
7743 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
7744 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
7745 return (long)ret_conv;
7748 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
7749 if ((_res & 1) != 0) return;
7750 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
7752 CResult_PongDecodeErrorZ_free(_res_conv);
7755 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
7756 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
7757 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
7758 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
7759 return (long)ret_conv;
7762 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
7763 LDKUnsignedChannelAnnouncement o_conv;
7764 o_conv.inner = (void*)(o & (~1));
7765 o_conv.is_owned = (o & 1) || (o == 0);
7766 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
7767 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
7768 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
7769 return (long)ret_conv;
7772 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
7773 LDKDecodeError e_conv;
7774 e_conv.inner = (void*)(e & (~1));
7775 e_conv.is_owned = (e & 1) || (e == 0);
7776 e_conv = DecodeError_clone(&e_conv);
7777 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
7778 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
7779 return (long)ret_conv;
7782 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
7783 if ((_res & 1) != 0) return;
7784 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
7786 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
7789 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
7790 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
7791 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
7792 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
7793 return (long)ret_conv;
7796 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
7797 LDKChannelAnnouncement o_conv;
7798 o_conv.inner = (void*)(o & (~1));
7799 o_conv.is_owned = (o & 1) || (o == 0);
7800 o_conv = ChannelAnnouncement_clone(&o_conv);
7801 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
7802 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
7803 return (long)ret_conv;
7806 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
7807 LDKDecodeError e_conv;
7808 e_conv.inner = (void*)(e & (~1));
7809 e_conv.is_owned = (e & 1) || (e == 0);
7810 e_conv = DecodeError_clone(&e_conv);
7811 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
7812 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
7813 return (long)ret_conv;
7816 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
7817 if ((_res & 1) != 0) return;
7818 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
7820 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
7823 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
7824 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
7825 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
7826 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
7827 return (long)ret_conv;
7830 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
7831 LDKUnsignedChannelUpdate o_conv;
7832 o_conv.inner = (void*)(o & (~1));
7833 o_conv.is_owned = (o & 1) || (o == 0);
7834 o_conv = UnsignedChannelUpdate_clone(&o_conv);
7835 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
7836 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
7837 return (long)ret_conv;
7840 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
7841 LDKDecodeError e_conv;
7842 e_conv.inner = (void*)(e & (~1));
7843 e_conv.is_owned = (e & 1) || (e == 0);
7844 e_conv = DecodeError_clone(&e_conv);
7845 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
7846 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
7847 return (long)ret_conv;
7850 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
7851 if ((_res & 1) != 0) return;
7852 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
7854 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
7857 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
7858 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
7859 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
7860 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
7861 return (long)ret_conv;
7864 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
7865 LDKChannelUpdate o_conv;
7866 o_conv.inner = (void*)(o & (~1));
7867 o_conv.is_owned = (o & 1) || (o == 0);
7868 o_conv = ChannelUpdate_clone(&o_conv);
7869 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
7870 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
7871 return (long)ret_conv;
7874 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
7875 LDKDecodeError e_conv;
7876 e_conv.inner = (void*)(e & (~1));
7877 e_conv.is_owned = (e & 1) || (e == 0);
7878 e_conv = DecodeError_clone(&e_conv);
7879 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
7880 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
7881 return (long)ret_conv;
7884 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
7885 if ((_res & 1) != 0) return;
7886 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
7888 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
7891 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
7892 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
7893 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
7894 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
7895 return (long)ret_conv;
7898 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
7899 LDKErrorMessage o_conv;
7900 o_conv.inner = (void*)(o & (~1));
7901 o_conv.is_owned = (o & 1) || (o == 0);
7902 o_conv = ErrorMessage_clone(&o_conv);
7903 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
7904 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
7905 return (long)ret_conv;
7908 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
7909 LDKDecodeError e_conv;
7910 e_conv.inner = (void*)(e & (~1));
7911 e_conv.is_owned = (e & 1) || (e == 0);
7912 e_conv = DecodeError_clone(&e_conv);
7913 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
7914 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
7915 return (long)ret_conv;
7918 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
7919 if ((_res & 1) != 0) return;
7920 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
7922 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
7925 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
7926 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
7927 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
7928 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
7929 return (long)ret_conv;
7932 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
7933 LDKUnsignedNodeAnnouncement o_conv;
7934 o_conv.inner = (void*)(o & (~1));
7935 o_conv.is_owned = (o & 1) || (o == 0);
7936 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
7937 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
7938 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
7939 return (long)ret_conv;
7942 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
7943 LDKDecodeError e_conv;
7944 e_conv.inner = (void*)(e & (~1));
7945 e_conv.is_owned = (e & 1) || (e == 0);
7946 e_conv = DecodeError_clone(&e_conv);
7947 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
7948 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
7949 return (long)ret_conv;
7952 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
7953 if ((_res & 1) != 0) return;
7954 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
7956 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
7959 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
7960 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
7961 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
7962 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
7963 return (long)ret_conv;
7966 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
7967 LDKNodeAnnouncement o_conv;
7968 o_conv.inner = (void*)(o & (~1));
7969 o_conv.is_owned = (o & 1) || (o == 0);
7970 o_conv = NodeAnnouncement_clone(&o_conv);
7971 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
7972 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
7973 return (long)ret_conv;
7976 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
7977 LDKDecodeError e_conv;
7978 e_conv.inner = (void*)(e & (~1));
7979 e_conv.is_owned = (e & 1) || (e == 0);
7980 e_conv = DecodeError_clone(&e_conv);
7981 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
7982 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
7983 return (long)ret_conv;
7986 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
7987 if ((_res & 1) != 0) return;
7988 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
7990 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
7993 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
7994 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
7995 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
7996 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
7997 return (long)ret_conv;
8000 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
8001 LDKQueryShortChannelIds o_conv;
8002 o_conv.inner = (void*)(o & (~1));
8003 o_conv.is_owned = (o & 1) || (o == 0);
8004 o_conv = QueryShortChannelIds_clone(&o_conv);
8005 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8006 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
8007 return (long)ret_conv;
8010 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
8011 LDKDecodeError e_conv;
8012 e_conv.inner = (void*)(e & (~1));
8013 e_conv.is_owned = (e & 1) || (e == 0);
8014 e_conv = DecodeError_clone(&e_conv);
8015 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8016 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
8017 return (long)ret_conv;
8020 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
8021 if ((_res & 1) != 0) return;
8022 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
8024 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
8027 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
8028 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
8029 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8030 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
8031 return (long)ret_conv;
8034 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
8035 LDKReplyShortChannelIdsEnd o_conv;
8036 o_conv.inner = (void*)(o & (~1));
8037 o_conv.is_owned = (o & 1) || (o == 0);
8038 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
8039 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8040 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
8041 return (long)ret_conv;
8044 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
8045 LDKDecodeError e_conv;
8046 e_conv.inner = (void*)(e & (~1));
8047 e_conv.is_owned = (e & 1) || (e == 0);
8048 e_conv = DecodeError_clone(&e_conv);
8049 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8050 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
8051 return (long)ret_conv;
8054 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
8055 if ((_res & 1) != 0) return;
8056 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
8058 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
8061 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
8062 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
8063 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8064 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
8065 return (long)ret_conv;
8068 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
8069 LDKQueryChannelRange o_conv;
8070 o_conv.inner = (void*)(o & (~1));
8071 o_conv.is_owned = (o & 1) || (o == 0);
8072 o_conv = QueryChannelRange_clone(&o_conv);
8073 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8074 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
8075 return (long)ret_conv;
8078 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
8079 LDKDecodeError e_conv;
8080 e_conv.inner = (void*)(e & (~1));
8081 e_conv.is_owned = (e & 1) || (e == 0);
8082 e_conv = DecodeError_clone(&e_conv);
8083 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8084 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
8085 return (long)ret_conv;
8088 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
8089 if ((_res & 1) != 0) return;
8090 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8092 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
8095 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
8096 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
8097 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8098 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
8099 return (long)ret_conv;
8102 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
8103 LDKReplyChannelRange o_conv;
8104 o_conv.inner = (void*)(o & (~1));
8105 o_conv.is_owned = (o & 1) || (o == 0);
8106 o_conv = ReplyChannelRange_clone(&o_conv);
8107 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8108 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
8109 return (long)ret_conv;
8112 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
8113 LDKDecodeError e_conv;
8114 e_conv.inner = (void*)(e & (~1));
8115 e_conv.is_owned = (e & 1) || (e == 0);
8116 e_conv = DecodeError_clone(&e_conv);
8117 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8118 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
8119 return (long)ret_conv;
8122 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
8123 if ((_res & 1) != 0) return;
8124 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8126 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
8129 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
8130 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
8131 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8132 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
8133 return (long)ret_conv;
8136 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
8137 LDKGossipTimestampFilter o_conv;
8138 o_conv.inner = (void*)(o & (~1));
8139 o_conv.is_owned = (o & 1) || (o == 0);
8140 o_conv = GossipTimestampFilter_clone(&o_conv);
8141 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8142 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
8143 return (long)ret_conv;
8146 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
8147 LDKDecodeError e_conv;
8148 e_conv.inner = (void*)(e & (~1));
8149 e_conv.is_owned = (e & 1) || (e == 0);
8150 e_conv = DecodeError_clone(&e_conv);
8151 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8152 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
8153 return (long)ret_conv;
8156 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
8157 if ((_res & 1) != 0) return;
8158 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
8160 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
8163 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
8164 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
8165 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8166 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
8167 return (long)ret_conv;
8170 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
8171 if ((this_ptr & 1) != 0) return;
8172 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
8173 FREE((void*)this_ptr);
8174 Event_free(this_ptr_conv);
8177 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
8178 LDKEvent* orig_conv = (LDKEvent*)orig;
8179 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
8180 *ret_copy = Event_clone(orig_conv);
8181 long ret_ref = (long)ret_copy;
8185 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
8186 LDKEvent* obj_conv = (LDKEvent*)obj;
8187 LDKCVec_u8Z arg_var = Event_write(obj_conv);
8188 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
8189 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
8190 CVec_u8Z_free(arg_var);
8194 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
8195 if ((this_ptr & 1) != 0) return;
8196 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
8197 FREE((void*)this_ptr);
8198 MessageSendEvent_free(this_ptr_conv);
8201 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
8202 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
8203 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
8204 *ret_copy = MessageSendEvent_clone(orig_conv);
8205 long ret_ref = (long)ret_copy;
8209 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
8210 if ((this_ptr & 1) != 0) return;
8211 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
8212 FREE((void*)this_ptr);
8213 MessageSendEventsProvider_free(this_ptr_conv);
8216 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
8217 if ((this_ptr & 1) != 0) return;
8218 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
8219 FREE((void*)this_ptr);
8220 EventsProvider_free(this_ptr_conv);
8223 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
8224 if ((this_ptr & 1) != 0) return;
8225 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
8226 FREE((void*)this_ptr);
8227 APIError_free(this_ptr_conv);
8230 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
8231 LDKAPIError* orig_conv = (LDKAPIError*)orig;
8232 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
8233 *ret_copy = APIError_clone(orig_conv);
8234 long ret_ref = (long)ret_copy;
8238 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
8239 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
8240 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
8244 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
8245 uint32_t ret_conv = LDKLevel_to_js(Level_max());
8249 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
8250 if ((this_ptr & 1) != 0) return;
8251 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
8252 FREE((void*)this_ptr);
8253 Logger_free(this_ptr_conv);
8256 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_ptr) {
8257 LDKChannelHandshakeConfig this_ptr_conv;
8258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8259 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8260 ChannelHandshakeConfig_free(this_ptr_conv);
8263 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
8264 LDKChannelHandshakeConfig this_ptr_conv;
8265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8266 this_ptr_conv.is_owned = false;
8267 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
8271 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
8272 LDKChannelHandshakeConfig this_ptr_conv;
8273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8274 this_ptr_conv.is_owned = false;
8275 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
8278 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
8279 LDKChannelHandshakeConfig this_ptr_conv;
8280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8281 this_ptr_conv.is_owned = false;
8282 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
8286 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
8287 LDKChannelHandshakeConfig this_ptr_conv;
8288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8289 this_ptr_conv.is_owned = false;
8290 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
8293 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
8294 LDKChannelHandshakeConfig this_ptr_conv;
8295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8296 this_ptr_conv.is_owned = false;
8297 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
8301 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
8302 LDKChannelHandshakeConfig this_ptr_conv;
8303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8304 this_ptr_conv.is_owned = false;
8305 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
8308 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) {
8309 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
8310 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8311 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8312 long ret_ref = (long)ret_var.inner;
8313 if (ret_var.is_owned) {
8319 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
8320 LDKChannelHandshakeConfig orig_conv;
8321 orig_conv.inner = (void*)(orig & (~1));
8322 orig_conv.is_owned = false;
8323 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
8324 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8325 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8326 long ret_ref = (long)ret_var.inner;
8327 if (ret_var.is_owned) {
8333 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
8334 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
8335 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8336 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8337 long ret_ref = (long)ret_var.inner;
8338 if (ret_var.is_owned) {
8344 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_ptr) {
8345 LDKChannelHandshakeLimits this_ptr_conv;
8346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8348 ChannelHandshakeLimits_free(this_ptr_conv);
8351 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
8352 LDKChannelHandshakeLimits this_ptr_conv;
8353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8354 this_ptr_conv.is_owned = false;
8355 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
8359 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
8360 LDKChannelHandshakeLimits this_ptr_conv;
8361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8362 this_ptr_conv.is_owned = false;
8363 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
8366 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
8367 LDKChannelHandshakeLimits this_ptr_conv;
8368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8369 this_ptr_conv.is_owned = false;
8370 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
8374 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
8375 LDKChannelHandshakeLimits this_ptr_conv;
8376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8377 this_ptr_conv.is_owned = false;
8378 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
8381 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
8382 LDKChannelHandshakeLimits this_ptr_conv;
8383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8384 this_ptr_conv.is_owned = false;
8385 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
8389 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
8390 LDKChannelHandshakeLimits this_ptr_conv;
8391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8392 this_ptr_conv.is_owned = false;
8393 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8396 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
8397 LDKChannelHandshakeLimits this_ptr_conv;
8398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8399 this_ptr_conv.is_owned = false;
8400 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
8404 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
8405 LDKChannelHandshakeLimits this_ptr_conv;
8406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8407 this_ptr_conv.is_owned = false;
8408 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
8411 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
8412 LDKChannelHandshakeLimits this_ptr_conv;
8413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8414 this_ptr_conv.is_owned = false;
8415 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
8419 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
8420 LDKChannelHandshakeLimits this_ptr_conv;
8421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8422 this_ptr_conv.is_owned = false;
8423 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
8426 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_dust_limit_satoshis(uint32_t this_ptr) {
8427 LDKChannelHandshakeLimits this_ptr_conv;
8428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8429 this_ptr_conv.is_owned = false;
8430 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
8434 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
8435 LDKChannelHandshakeLimits this_ptr_conv;
8436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8437 this_ptr_conv.is_owned = false;
8438 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
8441 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_dust_limit_satoshis(uint32_t this_ptr) {
8442 LDKChannelHandshakeLimits this_ptr_conv;
8443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8444 this_ptr_conv.is_owned = false;
8445 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
8449 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
8450 LDKChannelHandshakeLimits this_ptr_conv;
8451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8452 this_ptr_conv.is_owned = false;
8453 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
8456 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
8457 LDKChannelHandshakeLimits this_ptr_conv;
8458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8459 this_ptr_conv.is_owned = false;
8460 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
8464 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
8465 LDKChannelHandshakeLimits this_ptr_conv;
8466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8467 this_ptr_conv.is_owned = false;
8468 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
8471 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
8472 LDKChannelHandshakeLimits this_ptr_conv;
8473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8474 this_ptr_conv.is_owned = false;
8475 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
8479 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
8480 LDKChannelHandshakeLimits this_ptr_conv;
8481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8482 this_ptr_conv.is_owned = false;
8483 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
8486 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
8487 LDKChannelHandshakeLimits this_ptr_conv;
8488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8489 this_ptr_conv.is_owned = false;
8490 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
8494 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
8495 LDKChannelHandshakeLimits this_ptr_conv;
8496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8497 this_ptr_conv.is_owned = false;
8498 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
8501 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) {
8502 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);
8503 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8504 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8505 long ret_ref = (long)ret_var.inner;
8506 if (ret_var.is_owned) {
8512 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
8513 LDKChannelHandshakeLimits orig_conv;
8514 orig_conv.inner = (void*)(orig & (~1));
8515 orig_conv.is_owned = false;
8516 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
8517 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8518 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8519 long ret_ref = (long)ret_var.inner;
8520 if (ret_var.is_owned) {
8526 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
8527 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
8528 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8529 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8530 long ret_ref = (long)ret_var.inner;
8531 if (ret_var.is_owned) {
8537 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_ptr) {
8538 LDKChannelConfig this_ptr_conv;
8539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8540 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8541 ChannelConfig_free(this_ptr_conv);
8544 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_fee_proportional_millionths(uint32_t this_ptr) {
8545 LDKChannelConfig this_ptr_conv;
8546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8547 this_ptr_conv.is_owned = false;
8548 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
8552 void __attribute__((visibility("default"))) TS_ChannelConfig_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
8553 LDKChannelConfig this_ptr_conv;
8554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8555 this_ptr_conv.is_owned = false;
8556 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
8559 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
8560 LDKChannelConfig this_ptr_conv;
8561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8562 this_ptr_conv.is_owned = false;
8563 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
8567 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
8568 LDKChannelConfig this_ptr_conv;
8569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8570 this_ptr_conv.is_owned = false;
8571 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
8574 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
8575 LDKChannelConfig this_ptr_conv;
8576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8577 this_ptr_conv.is_owned = false;
8578 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
8582 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
8583 LDKChannelConfig this_ptr_conv;
8584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8585 this_ptr_conv.is_owned = false;
8586 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
8589 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_new(int32_t fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
8590 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
8591 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8592 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8593 long ret_ref = (long)ret_var.inner;
8594 if (ret_var.is_owned) {
8600 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
8601 LDKChannelConfig orig_conv;
8602 orig_conv.inner = (void*)(orig & (~1));
8603 orig_conv.is_owned = false;
8604 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
8605 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8606 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8607 long ret_ref = (long)ret_var.inner;
8608 if (ret_var.is_owned) {
8614 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
8615 LDKChannelConfig ret_var = ChannelConfig_default();
8616 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8617 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8618 long ret_ref = (long)ret_var.inner;
8619 if (ret_var.is_owned) {
8625 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
8626 LDKChannelConfig obj_conv;
8627 obj_conv.inner = (void*)(obj & (~1));
8628 obj_conv.is_owned = false;
8629 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
8630 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
8631 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
8632 CVec_u8Z_free(arg_var);
8636 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
8638 ser_ref.datalen = *((uint32_t*)ser);
8639 ser_ref.data = (int8_t*)(ser + 4);
8640 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8641 *ret_conv = ChannelConfig_read(ser_ref);
8642 return (long)ret_conv;
8645 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_ptr) {
8646 LDKUserConfig this_ptr_conv;
8647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8648 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8649 UserConfig_free(this_ptr_conv);
8652 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
8653 LDKUserConfig this_ptr_conv;
8654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8655 this_ptr_conv.is_owned = false;
8656 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
8657 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8658 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8659 long ret_ref = (long)ret_var.inner;
8660 if (ret_var.is_owned) {
8666 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
8667 LDKUserConfig this_ptr_conv;
8668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8669 this_ptr_conv.is_owned = false;
8670 LDKChannelHandshakeConfig val_conv;
8671 val_conv.inner = (void*)(val & (~1));
8672 val_conv.is_owned = (val & 1) || (val == 0);
8673 val_conv = ChannelHandshakeConfig_clone(&val_conv);
8674 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
8677 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
8678 LDKUserConfig this_ptr_conv;
8679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8680 this_ptr_conv.is_owned = false;
8681 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
8682 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8683 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8684 long ret_ref = (long)ret_var.inner;
8685 if (ret_var.is_owned) {
8691 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
8692 LDKUserConfig this_ptr_conv;
8693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8694 this_ptr_conv.is_owned = false;
8695 LDKChannelHandshakeLimits val_conv;
8696 val_conv.inner = (void*)(val & (~1));
8697 val_conv.is_owned = (val & 1) || (val == 0);
8698 val_conv = ChannelHandshakeLimits_clone(&val_conv);
8699 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
8702 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
8703 LDKUserConfig this_ptr_conv;
8704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8705 this_ptr_conv.is_owned = false;
8706 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
8707 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8708 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8709 long ret_ref = (long)ret_var.inner;
8710 if (ret_var.is_owned) {
8716 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
8717 LDKUserConfig this_ptr_conv;
8718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8719 this_ptr_conv.is_owned = false;
8720 LDKChannelConfig val_conv;
8721 val_conv.inner = (void*)(val & (~1));
8722 val_conv.is_owned = (val & 1) || (val == 0);
8723 val_conv = ChannelConfig_clone(&val_conv);
8724 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
8727 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) {
8728 LDKChannelHandshakeConfig own_channel_config_arg_conv;
8729 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
8730 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
8731 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
8732 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
8733 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
8734 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
8735 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
8736 LDKChannelConfig channel_options_arg_conv;
8737 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
8738 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
8739 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
8740 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
8741 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8742 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8743 long ret_ref = (long)ret_var.inner;
8744 if (ret_var.is_owned) {
8750 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
8751 LDKUserConfig orig_conv;
8752 orig_conv.inner = (void*)(orig & (~1));
8753 orig_conv.is_owned = false;
8754 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
8755 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8756 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8757 long ret_ref = (long)ret_var.inner;
8758 if (ret_var.is_owned) {
8764 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
8765 LDKUserConfig ret_var = UserConfig_default();
8766 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8767 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8768 long ret_ref = (long)ret_var.inner;
8769 if (ret_var.is_owned) {
8775 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
8776 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
8777 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
8781 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
8782 if ((this_ptr & 1) != 0) return;
8783 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
8784 FREE((void*)this_ptr);
8785 Access_free(this_ptr_conv);
8788 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
8789 if ((this_ptr & 1) != 0) return;
8790 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
8791 FREE((void*)this_ptr);
8792 Watch_free(this_ptr_conv);
8795 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
8796 if ((this_ptr & 1) != 0) return;
8797 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
8798 FREE((void*)this_ptr);
8799 Filter_free(this_ptr_conv);
8802 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
8803 if ((this_ptr & 1) != 0) return;
8804 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
8805 FREE((void*)this_ptr);
8806 BroadcasterInterface_free(this_ptr_conv);
8809 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
8810 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
8811 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
8815 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
8816 if ((this_ptr & 1) != 0) return;
8817 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
8818 FREE((void*)this_ptr);
8819 FeeEstimator_free(this_ptr_conv);
8822 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_ptr) {
8823 LDKChainMonitor this_ptr_conv;
8824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8825 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8826 ChainMonitor_free(this_ptr_conv);
8829 void __attribute__((visibility("default"))) TS_ChainMonitor_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
8830 LDKChainMonitor this_arg_conv;
8831 this_arg_conv.inner = (void*)(this_arg & (~1));
8832 this_arg_conv.is_owned = false;
8833 unsigned char header_arr[80];
8834 CHECK(*((uint32_t*)header) == 80);
8835 memcpy(header_arr, (uint8_t*)(header + 4), 80);
8836 unsigned char (*header_ref)[80] = &header_arr;
8837 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8838 txdata_constr.datalen = *((uint32_t*)txdata);
8839 if (txdata_constr.datalen > 0)
8840 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8842 txdata_constr.data = NULL;
8843 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
8844 for (size_t e = 0; e < txdata_constr.datalen; e++) {
8845 uint32_t arr_conv_30 = txdata_vals[e];
8846 LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_30) & ~1);
8847 FREE((void*)arr_conv_30);
8848 txdata_constr.data[e] = arr_conv_30_conv;
8850 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
8853 void __attribute__((visibility("default"))) TS_ChainMonitor_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t disconnected_height) {
8854 LDKChainMonitor this_arg_conv;
8855 this_arg_conv.inner = (void*)(this_arg & (~1));
8856 this_arg_conv.is_owned = false;
8857 unsigned char header_arr[80];
8858 CHECK(*((uint32_t*)header) == 80);
8859 memcpy(header_arr, (uint8_t*)(header + 4), 80);
8860 unsigned char (*header_ref)[80] = &header_arr;
8861 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
8864 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
8865 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
8866 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
8867 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
8868 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
8869 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
8870 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
8871 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8872 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8873 long ret_ref = (long)ret_var.inner;
8874 if (ret_var.is_owned) {
8880 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
8881 LDKChainMonitor this_arg_conv;
8882 this_arg_conv.inner = (void*)(this_arg & (~1));
8883 this_arg_conv.is_owned = false;
8884 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
8885 *ret = ChainMonitor_as_Watch(&this_arg_conv);
8889 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
8890 LDKChainMonitor this_arg_conv;
8891 this_arg_conv.inner = (void*)(this_arg & (~1));
8892 this_arg_conv.is_owned = false;
8893 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8894 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
8898 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_ptr) {
8899 LDKChannelMonitorUpdate this_ptr_conv;
8900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8901 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8902 ChannelMonitorUpdate_free(this_ptr_conv);
8905 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
8906 LDKChannelMonitorUpdate this_ptr_conv;
8907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8908 this_ptr_conv.is_owned = false;
8909 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
8913 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
8914 LDKChannelMonitorUpdate this_ptr_conv;
8915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8916 this_ptr_conv.is_owned = false;
8917 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
8920 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
8921 LDKChannelMonitorUpdate orig_conv;
8922 orig_conv.inner = (void*)(orig & (~1));
8923 orig_conv.is_owned = false;
8924 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
8925 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8926 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8927 long ret_ref = (long)ret_var.inner;
8928 if (ret_var.is_owned) {
8934 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
8935 LDKChannelMonitorUpdate obj_conv;
8936 obj_conv.inner = (void*)(obj & (~1));
8937 obj_conv.is_owned = false;
8938 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
8939 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
8940 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
8941 CVec_u8Z_free(arg_var);
8945 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
8947 ser_ref.datalen = *((uint32_t*)ser);
8948 ser_ref.data = (int8_t*)(ser + 4);
8949 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
8950 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
8951 return (long)ret_conv;
8954 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
8955 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
8956 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
8960 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_ptr) {
8961 LDKMonitorUpdateError this_ptr_conv;
8962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8963 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8964 MonitorUpdateError_free(this_ptr_conv);
8967 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
8968 LDKMonitorUpdateError orig_conv;
8969 orig_conv.inner = (void*)(orig & (~1));
8970 orig_conv.is_owned = false;
8971 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
8972 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8973 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8974 long ret_ref = (long)ret_var.inner;
8975 if (ret_var.is_owned) {
8981 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
8982 LDKMonitorEvent this_ptr_conv;
8983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8984 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8985 MonitorEvent_free(this_ptr_conv);
8988 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
8989 LDKMonitorEvent orig_conv;
8990 orig_conv.inner = (void*)(orig & (~1));
8991 orig_conv.is_owned = false;
8992 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
8993 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8994 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8995 long ret_ref = (long)ret_var.inner;
8996 if (ret_var.is_owned) {
9002 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_ptr) {
9003 LDKHTLCUpdate this_ptr_conv;
9004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9005 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9006 HTLCUpdate_free(this_ptr_conv);
9009 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
9010 LDKHTLCUpdate orig_conv;
9011 orig_conv.inner = (void*)(orig & (~1));
9012 orig_conv.is_owned = false;
9013 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
9014 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9015 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9016 long ret_ref = (long)ret_var.inner;
9017 if (ret_var.is_owned) {
9023 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
9024 LDKHTLCUpdate obj_conv;
9025 obj_conv.inner = (void*)(obj & (~1));
9026 obj_conv.is_owned = false;
9027 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
9028 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9029 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
9030 CVec_u8Z_free(arg_var);
9034 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
9036 ser_ref.datalen = *((uint32_t*)ser);
9037 ser_ref.data = (int8_t*)(ser + 4);
9038 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9039 *ret_conv = HTLCUpdate_read(ser_ref);
9040 return (long)ret_conv;
9043 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_ptr) {
9044 LDKChannelMonitor this_ptr_conv;
9045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9046 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9047 ChannelMonitor_free(this_ptr_conv);
9050 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
9051 LDKChannelMonitor orig_conv;
9052 orig_conv.inner = (void*)(orig & (~1));
9053 orig_conv.is_owned = false;
9054 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
9055 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9056 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9057 long ret_ref = (long)ret_var.inner;
9058 if (ret_var.is_owned) {
9064 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
9065 LDKChannelMonitor obj_conv;
9066 obj_conv.inner = (void*)(obj & (~1));
9067 obj_conv.is_owned = false;
9068 LDKCVec_u8Z arg_var = ChannelMonitor_write(&obj_conv);
9069 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9070 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
9071 CVec_u8Z_free(arg_var);
9075 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) {
9076 LDKChannelMonitor this_arg_conv;
9077 this_arg_conv.inner = (void*)(this_arg & (~1));
9078 this_arg_conv.is_owned = false;
9079 LDKChannelMonitorUpdate updates_conv;
9080 updates_conv.inner = (void*)(updates & (~1));
9081 updates_conv.is_owned = false;
9082 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
9083 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator;
9084 LDKLogger* logger_conv = (LDKLogger*)logger;
9085 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
9086 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
9087 return (long)ret_conv;
9090 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
9091 LDKChannelMonitor this_arg_conv;
9092 this_arg_conv.inner = (void*)(this_arg & (~1));
9093 this_arg_conv.is_owned = false;
9094 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
9098 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
9099 LDKChannelMonitor this_arg_conv;
9100 this_arg_conv.inner = (void*)(this_arg & (~1));
9101 this_arg_conv.is_owned = false;
9102 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
9103 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
9104 return (long)ret_ref;
9107 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
9108 LDKChannelMonitor this_arg_conv;
9109 this_arg_conv.inner = (void*)(this_arg & (~1));
9110 this_arg_conv.is_owned = false;
9111 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
9112 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9113 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9114 for (size_t o = 0; o < ret_var.datalen; o++) {
9115 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
9116 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9117 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9118 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
9119 if (arr_conv_14_var.is_owned) {
9120 arr_conv_14_ref |= 1;
9122 ret_arr_ptr[o] = arr_conv_14_ref;
9128 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
9129 LDKChannelMonitor this_arg_conv;
9130 this_arg_conv.inner = (void*)(this_arg & (~1));
9131 this_arg_conv.is_owned = false;
9132 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
9133 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9134 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9135 for (size_t h = 0; h < ret_var.datalen; h++) {
9136 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
9137 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
9138 long arr_conv_7_ref = (long)arr_conv_7_copy;
9139 ret_arr_ptr[h] = arr_conv_7_ref;
9145 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
9146 LDKChannelMonitor this_arg_conv;
9147 this_arg_conv.inner = (void*)(this_arg & (~1));
9148 this_arg_conv.is_owned = false;
9149 LDKLogger* logger_conv = (LDKLogger*)logger;
9150 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
9151 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
9152 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
9153 for (size_t m = 0; m < ret_var.datalen; m++) {
9154 LDKTransaction arr_conv_12_var = ret_var.data[m];
9155 int8_tArray arr_conv_12_arr = init_arr(arr_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9156 memcpy((uint8_t*)(arr_conv_12_arr + 4), arr_conv_12_var.data, arr_conv_12_var.datalen);
9157 Transaction_free(arr_conv_12_var);
9158 ret_arr_ptr[m] = arr_conv_12_arr;
9164 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) {
9165 LDKChannelMonitor this_arg_conv;
9166 this_arg_conv.inner = (void*)(this_arg & (~1));
9167 this_arg_conv.is_owned = false;
9168 unsigned char header_arr[80];
9169 CHECK(*((uint32_t*)header) == 80);
9170 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9171 unsigned char (*header_ref)[80] = &header_arr;
9172 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9173 txdata_constr.datalen = *((uint32_t*)txdata);
9174 if (txdata_constr.datalen > 0)
9175 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9177 txdata_constr.data = NULL;
9178 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
9179 for (size_t e = 0; e < txdata_constr.datalen; e++) {
9180 uint32_t arr_conv_30 = txdata_vals[e];
9181 LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_30) & ~1);
9182 FREE((void*)arr_conv_30);
9183 txdata_constr.data[e] = arr_conv_30_conv;
9185 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
9186 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
9187 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9188 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);
9189 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9190 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9191 for (size_t x = 0; x < ret_var.datalen; x++) {
9192 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arr_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
9193 *arr_conv_49_ref = ret_var.data[x];
9194 ret_arr_ptr[x] = (long)arr_conv_49_ref;
9200 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) {
9201 LDKChannelMonitor this_arg_conv;
9202 this_arg_conv.inner = (void*)(this_arg & (~1));
9203 this_arg_conv.is_owned = false;
9204 unsigned char header_arr[80];
9205 CHECK(*((uint32_t*)header) == 80);
9206 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9207 unsigned char (*header_ref)[80] = &header_arr;
9208 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
9209 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
9210 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9211 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
9214 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
9215 if ((this_ptr & 1) != 0) return;
9216 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
9217 FREE((void*)this_ptr);
9218 Persist_free(this_ptr_conv);
9221 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
9223 ser_ref.datalen = *((uint32_t*)ser);
9224 ser_ref.data = (int8_t*)(ser + 4);
9225 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
9226 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
9227 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
9228 return (long)ret_conv;
9231 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_ptr) {
9232 LDKOutPoint this_ptr_conv;
9233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9234 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9235 OutPoint_free(this_ptr_conv);
9238 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
9239 LDKOutPoint this_ptr_conv;
9240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9241 this_ptr_conv.is_owned = false;
9242 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9243 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
9247 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
9248 LDKOutPoint this_ptr_conv;
9249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9250 this_ptr_conv.is_owned = false;
9251 LDKThirtyTwoBytes val_ref;
9252 CHECK(*((uint32_t*)val) == 32);
9253 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
9254 OutPoint_set_txid(&this_ptr_conv, val_ref);
9257 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
9258 LDKOutPoint this_ptr_conv;
9259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9260 this_ptr_conv.is_owned = false;
9261 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
9265 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
9266 LDKOutPoint this_ptr_conv;
9267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9268 this_ptr_conv.is_owned = false;
9269 OutPoint_set_index(&this_ptr_conv, val);
9272 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
9273 LDKThirtyTwoBytes txid_arg_ref;
9274 CHECK(*((uint32_t*)txid_arg) == 32);
9275 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
9276 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
9277 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9278 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9279 long ret_ref = (long)ret_var.inner;
9280 if (ret_var.is_owned) {
9286 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
9287 LDKOutPoint orig_conv;
9288 orig_conv.inner = (void*)(orig & (~1));
9289 orig_conv.is_owned = false;
9290 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
9291 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9292 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9293 long ret_ref = (long)ret_var.inner;
9294 if (ret_var.is_owned) {
9300 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
9301 LDKOutPoint this_arg_conv;
9302 this_arg_conv.inner = (void*)(this_arg & (~1));
9303 this_arg_conv.is_owned = false;
9304 int8_tArray arg_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9305 memcpy((uint8_t*)(arg_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
9309 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
9310 LDKOutPoint obj_conv;
9311 obj_conv.inner = (void*)(obj & (~1));
9312 obj_conv.is_owned = false;
9313 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
9314 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9315 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
9316 CVec_u8Z_free(arg_var);
9320 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
9322 ser_ref.datalen = *((uint32_t*)ser);
9323 ser_ref.data = (int8_t*)(ser + 4);
9324 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9325 *ret_conv = OutPoint_read(ser_ref);
9326 return (long)ret_conv;
9329 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
9330 if ((this_ptr & 1) != 0) return;
9331 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
9332 FREE((void*)this_ptr);
9333 SpendableOutputDescriptor_free(this_ptr_conv);
9336 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
9337 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
9338 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
9339 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
9340 long ret_ref = (long)ret_copy;
9344 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
9345 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
9346 LDKCVec_u8Z arg_var = SpendableOutputDescriptor_write(obj_conv);
9347 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9348 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
9349 CVec_u8Z_free(arg_var);
9353 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
9355 ser_ref.datalen = *((uint32_t*)ser);
9356 ser_ref.data = (int8_t*)(ser + 4);
9357 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9358 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
9359 return (long)ret_conv;
9362 uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_clone(uint32_t orig) {
9363 LDKChannelKeys* orig_conv = (LDKChannelKeys*)orig;
9364 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
9365 *ret = ChannelKeys_clone(orig_conv);
9369 void __attribute__((visibility("default"))) TS_ChannelKeys_free(uint32_t this_ptr) {
9370 if ((this_ptr & 1) != 0) return;
9371 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)(((uint64_t)this_ptr) & ~1);
9372 FREE((void*)this_ptr);
9373 ChannelKeys_free(this_ptr_conv);
9376 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
9377 if ((this_ptr & 1) != 0) return;
9378 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
9379 FREE((void*)this_ptr);
9380 KeysInterface_free(this_ptr_conv);
9383 void __attribute__((visibility("default"))) TS_InMemoryChannelKeys_free(uint32_t this_ptr) {
9384 LDKInMemoryChannelKeys this_ptr_conv;
9385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9386 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9387 InMemoryChannelKeys_free(this_ptr_conv);
9390 int8_tArray __attribute__((visibility("default"))) TS_InMemoryChannelKeys_get_funding_key(uint32_t this_ptr) {
9391 LDKInMemoryChannelKeys this_ptr_conv;
9392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9393 this_ptr_conv.is_owned = false;
9394 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9395 memcpy((uint8_t*)(ret_arr + 4), *InMemoryChannelKeys_get_funding_key(&this_ptr_conv), 32);
9399 void __attribute__((visibility("default"))) TS_InMemoryChannelKeys_set_funding_key(uint32_t this_ptr, int8_tArray val) {
9400 LDKInMemoryChannelKeys this_ptr_conv;
9401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9402 this_ptr_conv.is_owned = false;
9403 LDKSecretKey val_ref;
9404 CHECK(*((uint32_t*)val) == 32);
9405 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
9406 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
9409 int8_tArray __attribute__((visibility("default"))) TS_InMemoryChannelKeys_get_revocation_base_key(uint32_t this_ptr) {
9410 LDKInMemoryChannelKeys this_ptr_conv;
9411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9412 this_ptr_conv.is_owned = false;
9413 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9414 memcpy((uint8_t*)(ret_arr + 4), *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv), 32);
9418 void __attribute__((visibility("default"))) TS_InMemoryChannelKeys_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
9419 LDKInMemoryChannelKeys this_ptr_conv;
9420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9421 this_ptr_conv.is_owned = false;
9422 LDKSecretKey val_ref;
9423 CHECK(*((uint32_t*)val) == 32);
9424 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
9425 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
9428 int8_tArray __attribute__((visibility("default"))) TS_InMemoryChannelKeys_get_payment_key(uint32_t this_ptr) {
9429 LDKInMemoryChannelKeys this_ptr_conv;
9430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9431 this_ptr_conv.is_owned = false;
9432 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9433 memcpy((uint8_t*)(ret_arr + 4), *InMemoryChannelKeys_get_payment_key(&this_ptr_conv), 32);
9437 void __attribute__((visibility("default"))) TS_InMemoryChannelKeys_set_payment_key(uint32_t this_ptr, int8_tArray val) {
9438 LDKInMemoryChannelKeys this_ptr_conv;
9439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9440 this_ptr_conv.is_owned = false;
9441 LDKSecretKey val_ref;
9442 CHECK(*((uint32_t*)val) == 32);
9443 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
9444 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
9447 int8_tArray __attribute__((visibility("default"))) TS_InMemoryChannelKeys_get_delayed_payment_base_key(uint32_t this_ptr) {
9448 LDKInMemoryChannelKeys this_ptr_conv;
9449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9450 this_ptr_conv.is_owned = false;
9451 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9452 memcpy((uint8_t*)(ret_arr + 4), *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv), 32);
9456 void __attribute__((visibility("default"))) TS_InMemoryChannelKeys_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
9457 LDKInMemoryChannelKeys this_ptr_conv;
9458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9459 this_ptr_conv.is_owned = false;
9460 LDKSecretKey val_ref;
9461 CHECK(*((uint32_t*)val) == 32);
9462 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
9463 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
9466 int8_tArray __attribute__((visibility("default"))) TS_InMemoryChannelKeys_get_htlc_base_key(uint32_t this_ptr) {
9467 LDKInMemoryChannelKeys this_ptr_conv;
9468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9469 this_ptr_conv.is_owned = false;
9470 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9471 memcpy((uint8_t*)(ret_arr + 4), *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv), 32);
9475 void __attribute__((visibility("default"))) TS_InMemoryChannelKeys_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
9476 LDKInMemoryChannelKeys this_ptr_conv;
9477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9478 this_ptr_conv.is_owned = false;
9479 LDKSecretKey val_ref;
9480 CHECK(*((uint32_t*)val) == 32);
9481 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
9482 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
9485 int8_tArray __attribute__((visibility("default"))) TS_InMemoryChannelKeys_get_commitment_seed(uint32_t this_ptr) {
9486 LDKInMemoryChannelKeys this_ptr_conv;
9487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9488 this_ptr_conv.is_owned = false;
9489 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9490 memcpy((uint8_t*)(ret_arr + 4), *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv), 32);
9494 void __attribute__((visibility("default"))) TS_InMemoryChannelKeys_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
9495 LDKInMemoryChannelKeys this_ptr_conv;
9496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9497 this_ptr_conv.is_owned = false;
9498 LDKThirtyTwoBytes val_ref;
9499 CHECK(*((uint32_t*)val) == 32);
9500 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
9501 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
9504 uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_clone(uint32_t orig) {
9505 LDKInMemoryChannelKeys orig_conv;
9506 orig_conv.inner = (void*)(orig & (~1));
9507 orig_conv.is_owned = false;
9508 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
9509 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9510 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9511 long ret_ref = (long)ret_var.inner;
9512 if (ret_var.is_owned) {
9518 uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_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, uint32_t key_derivation_params) {
9519 LDKSecretKey funding_key_ref;
9520 CHECK(*((uint32_t*)funding_key) == 32);
9521 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
9522 LDKSecretKey revocation_base_key_ref;
9523 CHECK(*((uint32_t*)revocation_base_key) == 32);
9524 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
9525 LDKSecretKey payment_key_ref;
9526 CHECK(*((uint32_t*)payment_key) == 32);
9527 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
9528 LDKSecretKey delayed_payment_base_key_ref;
9529 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
9530 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
9531 LDKSecretKey htlc_base_key_ref;
9532 CHECK(*((uint32_t*)htlc_base_key) == 32);
9533 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
9534 LDKThirtyTwoBytes commitment_seed_ref;
9535 CHECK(*((uint32_t*)commitment_seed) == 32);
9536 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
9537 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)key_derivation_params) & ~1);
9538 FREE((void*)key_derivation_params);
9539 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_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, key_derivation_params_conv);
9540 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9541 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9542 long ret_ref = (long)ret_var.inner;
9543 if (ret_var.is_owned) {
9549 uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_counterparty_pubkeys(uint32_t this_arg) {
9550 LDKInMemoryChannelKeys this_arg_conv;
9551 this_arg_conv.inner = (void*)(this_arg & (~1));
9552 this_arg_conv.is_owned = false;
9553 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
9554 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9555 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9556 long ret_ref = (long)ret_var.inner;
9557 if (ret_var.is_owned) {
9563 int16_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_counterparty_selected_contest_delay(uint32_t this_arg) {
9564 LDKInMemoryChannelKeys this_arg_conv;
9565 this_arg_conv.inner = (void*)(this_arg & (~1));
9566 this_arg_conv.is_owned = false;
9567 int16_t ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
9571 int16_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_holder_selected_contest_delay(uint32_t this_arg) {
9572 LDKInMemoryChannelKeys this_arg_conv;
9573 this_arg_conv.inner = (void*)(this_arg & (~1));
9574 this_arg_conv.is_owned = false;
9575 int16_t ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
9579 jboolean __attribute__((visibility("default"))) TS_InMemoryChannelKeys_is_outbound(uint32_t this_arg) {
9580 LDKInMemoryChannelKeys this_arg_conv;
9581 this_arg_conv.inner = (void*)(this_arg & (~1));
9582 this_arg_conv.is_owned = false;
9583 jboolean ret_val = InMemoryChannelKeys_is_outbound(&this_arg_conv);
9587 uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_funding_outpoint(uint32_t this_arg) {
9588 LDKInMemoryChannelKeys this_arg_conv;
9589 this_arg_conv.inner = (void*)(this_arg & (~1));
9590 this_arg_conv.is_owned = false;
9591 LDKOutPoint ret_var = InMemoryChannelKeys_funding_outpoint(&this_arg_conv);
9592 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9593 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9594 long ret_ref = (long)ret_var.inner;
9595 if (ret_var.is_owned) {
9601 uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_get_channel_parameters(uint32_t this_arg) {
9602 LDKInMemoryChannelKeys this_arg_conv;
9603 this_arg_conv.inner = (void*)(this_arg & (~1));
9604 this_arg_conv.is_owned = false;
9605 LDKChannelTransactionParameters ret_var = InMemoryChannelKeys_get_channel_parameters(&this_arg_conv);
9606 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9607 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9608 long ret_ref = (long)ret_var.inner;
9609 if (ret_var.is_owned) {
9615 uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_as_ChannelKeys(uint32_t this_arg) {
9616 LDKInMemoryChannelKeys this_arg_conv;
9617 this_arg_conv.inner = (void*)(this_arg & (~1));
9618 this_arg_conv.is_owned = false;
9619 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
9620 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
9624 int8_tArray __attribute__((visibility("default"))) TS_InMemoryChannelKeys_write(uint32_t obj) {
9625 LDKInMemoryChannelKeys obj_conv;
9626 obj_conv.inner = (void*)(obj & (~1));
9627 obj_conv.is_owned = false;
9628 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
9629 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9630 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
9631 CVec_u8Z_free(arg_var);
9635 uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_read(int8_tArray ser) {
9637 ser_ref.datalen = *((uint32_t*)ser);
9638 ser_ref.data = (int8_t*)(ser + 4);
9639 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
9640 *ret_conv = InMemoryChannelKeys_read(ser_ref);
9641 return (long)ret_conv;
9644 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_ptr) {
9645 LDKKeysManager this_ptr_conv;
9646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9647 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9648 KeysManager_free(this_ptr_conv);
9651 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, uint32_t network, int64_t starting_time_secs, int32_t starting_time_nanos) {
9652 unsigned char seed_arr[32];
9653 CHECK(*((uint32_t*)seed) == 32);
9654 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
9655 unsigned char (*seed_ref)[32] = &seed_arr;
9656 LDKNetwork network_conv = LDKNetwork_from_js(network);
9657 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
9658 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9659 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9660 long ret_ref = (long)ret_var.inner;
9661 if (ret_var.is_owned) {
9667 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int64_t params_1, int64_t params_2) {
9668 LDKKeysManager this_arg_conv;
9669 this_arg_conv.inner = (void*)(this_arg & (~1));
9670 this_arg_conv.is_owned = false;
9671 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
9672 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9673 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9674 long ret_ref = (long)ret_var.inner;
9675 if (ret_var.is_owned) {
9681 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
9682 LDKKeysManager this_arg_conv;
9683 this_arg_conv.inner = (void*)(this_arg & (~1));
9684 this_arg_conv.is_owned = false;
9685 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
9686 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
9690 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_ptr) {
9691 LDKChannelManager this_ptr_conv;
9692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9693 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9694 ChannelManager_free(this_ptr_conv);
9697 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_ptr) {
9698 LDKChannelDetails this_ptr_conv;
9699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9700 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9701 ChannelDetails_free(this_ptr_conv);
9704 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
9705 LDKChannelDetails this_ptr_conv;
9706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9707 this_ptr_conv.is_owned = false;
9708 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9709 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
9713 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
9714 LDKChannelDetails this_ptr_conv;
9715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9716 this_ptr_conv.is_owned = false;
9717 LDKThirtyTwoBytes val_ref;
9718 CHECK(*((uint32_t*)val) == 32);
9719 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
9720 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
9723 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_remote_network_id(uint32_t this_ptr) {
9724 LDKChannelDetails this_ptr_conv;
9725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9726 this_ptr_conv.is_owned = false;
9727 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
9728 memcpy((uint8_t*)(arg_arr + 4), ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form, 33);
9732 void __attribute__((visibility("default"))) TS_ChannelDetails_set_remote_network_id(uint32_t this_ptr, int8_tArray val) {
9733 LDKChannelDetails this_ptr_conv;
9734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9735 this_ptr_conv.is_owned = false;
9736 LDKPublicKey val_ref;
9737 CHECK(*((uint32_t*)val) == 33);
9738 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
9739 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
9742 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty_features(uint32_t this_ptr) {
9743 LDKChannelDetails this_ptr_conv;
9744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9745 this_ptr_conv.is_owned = false;
9746 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
9747 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9748 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9749 long ret_ref = (long)ret_var.inner;
9750 if (ret_var.is_owned) {
9756 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty_features(uint32_t this_ptr, uint32_t val) {
9757 LDKChannelDetails this_ptr_conv;
9758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9759 this_ptr_conv.is_owned = false;
9760 LDKInitFeatures val_conv;
9761 val_conv.inner = (void*)(val & (~1));
9762 val_conv.is_owned = (val & 1) || (val == 0);
9763 val_conv = InitFeatures_clone(&val_conv);
9764 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
9767 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
9768 LDKChannelDetails this_ptr_conv;
9769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9770 this_ptr_conv.is_owned = false;
9771 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
9775 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
9776 LDKChannelDetails this_ptr_conv;
9777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9778 this_ptr_conv.is_owned = false;
9779 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
9782 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_id(uint32_t this_ptr) {
9783 LDKChannelDetails this_ptr_conv;
9784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9785 this_ptr_conv.is_owned = false;
9786 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
9790 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_id(uint32_t this_ptr, int64_t val) {
9791 LDKChannelDetails this_ptr_conv;
9792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9793 this_ptr_conv.is_owned = false;
9794 ChannelDetails_set_user_id(&this_ptr_conv, val);
9797 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
9798 LDKChannelDetails this_ptr_conv;
9799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9800 this_ptr_conv.is_owned = false;
9801 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
9805 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
9806 LDKChannelDetails this_ptr_conv;
9807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9808 this_ptr_conv.is_owned = false;
9809 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
9812 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
9813 LDKChannelDetails this_ptr_conv;
9814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9815 this_ptr_conv.is_owned = false;
9816 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
9820 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
9821 LDKChannelDetails this_ptr_conv;
9822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9823 this_ptr_conv.is_owned = false;
9824 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
9827 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_live(uint32_t this_ptr) {
9828 LDKChannelDetails this_ptr_conv;
9829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9830 this_ptr_conv.is_owned = false;
9831 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
9835 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_live(uint32_t this_ptr, jboolean val) {
9836 LDKChannelDetails this_ptr_conv;
9837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9838 this_ptr_conv.is_owned = false;
9839 ChannelDetails_set_is_live(&this_ptr_conv, val);
9842 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
9843 LDKChannelDetails orig_conv;
9844 orig_conv.inner = (void*)(orig & (~1));
9845 orig_conv.is_owned = false;
9846 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
9847 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9848 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9849 long ret_ref = (long)ret_var.inner;
9850 if (ret_var.is_owned) {
9856 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
9857 LDKPaymentSendFailure this_ptr_conv;
9858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9859 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9860 PaymentSendFailure_free(this_ptr_conv);
9863 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
9864 LDKPaymentSendFailure orig_conv;
9865 orig_conv.inner = (void*)(orig & (~1));
9866 orig_conv.is_owned = false;
9867 LDKPaymentSendFailure ret_var = PaymentSendFailure_clone(&orig_conv);
9868 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9869 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9870 long ret_ref = (long)ret_var.inner;
9871 if (ret_var.is_owned) {
9877 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_new(uint32_t network, uint32_t fee_est, uint32_t chain_monitor, uint32_t tx_broadcaster, uint32_t logger, uint32_t keys_manager, uint32_t config, int64_t current_blockchain_height) {
9878 LDKNetwork network_conv = LDKNetwork_from_js(network);
9879 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
9880 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
9881 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
9882 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9883 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
9884 LDKUserConfig config_conv;
9885 config_conv.inner = (void*)(config & (~1));
9886 config_conv.is_owned = (config & 1) || (config == 0);
9887 config_conv = UserConfig_clone(&config_conv);
9888 LDKChannelManager ret_var = ChannelManager_new(network_conv, fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, current_blockchain_height);
9889 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9890 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9891 long ret_ref = (long)ret_var.inner;
9892 if (ret_var.is_owned) {
9898 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) {
9899 LDKChannelManager this_arg_conv;
9900 this_arg_conv.inner = (void*)(this_arg & (~1));
9901 this_arg_conv.is_owned = false;
9902 LDKPublicKey their_network_key_ref;
9903 CHECK(*((uint32_t*)their_network_key) == 33);
9904 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
9905 LDKUserConfig override_config_conv;
9906 override_config_conv.inner = (void*)(override_config & (~1));
9907 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
9908 override_config_conv = UserConfig_clone(&override_config_conv);
9909 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9910 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
9911 return (long)ret_conv;
9914 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
9915 LDKChannelManager this_arg_conv;
9916 this_arg_conv.inner = (void*)(this_arg & (~1));
9917 this_arg_conv.is_owned = false;
9918 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
9919 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9920 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9921 for (size_t q = 0; q < ret_var.datalen; q++) {
9922 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
9923 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9924 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9925 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
9926 if (arr_conv_16_var.is_owned) {
9927 arr_conv_16_ref |= 1;
9929 ret_arr_ptr[q] = arr_conv_16_ref;
9935 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
9936 LDKChannelManager this_arg_conv;
9937 this_arg_conv.inner = (void*)(this_arg & (~1));
9938 this_arg_conv.is_owned = false;
9939 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
9940 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9941 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9942 for (size_t q = 0; q < ret_var.datalen; q++) {
9943 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
9944 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9945 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9946 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
9947 if (arr_conv_16_var.is_owned) {
9948 arr_conv_16_ref |= 1;
9950 ret_arr_ptr[q] = arr_conv_16_ref;
9956 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
9957 LDKChannelManager this_arg_conv;
9958 this_arg_conv.inner = (void*)(this_arg & (~1));
9959 this_arg_conv.is_owned = false;
9960 unsigned char channel_id_arr[32];
9961 CHECK(*((uint32_t*)channel_id) == 32);
9962 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
9963 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
9964 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9965 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
9966 return (long)ret_conv;
9969 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
9970 LDKChannelManager this_arg_conv;
9971 this_arg_conv.inner = (void*)(this_arg & (~1));
9972 this_arg_conv.is_owned = false;
9973 unsigned char channel_id_arr[32];
9974 CHECK(*((uint32_t*)channel_id) == 32);
9975 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
9976 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
9977 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9978 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
9979 return (long)ret_conv;
9982 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
9983 LDKChannelManager this_arg_conv;
9984 this_arg_conv.inner = (void*)(this_arg & (~1));
9985 this_arg_conv.is_owned = false;
9986 ChannelManager_force_close_all_channels(&this_arg_conv);
9989 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
9990 LDKChannelManager this_arg_conv;
9991 this_arg_conv.inner = (void*)(this_arg & (~1));
9992 this_arg_conv.is_owned = false;
9993 LDKRoute route_conv;
9994 route_conv.inner = (void*)(route & (~1));
9995 route_conv.is_owned = false;
9996 LDKThirtyTwoBytes payment_hash_ref;
9997 CHECK(*((uint32_t*)payment_hash) == 32);
9998 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
9999 LDKThirtyTwoBytes payment_secret_ref;
10000 CHECK(*((uint32_t*)payment_secret) == 32);
10001 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
10002 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10003 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
10004 return (long)ret_conv;
10007 void __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, uint32_t funding_txo) {
10008 LDKChannelManager this_arg_conv;
10009 this_arg_conv.inner = (void*)(this_arg & (~1));
10010 this_arg_conv.is_owned = false;
10011 unsigned char temporary_channel_id_arr[32];
10012 CHECK(*((uint32_t*)temporary_channel_id) == 32);
10013 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
10014 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
10015 LDKOutPoint funding_txo_conv;
10016 funding_txo_conv.inner = (void*)(funding_txo & (~1));
10017 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
10018 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
10019 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
10022 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
10023 LDKChannelManager this_arg_conv;
10024 this_arg_conv.inner = (void*)(this_arg & (~1));
10025 this_arg_conv.is_owned = false;
10026 LDKThreeBytes rgb_ref;
10027 CHECK(*((uint32_t*)rgb) == 3);
10028 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
10029 LDKThirtyTwoBytes alias_ref;
10030 CHECK(*((uint32_t*)alias) == 32);
10031 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
10032 LDKCVec_NetAddressZ addresses_constr;
10033 addresses_constr.datalen = *((uint32_t*)addresses);
10034 if (addresses_constr.datalen > 0)
10035 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10037 addresses_constr.data = NULL;
10038 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
10039 for (size_t m = 0; m < addresses_constr.datalen; m++) {
10040 uint32_t arr_conv_12 = addresses_vals[m];
10041 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
10042 FREE((void*)arr_conv_12);
10043 addresses_constr.data[m] = arr_conv_12_conv;
10045 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
10048 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
10049 LDKChannelManager this_arg_conv;
10050 this_arg_conv.inner = (void*)(this_arg & (~1));
10051 this_arg_conv.is_owned = false;
10052 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
10055 void __attribute__((visibility("default"))) TS_ChannelManager_timer_chan_freshness_every_min(uint32_t this_arg) {
10056 LDKChannelManager this_arg_conv;
10057 this_arg_conv.inner = (void*)(this_arg & (~1));
10058 this_arg_conv.is_owned = false;
10059 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
10062 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
10063 LDKChannelManager this_arg_conv;
10064 this_arg_conv.inner = (void*)(this_arg & (~1));
10065 this_arg_conv.is_owned = false;
10066 unsigned char payment_hash_arr[32];
10067 CHECK(*((uint32_t*)payment_hash) == 32);
10068 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
10069 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
10070 LDKThirtyTwoBytes payment_secret_ref;
10071 CHECK(*((uint32_t*)payment_secret) == 32);
10072 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
10073 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
10077 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t expected_amount) {
10078 LDKChannelManager this_arg_conv;
10079 this_arg_conv.inner = (void*)(this_arg & (~1));
10080 this_arg_conv.is_owned = false;
10081 LDKThirtyTwoBytes payment_preimage_ref;
10082 CHECK(*((uint32_t*)payment_preimage) == 32);
10083 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
10084 LDKThirtyTwoBytes payment_secret_ref;
10085 CHECK(*((uint32_t*)payment_secret) == 32);
10086 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
10087 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
10091 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
10092 LDKChannelManager this_arg_conv;
10093 this_arg_conv.inner = (void*)(this_arg & (~1));
10094 this_arg_conv.is_owned = false;
10095 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10096 memcpy((uint8_t*)(arg_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
10100 void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
10101 LDKChannelManager this_arg_conv;
10102 this_arg_conv.inner = (void*)(this_arg & (~1));
10103 this_arg_conv.is_owned = false;
10104 LDKOutPoint funding_txo_conv;
10105 funding_txo_conv.inner = (void*)(funding_txo & (~1));
10106 funding_txo_conv.is_owned = false;
10107 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
10110 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
10111 LDKChannelManager this_arg_conv;
10112 this_arg_conv.inner = (void*)(this_arg & (~1));
10113 this_arg_conv.is_owned = false;
10114 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
10115 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
10119 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
10120 LDKChannelManager this_arg_conv;
10121 this_arg_conv.inner = (void*)(this_arg & (~1));
10122 this_arg_conv.is_owned = false;
10123 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
10124 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
10128 void __attribute__((visibility("default"))) TS_ChannelManager_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
10129 LDKChannelManager this_arg_conv;
10130 this_arg_conv.inner = (void*)(this_arg & (~1));
10131 this_arg_conv.is_owned = false;
10132 unsigned char header_arr[80];
10133 CHECK(*((uint32_t*)header) == 80);
10134 memcpy(header_arr, (uint8_t*)(header + 4), 80);
10135 unsigned char (*header_ref)[80] = &header_arr;
10136 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10137 txdata_constr.datalen = *((uint32_t*)txdata);
10138 if (txdata_constr.datalen > 0)
10139 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10141 txdata_constr.data = NULL;
10142 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
10143 for (size_t e = 0; e < txdata_constr.datalen; e++) {
10144 uint32_t arr_conv_30 = txdata_vals[e];
10145 LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_30) & ~1);
10146 FREE((void*)arr_conv_30);
10147 txdata_constr.data[e] = arr_conv_30_conv;
10149 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
10152 void __attribute__((visibility("default"))) TS_ChannelManager_block_disconnected(uint32_t this_arg, int8_tArray header) {
10153 LDKChannelManager this_arg_conv;
10154 this_arg_conv.inner = (void*)(this_arg & (~1));
10155 this_arg_conv.is_owned = false;
10156 unsigned char header_arr[80];
10157 CHECK(*((uint32_t*)header) == 80);
10158 memcpy(header_arr, (uint8_t*)(header + 4), 80);
10159 unsigned char (*header_ref)[80] = &header_arr;
10160 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
10163 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
10164 LDKChannelManager this_arg_conv;
10165 this_arg_conv.inner = (void*)(this_arg & (~1));
10166 this_arg_conv.is_owned = false;
10167 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
10168 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
10172 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
10173 LDKChannelManager obj_conv;
10174 obj_conv.inner = (void*)(obj & (~1));
10175 obj_conv.is_owned = false;
10176 LDKCVec_u8Z arg_var = ChannelManager_write(&obj_conv);
10177 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10178 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
10179 CVec_u8Z_free(arg_var);
10183 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_ptr) {
10184 LDKChannelManagerReadArgs this_ptr_conv;
10185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10186 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10187 ChannelManagerReadArgs_free(this_ptr_conv);
10190 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
10191 LDKChannelManagerReadArgs this_ptr_conv;
10192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10193 this_ptr_conv.is_owned = false;
10194 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
10198 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
10199 LDKChannelManagerReadArgs this_ptr_conv;
10200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10201 this_ptr_conv.is_owned = false;
10202 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
10203 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
10206 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
10207 LDKChannelManagerReadArgs this_ptr_conv;
10208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10209 this_ptr_conv.is_owned = false;
10210 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
10214 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
10215 LDKChannelManagerReadArgs this_ptr_conv;
10216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10217 this_ptr_conv.is_owned = false;
10218 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
10219 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
10222 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
10223 LDKChannelManagerReadArgs this_ptr_conv;
10224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10225 this_ptr_conv.is_owned = false;
10226 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
10230 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
10231 LDKChannelManagerReadArgs this_ptr_conv;
10232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10233 this_ptr_conv.is_owned = false;
10234 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
10235 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
10238 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
10239 LDKChannelManagerReadArgs this_ptr_conv;
10240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10241 this_ptr_conv.is_owned = false;
10242 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
10246 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
10247 LDKChannelManagerReadArgs this_ptr_conv;
10248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10249 this_ptr_conv.is_owned = false;
10250 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
10251 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
10254 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
10255 LDKChannelManagerReadArgs this_ptr_conv;
10256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10257 this_ptr_conv.is_owned = false;
10258 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
10262 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
10263 LDKChannelManagerReadArgs this_ptr_conv;
10264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10265 this_ptr_conv.is_owned = false;
10266 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
10267 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
10270 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
10271 LDKChannelManagerReadArgs this_ptr_conv;
10272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10273 this_ptr_conv.is_owned = false;
10274 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
10275 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10276 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10277 long ret_ref = (long)ret_var.inner;
10278 if (ret_var.is_owned) {
10284 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
10285 LDKChannelManagerReadArgs this_ptr_conv;
10286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10287 this_ptr_conv.is_owned = false;
10288 LDKUserConfig val_conv;
10289 val_conv.inner = (void*)(val & (~1));
10290 val_conv.is_owned = (val & 1) || (val == 0);
10291 val_conv = UserConfig_clone(&val_conv);
10292 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
10295 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) {
10296 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
10297 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10298 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
10299 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
10300 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10301 LDKUserConfig default_config_conv;
10302 default_config_conv.inner = (void*)(default_config & (~1));
10303 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
10304 default_config_conv = UserConfig_clone(&default_config_conv);
10305 LDKCVec_ChannelMonitorZ channel_monitors_constr;
10306 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
10307 if (channel_monitors_constr.datalen > 0)
10308 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
10310 channel_monitors_constr.data = NULL;
10311 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
10312 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
10313 uint32_t arr_conv_16 = channel_monitors_vals[q];
10314 LDKChannelMonitor arr_conv_16_conv;
10315 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
10316 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
10317 channel_monitors_constr.data[q] = arr_conv_16_conv;
10319 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);
10320 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10321 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10322 long ret_ref = (long)ret_var.inner;
10323 if (ret_var.is_owned) {
10329 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
10330 LDKu8slice ser_ref;
10331 ser_ref.datalen = *((uint32_t*)ser);
10332 ser_ref.data = (int8_t*)(ser + 4);
10333 LDKChannelManagerReadArgs arg_conv;
10334 arg_conv.inner = (void*)(arg & (~1));
10335 arg_conv.is_owned = (arg & 1) || (arg == 0);
10336 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
10337 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10338 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
10339 return (long)ret_conv;
10342 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_ptr) {
10343 LDKDecodeError this_ptr_conv;
10344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10345 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10346 DecodeError_free(this_ptr_conv);
10349 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
10350 LDKDecodeError orig_conv;
10351 orig_conv.inner = (void*)(orig & (~1));
10352 orig_conv.is_owned = false;
10353 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
10354 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10355 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10356 long ret_ref = (long)ret_var.inner;
10357 if (ret_var.is_owned) {
10363 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_ptr) {
10364 LDKInit this_ptr_conv;
10365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10366 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10367 Init_free(this_ptr_conv);
10370 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
10372 orig_conv.inner = (void*)(orig & (~1));
10373 orig_conv.is_owned = false;
10374 LDKInit ret_var = Init_clone(&orig_conv);
10375 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10376 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10377 long ret_ref = (long)ret_var.inner;
10378 if (ret_var.is_owned) {
10384 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_ptr) {
10385 LDKErrorMessage this_ptr_conv;
10386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10388 ErrorMessage_free(this_ptr_conv);
10391 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
10392 LDKErrorMessage this_ptr_conv;
10393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10394 this_ptr_conv.is_owned = false;
10395 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10396 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
10400 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
10401 LDKErrorMessage this_ptr_conv;
10402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10403 this_ptr_conv.is_owned = false;
10404 LDKThirtyTwoBytes val_ref;
10405 CHECK(*((uint32_t*)val) == 32);
10406 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10407 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
10410 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
10411 LDKErrorMessage this_ptr_conv;
10412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10413 this_ptr_conv.is_owned = false;
10414 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
10415 jstring _conv = str_ref_to_ts(_str.chars, _str.len);
10419 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, int8_tArray val) {
10420 LDKErrorMessage this_ptr_conv;
10421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10422 this_ptr_conv.is_owned = false;
10423 LDKCVec_u8Z val_ref;
10424 val_ref.datalen = *((uint32_t*)val);
10425 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
10426 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
10427 ErrorMessage_set_data(&this_ptr_conv, val_ref);
10430 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
10431 LDKThirtyTwoBytes channel_id_arg_ref;
10432 CHECK(*((uint32_t*)channel_id_arg) == 32);
10433 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
10434 LDKCVec_u8Z data_arg_ref;
10435 data_arg_ref.datalen = *((uint32_t*)data_arg);
10436 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
10437 memcpy(data_arg_ref.data, (uint8_t*)(data_arg + 4), data_arg_ref.datalen);
10438 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
10439 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10440 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10441 long ret_ref = (long)ret_var.inner;
10442 if (ret_var.is_owned) {
10448 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
10449 LDKErrorMessage orig_conv;
10450 orig_conv.inner = (void*)(orig & (~1));
10451 orig_conv.is_owned = false;
10452 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
10453 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10454 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10455 long ret_ref = (long)ret_var.inner;
10456 if (ret_var.is_owned) {
10462 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_ptr) {
10463 LDKPing this_ptr_conv;
10464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10465 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10466 Ping_free(this_ptr_conv);
10469 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
10470 LDKPing this_ptr_conv;
10471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10472 this_ptr_conv.is_owned = false;
10473 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
10477 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
10478 LDKPing this_ptr_conv;
10479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10480 this_ptr_conv.is_owned = false;
10481 Ping_set_ponglen(&this_ptr_conv, val);
10484 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
10485 LDKPing this_ptr_conv;
10486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10487 this_ptr_conv.is_owned = false;
10488 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
10492 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
10493 LDKPing this_ptr_conv;
10494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10495 this_ptr_conv.is_owned = false;
10496 Ping_set_byteslen(&this_ptr_conv, val);
10499 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
10500 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
10501 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10502 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10503 long ret_ref = (long)ret_var.inner;
10504 if (ret_var.is_owned) {
10510 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
10512 orig_conv.inner = (void*)(orig & (~1));
10513 orig_conv.is_owned = false;
10514 LDKPing ret_var = Ping_clone(&orig_conv);
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 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_ptr) {
10525 LDKPong this_ptr_conv;
10526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10527 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10528 Pong_free(this_ptr_conv);
10531 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
10532 LDKPong this_ptr_conv;
10533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10534 this_ptr_conv.is_owned = false;
10535 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
10539 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
10540 LDKPong this_ptr_conv;
10541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10542 this_ptr_conv.is_owned = false;
10543 Pong_set_byteslen(&this_ptr_conv, val);
10546 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
10547 LDKPong ret_var = Pong_new(byteslen_arg);
10548 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10549 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10550 long ret_ref = (long)ret_var.inner;
10551 if (ret_var.is_owned) {
10557 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
10559 orig_conv.inner = (void*)(orig & (~1));
10560 orig_conv.is_owned = false;
10561 LDKPong ret_var = Pong_clone(&orig_conv);
10562 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10563 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10564 long ret_ref = (long)ret_var.inner;
10565 if (ret_var.is_owned) {
10571 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_ptr) {
10572 LDKOpenChannel this_ptr_conv;
10573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10574 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10575 OpenChannel_free(this_ptr_conv);
10578 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
10579 LDKOpenChannel this_ptr_conv;
10580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10581 this_ptr_conv.is_owned = false;
10582 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10583 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
10587 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
10588 LDKOpenChannel this_ptr_conv;
10589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10590 this_ptr_conv.is_owned = false;
10591 LDKThirtyTwoBytes val_ref;
10592 CHECK(*((uint32_t*)val) == 32);
10593 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10594 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
10597 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
10598 LDKOpenChannel this_ptr_conv;
10599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10600 this_ptr_conv.is_owned = false;
10601 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10602 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
10606 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
10607 LDKOpenChannel this_ptr_conv;
10608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10609 this_ptr_conv.is_owned = false;
10610 LDKThirtyTwoBytes val_ref;
10611 CHECK(*((uint32_t*)val) == 32);
10612 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10613 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
10616 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
10617 LDKOpenChannel this_ptr_conv;
10618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10619 this_ptr_conv.is_owned = false;
10620 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
10624 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
10625 LDKOpenChannel this_ptr_conv;
10626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10627 this_ptr_conv.is_owned = false;
10628 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
10631 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
10632 LDKOpenChannel this_ptr_conv;
10633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10634 this_ptr_conv.is_owned = false;
10635 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
10639 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
10640 LDKOpenChannel this_ptr_conv;
10641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10642 this_ptr_conv.is_owned = false;
10643 OpenChannel_set_push_msat(&this_ptr_conv, val);
10646 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
10647 LDKOpenChannel this_ptr_conv;
10648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10649 this_ptr_conv.is_owned = false;
10650 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
10654 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
10655 LDKOpenChannel this_ptr_conv;
10656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10657 this_ptr_conv.is_owned = false;
10658 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
10661 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
10662 LDKOpenChannel this_ptr_conv;
10663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10664 this_ptr_conv.is_owned = false;
10665 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
10669 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
10670 LDKOpenChannel this_ptr_conv;
10671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10672 this_ptr_conv.is_owned = false;
10673 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
10676 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
10677 LDKOpenChannel this_ptr_conv;
10678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10679 this_ptr_conv.is_owned = false;
10680 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
10684 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
10685 LDKOpenChannel this_ptr_conv;
10686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10687 this_ptr_conv.is_owned = false;
10688 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
10691 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
10692 LDKOpenChannel this_ptr_conv;
10693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10694 this_ptr_conv.is_owned = false;
10695 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
10699 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
10700 LDKOpenChannel this_ptr_conv;
10701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10702 this_ptr_conv.is_owned = false;
10703 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
10706 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
10707 LDKOpenChannel this_ptr_conv;
10708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10709 this_ptr_conv.is_owned = false;
10710 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
10714 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
10715 LDKOpenChannel this_ptr_conv;
10716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10717 this_ptr_conv.is_owned = false;
10718 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
10721 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
10722 LDKOpenChannel this_ptr_conv;
10723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10724 this_ptr_conv.is_owned = false;
10725 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
10729 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
10730 LDKOpenChannel this_ptr_conv;
10731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10732 this_ptr_conv.is_owned = false;
10733 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
10736 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
10737 LDKOpenChannel this_ptr_conv;
10738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10739 this_ptr_conv.is_owned = false;
10740 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
10744 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
10745 LDKOpenChannel this_ptr_conv;
10746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10747 this_ptr_conv.is_owned = false;
10748 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
10751 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
10752 LDKOpenChannel this_ptr_conv;
10753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10754 this_ptr_conv.is_owned = false;
10755 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10756 memcpy((uint8_t*)(arg_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
10760 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
10761 LDKOpenChannel this_ptr_conv;
10762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10763 this_ptr_conv.is_owned = false;
10764 LDKPublicKey val_ref;
10765 CHECK(*((uint32_t*)val) == 33);
10766 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10767 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
10770 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
10771 LDKOpenChannel this_ptr_conv;
10772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10773 this_ptr_conv.is_owned = false;
10774 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10775 memcpy((uint8_t*)(arg_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
10779 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
10780 LDKOpenChannel this_ptr_conv;
10781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10782 this_ptr_conv.is_owned = false;
10783 LDKPublicKey val_ref;
10784 CHECK(*((uint32_t*)val) == 33);
10785 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10786 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
10789 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
10790 LDKOpenChannel this_ptr_conv;
10791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10792 this_ptr_conv.is_owned = false;
10793 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10794 memcpy((uint8_t*)(arg_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
10798 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
10799 LDKOpenChannel this_ptr_conv;
10800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10801 this_ptr_conv.is_owned = false;
10802 LDKPublicKey val_ref;
10803 CHECK(*((uint32_t*)val) == 33);
10804 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10805 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
10808 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
10809 LDKOpenChannel this_ptr_conv;
10810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10811 this_ptr_conv.is_owned = false;
10812 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10813 memcpy((uint8_t*)(arg_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
10817 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
10818 LDKOpenChannel this_ptr_conv;
10819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10820 this_ptr_conv.is_owned = false;
10821 LDKPublicKey val_ref;
10822 CHECK(*((uint32_t*)val) == 33);
10823 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10824 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
10827 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
10828 LDKOpenChannel this_ptr_conv;
10829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10830 this_ptr_conv.is_owned = false;
10831 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10832 memcpy((uint8_t*)(arg_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
10836 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
10837 LDKOpenChannel this_ptr_conv;
10838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10839 this_ptr_conv.is_owned = false;
10840 LDKPublicKey val_ref;
10841 CHECK(*((uint32_t*)val) == 33);
10842 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10843 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
10846 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
10847 LDKOpenChannel this_ptr_conv;
10848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10849 this_ptr_conv.is_owned = false;
10850 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10851 memcpy((uint8_t*)(arg_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
10855 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
10856 LDKOpenChannel this_ptr_conv;
10857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10858 this_ptr_conv.is_owned = false;
10859 LDKPublicKey val_ref;
10860 CHECK(*((uint32_t*)val) == 33);
10861 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10862 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
10865 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
10866 LDKOpenChannel this_ptr_conv;
10867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10868 this_ptr_conv.is_owned = false;
10869 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
10873 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
10874 LDKOpenChannel this_ptr_conv;
10875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10876 this_ptr_conv.is_owned = false;
10877 OpenChannel_set_channel_flags(&this_ptr_conv, val);
10880 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
10881 LDKOpenChannel orig_conv;
10882 orig_conv.inner = (void*)(orig & (~1));
10883 orig_conv.is_owned = false;
10884 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
10885 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10886 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10887 long ret_ref = (long)ret_var.inner;
10888 if (ret_var.is_owned) {
10894 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_ptr) {
10895 LDKAcceptChannel this_ptr_conv;
10896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10898 AcceptChannel_free(this_ptr_conv);
10901 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
10902 LDKAcceptChannel this_ptr_conv;
10903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10904 this_ptr_conv.is_owned = false;
10905 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10906 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
10910 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
10911 LDKAcceptChannel this_ptr_conv;
10912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10913 this_ptr_conv.is_owned = false;
10914 LDKThirtyTwoBytes val_ref;
10915 CHECK(*((uint32_t*)val) == 32);
10916 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10917 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
10920 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
10921 LDKAcceptChannel this_ptr_conv;
10922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10923 this_ptr_conv.is_owned = false;
10924 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
10928 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
10929 LDKAcceptChannel this_ptr_conv;
10930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10931 this_ptr_conv.is_owned = false;
10932 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
10935 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
10936 LDKAcceptChannel this_ptr_conv;
10937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10938 this_ptr_conv.is_owned = false;
10939 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
10943 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
10944 LDKAcceptChannel this_ptr_conv;
10945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10946 this_ptr_conv.is_owned = false;
10947 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
10950 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
10951 LDKAcceptChannel this_ptr_conv;
10952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10953 this_ptr_conv.is_owned = false;
10954 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
10958 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
10959 LDKAcceptChannel this_ptr_conv;
10960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10961 this_ptr_conv.is_owned = false;
10962 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
10965 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
10966 LDKAcceptChannel this_ptr_conv;
10967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10968 this_ptr_conv.is_owned = false;
10969 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
10973 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
10974 LDKAcceptChannel this_ptr_conv;
10975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10976 this_ptr_conv.is_owned = false;
10977 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
10980 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
10981 LDKAcceptChannel this_ptr_conv;
10982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10983 this_ptr_conv.is_owned = false;
10984 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
10988 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
10989 LDKAcceptChannel this_ptr_conv;
10990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10991 this_ptr_conv.is_owned = false;
10992 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
10995 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
10996 LDKAcceptChannel this_ptr_conv;
10997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10998 this_ptr_conv.is_owned = false;
10999 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
11003 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
11004 LDKAcceptChannel this_ptr_conv;
11005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11006 this_ptr_conv.is_owned = false;
11007 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
11010 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
11011 LDKAcceptChannel this_ptr_conv;
11012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11013 this_ptr_conv.is_owned = false;
11014 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
11018 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
11019 LDKAcceptChannel this_ptr_conv;
11020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11021 this_ptr_conv.is_owned = false;
11022 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
11025 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
11026 LDKAcceptChannel this_ptr_conv;
11027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11028 this_ptr_conv.is_owned = false;
11029 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11030 memcpy((uint8_t*)(arg_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
11034 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
11035 LDKAcceptChannel this_ptr_conv;
11036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11037 this_ptr_conv.is_owned = false;
11038 LDKPublicKey val_ref;
11039 CHECK(*((uint32_t*)val) == 33);
11040 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11041 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
11044 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
11045 LDKAcceptChannel this_ptr_conv;
11046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11047 this_ptr_conv.is_owned = false;
11048 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11049 memcpy((uint8_t*)(arg_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
11053 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
11054 LDKAcceptChannel this_ptr_conv;
11055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11056 this_ptr_conv.is_owned = false;
11057 LDKPublicKey val_ref;
11058 CHECK(*((uint32_t*)val) == 33);
11059 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11060 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
11063 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
11064 LDKAcceptChannel this_ptr_conv;
11065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11066 this_ptr_conv.is_owned = false;
11067 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11068 memcpy((uint8_t*)(arg_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
11072 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
11073 LDKAcceptChannel this_ptr_conv;
11074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11075 this_ptr_conv.is_owned = false;
11076 LDKPublicKey val_ref;
11077 CHECK(*((uint32_t*)val) == 33);
11078 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11079 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
11082 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
11083 LDKAcceptChannel this_ptr_conv;
11084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11085 this_ptr_conv.is_owned = false;
11086 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11087 memcpy((uint8_t*)(arg_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
11091 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
11092 LDKAcceptChannel this_ptr_conv;
11093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11094 this_ptr_conv.is_owned = false;
11095 LDKPublicKey val_ref;
11096 CHECK(*((uint32_t*)val) == 33);
11097 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11098 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
11101 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
11102 LDKAcceptChannel this_ptr_conv;
11103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11104 this_ptr_conv.is_owned = false;
11105 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11106 memcpy((uint8_t*)(arg_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
11110 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
11111 LDKAcceptChannel this_ptr_conv;
11112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11113 this_ptr_conv.is_owned = false;
11114 LDKPublicKey val_ref;
11115 CHECK(*((uint32_t*)val) == 33);
11116 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11117 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
11120 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
11121 LDKAcceptChannel this_ptr_conv;
11122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11123 this_ptr_conv.is_owned = false;
11124 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11125 memcpy((uint8_t*)(arg_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
11129 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
11130 LDKAcceptChannel this_ptr_conv;
11131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11132 this_ptr_conv.is_owned = false;
11133 LDKPublicKey val_ref;
11134 CHECK(*((uint32_t*)val) == 33);
11135 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11136 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
11139 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
11140 LDKAcceptChannel orig_conv;
11141 orig_conv.inner = (void*)(orig & (~1));
11142 orig_conv.is_owned = false;
11143 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
11144 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11145 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11146 long ret_ref = (long)ret_var.inner;
11147 if (ret_var.is_owned) {
11153 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_ptr) {
11154 LDKFundingCreated this_ptr_conv;
11155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11156 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11157 FundingCreated_free(this_ptr_conv);
11160 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
11161 LDKFundingCreated this_ptr_conv;
11162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11163 this_ptr_conv.is_owned = false;
11164 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11165 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
11169 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
11170 LDKFundingCreated this_ptr_conv;
11171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11172 this_ptr_conv.is_owned = false;
11173 LDKThirtyTwoBytes val_ref;
11174 CHECK(*((uint32_t*)val) == 32);
11175 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11176 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
11179 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
11180 LDKFundingCreated this_ptr_conv;
11181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11182 this_ptr_conv.is_owned = false;
11183 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11184 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
11188 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
11189 LDKFundingCreated this_ptr_conv;
11190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11191 this_ptr_conv.is_owned = false;
11192 LDKThirtyTwoBytes val_ref;
11193 CHECK(*((uint32_t*)val) == 32);
11194 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11195 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
11198 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
11199 LDKFundingCreated this_ptr_conv;
11200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11201 this_ptr_conv.is_owned = false;
11202 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
11206 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
11207 LDKFundingCreated this_ptr_conv;
11208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11209 this_ptr_conv.is_owned = false;
11210 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
11213 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
11214 LDKFundingCreated this_ptr_conv;
11215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11216 this_ptr_conv.is_owned = false;
11217 int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
11218 memcpy((uint8_t*)(arg_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
11222 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
11223 LDKFundingCreated this_ptr_conv;
11224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11225 this_ptr_conv.is_owned = false;
11226 LDKSignature val_ref;
11227 CHECK(*((uint32_t*)val) == 64);
11228 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
11229 FundingCreated_set_signature(&this_ptr_conv, val_ref);
11232 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) {
11233 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
11234 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
11235 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
11236 LDKThirtyTwoBytes funding_txid_arg_ref;
11237 CHECK(*((uint32_t*)funding_txid_arg) == 32);
11238 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
11239 LDKSignature signature_arg_ref;
11240 CHECK(*((uint32_t*)signature_arg) == 64);
11241 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
11242 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
11243 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11244 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11245 long ret_ref = (long)ret_var.inner;
11246 if (ret_var.is_owned) {
11252 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
11253 LDKFundingCreated orig_conv;
11254 orig_conv.inner = (void*)(orig & (~1));
11255 orig_conv.is_owned = false;
11256 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
11257 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11258 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11259 long ret_ref = (long)ret_var.inner;
11260 if (ret_var.is_owned) {
11266 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_ptr) {
11267 LDKFundingSigned this_ptr_conv;
11268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11269 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11270 FundingSigned_free(this_ptr_conv);
11273 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
11274 LDKFundingSigned this_ptr_conv;
11275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11276 this_ptr_conv.is_owned = false;
11277 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11278 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
11282 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
11283 LDKFundingSigned this_ptr_conv;
11284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11285 this_ptr_conv.is_owned = false;
11286 LDKThirtyTwoBytes val_ref;
11287 CHECK(*((uint32_t*)val) == 32);
11288 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11289 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
11292 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
11293 LDKFundingSigned this_ptr_conv;
11294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11295 this_ptr_conv.is_owned = false;
11296 int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
11297 memcpy((uint8_t*)(arg_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
11301 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
11302 LDKFundingSigned this_ptr_conv;
11303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11304 this_ptr_conv.is_owned = false;
11305 LDKSignature val_ref;
11306 CHECK(*((uint32_t*)val) == 64);
11307 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
11308 FundingSigned_set_signature(&this_ptr_conv, val_ref);
11311 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
11312 LDKThirtyTwoBytes channel_id_arg_ref;
11313 CHECK(*((uint32_t*)channel_id_arg) == 32);
11314 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
11315 LDKSignature signature_arg_ref;
11316 CHECK(*((uint32_t*)signature_arg) == 64);
11317 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
11318 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
11319 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11320 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11321 long ret_ref = (long)ret_var.inner;
11322 if (ret_var.is_owned) {
11328 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
11329 LDKFundingSigned orig_conv;
11330 orig_conv.inner = (void*)(orig & (~1));
11331 orig_conv.is_owned = false;
11332 LDKFundingSigned ret_var = FundingSigned_clone(&orig_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_FundingLocked_free(uint32_t this_ptr) {
11343 LDKFundingLocked this_ptr_conv;
11344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11345 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11346 FundingLocked_free(this_ptr_conv);
11349 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
11350 LDKFundingLocked this_ptr_conv;
11351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11352 this_ptr_conv.is_owned = false;
11353 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11354 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
11358 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
11359 LDKFundingLocked this_ptr_conv;
11360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11361 this_ptr_conv.is_owned = false;
11362 LDKThirtyTwoBytes val_ref;
11363 CHECK(*((uint32_t*)val) == 32);
11364 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11365 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
11368 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
11369 LDKFundingLocked this_ptr_conv;
11370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11371 this_ptr_conv.is_owned = false;
11372 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11373 memcpy((uint8_t*)(arg_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
11377 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
11378 LDKFundingLocked this_ptr_conv;
11379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11380 this_ptr_conv.is_owned = false;
11381 LDKPublicKey val_ref;
11382 CHECK(*((uint32_t*)val) == 33);
11383 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11384 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
11387 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
11388 LDKThirtyTwoBytes channel_id_arg_ref;
11389 CHECK(*((uint32_t*)channel_id_arg) == 32);
11390 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
11391 LDKPublicKey next_per_commitment_point_arg_ref;
11392 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
11393 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
11394 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
11395 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11396 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11397 long ret_ref = (long)ret_var.inner;
11398 if (ret_var.is_owned) {
11404 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
11405 LDKFundingLocked orig_conv;
11406 orig_conv.inner = (void*)(orig & (~1));
11407 orig_conv.is_owned = false;
11408 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
11409 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11410 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11411 long ret_ref = (long)ret_var.inner;
11412 if (ret_var.is_owned) {
11418 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_ptr) {
11419 LDKShutdown this_ptr_conv;
11420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11421 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11422 Shutdown_free(this_ptr_conv);
11425 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
11426 LDKShutdown this_ptr_conv;
11427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11428 this_ptr_conv.is_owned = false;
11429 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11430 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
11434 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
11435 LDKShutdown this_ptr_conv;
11436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11437 this_ptr_conv.is_owned = false;
11438 LDKThirtyTwoBytes val_ref;
11439 CHECK(*((uint32_t*)val) == 32);
11440 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11441 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
11444 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
11445 LDKShutdown this_ptr_conv;
11446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11447 this_ptr_conv.is_owned = false;
11448 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
11449 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11450 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
11454 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
11455 LDKShutdown this_ptr_conv;
11456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11457 this_ptr_conv.is_owned = false;
11458 LDKCVec_u8Z val_ref;
11459 val_ref.datalen = *((uint32_t*)val);
11460 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
11461 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
11462 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
11465 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
11466 LDKThirtyTwoBytes channel_id_arg_ref;
11467 CHECK(*((uint32_t*)channel_id_arg) == 32);
11468 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
11469 LDKCVec_u8Z scriptpubkey_arg_ref;
11470 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
11471 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
11472 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
11473 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
11474 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11475 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11476 long ret_ref = (long)ret_var.inner;
11477 if (ret_var.is_owned) {
11483 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
11484 LDKShutdown orig_conv;
11485 orig_conv.inner = (void*)(orig & (~1));
11486 orig_conv.is_owned = false;
11487 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
11488 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11489 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11490 long ret_ref = (long)ret_var.inner;
11491 if (ret_var.is_owned) {
11497 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_ptr) {
11498 LDKClosingSigned this_ptr_conv;
11499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11500 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11501 ClosingSigned_free(this_ptr_conv);
11504 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
11505 LDKClosingSigned this_ptr_conv;
11506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11507 this_ptr_conv.is_owned = false;
11508 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11509 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
11513 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
11514 LDKClosingSigned this_ptr_conv;
11515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11516 this_ptr_conv.is_owned = false;
11517 LDKThirtyTwoBytes val_ref;
11518 CHECK(*((uint32_t*)val) == 32);
11519 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11520 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
11523 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
11524 LDKClosingSigned this_ptr_conv;
11525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11526 this_ptr_conv.is_owned = false;
11527 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
11531 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
11532 LDKClosingSigned this_ptr_conv;
11533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11534 this_ptr_conv.is_owned = false;
11535 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
11538 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
11539 LDKClosingSigned this_ptr_conv;
11540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11541 this_ptr_conv.is_owned = false;
11542 int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
11543 memcpy((uint8_t*)(arg_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
11547 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
11548 LDKClosingSigned this_ptr_conv;
11549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11550 this_ptr_conv.is_owned = false;
11551 LDKSignature val_ref;
11552 CHECK(*((uint32_t*)val) == 64);
11553 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
11554 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
11557 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
11558 LDKThirtyTwoBytes channel_id_arg_ref;
11559 CHECK(*((uint32_t*)channel_id_arg) == 32);
11560 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
11561 LDKSignature signature_arg_ref;
11562 CHECK(*((uint32_t*)signature_arg) == 64);
11563 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
11564 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
11565 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11566 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11567 long ret_ref = (long)ret_var.inner;
11568 if (ret_var.is_owned) {
11574 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
11575 LDKClosingSigned orig_conv;
11576 orig_conv.inner = (void*)(orig & (~1));
11577 orig_conv.is_owned = false;
11578 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
11579 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11580 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11581 long ret_ref = (long)ret_var.inner;
11582 if (ret_var.is_owned) {
11588 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_ptr) {
11589 LDKUpdateAddHTLC this_ptr_conv;
11590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11591 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11592 UpdateAddHTLC_free(this_ptr_conv);
11595 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
11596 LDKUpdateAddHTLC this_ptr_conv;
11597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11598 this_ptr_conv.is_owned = false;
11599 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11600 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
11604 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
11605 LDKUpdateAddHTLC this_ptr_conv;
11606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11607 this_ptr_conv.is_owned = false;
11608 LDKThirtyTwoBytes val_ref;
11609 CHECK(*((uint32_t*)val) == 32);
11610 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11611 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
11614 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
11615 LDKUpdateAddHTLC this_ptr_conv;
11616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11617 this_ptr_conv.is_owned = false;
11618 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
11622 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
11623 LDKUpdateAddHTLC this_ptr_conv;
11624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11625 this_ptr_conv.is_owned = false;
11626 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
11629 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
11630 LDKUpdateAddHTLC this_ptr_conv;
11631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11632 this_ptr_conv.is_owned = false;
11633 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
11637 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
11638 LDKUpdateAddHTLC this_ptr_conv;
11639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11640 this_ptr_conv.is_owned = false;
11641 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
11644 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
11645 LDKUpdateAddHTLC this_ptr_conv;
11646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11647 this_ptr_conv.is_owned = false;
11648 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11649 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
11653 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
11654 LDKUpdateAddHTLC this_ptr_conv;
11655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11656 this_ptr_conv.is_owned = false;
11657 LDKThirtyTwoBytes val_ref;
11658 CHECK(*((uint32_t*)val) == 32);
11659 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11660 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
11663 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
11664 LDKUpdateAddHTLC this_ptr_conv;
11665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11666 this_ptr_conv.is_owned = false;
11667 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
11671 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
11672 LDKUpdateAddHTLC this_ptr_conv;
11673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11674 this_ptr_conv.is_owned = false;
11675 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
11678 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
11679 LDKUpdateAddHTLC orig_conv;
11680 orig_conv.inner = (void*)(orig & (~1));
11681 orig_conv.is_owned = false;
11682 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
11683 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11684 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11685 long ret_ref = (long)ret_var.inner;
11686 if (ret_var.is_owned) {
11692 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_ptr) {
11693 LDKUpdateFulfillHTLC this_ptr_conv;
11694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11695 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11696 UpdateFulfillHTLC_free(this_ptr_conv);
11699 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
11700 LDKUpdateFulfillHTLC this_ptr_conv;
11701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11702 this_ptr_conv.is_owned = false;
11703 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11704 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
11708 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
11709 LDKUpdateFulfillHTLC this_ptr_conv;
11710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11711 this_ptr_conv.is_owned = false;
11712 LDKThirtyTwoBytes val_ref;
11713 CHECK(*((uint32_t*)val) == 32);
11714 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11715 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
11718 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
11719 LDKUpdateFulfillHTLC this_ptr_conv;
11720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11721 this_ptr_conv.is_owned = false;
11722 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
11726 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
11727 LDKUpdateFulfillHTLC this_ptr_conv;
11728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11729 this_ptr_conv.is_owned = false;
11730 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
11733 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
11734 LDKUpdateFulfillHTLC this_ptr_conv;
11735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11736 this_ptr_conv.is_owned = false;
11737 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11738 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
11742 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
11743 LDKUpdateFulfillHTLC this_ptr_conv;
11744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11745 this_ptr_conv.is_owned = false;
11746 LDKThirtyTwoBytes val_ref;
11747 CHECK(*((uint32_t*)val) == 32);
11748 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11749 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
11752 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
11753 LDKThirtyTwoBytes channel_id_arg_ref;
11754 CHECK(*((uint32_t*)channel_id_arg) == 32);
11755 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
11756 LDKThirtyTwoBytes payment_preimage_arg_ref;
11757 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
11758 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
11759 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
11760 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11761 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11762 long ret_ref = (long)ret_var.inner;
11763 if (ret_var.is_owned) {
11769 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
11770 LDKUpdateFulfillHTLC orig_conv;
11771 orig_conv.inner = (void*)(orig & (~1));
11772 orig_conv.is_owned = false;
11773 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
11774 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11775 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11776 long ret_ref = (long)ret_var.inner;
11777 if (ret_var.is_owned) {
11783 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_ptr) {
11784 LDKUpdateFailHTLC this_ptr_conv;
11785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11786 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11787 UpdateFailHTLC_free(this_ptr_conv);
11790 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
11791 LDKUpdateFailHTLC this_ptr_conv;
11792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11793 this_ptr_conv.is_owned = false;
11794 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11795 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
11799 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
11800 LDKUpdateFailHTLC this_ptr_conv;
11801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11802 this_ptr_conv.is_owned = false;
11803 LDKThirtyTwoBytes val_ref;
11804 CHECK(*((uint32_t*)val) == 32);
11805 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11806 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
11809 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
11810 LDKUpdateFailHTLC this_ptr_conv;
11811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11812 this_ptr_conv.is_owned = false;
11813 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
11817 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
11818 LDKUpdateFailHTLC this_ptr_conv;
11819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11820 this_ptr_conv.is_owned = false;
11821 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
11824 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
11825 LDKUpdateFailHTLC orig_conv;
11826 orig_conv.inner = (void*)(orig & (~1));
11827 orig_conv.is_owned = false;
11828 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
11829 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11830 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11831 long ret_ref = (long)ret_var.inner;
11832 if (ret_var.is_owned) {
11838 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_ptr) {
11839 LDKUpdateFailMalformedHTLC this_ptr_conv;
11840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11841 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11842 UpdateFailMalformedHTLC_free(this_ptr_conv);
11845 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
11846 LDKUpdateFailMalformedHTLC this_ptr_conv;
11847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11848 this_ptr_conv.is_owned = false;
11849 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11850 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
11854 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
11855 LDKUpdateFailMalformedHTLC this_ptr_conv;
11856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11857 this_ptr_conv.is_owned = false;
11858 LDKThirtyTwoBytes val_ref;
11859 CHECK(*((uint32_t*)val) == 32);
11860 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11861 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
11864 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
11865 LDKUpdateFailMalformedHTLC this_ptr_conv;
11866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11867 this_ptr_conv.is_owned = false;
11868 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
11872 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
11873 LDKUpdateFailMalformedHTLC this_ptr_conv;
11874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11875 this_ptr_conv.is_owned = false;
11876 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
11879 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
11880 LDKUpdateFailMalformedHTLC this_ptr_conv;
11881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11882 this_ptr_conv.is_owned = false;
11883 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
11887 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
11888 LDKUpdateFailMalformedHTLC this_ptr_conv;
11889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11890 this_ptr_conv.is_owned = false;
11891 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
11894 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
11895 LDKUpdateFailMalformedHTLC orig_conv;
11896 orig_conv.inner = (void*)(orig & (~1));
11897 orig_conv.is_owned = false;
11898 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
11899 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11900 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11901 long ret_ref = (long)ret_var.inner;
11902 if (ret_var.is_owned) {
11908 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_ptr) {
11909 LDKCommitmentSigned this_ptr_conv;
11910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11911 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11912 CommitmentSigned_free(this_ptr_conv);
11915 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
11916 LDKCommitmentSigned this_ptr_conv;
11917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11918 this_ptr_conv.is_owned = false;
11919 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11920 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
11924 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
11925 LDKCommitmentSigned this_ptr_conv;
11926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11927 this_ptr_conv.is_owned = false;
11928 LDKThirtyTwoBytes val_ref;
11929 CHECK(*((uint32_t*)val) == 32);
11930 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11931 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
11934 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
11935 LDKCommitmentSigned this_ptr_conv;
11936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11937 this_ptr_conv.is_owned = false;
11938 int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
11939 memcpy((uint8_t*)(arg_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
11943 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
11944 LDKCommitmentSigned this_ptr_conv;
11945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11946 this_ptr_conv.is_owned = false;
11947 LDKSignature val_ref;
11948 CHECK(*((uint32_t*)val) == 64);
11949 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
11950 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
11953 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
11954 LDKCommitmentSigned this_ptr_conv;
11955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11956 this_ptr_conv.is_owned = false;
11957 LDKCVec_SignatureZ val_constr;
11958 val_constr.datalen = *((uint32_t*)val);
11959 if (val_constr.datalen > 0)
11960 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11962 val_constr.data = NULL;
11963 int8_tArray* val_vals = (int8_tArray*)(val + 4);
11964 for (size_t m = 0; m < val_constr.datalen; m++) {
11965 int8_tArray arr_conv_12 = val_vals[m];
11966 LDKSignature arr_conv_12_ref;
11967 CHECK(*((uint32_t*)arr_conv_12) == 64);
11968 memcpy(arr_conv_12_ref.compact_form, (uint8_t*)(arr_conv_12 + 4), 64);
11969 val_constr.data[m] = arr_conv_12_ref;
11971 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
11974 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
11975 LDKThirtyTwoBytes channel_id_arg_ref;
11976 CHECK(*((uint32_t*)channel_id_arg) == 32);
11977 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
11978 LDKSignature signature_arg_ref;
11979 CHECK(*((uint32_t*)signature_arg) == 64);
11980 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
11981 LDKCVec_SignatureZ htlc_signatures_arg_constr;
11982 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
11983 if (htlc_signatures_arg_constr.datalen > 0)
11984 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11986 htlc_signatures_arg_constr.data = NULL;
11987 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
11988 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
11989 int8_tArray arr_conv_12 = htlc_signatures_arg_vals[m];
11990 LDKSignature arr_conv_12_ref;
11991 CHECK(*((uint32_t*)arr_conv_12) == 64);
11992 memcpy(arr_conv_12_ref.compact_form, (uint8_t*)(arr_conv_12 + 4), 64);
11993 htlc_signatures_arg_constr.data[m] = arr_conv_12_ref;
11995 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
11996 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11997 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11998 long ret_ref = (long)ret_var.inner;
11999 if (ret_var.is_owned) {
12005 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
12006 LDKCommitmentSigned orig_conv;
12007 orig_conv.inner = (void*)(orig & (~1));
12008 orig_conv.is_owned = false;
12009 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
12010 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12011 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12012 long ret_ref = (long)ret_var.inner;
12013 if (ret_var.is_owned) {
12019 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_ptr) {
12020 LDKRevokeAndACK this_ptr_conv;
12021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12022 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12023 RevokeAndACK_free(this_ptr_conv);
12026 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
12027 LDKRevokeAndACK this_ptr_conv;
12028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12029 this_ptr_conv.is_owned = false;
12030 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12031 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
12035 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12036 LDKRevokeAndACK this_ptr_conv;
12037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12038 this_ptr_conv.is_owned = false;
12039 LDKThirtyTwoBytes val_ref;
12040 CHECK(*((uint32_t*)val) == 32);
12041 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12042 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
12045 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
12046 LDKRevokeAndACK this_ptr_conv;
12047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12048 this_ptr_conv.is_owned = false;
12049 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12050 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
12054 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
12055 LDKRevokeAndACK this_ptr_conv;
12056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12057 this_ptr_conv.is_owned = false;
12058 LDKThirtyTwoBytes val_ref;
12059 CHECK(*((uint32_t*)val) == 32);
12060 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12061 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
12064 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
12065 LDKRevokeAndACK this_ptr_conv;
12066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12067 this_ptr_conv.is_owned = false;
12068 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12069 memcpy((uint8_t*)(arg_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12073 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12074 LDKRevokeAndACK this_ptr_conv;
12075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12076 this_ptr_conv.is_owned = false;
12077 LDKPublicKey val_ref;
12078 CHECK(*((uint32_t*)val) == 33);
12079 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12080 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
12083 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) {
12084 LDKThirtyTwoBytes channel_id_arg_ref;
12085 CHECK(*((uint32_t*)channel_id_arg) == 32);
12086 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12087 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
12088 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
12089 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
12090 LDKPublicKey next_per_commitment_point_arg_ref;
12091 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
12092 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
12093 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
12094 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12095 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12096 long ret_ref = (long)ret_var.inner;
12097 if (ret_var.is_owned) {
12103 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
12104 LDKRevokeAndACK orig_conv;
12105 orig_conv.inner = (void*)(orig & (~1));
12106 orig_conv.is_owned = false;
12107 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
12108 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12109 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12110 long ret_ref = (long)ret_var.inner;
12111 if (ret_var.is_owned) {
12117 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_ptr) {
12118 LDKUpdateFee this_ptr_conv;
12119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12120 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12121 UpdateFee_free(this_ptr_conv);
12124 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
12125 LDKUpdateFee this_ptr_conv;
12126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12127 this_ptr_conv.is_owned = false;
12128 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12129 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
12133 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12134 LDKUpdateFee this_ptr_conv;
12135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12136 this_ptr_conv.is_owned = false;
12137 LDKThirtyTwoBytes val_ref;
12138 CHECK(*((uint32_t*)val) == 32);
12139 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12140 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
12143 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
12144 LDKUpdateFee this_ptr_conv;
12145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12146 this_ptr_conv.is_owned = false;
12147 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
12151 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
12152 LDKUpdateFee this_ptr_conv;
12153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12154 this_ptr_conv.is_owned = false;
12155 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
12158 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
12159 LDKThirtyTwoBytes channel_id_arg_ref;
12160 CHECK(*((uint32_t*)channel_id_arg) == 32);
12161 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12162 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
12163 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12164 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12165 long ret_ref = (long)ret_var.inner;
12166 if (ret_var.is_owned) {
12172 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
12173 LDKUpdateFee orig_conv;
12174 orig_conv.inner = (void*)(orig & (~1));
12175 orig_conv.is_owned = false;
12176 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
12177 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12178 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12179 long ret_ref = (long)ret_var.inner;
12180 if (ret_var.is_owned) {
12186 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_ptr) {
12187 LDKDataLossProtect this_ptr_conv;
12188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12189 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12190 DataLossProtect_free(this_ptr_conv);
12193 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
12194 LDKDataLossProtect this_ptr_conv;
12195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12196 this_ptr_conv.is_owned = false;
12197 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12198 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
12202 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
12203 LDKDataLossProtect this_ptr_conv;
12204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12205 this_ptr_conv.is_owned = false;
12206 LDKThirtyTwoBytes val_ref;
12207 CHECK(*((uint32_t*)val) == 32);
12208 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12209 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
12212 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
12213 LDKDataLossProtect this_ptr_conv;
12214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12215 this_ptr_conv.is_owned = false;
12216 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12217 memcpy((uint8_t*)(arg_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12221 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12222 LDKDataLossProtect this_ptr_conv;
12223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12224 this_ptr_conv.is_owned = false;
12225 LDKPublicKey val_ref;
12226 CHECK(*((uint32_t*)val) == 33);
12227 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12228 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
12231 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
12232 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
12233 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
12234 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
12235 LDKPublicKey my_current_per_commitment_point_arg_ref;
12236 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
12237 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
12238 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
12239 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12240 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12241 long ret_ref = (long)ret_var.inner;
12242 if (ret_var.is_owned) {
12248 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
12249 LDKDataLossProtect orig_conv;
12250 orig_conv.inner = (void*)(orig & (~1));
12251 orig_conv.is_owned = false;
12252 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
12253 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12254 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12255 long ret_ref = (long)ret_var.inner;
12256 if (ret_var.is_owned) {
12262 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_ptr) {
12263 LDKChannelReestablish this_ptr_conv;
12264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12265 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12266 ChannelReestablish_free(this_ptr_conv);
12269 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
12270 LDKChannelReestablish this_ptr_conv;
12271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12272 this_ptr_conv.is_owned = false;
12273 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12274 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
12278 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12279 LDKChannelReestablish this_ptr_conv;
12280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12281 this_ptr_conv.is_owned = false;
12282 LDKThirtyTwoBytes val_ref;
12283 CHECK(*((uint32_t*)val) == 32);
12284 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12285 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
12288 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
12289 LDKChannelReestablish this_ptr_conv;
12290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12291 this_ptr_conv.is_owned = false;
12292 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
12296 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
12297 LDKChannelReestablish this_ptr_conv;
12298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12299 this_ptr_conv.is_owned = false;
12300 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
12303 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
12304 LDKChannelReestablish this_ptr_conv;
12305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12306 this_ptr_conv.is_owned = false;
12307 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
12311 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
12312 LDKChannelReestablish this_ptr_conv;
12313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12314 this_ptr_conv.is_owned = false;
12315 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
12318 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
12319 LDKChannelReestablish orig_conv;
12320 orig_conv.inner = (void*)(orig & (~1));
12321 orig_conv.is_owned = false;
12322 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
12323 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12324 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12325 long ret_ref = (long)ret_var.inner;
12326 if (ret_var.is_owned) {
12332 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_ptr) {
12333 LDKAnnouncementSignatures this_ptr_conv;
12334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12335 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12336 AnnouncementSignatures_free(this_ptr_conv);
12339 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
12340 LDKAnnouncementSignatures this_ptr_conv;
12341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12342 this_ptr_conv.is_owned = false;
12343 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12344 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
12348 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12349 LDKAnnouncementSignatures this_ptr_conv;
12350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12351 this_ptr_conv.is_owned = false;
12352 LDKThirtyTwoBytes val_ref;
12353 CHECK(*((uint32_t*)val) == 32);
12354 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12355 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
12358 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
12359 LDKAnnouncementSignatures this_ptr_conv;
12360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12361 this_ptr_conv.is_owned = false;
12362 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
12366 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
12367 LDKAnnouncementSignatures this_ptr_conv;
12368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12369 this_ptr_conv.is_owned = false;
12370 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
12373 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
12374 LDKAnnouncementSignatures this_ptr_conv;
12375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12376 this_ptr_conv.is_owned = false;
12377 int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12378 memcpy((uint8_t*)(arg_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
12382 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
12383 LDKAnnouncementSignatures this_ptr_conv;
12384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12385 this_ptr_conv.is_owned = false;
12386 LDKSignature val_ref;
12387 CHECK(*((uint32_t*)val) == 64);
12388 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12389 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
12392 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
12393 LDKAnnouncementSignatures this_ptr_conv;
12394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12395 this_ptr_conv.is_owned = false;
12396 int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12397 memcpy((uint8_t*)(arg_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
12401 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
12402 LDKAnnouncementSignatures this_ptr_conv;
12403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12404 this_ptr_conv.is_owned = false;
12405 LDKSignature val_ref;
12406 CHECK(*((uint32_t*)val) == 64);
12407 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12408 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
12411 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) {
12412 LDKThirtyTwoBytes channel_id_arg_ref;
12413 CHECK(*((uint32_t*)channel_id_arg) == 32);
12414 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12415 LDKSignature node_signature_arg_ref;
12416 CHECK(*((uint32_t*)node_signature_arg) == 64);
12417 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
12418 LDKSignature bitcoin_signature_arg_ref;
12419 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
12420 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
12421 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
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 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
12432 LDKAnnouncementSignatures orig_conv;
12433 orig_conv.inner = (void*)(orig & (~1));
12434 orig_conv.is_owned = false;
12435 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
12436 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12437 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12438 long ret_ref = (long)ret_var.inner;
12439 if (ret_var.is_owned) {
12445 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
12446 if ((this_ptr & 1) != 0) return;
12447 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
12448 FREE((void*)this_ptr);
12449 NetAddress_free(this_ptr_conv);
12452 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
12453 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
12454 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
12455 *ret_copy = NetAddress_clone(orig_conv);
12456 long ret_ref = (long)ret_copy;
12460 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
12461 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
12462 LDKCVec_u8Z arg_var = NetAddress_write(obj_conv);
12463 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12464 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
12465 CVec_u8Z_free(arg_var);
12469 uint32_t __attribute__((visibility("default"))) TS_Result_read(int8_tArray ser) {
12470 LDKu8slice ser_ref;
12471 ser_ref.datalen = *((uint32_t*)ser);
12472 ser_ref.data = (int8_t*)(ser + 4);
12473 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
12474 *ret_conv = Result_read(ser_ref);
12475 return (long)ret_conv;
12478 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_ptr) {
12479 LDKUnsignedNodeAnnouncement this_ptr_conv;
12480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12481 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12482 UnsignedNodeAnnouncement_free(this_ptr_conv);
12485 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
12486 LDKUnsignedNodeAnnouncement this_ptr_conv;
12487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12488 this_ptr_conv.is_owned = false;
12489 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
12490 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12491 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12492 long ret_ref = (long)ret_var.inner;
12493 if (ret_var.is_owned) {
12499 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
12500 LDKUnsignedNodeAnnouncement this_ptr_conv;
12501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12502 this_ptr_conv.is_owned = false;
12503 LDKNodeFeatures val_conv;
12504 val_conv.inner = (void*)(val & (~1));
12505 val_conv.is_owned = (val & 1) || (val == 0);
12506 val_conv = NodeFeatures_clone(&val_conv);
12507 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
12510 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
12511 LDKUnsignedNodeAnnouncement this_ptr_conv;
12512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12513 this_ptr_conv.is_owned = false;
12514 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
12518 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
12519 LDKUnsignedNodeAnnouncement this_ptr_conv;
12520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12521 this_ptr_conv.is_owned = false;
12522 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
12525 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
12526 LDKUnsignedNodeAnnouncement this_ptr_conv;
12527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12528 this_ptr_conv.is_owned = false;
12529 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12530 memcpy((uint8_t*)(arg_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
12534 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
12535 LDKUnsignedNodeAnnouncement this_ptr_conv;
12536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12537 this_ptr_conv.is_owned = false;
12538 LDKPublicKey val_ref;
12539 CHECK(*((uint32_t*)val) == 33);
12540 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12541 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
12544 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
12545 LDKUnsignedNodeAnnouncement this_ptr_conv;
12546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12547 this_ptr_conv.is_owned = false;
12548 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
12549 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
12553 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
12554 LDKUnsignedNodeAnnouncement this_ptr_conv;
12555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12556 this_ptr_conv.is_owned = false;
12557 LDKThreeBytes val_ref;
12558 CHECK(*((uint32_t*)val) == 3);
12559 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
12560 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
12563 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
12564 LDKUnsignedNodeAnnouncement this_ptr_conv;
12565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12566 this_ptr_conv.is_owned = false;
12567 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12568 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
12572 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
12573 LDKUnsignedNodeAnnouncement this_ptr_conv;
12574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12575 this_ptr_conv.is_owned = false;
12576 LDKThirtyTwoBytes val_ref;
12577 CHECK(*((uint32_t*)val) == 32);
12578 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12579 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
12582 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
12583 LDKUnsignedNodeAnnouncement this_ptr_conv;
12584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12585 this_ptr_conv.is_owned = false;
12586 LDKCVec_NetAddressZ val_constr;
12587 val_constr.datalen = *((uint32_t*)val);
12588 if (val_constr.datalen > 0)
12589 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12591 val_constr.data = NULL;
12592 uint32_t* val_vals = (uint32_t*)(val + 4);
12593 for (size_t m = 0; m < val_constr.datalen; m++) {
12594 uint32_t arr_conv_12 = val_vals[m];
12595 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
12596 FREE((void*)arr_conv_12);
12597 val_constr.data[m] = arr_conv_12_conv;
12599 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
12602 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
12603 LDKUnsignedNodeAnnouncement orig_conv;
12604 orig_conv.inner = (void*)(orig & (~1));
12605 orig_conv.is_owned = false;
12606 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
12607 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12608 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12609 long ret_ref = (long)ret_var.inner;
12610 if (ret_var.is_owned) {
12616 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_ptr) {
12617 LDKNodeAnnouncement this_ptr_conv;
12618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12619 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12620 NodeAnnouncement_free(this_ptr_conv);
12623 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
12624 LDKNodeAnnouncement this_ptr_conv;
12625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12626 this_ptr_conv.is_owned = false;
12627 int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12628 memcpy((uint8_t*)(arg_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
12632 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
12633 LDKNodeAnnouncement this_ptr_conv;
12634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12635 this_ptr_conv.is_owned = false;
12636 LDKSignature val_ref;
12637 CHECK(*((uint32_t*)val) == 64);
12638 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12639 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
12642 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
12643 LDKNodeAnnouncement this_ptr_conv;
12644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12645 this_ptr_conv.is_owned = false;
12646 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
12647 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12648 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12649 long ret_ref = (long)ret_var.inner;
12650 if (ret_var.is_owned) {
12656 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
12657 LDKNodeAnnouncement this_ptr_conv;
12658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12659 this_ptr_conv.is_owned = false;
12660 LDKUnsignedNodeAnnouncement val_conv;
12661 val_conv.inner = (void*)(val & (~1));
12662 val_conv.is_owned = (val & 1) || (val == 0);
12663 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
12664 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
12667 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
12668 LDKSignature signature_arg_ref;
12669 CHECK(*((uint32_t*)signature_arg) == 64);
12670 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
12671 LDKUnsignedNodeAnnouncement contents_arg_conv;
12672 contents_arg_conv.inner = (void*)(contents_arg & (~1));
12673 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
12674 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
12675 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
12676 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12677 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12678 long ret_ref = (long)ret_var.inner;
12679 if (ret_var.is_owned) {
12685 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
12686 LDKNodeAnnouncement orig_conv;
12687 orig_conv.inner = (void*)(orig & (~1));
12688 orig_conv.is_owned = false;
12689 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
12690 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12691 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12692 long ret_ref = (long)ret_var.inner;
12693 if (ret_var.is_owned) {
12699 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_ptr) {
12700 LDKUnsignedChannelAnnouncement this_ptr_conv;
12701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12702 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12703 UnsignedChannelAnnouncement_free(this_ptr_conv);
12706 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
12707 LDKUnsignedChannelAnnouncement this_ptr_conv;
12708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12709 this_ptr_conv.is_owned = false;
12710 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
12711 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12712 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12713 long ret_ref = (long)ret_var.inner;
12714 if (ret_var.is_owned) {
12720 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
12721 LDKUnsignedChannelAnnouncement this_ptr_conv;
12722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12723 this_ptr_conv.is_owned = false;
12724 LDKChannelFeatures val_conv;
12725 val_conv.inner = (void*)(val & (~1));
12726 val_conv.is_owned = (val & 1) || (val == 0);
12727 val_conv = ChannelFeatures_clone(&val_conv);
12728 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
12731 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
12732 LDKUnsignedChannelAnnouncement this_ptr_conv;
12733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12734 this_ptr_conv.is_owned = false;
12735 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12736 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
12740 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
12741 LDKUnsignedChannelAnnouncement this_ptr_conv;
12742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12743 this_ptr_conv.is_owned = false;
12744 LDKThirtyTwoBytes val_ref;
12745 CHECK(*((uint32_t*)val) == 32);
12746 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12747 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
12750 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
12751 LDKUnsignedChannelAnnouncement this_ptr_conv;
12752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12753 this_ptr_conv.is_owned = false;
12754 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
12758 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
12759 LDKUnsignedChannelAnnouncement this_ptr_conv;
12760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12761 this_ptr_conv.is_owned = false;
12762 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
12765 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
12766 LDKUnsignedChannelAnnouncement this_ptr_conv;
12767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12768 this_ptr_conv.is_owned = false;
12769 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12770 memcpy((uint8_t*)(arg_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
12774 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
12775 LDKUnsignedChannelAnnouncement this_ptr_conv;
12776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12777 this_ptr_conv.is_owned = false;
12778 LDKPublicKey val_ref;
12779 CHECK(*((uint32_t*)val) == 33);
12780 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12781 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
12784 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
12785 LDKUnsignedChannelAnnouncement this_ptr_conv;
12786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12787 this_ptr_conv.is_owned = false;
12788 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12789 memcpy((uint8_t*)(arg_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
12793 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
12794 LDKUnsignedChannelAnnouncement this_ptr_conv;
12795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12796 this_ptr_conv.is_owned = false;
12797 LDKPublicKey val_ref;
12798 CHECK(*((uint32_t*)val) == 33);
12799 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12800 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
12803 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
12804 LDKUnsignedChannelAnnouncement this_ptr_conv;
12805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12806 this_ptr_conv.is_owned = false;
12807 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12808 memcpy((uint8_t*)(arg_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
12812 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
12813 LDKUnsignedChannelAnnouncement this_ptr_conv;
12814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12815 this_ptr_conv.is_owned = false;
12816 LDKPublicKey val_ref;
12817 CHECK(*((uint32_t*)val) == 33);
12818 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12819 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
12822 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
12823 LDKUnsignedChannelAnnouncement this_ptr_conv;
12824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12825 this_ptr_conv.is_owned = false;
12826 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12827 memcpy((uint8_t*)(arg_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
12831 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
12832 LDKUnsignedChannelAnnouncement this_ptr_conv;
12833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12834 this_ptr_conv.is_owned = false;
12835 LDKPublicKey val_ref;
12836 CHECK(*((uint32_t*)val) == 33);
12837 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12838 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
12841 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
12842 LDKUnsignedChannelAnnouncement orig_conv;
12843 orig_conv.inner = (void*)(orig & (~1));
12844 orig_conv.is_owned = false;
12845 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
12846 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12847 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12848 long ret_ref = (long)ret_var.inner;
12849 if (ret_var.is_owned) {
12855 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_ptr) {
12856 LDKChannelAnnouncement this_ptr_conv;
12857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12858 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12859 ChannelAnnouncement_free(this_ptr_conv);
12862 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
12863 LDKChannelAnnouncement this_ptr_conv;
12864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12865 this_ptr_conv.is_owned = false;
12866 int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12867 memcpy((uint8_t*)(arg_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
12871 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
12872 LDKChannelAnnouncement this_ptr_conv;
12873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12874 this_ptr_conv.is_owned = false;
12875 LDKSignature val_ref;
12876 CHECK(*((uint32_t*)val) == 64);
12877 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12878 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
12881 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
12882 LDKChannelAnnouncement this_ptr_conv;
12883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12884 this_ptr_conv.is_owned = false;
12885 int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12886 memcpy((uint8_t*)(arg_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
12890 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
12891 LDKChannelAnnouncement this_ptr_conv;
12892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12893 this_ptr_conv.is_owned = false;
12894 LDKSignature val_ref;
12895 CHECK(*((uint32_t*)val) == 64);
12896 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12897 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
12900 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
12901 LDKChannelAnnouncement this_ptr_conv;
12902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12903 this_ptr_conv.is_owned = false;
12904 int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12905 memcpy((uint8_t*)(arg_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
12909 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
12910 LDKChannelAnnouncement this_ptr_conv;
12911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12912 this_ptr_conv.is_owned = false;
12913 LDKSignature val_ref;
12914 CHECK(*((uint32_t*)val) == 64);
12915 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12916 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
12919 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
12920 LDKChannelAnnouncement this_ptr_conv;
12921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12922 this_ptr_conv.is_owned = false;
12923 int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12924 memcpy((uint8_t*)(arg_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
12928 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
12929 LDKChannelAnnouncement this_ptr_conv;
12930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12931 this_ptr_conv.is_owned = false;
12932 LDKSignature val_ref;
12933 CHECK(*((uint32_t*)val) == 64);
12934 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12935 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
12938 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
12939 LDKChannelAnnouncement this_ptr_conv;
12940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12941 this_ptr_conv.is_owned = false;
12942 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
12943 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12944 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12945 long ret_ref = (long)ret_var.inner;
12946 if (ret_var.is_owned) {
12952 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
12953 LDKChannelAnnouncement this_ptr_conv;
12954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12955 this_ptr_conv.is_owned = false;
12956 LDKUnsignedChannelAnnouncement val_conv;
12957 val_conv.inner = (void*)(val & (~1));
12958 val_conv.is_owned = (val & 1) || (val == 0);
12959 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
12960 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
12963 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) {
12964 LDKSignature node_signature_1_arg_ref;
12965 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
12966 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
12967 LDKSignature node_signature_2_arg_ref;
12968 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
12969 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
12970 LDKSignature bitcoin_signature_1_arg_ref;
12971 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
12972 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
12973 LDKSignature bitcoin_signature_2_arg_ref;
12974 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
12975 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
12976 LDKUnsignedChannelAnnouncement contents_arg_conv;
12977 contents_arg_conv.inner = (void*)(contents_arg & (~1));
12978 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
12979 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
12980 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);
12981 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12982 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12983 long ret_ref = (long)ret_var.inner;
12984 if (ret_var.is_owned) {
12990 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
12991 LDKChannelAnnouncement orig_conv;
12992 orig_conv.inner = (void*)(orig & (~1));
12993 orig_conv.is_owned = false;
12994 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
12995 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12996 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12997 long ret_ref = (long)ret_var.inner;
12998 if (ret_var.is_owned) {
13004 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_ptr) {
13005 LDKUnsignedChannelUpdate this_ptr_conv;
13006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13007 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13008 UnsignedChannelUpdate_free(this_ptr_conv);
13011 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
13012 LDKUnsignedChannelUpdate this_ptr_conv;
13013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13014 this_ptr_conv.is_owned = false;
13015 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13016 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
13020 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
13021 LDKUnsignedChannelUpdate this_ptr_conv;
13022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13023 this_ptr_conv.is_owned = false;
13024 LDKThirtyTwoBytes val_ref;
13025 CHECK(*((uint32_t*)val) == 32);
13026 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13027 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
13030 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
13031 LDKUnsignedChannelUpdate this_ptr_conv;
13032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13033 this_ptr_conv.is_owned = false;
13034 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
13038 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
13039 LDKUnsignedChannelUpdate this_ptr_conv;
13040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13041 this_ptr_conv.is_owned = false;
13042 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
13045 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
13046 LDKUnsignedChannelUpdate this_ptr_conv;
13047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13048 this_ptr_conv.is_owned = false;
13049 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
13053 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
13054 LDKUnsignedChannelUpdate this_ptr_conv;
13055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13056 this_ptr_conv.is_owned = false;
13057 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
13060 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
13061 LDKUnsignedChannelUpdate this_ptr_conv;
13062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13063 this_ptr_conv.is_owned = false;
13064 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
13068 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
13069 LDKUnsignedChannelUpdate this_ptr_conv;
13070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13071 this_ptr_conv.is_owned = false;
13072 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
13075 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
13076 LDKUnsignedChannelUpdate this_ptr_conv;
13077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13078 this_ptr_conv.is_owned = false;
13079 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
13083 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
13084 LDKUnsignedChannelUpdate this_ptr_conv;
13085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13086 this_ptr_conv.is_owned = false;
13087 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
13090 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
13091 LDKUnsignedChannelUpdate this_ptr_conv;
13092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13093 this_ptr_conv.is_owned = false;
13094 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
13098 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
13099 LDKUnsignedChannelUpdate this_ptr_conv;
13100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13101 this_ptr_conv.is_owned = false;
13102 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
13105 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
13106 LDKUnsignedChannelUpdate this_ptr_conv;
13107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13108 this_ptr_conv.is_owned = false;
13109 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
13113 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
13114 LDKUnsignedChannelUpdate this_ptr_conv;
13115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13116 this_ptr_conv.is_owned = false;
13117 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
13120 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
13121 LDKUnsignedChannelUpdate this_ptr_conv;
13122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13123 this_ptr_conv.is_owned = false;
13124 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
13128 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
13129 LDKUnsignedChannelUpdate this_ptr_conv;
13130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13131 this_ptr_conv.is_owned = false;
13132 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
13135 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
13136 LDKUnsignedChannelUpdate orig_conv;
13137 orig_conv.inner = (void*)(orig & (~1));
13138 orig_conv.is_owned = false;
13139 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
13140 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13141 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13142 long ret_ref = (long)ret_var.inner;
13143 if (ret_var.is_owned) {
13149 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_ptr) {
13150 LDKChannelUpdate this_ptr_conv;
13151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13152 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13153 ChannelUpdate_free(this_ptr_conv);
13156 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
13157 LDKChannelUpdate this_ptr_conv;
13158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13159 this_ptr_conv.is_owned = false;
13160 int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13161 memcpy((uint8_t*)(arg_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
13165 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
13166 LDKChannelUpdate this_ptr_conv;
13167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13168 this_ptr_conv.is_owned = false;
13169 LDKSignature val_ref;
13170 CHECK(*((uint32_t*)val) == 64);
13171 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13172 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
13175 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
13176 LDKChannelUpdate this_ptr_conv;
13177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13178 this_ptr_conv.is_owned = false;
13179 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
13180 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13181 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13182 long ret_ref = (long)ret_var.inner;
13183 if (ret_var.is_owned) {
13189 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
13190 LDKChannelUpdate this_ptr_conv;
13191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13192 this_ptr_conv.is_owned = false;
13193 LDKUnsignedChannelUpdate val_conv;
13194 val_conv.inner = (void*)(val & (~1));
13195 val_conv.is_owned = (val & 1) || (val == 0);
13196 val_conv = UnsignedChannelUpdate_clone(&val_conv);
13197 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
13200 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
13201 LDKSignature signature_arg_ref;
13202 CHECK(*((uint32_t*)signature_arg) == 64);
13203 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
13204 LDKUnsignedChannelUpdate contents_arg_conv;
13205 contents_arg_conv.inner = (void*)(contents_arg & (~1));
13206 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
13207 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
13208 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
13209 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13210 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13211 long ret_ref = (long)ret_var.inner;
13212 if (ret_var.is_owned) {
13218 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
13219 LDKChannelUpdate orig_conv;
13220 orig_conv.inner = (void*)(orig & (~1));
13221 orig_conv.is_owned = false;
13222 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
13223 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13224 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13225 long ret_ref = (long)ret_var.inner;
13226 if (ret_var.is_owned) {
13232 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_ptr) {
13233 LDKQueryChannelRange this_ptr_conv;
13234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13235 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13236 QueryChannelRange_free(this_ptr_conv);
13239 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
13240 LDKQueryChannelRange this_ptr_conv;
13241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13242 this_ptr_conv.is_owned = false;
13243 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13244 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
13248 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
13249 LDKQueryChannelRange this_ptr_conv;
13250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13251 this_ptr_conv.is_owned = false;
13252 LDKThirtyTwoBytes val_ref;
13253 CHECK(*((uint32_t*)val) == 32);
13254 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13255 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
13258 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
13259 LDKQueryChannelRange this_ptr_conv;
13260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13261 this_ptr_conv.is_owned = false;
13262 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
13266 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
13267 LDKQueryChannelRange this_ptr_conv;
13268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13269 this_ptr_conv.is_owned = false;
13270 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
13273 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
13274 LDKQueryChannelRange this_ptr_conv;
13275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13276 this_ptr_conv.is_owned = false;
13277 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
13281 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
13282 LDKQueryChannelRange this_ptr_conv;
13283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13284 this_ptr_conv.is_owned = false;
13285 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
13288 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
13289 LDKThirtyTwoBytes chain_hash_arg_ref;
13290 CHECK(*((uint32_t*)chain_hash_arg) == 32);
13291 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
13292 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
13293 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13294 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13295 long ret_ref = (long)ret_var.inner;
13296 if (ret_var.is_owned) {
13302 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
13303 LDKQueryChannelRange orig_conv;
13304 orig_conv.inner = (void*)(orig & (~1));
13305 orig_conv.is_owned = false;
13306 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
13307 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13308 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13309 long ret_ref = (long)ret_var.inner;
13310 if (ret_var.is_owned) {
13316 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_ptr) {
13317 LDKReplyChannelRange this_ptr_conv;
13318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13319 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13320 ReplyChannelRange_free(this_ptr_conv);
13323 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
13324 LDKReplyChannelRange this_ptr_conv;
13325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13326 this_ptr_conv.is_owned = false;
13327 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13328 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
13332 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
13333 LDKReplyChannelRange this_ptr_conv;
13334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13335 this_ptr_conv.is_owned = false;
13336 LDKThirtyTwoBytes val_ref;
13337 CHECK(*((uint32_t*)val) == 32);
13338 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13339 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
13342 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
13343 LDKReplyChannelRange this_ptr_conv;
13344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13345 this_ptr_conv.is_owned = false;
13346 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
13350 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
13351 LDKReplyChannelRange this_ptr_conv;
13352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13353 this_ptr_conv.is_owned = false;
13354 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
13357 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
13358 LDKReplyChannelRange this_ptr_conv;
13359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13360 this_ptr_conv.is_owned = false;
13361 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
13365 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
13366 LDKReplyChannelRange this_ptr_conv;
13367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13368 this_ptr_conv.is_owned = false;
13369 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
13372 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
13373 LDKReplyChannelRange this_ptr_conv;
13374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13375 this_ptr_conv.is_owned = false;
13376 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
13380 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
13381 LDKReplyChannelRange this_ptr_conv;
13382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13383 this_ptr_conv.is_owned = false;
13384 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
13387 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
13388 LDKReplyChannelRange this_ptr_conv;
13389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13390 this_ptr_conv.is_owned = false;
13391 LDKCVec_u64Z val_constr;
13392 val_constr.datalen = *((uint32_t*)val);
13393 if (val_constr.datalen > 0)
13394 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
13396 val_constr.data = NULL;
13397 int64_t* val_vals = (int64_t*)(val + 4);
13398 for (size_t i = 0; i < val_constr.datalen; i++) {
13399 int64_t arr_conv_8 = val_vals[i];
13400 val_constr.data[i] = arr_conv_8;
13402 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
13405 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) {
13406 LDKThirtyTwoBytes chain_hash_arg_ref;
13407 CHECK(*((uint32_t*)chain_hash_arg) == 32);
13408 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
13409 LDKCVec_u64Z short_channel_ids_arg_constr;
13410 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
13411 if (short_channel_ids_arg_constr.datalen > 0)
13412 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
13414 short_channel_ids_arg_constr.data = NULL;
13415 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
13416 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
13417 int64_t arr_conv_8 = short_channel_ids_arg_vals[i];
13418 short_channel_ids_arg_constr.data[i] = arr_conv_8;
13420 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
13421 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13422 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13423 long ret_ref = (long)ret_var.inner;
13424 if (ret_var.is_owned) {
13430 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
13431 LDKReplyChannelRange orig_conv;
13432 orig_conv.inner = (void*)(orig & (~1));
13433 orig_conv.is_owned = false;
13434 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
13435 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13436 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13437 long ret_ref = (long)ret_var.inner;
13438 if (ret_var.is_owned) {
13444 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_ptr) {
13445 LDKQueryShortChannelIds this_ptr_conv;
13446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13447 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13448 QueryShortChannelIds_free(this_ptr_conv);
13451 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
13452 LDKQueryShortChannelIds this_ptr_conv;
13453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13454 this_ptr_conv.is_owned = false;
13455 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13456 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
13460 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
13461 LDKQueryShortChannelIds this_ptr_conv;
13462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13463 this_ptr_conv.is_owned = false;
13464 LDKThirtyTwoBytes val_ref;
13465 CHECK(*((uint32_t*)val) == 32);
13466 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13467 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
13470 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
13471 LDKQueryShortChannelIds this_ptr_conv;
13472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13473 this_ptr_conv.is_owned = false;
13474 LDKCVec_u64Z val_constr;
13475 val_constr.datalen = *((uint32_t*)val);
13476 if (val_constr.datalen > 0)
13477 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
13479 val_constr.data = NULL;
13480 int64_t* val_vals = (int64_t*)(val + 4);
13481 for (size_t i = 0; i < val_constr.datalen; i++) {
13482 int64_t arr_conv_8 = val_vals[i];
13483 val_constr.data[i] = arr_conv_8;
13485 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
13488 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
13489 LDKThirtyTwoBytes chain_hash_arg_ref;
13490 CHECK(*((uint32_t*)chain_hash_arg) == 32);
13491 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
13492 LDKCVec_u64Z short_channel_ids_arg_constr;
13493 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
13494 if (short_channel_ids_arg_constr.datalen > 0)
13495 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
13497 short_channel_ids_arg_constr.data = NULL;
13498 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
13499 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
13500 int64_t arr_conv_8 = short_channel_ids_arg_vals[i];
13501 short_channel_ids_arg_constr.data[i] = arr_conv_8;
13503 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
13504 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13505 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13506 long ret_ref = (long)ret_var.inner;
13507 if (ret_var.is_owned) {
13513 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
13514 LDKQueryShortChannelIds orig_conv;
13515 orig_conv.inner = (void*)(orig & (~1));
13516 orig_conv.is_owned = false;
13517 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
13518 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13519 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13520 long ret_ref = (long)ret_var.inner;
13521 if (ret_var.is_owned) {
13527 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_ptr) {
13528 LDKReplyShortChannelIdsEnd this_ptr_conv;
13529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13530 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13531 ReplyShortChannelIdsEnd_free(this_ptr_conv);
13534 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
13535 LDKReplyShortChannelIdsEnd this_ptr_conv;
13536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13537 this_ptr_conv.is_owned = false;
13538 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13539 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
13543 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
13544 LDKReplyShortChannelIdsEnd this_ptr_conv;
13545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13546 this_ptr_conv.is_owned = false;
13547 LDKThirtyTwoBytes val_ref;
13548 CHECK(*((uint32_t*)val) == 32);
13549 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13550 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
13553 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
13554 LDKReplyShortChannelIdsEnd this_ptr_conv;
13555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13556 this_ptr_conv.is_owned = false;
13557 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
13561 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
13562 LDKReplyShortChannelIdsEnd this_ptr_conv;
13563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13564 this_ptr_conv.is_owned = false;
13565 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
13568 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
13569 LDKThirtyTwoBytes chain_hash_arg_ref;
13570 CHECK(*((uint32_t*)chain_hash_arg) == 32);
13571 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
13572 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
13573 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13574 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13575 long ret_ref = (long)ret_var.inner;
13576 if (ret_var.is_owned) {
13582 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
13583 LDKReplyShortChannelIdsEnd orig_conv;
13584 orig_conv.inner = (void*)(orig & (~1));
13585 orig_conv.is_owned = false;
13586 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
13587 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13588 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13589 long ret_ref = (long)ret_var.inner;
13590 if (ret_var.is_owned) {
13596 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_ptr) {
13597 LDKGossipTimestampFilter this_ptr_conv;
13598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13599 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13600 GossipTimestampFilter_free(this_ptr_conv);
13603 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
13604 LDKGossipTimestampFilter this_ptr_conv;
13605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13606 this_ptr_conv.is_owned = false;
13607 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13608 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
13612 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
13613 LDKGossipTimestampFilter this_ptr_conv;
13614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13615 this_ptr_conv.is_owned = false;
13616 LDKThirtyTwoBytes val_ref;
13617 CHECK(*((uint32_t*)val) == 32);
13618 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13619 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
13622 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
13623 LDKGossipTimestampFilter this_ptr_conv;
13624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13625 this_ptr_conv.is_owned = false;
13626 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
13630 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
13631 LDKGossipTimestampFilter this_ptr_conv;
13632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13633 this_ptr_conv.is_owned = false;
13634 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
13637 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
13638 LDKGossipTimestampFilter this_ptr_conv;
13639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13640 this_ptr_conv.is_owned = false;
13641 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
13645 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
13646 LDKGossipTimestampFilter this_ptr_conv;
13647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13648 this_ptr_conv.is_owned = false;
13649 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
13652 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
13653 LDKThirtyTwoBytes chain_hash_arg_ref;
13654 CHECK(*((uint32_t*)chain_hash_arg) == 32);
13655 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
13656 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
13657 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13658 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13659 long ret_ref = (long)ret_var.inner;
13660 if (ret_var.is_owned) {
13666 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
13667 LDKGossipTimestampFilter orig_conv;
13668 orig_conv.inner = (void*)(orig & (~1));
13669 orig_conv.is_owned = false;
13670 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
13671 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13672 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13673 long ret_ref = (long)ret_var.inner;
13674 if (ret_var.is_owned) {
13680 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
13681 if ((this_ptr & 1) != 0) return;
13682 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
13683 FREE((void*)this_ptr);
13684 ErrorAction_free(this_ptr_conv);
13687 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
13688 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
13689 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
13690 *ret_copy = ErrorAction_clone(orig_conv);
13691 long ret_ref = (long)ret_copy;
13695 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_ptr) {
13696 LDKLightningError this_ptr_conv;
13697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13699 LightningError_free(this_ptr_conv);
13702 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
13703 LDKLightningError this_ptr_conv;
13704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13705 this_ptr_conv.is_owned = false;
13706 LDKStr _str = LightningError_get_err(&this_ptr_conv);
13707 jstring _conv = str_ref_to_ts(_str.chars, _str.len);
13711 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, int8_tArray val) {
13712 LDKLightningError this_ptr_conv;
13713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13714 this_ptr_conv.is_owned = false;
13715 LDKCVec_u8Z val_ref;
13716 val_ref.datalen = *((uint32_t*)val);
13717 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13718 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
13719 LightningError_set_err(&this_ptr_conv, val_ref);
13722 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
13723 LDKLightningError this_ptr_conv;
13724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13725 this_ptr_conv.is_owned = false;
13726 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
13727 *ret_copy = LightningError_get_action(&this_ptr_conv);
13728 long ret_ref = (long)ret_copy;
13732 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
13733 LDKLightningError this_ptr_conv;
13734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13735 this_ptr_conv.is_owned = false;
13736 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
13738 LightningError_set_action(&this_ptr_conv, val_conv);
13741 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(int8_tArray err_arg, uint32_t action_arg) {
13742 LDKCVec_u8Z err_arg_ref;
13743 err_arg_ref.datalen = *((uint32_t*)err_arg);
13744 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13745 memcpy(err_arg_ref.data, (uint8_t*)(err_arg + 4), err_arg_ref.datalen);
13746 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
13747 FREE((void*)action_arg);
13748 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
13749 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13750 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13751 long ret_ref = (long)ret_var.inner;
13752 if (ret_var.is_owned) {
13758 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
13759 LDKLightningError orig_conv;
13760 orig_conv.inner = (void*)(orig & (~1));
13761 orig_conv.is_owned = false;
13762 LDKLightningError ret_var = LightningError_clone(&orig_conv);
13763 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13764 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13765 long ret_ref = (long)ret_var.inner;
13766 if (ret_var.is_owned) {
13772 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_ptr) {
13773 LDKCommitmentUpdate this_ptr_conv;
13774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13775 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13776 CommitmentUpdate_free(this_ptr_conv);
13779 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
13780 LDKCommitmentUpdate this_ptr_conv;
13781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13782 this_ptr_conv.is_owned = false;
13783 LDKCVec_UpdateAddHTLCZ val_constr;
13784 val_constr.datalen = *((uint32_t*)val);
13785 if (val_constr.datalen > 0)
13786 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
13788 val_constr.data = NULL;
13789 uint32_t* val_vals = (uint32_t*)(val + 4);
13790 for (size_t p = 0; p < val_constr.datalen; p++) {
13791 uint32_t arr_conv_15 = val_vals[p];
13792 LDKUpdateAddHTLC arr_conv_15_conv;
13793 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
13794 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
13795 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
13796 val_constr.data[p] = arr_conv_15_conv;
13798 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
13801 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
13802 LDKCommitmentUpdate this_ptr_conv;
13803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13804 this_ptr_conv.is_owned = false;
13805 LDKCVec_UpdateFulfillHTLCZ val_constr;
13806 val_constr.datalen = *((uint32_t*)val);
13807 if (val_constr.datalen > 0)
13808 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
13810 val_constr.data = NULL;
13811 uint32_t* val_vals = (uint32_t*)(val + 4);
13812 for (size_t t = 0; t < val_constr.datalen; t++) {
13813 uint32_t arr_conv_19 = val_vals[t];
13814 LDKUpdateFulfillHTLC arr_conv_19_conv;
13815 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
13816 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
13817 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
13818 val_constr.data[t] = arr_conv_19_conv;
13820 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
13823 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
13824 LDKCommitmentUpdate this_ptr_conv;
13825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13826 this_ptr_conv.is_owned = false;
13827 LDKCVec_UpdateFailHTLCZ val_constr;
13828 val_constr.datalen = *((uint32_t*)val);
13829 if (val_constr.datalen > 0)
13830 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
13832 val_constr.data = NULL;
13833 uint32_t* val_vals = (uint32_t*)(val + 4);
13834 for (size_t q = 0; q < val_constr.datalen; q++) {
13835 uint32_t arr_conv_16 = val_vals[q];
13836 LDKUpdateFailHTLC arr_conv_16_conv;
13837 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13838 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13839 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
13840 val_constr.data[q] = arr_conv_16_conv;
13842 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
13845 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
13846 LDKCommitmentUpdate this_ptr_conv;
13847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13848 this_ptr_conv.is_owned = false;
13849 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
13850 val_constr.datalen = *((uint32_t*)val);
13851 if (val_constr.datalen > 0)
13852 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13854 val_constr.data = NULL;
13855 uint32_t* val_vals = (uint32_t*)(val + 4);
13856 for (size_t z = 0; z < val_constr.datalen; z++) {
13857 uint32_t arr_conv_25 = val_vals[z];
13858 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
13859 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
13860 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
13861 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
13862 val_constr.data[z] = arr_conv_25_conv;
13864 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
13867 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
13868 LDKCommitmentUpdate this_ptr_conv;
13869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13870 this_ptr_conv.is_owned = false;
13871 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
13872 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13873 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13874 long ret_ref = (long)ret_var.inner;
13875 if (ret_var.is_owned) {
13881 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
13882 LDKCommitmentUpdate this_ptr_conv;
13883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13884 this_ptr_conv.is_owned = false;
13885 LDKUpdateFee val_conv;
13886 val_conv.inner = (void*)(val & (~1));
13887 val_conv.is_owned = (val & 1) || (val == 0);
13888 val_conv = UpdateFee_clone(&val_conv);
13889 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
13892 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
13893 LDKCommitmentUpdate this_ptr_conv;
13894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13895 this_ptr_conv.is_owned = false;
13896 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
13897 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13898 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13899 long ret_ref = (long)ret_var.inner;
13900 if (ret_var.is_owned) {
13906 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
13907 LDKCommitmentUpdate this_ptr_conv;
13908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13909 this_ptr_conv.is_owned = false;
13910 LDKCommitmentSigned val_conv;
13911 val_conv.inner = (void*)(val & (~1));
13912 val_conv.is_owned = (val & 1) || (val == 0);
13913 val_conv = CommitmentSigned_clone(&val_conv);
13914 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
13917 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) {
13918 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
13919 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
13920 if (update_add_htlcs_arg_constr.datalen > 0)
13921 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
13923 update_add_htlcs_arg_constr.data = NULL;
13924 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
13925 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
13926 uint32_t arr_conv_15 = update_add_htlcs_arg_vals[p];
13927 LDKUpdateAddHTLC arr_conv_15_conv;
13928 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
13929 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
13930 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
13931 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
13933 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
13934 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
13935 if (update_fulfill_htlcs_arg_constr.datalen > 0)
13936 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
13938 update_fulfill_htlcs_arg_constr.data = NULL;
13939 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
13940 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
13941 uint32_t arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
13942 LDKUpdateFulfillHTLC arr_conv_19_conv;
13943 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
13944 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
13945 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
13946 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
13948 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
13949 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
13950 if (update_fail_htlcs_arg_constr.datalen > 0)
13951 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
13953 update_fail_htlcs_arg_constr.data = NULL;
13954 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
13955 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
13956 uint32_t arr_conv_16 = update_fail_htlcs_arg_vals[q];
13957 LDKUpdateFailHTLC arr_conv_16_conv;
13958 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13959 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13960 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
13961 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
13963 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
13964 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
13965 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
13966 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13968 update_fail_malformed_htlcs_arg_constr.data = NULL;
13969 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
13970 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
13971 uint32_t arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
13972 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
13973 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
13974 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
13975 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
13976 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
13978 LDKUpdateFee update_fee_arg_conv;
13979 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
13980 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
13981 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
13982 LDKCommitmentSigned commitment_signed_arg_conv;
13983 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
13984 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
13985 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
13986 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);
13987 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13988 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13989 long ret_ref = (long)ret_var.inner;
13990 if (ret_var.is_owned) {
13996 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
13997 LDKCommitmentUpdate orig_conv;
13998 orig_conv.inner = (void*)(orig & (~1));
13999 orig_conv.is_owned = false;
14000 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
14001 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14002 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14003 long ret_ref = (long)ret_var.inner;
14004 if (ret_var.is_owned) {
14010 void __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_free(uint32_t this_ptr) {
14011 if ((this_ptr & 1) != 0) return;
14012 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
14013 FREE((void*)this_ptr);
14014 HTLCFailChannelUpdate_free(this_ptr_conv);
14017 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_clone(uint32_t orig) {
14018 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
14019 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
14020 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
14021 long ret_ref = (long)ret_copy;
14025 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
14026 if ((this_ptr & 1) != 0) return;
14027 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
14028 FREE((void*)this_ptr);
14029 ChannelMessageHandler_free(this_ptr_conv);
14032 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
14033 if ((this_ptr & 1) != 0) return;
14034 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
14035 FREE((void*)this_ptr);
14036 RoutingMessageHandler_free(this_ptr_conv);
14039 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
14040 LDKAcceptChannel obj_conv;
14041 obj_conv.inner = (void*)(obj & (~1));
14042 obj_conv.is_owned = false;
14043 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
14044 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14045 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14046 CVec_u8Z_free(arg_var);
14050 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
14051 LDKu8slice ser_ref;
14052 ser_ref.datalen = *((uint32_t*)ser);
14053 ser_ref.data = (int8_t*)(ser + 4);
14054 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14055 *ret_conv = AcceptChannel_read(ser_ref);
14056 return (long)ret_conv;
14059 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
14060 LDKAnnouncementSignatures obj_conv;
14061 obj_conv.inner = (void*)(obj & (~1));
14062 obj_conv.is_owned = false;
14063 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
14064 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14065 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14066 CVec_u8Z_free(arg_var);
14070 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
14071 LDKu8slice ser_ref;
14072 ser_ref.datalen = *((uint32_t*)ser);
14073 ser_ref.data = (int8_t*)(ser + 4);
14074 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14075 *ret_conv = AnnouncementSignatures_read(ser_ref);
14076 return (long)ret_conv;
14079 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
14080 LDKChannelReestablish obj_conv;
14081 obj_conv.inner = (void*)(obj & (~1));
14082 obj_conv.is_owned = false;
14083 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
14084 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14085 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14086 CVec_u8Z_free(arg_var);
14090 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
14091 LDKu8slice ser_ref;
14092 ser_ref.datalen = *((uint32_t*)ser);
14093 ser_ref.data = (int8_t*)(ser + 4);
14094 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14095 *ret_conv = ChannelReestablish_read(ser_ref);
14096 return (long)ret_conv;
14099 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
14100 LDKClosingSigned obj_conv;
14101 obj_conv.inner = (void*)(obj & (~1));
14102 obj_conv.is_owned = false;
14103 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
14104 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14105 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14106 CVec_u8Z_free(arg_var);
14110 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
14111 LDKu8slice ser_ref;
14112 ser_ref.datalen = *((uint32_t*)ser);
14113 ser_ref.data = (int8_t*)(ser + 4);
14114 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14115 *ret_conv = ClosingSigned_read(ser_ref);
14116 return (long)ret_conv;
14119 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
14120 LDKCommitmentSigned obj_conv;
14121 obj_conv.inner = (void*)(obj & (~1));
14122 obj_conv.is_owned = false;
14123 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
14124 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14125 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14126 CVec_u8Z_free(arg_var);
14130 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
14131 LDKu8slice ser_ref;
14132 ser_ref.datalen = *((uint32_t*)ser);
14133 ser_ref.data = (int8_t*)(ser + 4);
14134 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14135 *ret_conv = CommitmentSigned_read(ser_ref);
14136 return (long)ret_conv;
14139 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
14140 LDKFundingCreated obj_conv;
14141 obj_conv.inner = (void*)(obj & (~1));
14142 obj_conv.is_owned = false;
14143 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
14144 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14145 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14146 CVec_u8Z_free(arg_var);
14150 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
14151 LDKu8slice ser_ref;
14152 ser_ref.datalen = *((uint32_t*)ser);
14153 ser_ref.data = (int8_t*)(ser + 4);
14154 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14155 *ret_conv = FundingCreated_read(ser_ref);
14156 return (long)ret_conv;
14159 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
14160 LDKFundingSigned obj_conv;
14161 obj_conv.inner = (void*)(obj & (~1));
14162 obj_conv.is_owned = false;
14163 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
14164 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14165 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14166 CVec_u8Z_free(arg_var);
14170 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
14171 LDKu8slice ser_ref;
14172 ser_ref.datalen = *((uint32_t*)ser);
14173 ser_ref.data = (int8_t*)(ser + 4);
14174 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14175 *ret_conv = FundingSigned_read(ser_ref);
14176 return (long)ret_conv;
14179 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
14180 LDKFundingLocked obj_conv;
14181 obj_conv.inner = (void*)(obj & (~1));
14182 obj_conv.is_owned = false;
14183 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
14184 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14185 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14186 CVec_u8Z_free(arg_var);
14190 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
14191 LDKu8slice ser_ref;
14192 ser_ref.datalen = *((uint32_t*)ser);
14193 ser_ref.data = (int8_t*)(ser + 4);
14194 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14195 *ret_conv = FundingLocked_read(ser_ref);
14196 return (long)ret_conv;
14199 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
14201 obj_conv.inner = (void*)(obj & (~1));
14202 obj_conv.is_owned = false;
14203 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
14204 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14205 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14206 CVec_u8Z_free(arg_var);
14210 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
14211 LDKu8slice ser_ref;
14212 ser_ref.datalen = *((uint32_t*)ser);
14213 ser_ref.data = (int8_t*)(ser + 4);
14214 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14215 *ret_conv = Init_read(ser_ref);
14216 return (long)ret_conv;
14219 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
14220 LDKOpenChannel obj_conv;
14221 obj_conv.inner = (void*)(obj & (~1));
14222 obj_conv.is_owned = false;
14223 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
14224 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14225 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14226 CVec_u8Z_free(arg_var);
14230 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
14231 LDKu8slice ser_ref;
14232 ser_ref.datalen = *((uint32_t*)ser);
14233 ser_ref.data = (int8_t*)(ser + 4);
14234 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14235 *ret_conv = OpenChannel_read(ser_ref);
14236 return (long)ret_conv;
14239 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
14240 LDKRevokeAndACK obj_conv;
14241 obj_conv.inner = (void*)(obj & (~1));
14242 obj_conv.is_owned = false;
14243 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
14244 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14245 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14246 CVec_u8Z_free(arg_var);
14250 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
14251 LDKu8slice ser_ref;
14252 ser_ref.datalen = *((uint32_t*)ser);
14253 ser_ref.data = (int8_t*)(ser + 4);
14254 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14255 *ret_conv = RevokeAndACK_read(ser_ref);
14256 return (long)ret_conv;
14259 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
14260 LDKShutdown obj_conv;
14261 obj_conv.inner = (void*)(obj & (~1));
14262 obj_conv.is_owned = false;
14263 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
14264 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14265 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14266 CVec_u8Z_free(arg_var);
14270 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
14271 LDKu8slice ser_ref;
14272 ser_ref.datalen = *((uint32_t*)ser);
14273 ser_ref.data = (int8_t*)(ser + 4);
14274 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14275 *ret_conv = Shutdown_read(ser_ref);
14276 return (long)ret_conv;
14279 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
14280 LDKUpdateFailHTLC obj_conv;
14281 obj_conv.inner = (void*)(obj & (~1));
14282 obj_conv.is_owned = false;
14283 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
14284 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14285 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14286 CVec_u8Z_free(arg_var);
14290 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
14291 LDKu8slice ser_ref;
14292 ser_ref.datalen = *((uint32_t*)ser);
14293 ser_ref.data = (int8_t*)(ser + 4);
14294 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
14295 *ret_conv = UpdateFailHTLC_read(ser_ref);
14296 return (long)ret_conv;
14299 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
14300 LDKUpdateFailMalformedHTLC obj_conv;
14301 obj_conv.inner = (void*)(obj & (~1));
14302 obj_conv.is_owned = false;
14303 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
14304 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14305 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14306 CVec_u8Z_free(arg_var);
14310 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
14311 LDKu8slice ser_ref;
14312 ser_ref.datalen = *((uint32_t*)ser);
14313 ser_ref.data = (int8_t*)(ser + 4);
14314 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14315 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
14316 return (long)ret_conv;
14319 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
14320 LDKUpdateFee obj_conv;
14321 obj_conv.inner = (void*)(obj & (~1));
14322 obj_conv.is_owned = false;
14323 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
14324 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14325 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14326 CVec_u8Z_free(arg_var);
14330 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
14331 LDKu8slice ser_ref;
14332 ser_ref.datalen = *((uint32_t*)ser);
14333 ser_ref.data = (int8_t*)(ser + 4);
14334 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14335 *ret_conv = UpdateFee_read(ser_ref);
14336 return (long)ret_conv;
14339 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
14340 LDKUpdateFulfillHTLC obj_conv;
14341 obj_conv.inner = (void*)(obj & (~1));
14342 obj_conv.is_owned = false;
14343 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
14344 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14345 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14346 CVec_u8Z_free(arg_var);
14350 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
14351 LDKu8slice ser_ref;
14352 ser_ref.datalen = *((uint32_t*)ser);
14353 ser_ref.data = (int8_t*)(ser + 4);
14354 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14355 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
14356 return (long)ret_conv;
14359 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
14360 LDKUpdateAddHTLC obj_conv;
14361 obj_conv.inner = (void*)(obj & (~1));
14362 obj_conv.is_owned = false;
14363 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
14364 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14365 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14366 CVec_u8Z_free(arg_var);
14370 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
14371 LDKu8slice ser_ref;
14372 ser_ref.datalen = *((uint32_t*)ser);
14373 ser_ref.data = (int8_t*)(ser + 4);
14374 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14375 *ret_conv = UpdateAddHTLC_read(ser_ref);
14376 return (long)ret_conv;
14379 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
14381 obj_conv.inner = (void*)(obj & (~1));
14382 obj_conv.is_owned = false;
14383 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
14384 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14385 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14386 CVec_u8Z_free(arg_var);
14390 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
14391 LDKu8slice ser_ref;
14392 ser_ref.datalen = *((uint32_t*)ser);
14393 ser_ref.data = (int8_t*)(ser + 4);
14394 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14395 *ret_conv = Ping_read(ser_ref);
14396 return (long)ret_conv;
14399 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
14401 obj_conv.inner = (void*)(obj & (~1));
14402 obj_conv.is_owned = false;
14403 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
14404 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14405 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14406 CVec_u8Z_free(arg_var);
14410 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
14411 LDKu8slice ser_ref;
14412 ser_ref.datalen = *((uint32_t*)ser);
14413 ser_ref.data = (int8_t*)(ser + 4);
14414 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14415 *ret_conv = Pong_read(ser_ref);
14416 return (long)ret_conv;
14419 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
14420 LDKUnsignedChannelAnnouncement obj_conv;
14421 obj_conv.inner = (void*)(obj & (~1));
14422 obj_conv.is_owned = false;
14423 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
14424 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14425 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14426 CVec_u8Z_free(arg_var);
14430 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
14431 LDKu8slice ser_ref;
14432 ser_ref.datalen = *((uint32_t*)ser);
14433 ser_ref.data = (int8_t*)(ser + 4);
14434 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14435 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
14436 return (long)ret_conv;
14439 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
14440 LDKChannelAnnouncement obj_conv;
14441 obj_conv.inner = (void*)(obj & (~1));
14442 obj_conv.is_owned = false;
14443 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
14444 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14445 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14446 CVec_u8Z_free(arg_var);
14450 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
14451 LDKu8slice ser_ref;
14452 ser_ref.datalen = *((uint32_t*)ser);
14453 ser_ref.data = (int8_t*)(ser + 4);
14454 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14455 *ret_conv = ChannelAnnouncement_read(ser_ref);
14456 return (long)ret_conv;
14459 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
14460 LDKUnsignedChannelUpdate obj_conv;
14461 obj_conv.inner = (void*)(obj & (~1));
14462 obj_conv.is_owned = false;
14463 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
14464 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14465 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14466 CVec_u8Z_free(arg_var);
14470 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
14471 LDKu8slice ser_ref;
14472 ser_ref.datalen = *((uint32_t*)ser);
14473 ser_ref.data = (int8_t*)(ser + 4);
14474 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14475 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
14476 return (long)ret_conv;
14479 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
14480 LDKChannelUpdate obj_conv;
14481 obj_conv.inner = (void*)(obj & (~1));
14482 obj_conv.is_owned = false;
14483 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
14484 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14485 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14486 CVec_u8Z_free(arg_var);
14490 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
14491 LDKu8slice ser_ref;
14492 ser_ref.datalen = *((uint32_t*)ser);
14493 ser_ref.data = (int8_t*)(ser + 4);
14494 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14495 *ret_conv = ChannelUpdate_read(ser_ref);
14496 return (long)ret_conv;
14499 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
14500 LDKErrorMessage obj_conv;
14501 obj_conv.inner = (void*)(obj & (~1));
14502 obj_conv.is_owned = false;
14503 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
14504 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14505 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14506 CVec_u8Z_free(arg_var);
14510 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
14511 LDKu8slice ser_ref;
14512 ser_ref.datalen = *((uint32_t*)ser);
14513 ser_ref.data = (int8_t*)(ser + 4);
14514 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14515 *ret_conv = ErrorMessage_read(ser_ref);
14516 return (long)ret_conv;
14519 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
14520 LDKUnsignedNodeAnnouncement obj_conv;
14521 obj_conv.inner = (void*)(obj & (~1));
14522 obj_conv.is_owned = false;
14523 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
14524 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14525 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14526 CVec_u8Z_free(arg_var);
14530 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
14531 LDKu8slice ser_ref;
14532 ser_ref.datalen = *((uint32_t*)ser);
14533 ser_ref.data = (int8_t*)(ser + 4);
14534 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14535 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
14536 return (long)ret_conv;
14539 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
14540 LDKNodeAnnouncement obj_conv;
14541 obj_conv.inner = (void*)(obj & (~1));
14542 obj_conv.is_owned = false;
14543 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
14544 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14545 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14546 CVec_u8Z_free(arg_var);
14550 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
14551 LDKu8slice ser_ref;
14552 ser_ref.datalen = *((uint32_t*)ser);
14553 ser_ref.data = (int8_t*)(ser + 4);
14554 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14555 *ret_conv = NodeAnnouncement_read(ser_ref);
14556 return (long)ret_conv;
14559 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
14560 LDKu8slice ser_ref;
14561 ser_ref.datalen = *((uint32_t*)ser);
14562 ser_ref.data = (int8_t*)(ser + 4);
14563 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14564 *ret_conv = QueryShortChannelIds_read(ser_ref);
14565 return (long)ret_conv;
14568 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
14569 LDKQueryShortChannelIds obj_conv;
14570 obj_conv.inner = (void*)(obj & (~1));
14571 obj_conv.is_owned = false;
14572 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
14573 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14574 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14575 CVec_u8Z_free(arg_var);
14579 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
14580 LDKu8slice ser_ref;
14581 ser_ref.datalen = *((uint32_t*)ser);
14582 ser_ref.data = (int8_t*)(ser + 4);
14583 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14584 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
14585 return (long)ret_conv;
14588 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
14589 LDKReplyShortChannelIdsEnd obj_conv;
14590 obj_conv.inner = (void*)(obj & (~1));
14591 obj_conv.is_owned = false;
14592 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
14593 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14594 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14595 CVec_u8Z_free(arg_var);
14599 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
14600 LDKu8slice ser_ref;
14601 ser_ref.datalen = *((uint32_t*)ser);
14602 ser_ref.data = (int8_t*)(ser + 4);
14603 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14604 *ret_conv = QueryChannelRange_read(ser_ref);
14605 return (long)ret_conv;
14608 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
14609 LDKQueryChannelRange obj_conv;
14610 obj_conv.inner = (void*)(obj & (~1));
14611 obj_conv.is_owned = false;
14612 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
14613 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14614 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14615 CVec_u8Z_free(arg_var);
14619 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
14620 LDKu8slice ser_ref;
14621 ser_ref.datalen = *((uint32_t*)ser);
14622 ser_ref.data = (int8_t*)(ser + 4);
14623 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14624 *ret_conv = ReplyChannelRange_read(ser_ref);
14625 return (long)ret_conv;
14628 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
14629 LDKReplyChannelRange obj_conv;
14630 obj_conv.inner = (void*)(obj & (~1));
14631 obj_conv.is_owned = false;
14632 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
14633 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14634 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14635 CVec_u8Z_free(arg_var);
14639 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
14640 LDKu8slice ser_ref;
14641 ser_ref.datalen = *((uint32_t*)ser);
14642 ser_ref.data = (int8_t*)(ser + 4);
14643 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14644 *ret_conv = GossipTimestampFilter_read(ser_ref);
14645 return (long)ret_conv;
14648 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
14649 LDKGossipTimestampFilter obj_conv;
14650 obj_conv.inner = (void*)(obj & (~1));
14651 obj_conv.is_owned = false;
14652 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
14653 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14654 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
14655 CVec_u8Z_free(arg_var);
14659 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_ptr) {
14660 LDKMessageHandler this_ptr_conv;
14661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14662 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14663 MessageHandler_free(this_ptr_conv);
14666 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
14667 LDKMessageHandler this_ptr_conv;
14668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14669 this_ptr_conv.is_owned = false;
14670 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
14674 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
14675 LDKMessageHandler this_ptr_conv;
14676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14677 this_ptr_conv.is_owned = false;
14678 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
14679 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
14682 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
14683 LDKMessageHandler this_ptr_conv;
14684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14685 this_ptr_conv.is_owned = false;
14686 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
14690 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
14691 LDKMessageHandler this_ptr_conv;
14692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14693 this_ptr_conv.is_owned = false;
14694 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
14695 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
14698 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
14699 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
14700 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
14701 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
14702 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14703 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14704 long ret_ref = (long)ret_var.inner;
14705 if (ret_var.is_owned) {
14711 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
14712 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig;
14713 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
14714 *ret = SocketDescriptor_clone(orig_conv);
14718 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
14719 if ((this_ptr & 1) != 0) return;
14720 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
14721 FREE((void*)this_ptr);
14722 SocketDescriptor_free(this_ptr_conv);
14725 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_ptr) {
14726 LDKPeerHandleError this_ptr_conv;
14727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14728 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14729 PeerHandleError_free(this_ptr_conv);
14732 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
14733 LDKPeerHandleError this_ptr_conv;
14734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14735 this_ptr_conv.is_owned = false;
14736 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
14740 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
14741 LDKPeerHandleError this_ptr_conv;
14742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14743 this_ptr_conv.is_owned = false;
14744 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
14747 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
14748 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
14749 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14750 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14751 long ret_ref = (long)ret_var.inner;
14752 if (ret_var.is_owned) {
14758 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
14759 LDKPeerHandleError orig_conv;
14760 orig_conv.inner = (void*)(orig & (~1));
14761 orig_conv.is_owned = false;
14762 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
14763 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14764 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14765 long ret_ref = (long)ret_var.inner;
14766 if (ret_var.is_owned) {
14772 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_ptr) {
14773 LDKPeerManager this_ptr_conv;
14774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14775 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14776 PeerManager_free(this_ptr_conv);
14779 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) {
14780 LDKMessageHandler message_handler_conv;
14781 message_handler_conv.inner = (void*)(message_handler & (~1));
14782 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
14783 // Warning: we need a move here but no clone is available for LDKMessageHandler
14784 LDKSecretKey our_node_secret_ref;
14785 CHECK(*((uint32_t*)our_node_secret) == 32);
14786 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
14787 unsigned char ephemeral_random_data_arr[32];
14788 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
14789 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
14790 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
14791 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14792 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
14793 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14794 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14795 long ret_ref = (long)ret_var.inner;
14796 if (ret_var.is_owned) {
14802 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
14803 LDKPeerManager this_arg_conv;
14804 this_arg_conv.inner = (void*)(this_arg & (~1));
14805 this_arg_conv.is_owned = false;
14806 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
14807 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
14808 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
14809 for (size_t m = 0; m < ret_var.datalen; m++) {
14810 int8_tArray arr_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14811 memcpy((uint8_t*)(arr_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
14812 ret_arr_ptr[m] = arr_conv_12_arr;
14814 FREE(ret_var.data);
14818 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
14819 LDKPeerManager this_arg_conv;
14820 this_arg_conv.inner = (void*)(this_arg & (~1));
14821 this_arg_conv.is_owned = false;
14822 LDKPublicKey their_node_id_ref;
14823 CHECK(*((uint32_t*)their_node_id) == 33);
14824 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
14825 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
14826 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
14827 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
14828 return (long)ret_conv;
14831 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
14832 LDKPeerManager this_arg_conv;
14833 this_arg_conv.inner = (void*)(this_arg & (~1));
14834 this_arg_conv.is_owned = false;
14835 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
14836 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
14837 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
14838 return (long)ret_conv;
14841 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
14842 LDKPeerManager this_arg_conv;
14843 this_arg_conv.inner = (void*)(this_arg & (~1));
14844 this_arg_conv.is_owned = false;
14845 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
14846 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
14847 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
14848 return (long)ret_conv;
14851 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
14852 LDKPeerManager this_arg_conv;
14853 this_arg_conv.inner = (void*)(this_arg & (~1));
14854 this_arg_conv.is_owned = false;
14855 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
14856 LDKu8slice data_ref;
14857 data_ref.datalen = *((uint32_t*)data);
14858 data_ref.data = (int8_t*)(data + 4);
14859 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
14860 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
14861 return (long)ret_conv;
14864 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
14865 LDKPeerManager this_arg_conv;
14866 this_arg_conv.inner = (void*)(this_arg & (~1));
14867 this_arg_conv.is_owned = false;
14868 PeerManager_process_events(&this_arg_conv);
14871 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
14872 LDKPeerManager this_arg_conv;
14873 this_arg_conv.inner = (void*)(this_arg & (~1));
14874 this_arg_conv.is_owned = false;
14875 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
14876 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
14879 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
14880 LDKPeerManager this_arg_conv;
14881 this_arg_conv.inner = (void*)(this_arg & (~1));
14882 this_arg_conv.is_owned = false;
14883 LDKPublicKey node_id_ref;
14884 CHECK(*((uint32_t*)node_id) == 33);
14885 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14886 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
14889 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occured(uint32_t this_arg) {
14890 LDKPeerManager this_arg_conv;
14891 this_arg_conv.inner = (void*)(this_arg & (~1));
14892 this_arg_conv.is_owned = false;
14893 PeerManager_timer_tick_occured(&this_arg_conv);
14896 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
14897 unsigned char commitment_seed_arr[32];
14898 CHECK(*((uint32_t*)commitment_seed) == 32);
14899 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
14900 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
14901 int8_tArray arg_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14902 memcpy((uint8_t*)(arg_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
14906 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
14907 LDKPublicKey per_commitment_point_ref;
14908 CHECK(*((uint32_t*)per_commitment_point) == 33);
14909 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
14910 unsigned char base_secret_arr[32];
14911 CHECK(*((uint32_t*)base_secret) == 32);
14912 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
14913 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
14914 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14915 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
14916 return (long)ret_conv;
14919 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
14920 LDKPublicKey per_commitment_point_ref;
14921 CHECK(*((uint32_t*)per_commitment_point) == 33);
14922 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
14923 LDKPublicKey base_point_ref;
14924 CHECK(*((uint32_t*)base_point) == 33);
14925 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
14926 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14927 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
14928 return (long)ret_conv;
14931 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
14932 unsigned char per_commitment_secret_arr[32];
14933 CHECK(*((uint32_t*)per_commitment_secret) == 32);
14934 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
14935 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
14936 unsigned char countersignatory_revocation_base_secret_arr[32];
14937 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
14938 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
14939 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
14940 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14941 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
14942 return (long)ret_conv;
14945 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
14946 LDKPublicKey per_commitment_point_ref;
14947 CHECK(*((uint32_t*)per_commitment_point) == 33);
14948 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
14949 LDKPublicKey countersignatory_revocation_base_point_ref;
14950 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
14951 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
14952 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14953 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
14954 return (long)ret_conv;
14957 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_ptr) {
14958 LDKTxCreationKeys this_ptr_conv;
14959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14960 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14961 TxCreationKeys_free(this_ptr_conv);
14964 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
14965 LDKTxCreationKeys this_ptr_conv;
14966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14967 this_ptr_conv.is_owned = false;
14968 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14969 memcpy((uint8_t*)(arg_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
14973 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
14974 LDKTxCreationKeys this_ptr_conv;
14975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14976 this_ptr_conv.is_owned = false;
14977 LDKPublicKey val_ref;
14978 CHECK(*((uint32_t*)val) == 33);
14979 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14980 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
14983 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
14984 LDKTxCreationKeys this_ptr_conv;
14985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14986 this_ptr_conv.is_owned = false;
14987 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14988 memcpy((uint8_t*)(arg_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
14992 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
14993 LDKTxCreationKeys this_ptr_conv;
14994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14995 this_ptr_conv.is_owned = false;
14996 LDKPublicKey val_ref;
14997 CHECK(*((uint32_t*)val) == 33);
14998 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14999 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
15002 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
15003 LDKTxCreationKeys this_ptr_conv;
15004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15005 this_ptr_conv.is_owned = false;
15006 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15007 memcpy((uint8_t*)(arg_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
15011 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
15012 LDKTxCreationKeys this_ptr_conv;
15013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15014 this_ptr_conv.is_owned = false;
15015 LDKPublicKey val_ref;
15016 CHECK(*((uint32_t*)val) == 33);
15017 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15018 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
15021 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
15022 LDKTxCreationKeys this_ptr_conv;
15023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15024 this_ptr_conv.is_owned = false;
15025 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15026 memcpy((uint8_t*)(arg_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
15030 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
15031 LDKTxCreationKeys this_ptr_conv;
15032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15033 this_ptr_conv.is_owned = false;
15034 LDKPublicKey val_ref;
15035 CHECK(*((uint32_t*)val) == 33);
15036 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15037 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
15040 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
15041 LDKTxCreationKeys this_ptr_conv;
15042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15043 this_ptr_conv.is_owned = false;
15044 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15045 memcpy((uint8_t*)(arg_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
15049 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
15050 LDKTxCreationKeys this_ptr_conv;
15051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15052 this_ptr_conv.is_owned = false;
15053 LDKPublicKey val_ref;
15054 CHECK(*((uint32_t*)val) == 33);
15055 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15056 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
15059 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) {
15060 LDKPublicKey per_commitment_point_arg_ref;
15061 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
15062 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
15063 LDKPublicKey revocation_key_arg_ref;
15064 CHECK(*((uint32_t*)revocation_key_arg) == 33);
15065 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
15066 LDKPublicKey broadcaster_htlc_key_arg_ref;
15067 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
15068 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
15069 LDKPublicKey countersignatory_htlc_key_arg_ref;
15070 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
15071 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
15072 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
15073 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
15074 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
15075 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);
15076 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15077 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15078 long ret_ref = (long)ret_var.inner;
15079 if (ret_var.is_owned) {
15085 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
15086 LDKTxCreationKeys orig_conv;
15087 orig_conv.inner = (void*)(orig & (~1));
15088 orig_conv.is_owned = false;
15089 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
15090 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15091 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15092 long ret_ref = (long)ret_var.inner;
15093 if (ret_var.is_owned) {
15099 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
15100 LDKTxCreationKeys obj_conv;
15101 obj_conv.inner = (void*)(obj & (~1));
15102 obj_conv.is_owned = false;
15103 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
15104 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15105 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
15106 CVec_u8Z_free(arg_var);
15110 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
15111 LDKu8slice ser_ref;
15112 ser_ref.datalen = *((uint32_t*)ser);
15113 ser_ref.data = (int8_t*)(ser + 4);
15114 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
15115 *ret_conv = TxCreationKeys_read(ser_ref);
15116 return (long)ret_conv;
15119 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_ptr) {
15120 LDKChannelPublicKeys this_ptr_conv;
15121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15122 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15123 ChannelPublicKeys_free(this_ptr_conv);
15126 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
15127 LDKChannelPublicKeys this_ptr_conv;
15128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15129 this_ptr_conv.is_owned = false;
15130 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15131 memcpy((uint8_t*)(arg_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
15135 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
15136 LDKChannelPublicKeys this_ptr_conv;
15137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15138 this_ptr_conv.is_owned = false;
15139 LDKPublicKey val_ref;
15140 CHECK(*((uint32_t*)val) == 33);
15141 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15142 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
15145 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
15146 LDKChannelPublicKeys this_ptr_conv;
15147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15148 this_ptr_conv.is_owned = false;
15149 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15150 memcpy((uint8_t*)(arg_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
15154 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
15155 LDKChannelPublicKeys this_ptr_conv;
15156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15157 this_ptr_conv.is_owned = false;
15158 LDKPublicKey val_ref;
15159 CHECK(*((uint32_t*)val) == 33);
15160 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15161 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
15164 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
15165 LDKChannelPublicKeys this_ptr_conv;
15166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15167 this_ptr_conv.is_owned = false;
15168 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15169 memcpy((uint8_t*)(arg_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
15173 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
15174 LDKChannelPublicKeys this_ptr_conv;
15175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15176 this_ptr_conv.is_owned = false;
15177 LDKPublicKey val_ref;
15178 CHECK(*((uint32_t*)val) == 33);
15179 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15180 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
15183 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
15184 LDKChannelPublicKeys this_ptr_conv;
15185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15186 this_ptr_conv.is_owned = false;
15187 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15188 memcpy((uint8_t*)(arg_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
15192 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
15193 LDKChannelPublicKeys this_ptr_conv;
15194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15195 this_ptr_conv.is_owned = false;
15196 LDKPublicKey val_ref;
15197 CHECK(*((uint32_t*)val) == 33);
15198 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15199 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
15202 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
15203 LDKChannelPublicKeys this_ptr_conv;
15204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15205 this_ptr_conv.is_owned = false;
15206 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15207 memcpy((uint8_t*)(arg_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
15211 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
15212 LDKChannelPublicKeys this_ptr_conv;
15213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15214 this_ptr_conv.is_owned = false;
15215 LDKPublicKey val_ref;
15216 CHECK(*((uint32_t*)val) == 33);
15217 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15218 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
15221 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) {
15222 LDKPublicKey funding_pubkey_arg_ref;
15223 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
15224 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
15225 LDKPublicKey revocation_basepoint_arg_ref;
15226 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
15227 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
15228 LDKPublicKey payment_point_arg_ref;
15229 CHECK(*((uint32_t*)payment_point_arg) == 33);
15230 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
15231 LDKPublicKey delayed_payment_basepoint_arg_ref;
15232 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
15233 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
15234 LDKPublicKey htlc_basepoint_arg_ref;
15235 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
15236 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
15237 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);
15238 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15239 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15240 long ret_ref = (long)ret_var.inner;
15241 if (ret_var.is_owned) {
15247 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
15248 LDKChannelPublicKeys orig_conv;
15249 orig_conv.inner = (void*)(orig & (~1));
15250 orig_conv.is_owned = false;
15251 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
15252 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15253 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15254 long ret_ref = (long)ret_var.inner;
15255 if (ret_var.is_owned) {
15261 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
15262 LDKChannelPublicKeys obj_conv;
15263 obj_conv.inner = (void*)(obj & (~1));
15264 obj_conv.is_owned = false;
15265 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
15266 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15267 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
15268 CVec_u8Z_free(arg_var);
15272 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
15273 LDKu8slice ser_ref;
15274 ser_ref.datalen = *((uint32_t*)ser);
15275 ser_ref.data = (int8_t*)(ser + 4);
15276 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15277 *ret_conv = ChannelPublicKeys_read(ser_ref);
15278 return (long)ret_conv;
15281 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) {
15282 LDKPublicKey per_commitment_point_ref;
15283 CHECK(*((uint32_t*)per_commitment_point) == 33);
15284 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
15285 LDKPublicKey broadcaster_delayed_payment_base_ref;
15286 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
15287 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
15288 LDKPublicKey broadcaster_htlc_base_ref;
15289 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
15290 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
15291 LDKPublicKey countersignatory_revocation_base_ref;
15292 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
15293 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
15294 LDKPublicKey countersignatory_htlc_base_ref;
15295 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
15296 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
15297 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
15298 *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);
15299 return (long)ret_conv;
15302 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
15303 LDKPublicKey per_commitment_point_ref;
15304 CHECK(*((uint32_t*)per_commitment_point) == 33);
15305 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
15306 LDKChannelPublicKeys broadcaster_keys_conv;
15307 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
15308 broadcaster_keys_conv.is_owned = false;
15309 LDKChannelPublicKeys countersignatory_keys_conv;
15310 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
15311 countersignatory_keys_conv.is_owned = false;
15312 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
15313 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
15314 return (long)ret_conv;
15317 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
15318 LDKPublicKey revocation_key_ref;
15319 CHECK(*((uint32_t*)revocation_key) == 33);
15320 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
15321 LDKPublicKey broadcaster_delayed_payment_key_ref;
15322 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
15323 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
15324 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
15325 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15326 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
15327 CVec_u8Z_free(arg_var);
15331 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_ptr) {
15332 LDKHTLCOutputInCommitment this_ptr_conv;
15333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15334 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15335 HTLCOutputInCommitment_free(this_ptr_conv);
15338 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
15339 LDKHTLCOutputInCommitment this_ptr_conv;
15340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15341 this_ptr_conv.is_owned = false;
15342 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
15346 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
15347 LDKHTLCOutputInCommitment this_ptr_conv;
15348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15349 this_ptr_conv.is_owned = false;
15350 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
15353 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
15354 LDKHTLCOutputInCommitment this_ptr_conv;
15355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15356 this_ptr_conv.is_owned = false;
15357 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
15361 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
15362 LDKHTLCOutputInCommitment this_ptr_conv;
15363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15364 this_ptr_conv.is_owned = false;
15365 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
15368 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
15369 LDKHTLCOutputInCommitment this_ptr_conv;
15370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15371 this_ptr_conv.is_owned = false;
15372 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
15376 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
15377 LDKHTLCOutputInCommitment this_ptr_conv;
15378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15379 this_ptr_conv.is_owned = false;
15380 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
15383 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
15384 LDKHTLCOutputInCommitment this_ptr_conv;
15385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15386 this_ptr_conv.is_owned = false;
15387 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15388 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
15392 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
15393 LDKHTLCOutputInCommitment this_ptr_conv;
15394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15395 this_ptr_conv.is_owned = false;
15396 LDKThirtyTwoBytes val_ref;
15397 CHECK(*((uint32_t*)val) == 32);
15398 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15399 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
15402 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
15403 LDKHTLCOutputInCommitment orig_conv;
15404 orig_conv.inner = (void*)(orig & (~1));
15405 orig_conv.is_owned = false;
15406 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
15407 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15408 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15409 long ret_ref = (long)ret_var.inner;
15410 if (ret_var.is_owned) {
15416 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
15417 LDKHTLCOutputInCommitment obj_conv;
15418 obj_conv.inner = (void*)(obj & (~1));
15419 obj_conv.is_owned = false;
15420 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
15421 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15422 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
15423 CVec_u8Z_free(arg_var);
15427 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
15428 LDKu8slice ser_ref;
15429 ser_ref.datalen = *((uint32_t*)ser);
15430 ser_ref.data = (int8_t*)(ser + 4);
15431 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15432 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
15433 return (long)ret_conv;
15436 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
15437 LDKHTLCOutputInCommitment htlc_conv;
15438 htlc_conv.inner = (void*)(htlc & (~1));
15439 htlc_conv.is_owned = false;
15440 LDKTxCreationKeys keys_conv;
15441 keys_conv.inner = (void*)(keys & (~1));
15442 keys_conv.is_owned = false;
15443 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
15444 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15445 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
15446 CVec_u8Z_free(arg_var);
15450 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
15451 LDKPublicKey broadcaster_ref;
15452 CHECK(*((uint32_t*)broadcaster) == 33);
15453 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
15454 LDKPublicKey countersignatory_ref;
15455 CHECK(*((uint32_t*)countersignatory) == 33);
15456 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
15457 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
15458 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15459 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
15460 CVec_u8Z_free(arg_var);
15464 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) {
15465 unsigned char prev_hash_arr[32];
15466 CHECK(*((uint32_t*)prev_hash) == 32);
15467 memcpy(prev_hash_arr, (uint8_t*)(prev_hash + 4), 32);
15468 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
15469 LDKHTLCOutputInCommitment htlc_conv;
15470 htlc_conv.inner = (void*)(htlc & (~1));
15471 htlc_conv.is_owned = false;
15472 LDKPublicKey broadcaster_delayed_payment_key_ref;
15473 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
15474 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
15475 LDKPublicKey revocation_key_ref;
15476 CHECK(*((uint32_t*)revocation_key) == 33);
15477 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
15478 LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
15479 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15480 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
15481 Transaction_free(arg_var);
15485 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_ptr) {
15486 LDKChannelTransactionParameters this_ptr_conv;
15487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15488 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15489 ChannelTransactionParameters_free(this_ptr_conv);
15492 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
15493 LDKChannelTransactionParameters this_ptr_conv;
15494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15495 this_ptr_conv.is_owned = false;
15496 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
15497 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15498 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15499 long ret_ref = (long)ret_var.inner;
15500 if (ret_var.is_owned) {
15506 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
15507 LDKChannelTransactionParameters this_ptr_conv;
15508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15509 this_ptr_conv.is_owned = false;
15510 LDKChannelPublicKeys val_conv;
15511 val_conv.inner = (void*)(val & (~1));
15512 val_conv.is_owned = (val & 1) || (val == 0);
15513 val_conv = ChannelPublicKeys_clone(&val_conv);
15514 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
15517 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
15518 LDKChannelTransactionParameters this_ptr_conv;
15519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15520 this_ptr_conv.is_owned = false;
15521 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
15525 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
15526 LDKChannelTransactionParameters this_ptr_conv;
15527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15528 this_ptr_conv.is_owned = false;
15529 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
15532 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
15533 LDKChannelTransactionParameters this_ptr_conv;
15534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15535 this_ptr_conv.is_owned = false;
15536 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
15540 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
15541 LDKChannelTransactionParameters this_ptr_conv;
15542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15543 this_ptr_conv.is_owned = false;
15544 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
15547 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
15548 LDKChannelTransactionParameters this_ptr_conv;
15549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15550 this_ptr_conv.is_owned = false;
15551 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
15552 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15553 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15554 long ret_ref = (long)ret_var.inner;
15555 if (ret_var.is_owned) {
15561 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
15562 LDKChannelTransactionParameters this_ptr_conv;
15563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15564 this_ptr_conv.is_owned = false;
15565 LDKCounterpartyChannelTransactionParameters val_conv;
15566 val_conv.inner = (void*)(val & (~1));
15567 val_conv.is_owned = (val & 1) || (val == 0);
15568 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
15569 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
15572 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
15573 LDKChannelTransactionParameters this_ptr_conv;
15574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15575 this_ptr_conv.is_owned = false;
15576 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
15577 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15578 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15579 long ret_ref = (long)ret_var.inner;
15580 if (ret_var.is_owned) {
15586 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
15587 LDKChannelTransactionParameters this_ptr_conv;
15588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15589 this_ptr_conv.is_owned = false;
15590 LDKOutPoint val_conv;
15591 val_conv.inner = (void*)(val & (~1));
15592 val_conv.is_owned = (val & 1) || (val == 0);
15593 val_conv = OutPoint_clone(&val_conv);
15594 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
15597 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) {
15598 LDKChannelPublicKeys holder_pubkeys_arg_conv;
15599 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
15600 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
15601 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
15602 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
15603 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
15604 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
15605 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
15606 LDKOutPoint funding_outpoint_arg_conv;
15607 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
15608 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
15609 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
15610 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);
15611 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15612 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15613 long ret_ref = (long)ret_var.inner;
15614 if (ret_var.is_owned) {
15620 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
15621 LDKChannelTransactionParameters orig_conv;
15622 orig_conv.inner = (void*)(orig & (~1));
15623 orig_conv.is_owned = false;
15624 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
15625 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15626 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15627 long ret_ref = (long)ret_var.inner;
15628 if (ret_var.is_owned) {
15634 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_ptr) {
15635 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15637 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15638 CounterpartyChannelTransactionParameters_free(this_ptr_conv);
15641 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
15642 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15644 this_ptr_conv.is_owned = false;
15645 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
15646 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15647 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15648 long ret_ref = (long)ret_var.inner;
15649 if (ret_var.is_owned) {
15655 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
15656 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15658 this_ptr_conv.is_owned = false;
15659 LDKChannelPublicKeys val_conv;
15660 val_conv.inner = (void*)(val & (~1));
15661 val_conv.is_owned = (val & 1) || (val == 0);
15662 val_conv = ChannelPublicKeys_clone(&val_conv);
15663 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
15666 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
15667 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15669 this_ptr_conv.is_owned = false;
15670 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
15674 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
15675 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15677 this_ptr_conv.is_owned = false;
15678 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
15681 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
15682 LDKChannelPublicKeys pubkeys_arg_conv;
15683 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
15684 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
15685 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
15686 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
15687 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15688 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15689 long ret_ref = (long)ret_var.inner;
15690 if (ret_var.is_owned) {
15696 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
15697 LDKCounterpartyChannelTransactionParameters orig_conv;
15698 orig_conv.inner = (void*)(orig & (~1));
15699 orig_conv.is_owned = false;
15700 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
15701 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15702 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15703 long ret_ref = (long)ret_var.inner;
15704 if (ret_var.is_owned) {
15710 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
15711 LDKChannelTransactionParameters this_arg_conv;
15712 this_arg_conv.inner = (void*)(this_arg & (~1));
15713 this_arg_conv.is_owned = false;
15714 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
15718 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
15719 LDKChannelTransactionParameters this_arg_conv;
15720 this_arg_conv.inner = (void*)(this_arg & (~1));
15721 this_arg_conv.is_owned = false;
15722 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
15723 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15724 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15725 long ret_ref = (long)ret_var.inner;
15726 if (ret_var.is_owned) {
15732 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
15733 LDKChannelTransactionParameters this_arg_conv;
15734 this_arg_conv.inner = (void*)(this_arg & (~1));
15735 this_arg_conv.is_owned = false;
15736 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
15737 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15738 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15739 long ret_ref = (long)ret_var.inner;
15740 if (ret_var.is_owned) {
15746 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
15747 LDKCounterpartyChannelTransactionParameters obj_conv;
15748 obj_conv.inner = (void*)(obj & (~1));
15749 obj_conv.is_owned = false;
15750 LDKCVec_u8Z arg_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
15751 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15752 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
15753 CVec_u8Z_free(arg_var);
15757 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
15758 LDKu8slice ser_ref;
15759 ser_ref.datalen = *((uint32_t*)ser);
15760 ser_ref.data = (int8_t*)(ser + 4);
15761 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15762 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
15763 return (long)ret_conv;
15766 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
15767 LDKChannelTransactionParameters obj_conv;
15768 obj_conv.inner = (void*)(obj & (~1));
15769 obj_conv.is_owned = false;
15770 LDKCVec_u8Z arg_var = ChannelTransactionParameters_write(&obj_conv);
15771 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15772 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
15773 CVec_u8Z_free(arg_var);
15777 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
15778 LDKu8slice ser_ref;
15779 ser_ref.datalen = *((uint32_t*)ser);
15780 ser_ref.data = (int8_t*)(ser + 4);
15781 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15782 *ret_conv = ChannelTransactionParameters_read(ser_ref);
15783 return (long)ret_conv;
15786 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_ptr) {
15787 LDKDirectedChannelTransactionParameters this_ptr_conv;
15788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15789 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15790 DirectedChannelTransactionParameters_free(this_ptr_conv);
15793 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
15794 LDKDirectedChannelTransactionParameters this_arg_conv;
15795 this_arg_conv.inner = (void*)(this_arg & (~1));
15796 this_arg_conv.is_owned = false;
15797 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
15798 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15799 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15800 long ret_ref = (long)ret_var.inner;
15801 if (ret_var.is_owned) {
15807 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
15808 LDKDirectedChannelTransactionParameters this_arg_conv;
15809 this_arg_conv.inner = (void*)(this_arg & (~1));
15810 this_arg_conv.is_owned = false;
15811 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
15812 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15813 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15814 long ret_ref = (long)ret_var.inner;
15815 if (ret_var.is_owned) {
15821 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
15822 LDKDirectedChannelTransactionParameters this_arg_conv;
15823 this_arg_conv.inner = (void*)(this_arg & (~1));
15824 this_arg_conv.is_owned = false;
15825 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
15829 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
15830 LDKDirectedChannelTransactionParameters this_arg_conv;
15831 this_arg_conv.inner = (void*)(this_arg & (~1));
15832 this_arg_conv.is_owned = false;
15833 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
15837 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
15838 LDKDirectedChannelTransactionParameters this_arg_conv;
15839 this_arg_conv.inner = (void*)(this_arg & (~1));
15840 this_arg_conv.is_owned = false;
15841 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
15842 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15843 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15844 long ret_ref = (long)ret_var.inner;
15845 if (ret_var.is_owned) {
15851 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_ptr) {
15852 LDKHolderCommitmentTransaction this_ptr_conv;
15853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15854 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15855 HolderCommitmentTransaction_free(this_ptr_conv);
15858 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
15859 LDKHolderCommitmentTransaction this_ptr_conv;
15860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15861 this_ptr_conv.is_owned = false;
15862 int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
15863 memcpy((uint8_t*)(arg_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
15867 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
15868 LDKHolderCommitmentTransaction this_ptr_conv;
15869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15870 this_ptr_conv.is_owned = false;
15871 LDKSignature val_ref;
15872 CHECK(*((uint32_t*)val) == 64);
15873 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
15874 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
15877 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
15878 LDKHolderCommitmentTransaction this_ptr_conv;
15879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15880 this_ptr_conv.is_owned = false;
15881 LDKCVec_SignatureZ val_constr;
15882 val_constr.datalen = *((uint32_t*)val);
15883 if (val_constr.datalen > 0)
15884 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15886 val_constr.data = NULL;
15887 int8_tArray* val_vals = (int8_tArray*)(val + 4);
15888 for (size_t m = 0; m < val_constr.datalen; m++) {
15889 int8_tArray arr_conv_12 = val_vals[m];
15890 LDKSignature arr_conv_12_ref;
15891 CHECK(*((uint32_t*)arr_conv_12) == 64);
15892 memcpy(arr_conv_12_ref.compact_form, (uint8_t*)(arr_conv_12 + 4), 64);
15893 val_constr.data[m] = arr_conv_12_ref;
15895 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
15898 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
15899 LDKHolderCommitmentTransaction orig_conv;
15900 orig_conv.inner = (void*)(orig & (~1));
15901 orig_conv.is_owned = false;
15902 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
15903 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15904 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15905 long ret_ref = (long)ret_var.inner;
15906 if (ret_var.is_owned) {
15912 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
15913 LDKHolderCommitmentTransaction obj_conv;
15914 obj_conv.inner = (void*)(obj & (~1));
15915 obj_conv.is_owned = false;
15916 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
15917 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15918 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
15919 CVec_u8Z_free(arg_var);
15923 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
15924 LDKu8slice ser_ref;
15925 ser_ref.datalen = *((uint32_t*)ser);
15926 ser_ref.data = (int8_t*)(ser + 4);
15927 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15928 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
15929 return (long)ret_conv;
15932 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) {
15933 LDKCommitmentTransaction commitment_tx_conv;
15934 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
15935 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
15936 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
15937 LDKSignature counterparty_sig_ref;
15938 CHECK(*((uint32_t*)counterparty_sig) == 64);
15939 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
15940 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
15941 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
15942 if (counterparty_htlc_sigs_constr.datalen > 0)
15943 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15945 counterparty_htlc_sigs_constr.data = NULL;
15946 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
15947 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
15948 int8_tArray arr_conv_12 = counterparty_htlc_sigs_vals[m];
15949 LDKSignature arr_conv_12_ref;
15950 CHECK(*((uint32_t*)arr_conv_12) == 64);
15951 memcpy(arr_conv_12_ref.compact_form, (uint8_t*)(arr_conv_12 + 4), 64);
15952 counterparty_htlc_sigs_constr.data[m] = arr_conv_12_ref;
15954 LDKPublicKey holder_funding_key_ref;
15955 CHECK(*((uint32_t*)holder_funding_key) == 33);
15956 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
15957 LDKPublicKey counterparty_funding_key_ref;
15958 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
15959 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
15960 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
15961 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15962 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15963 long ret_ref = (long)ret_var.inner;
15964 if (ret_var.is_owned) {
15970 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_ptr) {
15971 LDKBuiltCommitmentTransaction this_ptr_conv;
15972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15973 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15974 BuiltCommitmentTransaction_free(this_ptr_conv);
15977 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
15978 LDKBuiltCommitmentTransaction this_ptr_conv;
15979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15980 this_ptr_conv.is_owned = false;
15981 LDKTransaction arg_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
15982 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15983 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
15984 Transaction_free(arg_var);
15988 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
15989 LDKBuiltCommitmentTransaction this_ptr_conv;
15990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15991 this_ptr_conv.is_owned = false;
15992 LDKTransaction val_ref;
15993 val_ref.datalen = *((uint32_t*)val);
15994 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
15995 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
15996 val_ref.data_is_owned = true;
15997 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
16000 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
16001 LDKBuiltCommitmentTransaction this_ptr_conv;
16002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16003 this_ptr_conv.is_owned = false;
16004 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16005 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
16009 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
16010 LDKBuiltCommitmentTransaction this_ptr_conv;
16011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16012 this_ptr_conv.is_owned = false;
16013 LDKThirtyTwoBytes val_ref;
16014 CHECK(*((uint32_t*)val) == 32);
16015 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16016 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
16019 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
16020 LDKTransaction transaction_arg_ref;
16021 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
16022 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
16023 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
16024 transaction_arg_ref.data_is_owned = true;
16025 LDKThirtyTwoBytes txid_arg_ref;
16026 CHECK(*((uint32_t*)txid_arg) == 32);
16027 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
16028 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
16029 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16030 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16031 long ret_ref = (long)ret_var.inner;
16032 if (ret_var.is_owned) {
16038 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
16039 LDKBuiltCommitmentTransaction orig_conv;
16040 orig_conv.inner = (void*)(orig & (~1));
16041 orig_conv.is_owned = false;
16042 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
16043 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16044 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16045 long ret_ref = (long)ret_var.inner;
16046 if (ret_var.is_owned) {
16052 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
16053 LDKBuiltCommitmentTransaction obj_conv;
16054 obj_conv.inner = (void*)(obj & (~1));
16055 obj_conv.is_owned = false;
16056 LDKCVec_u8Z arg_var = BuiltCommitmentTransaction_write(&obj_conv);
16057 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16058 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
16059 CVec_u8Z_free(arg_var);
16063 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
16064 LDKu8slice ser_ref;
16065 ser_ref.datalen = *((uint32_t*)ser);
16066 ser_ref.data = (int8_t*)(ser + 4);
16067 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
16068 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
16069 return (long)ret_conv;
16072 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
16073 LDKBuiltCommitmentTransaction this_arg_conv;
16074 this_arg_conv.inner = (void*)(this_arg & (~1));
16075 this_arg_conv.is_owned = false;
16076 LDKu8slice funding_redeemscript_ref;
16077 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
16078 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
16079 int8_tArray arg_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16080 memcpy((uint8_t*)(arg_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
16084 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) {
16085 LDKBuiltCommitmentTransaction this_arg_conv;
16086 this_arg_conv.inner = (void*)(this_arg & (~1));
16087 this_arg_conv.is_owned = false;
16088 unsigned char funding_key_arr[32];
16089 CHECK(*((uint32_t*)funding_key) == 32);
16090 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
16091 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
16092 LDKu8slice funding_redeemscript_ref;
16093 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
16094 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
16095 int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16096 memcpy((uint8_t*)(arg_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
16100 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_ptr) {
16101 LDKCommitmentTransaction this_ptr_conv;
16102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16103 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16104 CommitmentTransaction_free(this_ptr_conv);
16107 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
16108 LDKCommitmentTransaction orig_conv;
16109 orig_conv.inner = (void*)(orig & (~1));
16110 orig_conv.is_owned = false;
16111 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
16112 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16113 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16114 long ret_ref = (long)ret_var.inner;
16115 if (ret_var.is_owned) {
16121 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
16122 LDKCommitmentTransaction obj_conv;
16123 obj_conv.inner = (void*)(obj & (~1));
16124 obj_conv.is_owned = false;
16125 LDKCVec_u8Z arg_var = CommitmentTransaction_write(&obj_conv);
16126 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16127 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
16128 CVec_u8Z_free(arg_var);
16132 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
16133 LDKu8slice ser_ref;
16134 ser_ref.datalen = *((uint32_t*)ser);
16135 ser_ref.data = (int8_t*)(ser + 4);
16136 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
16137 *ret_conv = CommitmentTransaction_read(ser_ref);
16138 return (long)ret_conv;
16141 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
16142 LDKCommitmentTransaction this_arg_conv;
16143 this_arg_conv.inner = (void*)(this_arg & (~1));
16144 this_arg_conv.is_owned = false;
16145 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
16149 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
16150 LDKCommitmentTransaction this_arg_conv;
16151 this_arg_conv.inner = (void*)(this_arg & (~1));
16152 this_arg_conv.is_owned = false;
16153 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
16157 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
16158 LDKCommitmentTransaction this_arg_conv;
16159 this_arg_conv.inner = (void*)(this_arg & (~1));
16160 this_arg_conv.is_owned = false;
16161 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
16165 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
16166 LDKCommitmentTransaction this_arg_conv;
16167 this_arg_conv.inner = (void*)(this_arg & (~1));
16168 this_arg_conv.is_owned = false;
16169 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
16173 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
16174 LDKCommitmentTransaction this_arg_conv;
16175 this_arg_conv.inner = (void*)(this_arg & (~1));
16176 this_arg_conv.is_owned = false;
16177 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
16178 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16179 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16180 long ret_ref = (long)ret_var.inner;
16181 if (ret_var.is_owned) {
16187 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
16188 LDKCommitmentTransaction this_arg_conv;
16189 this_arg_conv.inner = (void*)(this_arg & (~1));
16190 this_arg_conv.is_owned = false;
16191 LDKDirectedChannelTransactionParameters channel_parameters_conv;
16192 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
16193 channel_parameters_conv.is_owned = false;
16194 LDKChannelPublicKeys broadcaster_keys_conv;
16195 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
16196 broadcaster_keys_conv.is_owned = false;
16197 LDKChannelPublicKeys countersignatory_keys_conv;
16198 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
16199 countersignatory_keys_conv.is_owned = false;
16200 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
16201 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
16202 return (long)ret_conv;
16205 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_ptr) {
16206 LDKTrustedCommitmentTransaction this_ptr_conv;
16207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16208 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16209 TrustedCommitmentTransaction_free(this_ptr_conv);
16212 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
16213 LDKTrustedCommitmentTransaction this_arg_conv;
16214 this_arg_conv.inner = (void*)(this_arg & (~1));
16215 this_arg_conv.is_owned = false;
16216 int8_tArray arg_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16217 memcpy((uint8_t*)(arg_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
16221 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
16222 LDKTrustedCommitmentTransaction this_arg_conv;
16223 this_arg_conv.inner = (void*)(this_arg & (~1));
16224 this_arg_conv.is_owned = false;
16225 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
16226 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16227 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16228 long ret_ref = (long)ret_var.inner;
16229 if (ret_var.is_owned) {
16235 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
16236 LDKTrustedCommitmentTransaction this_arg_conv;
16237 this_arg_conv.inner = (void*)(this_arg & (~1));
16238 this_arg_conv.is_owned = false;
16239 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
16240 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16241 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16242 long ret_ref = (long)ret_var.inner;
16243 if (ret_var.is_owned) {
16249 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
16250 LDKTrustedCommitmentTransaction this_arg_conv;
16251 this_arg_conv.inner = (void*)(this_arg & (~1));
16252 this_arg_conv.is_owned = false;
16253 unsigned char htlc_base_key_arr[32];
16254 CHECK(*((uint32_t*)htlc_base_key) == 32);
16255 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
16256 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
16257 LDKDirectedChannelTransactionParameters channel_parameters_conv;
16258 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
16259 channel_parameters_conv.is_owned = false;
16260 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
16261 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
16262 return (long)ret_conv;
16265 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) {
16266 LDKPublicKey broadcaster_payment_basepoint_ref;
16267 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
16268 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
16269 LDKPublicKey countersignatory_payment_basepoint_ref;
16270 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
16271 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
16272 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
16276 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
16277 LDKInitFeatures orig_conv;
16278 orig_conv.inner = (void*)(orig & (~1));
16279 orig_conv.is_owned = false;
16280 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
16281 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16282 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16283 long ret_ref = (long)ret_var.inner;
16284 if (ret_var.is_owned) {
16290 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
16291 LDKNodeFeatures orig_conv;
16292 orig_conv.inner = (void*)(orig & (~1));
16293 orig_conv.is_owned = false;
16294 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
16295 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16296 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16297 long ret_ref = (long)ret_var.inner;
16298 if (ret_var.is_owned) {
16304 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
16305 LDKChannelFeatures orig_conv;
16306 orig_conv.inner = (void*)(orig & (~1));
16307 orig_conv.is_owned = false;
16308 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
16309 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16310 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16311 long ret_ref = (long)ret_var.inner;
16312 if (ret_var.is_owned) {
16318 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_ptr) {
16319 LDKInitFeatures this_ptr_conv;
16320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16321 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16322 InitFeatures_free(this_ptr_conv);
16325 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_ptr) {
16326 LDKNodeFeatures this_ptr_conv;
16327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16328 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16329 NodeFeatures_free(this_ptr_conv);
16332 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_ptr) {
16333 LDKChannelFeatures this_ptr_conv;
16334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16335 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16336 ChannelFeatures_free(this_ptr_conv);
16339 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
16340 LDKInitFeatures ret_var = InitFeatures_empty();
16341 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16342 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16343 long ret_ref = (long)ret_var.inner;
16344 if (ret_var.is_owned) {
16350 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
16351 LDKInitFeatures ret_var = InitFeatures_known();
16352 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16353 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16354 long ret_ref = (long)ret_var.inner;
16355 if (ret_var.is_owned) {
16361 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
16362 LDKNodeFeatures ret_var = NodeFeatures_empty();
16363 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16364 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16365 long ret_ref = (long)ret_var.inner;
16366 if (ret_var.is_owned) {
16372 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
16373 LDKNodeFeatures ret_var = NodeFeatures_known();
16374 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16375 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16376 long ret_ref = (long)ret_var.inner;
16377 if (ret_var.is_owned) {
16383 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
16384 LDKChannelFeatures ret_var = ChannelFeatures_empty();
16385 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16386 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16387 long ret_ref = (long)ret_var.inner;
16388 if (ret_var.is_owned) {
16394 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
16395 LDKChannelFeatures ret_var = ChannelFeatures_known();
16396 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16397 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16398 long ret_ref = (long)ret_var.inner;
16399 if (ret_var.is_owned) {
16405 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
16406 LDKInitFeatures obj_conv;
16407 obj_conv.inner = (void*)(obj & (~1));
16408 obj_conv.is_owned = false;
16409 LDKCVec_u8Z arg_var = InitFeatures_write(&obj_conv);
16410 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16411 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
16412 CVec_u8Z_free(arg_var);
16416 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
16417 LDKNodeFeatures obj_conv;
16418 obj_conv.inner = (void*)(obj & (~1));
16419 obj_conv.is_owned = false;
16420 LDKCVec_u8Z arg_var = NodeFeatures_write(&obj_conv);
16421 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16422 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
16423 CVec_u8Z_free(arg_var);
16427 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
16428 LDKChannelFeatures obj_conv;
16429 obj_conv.inner = (void*)(obj & (~1));
16430 obj_conv.is_owned = false;
16431 LDKCVec_u8Z arg_var = ChannelFeatures_write(&obj_conv);
16432 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16433 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
16434 CVec_u8Z_free(arg_var);
16438 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
16439 LDKu8slice ser_ref;
16440 ser_ref.datalen = *((uint32_t*)ser);
16441 ser_ref.data = (int8_t*)(ser + 4);
16442 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16443 *ret_conv = InitFeatures_read(ser_ref);
16444 return (long)ret_conv;
16447 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
16448 LDKu8slice ser_ref;
16449 ser_ref.datalen = *((uint32_t*)ser);
16450 ser_ref.data = (int8_t*)(ser + 4);
16451 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16452 *ret_conv = NodeFeatures_read(ser_ref);
16453 return (long)ret_conv;
16456 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
16457 LDKu8slice ser_ref;
16458 ser_ref.datalen = *((uint32_t*)ser);
16459 ser_ref.data = (int8_t*)(ser + 4);
16460 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16461 *ret_conv = ChannelFeatures_read(ser_ref);
16462 return (long)ret_conv;
16465 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_ptr) {
16466 LDKRouteHop this_ptr_conv;
16467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16468 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16469 RouteHop_free(this_ptr_conv);
16472 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
16473 LDKRouteHop this_ptr_conv;
16474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16475 this_ptr_conv.is_owned = false;
16476 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16477 memcpy((uint8_t*)(arg_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
16481 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
16482 LDKRouteHop this_ptr_conv;
16483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16484 this_ptr_conv.is_owned = false;
16485 LDKPublicKey val_ref;
16486 CHECK(*((uint32_t*)val) == 33);
16487 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16488 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
16491 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
16492 LDKRouteHop this_ptr_conv;
16493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16494 this_ptr_conv.is_owned = false;
16495 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
16496 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16497 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16498 long ret_ref = (long)ret_var.inner;
16499 if (ret_var.is_owned) {
16505 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
16506 LDKRouteHop this_ptr_conv;
16507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16508 this_ptr_conv.is_owned = false;
16509 LDKNodeFeatures val_conv;
16510 val_conv.inner = (void*)(val & (~1));
16511 val_conv.is_owned = (val & 1) || (val == 0);
16512 val_conv = NodeFeatures_clone(&val_conv);
16513 RouteHop_set_node_features(&this_ptr_conv, val_conv);
16516 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
16517 LDKRouteHop this_ptr_conv;
16518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16519 this_ptr_conv.is_owned = false;
16520 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
16524 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
16525 LDKRouteHop this_ptr_conv;
16526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16527 this_ptr_conv.is_owned = false;
16528 RouteHop_set_short_channel_id(&this_ptr_conv, val);
16531 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
16532 LDKRouteHop this_ptr_conv;
16533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16534 this_ptr_conv.is_owned = false;
16535 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
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 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
16546 LDKRouteHop this_ptr_conv;
16547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16548 this_ptr_conv.is_owned = false;
16549 LDKChannelFeatures val_conv;
16550 val_conv.inner = (void*)(val & (~1));
16551 val_conv.is_owned = (val & 1) || (val == 0);
16552 val_conv = ChannelFeatures_clone(&val_conv);
16553 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
16556 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
16557 LDKRouteHop this_ptr_conv;
16558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16559 this_ptr_conv.is_owned = false;
16560 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
16564 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
16565 LDKRouteHop this_ptr_conv;
16566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16567 this_ptr_conv.is_owned = false;
16568 RouteHop_set_fee_msat(&this_ptr_conv, val);
16571 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
16572 LDKRouteHop this_ptr_conv;
16573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16574 this_ptr_conv.is_owned = false;
16575 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
16579 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
16580 LDKRouteHop this_ptr_conv;
16581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16582 this_ptr_conv.is_owned = false;
16583 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
16586 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) {
16587 LDKPublicKey pubkey_arg_ref;
16588 CHECK(*((uint32_t*)pubkey_arg) == 33);
16589 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
16590 LDKNodeFeatures node_features_arg_conv;
16591 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
16592 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
16593 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
16594 LDKChannelFeatures channel_features_arg_conv;
16595 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
16596 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
16597 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
16598 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);
16599 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16600 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16601 long ret_ref = (long)ret_var.inner;
16602 if (ret_var.is_owned) {
16608 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
16609 LDKRouteHop orig_conv;
16610 orig_conv.inner = (void*)(orig & (~1));
16611 orig_conv.is_owned = false;
16612 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
16613 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16614 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16615 long ret_ref = (long)ret_var.inner;
16616 if (ret_var.is_owned) {
16622 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_ptr) {
16623 LDKRoute this_ptr_conv;
16624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16625 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16626 Route_free(this_ptr_conv);
16629 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
16630 LDKRoute this_ptr_conv;
16631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16632 this_ptr_conv.is_owned = false;
16633 LDKCVec_CVec_RouteHopZZ val_constr;
16634 val_constr.datalen = *((uint32_t*)val);
16635 if (val_constr.datalen > 0)
16636 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
16638 val_constr.data = NULL;
16639 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
16640 for (size_t m = 0; m < val_constr.datalen; m++) {
16641 uint32_tArray arr_conv_12 = val_vals[m];
16642 LDKCVec_RouteHopZ arr_conv_12_constr;
16643 arr_conv_12_constr.datalen = *((uint32_t*)arr_conv_12);
16644 if (arr_conv_12_constr.datalen > 0)
16645 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16647 arr_conv_12_constr.data = NULL;
16648 uint32_t* arr_conv_12_vals = (uint32_t*)(arr_conv_12 + 4);
16649 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
16650 uint32_t arr_conv_10 = arr_conv_12_vals[k];
16651 LDKRouteHop arr_conv_10_conv;
16652 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
16653 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
16654 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
16655 arr_conv_12_constr.data[k] = arr_conv_10_conv;
16657 val_constr.data[m] = arr_conv_12_constr;
16659 Route_set_paths(&this_ptr_conv, val_constr);
16662 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) {
16663 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
16664 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
16665 if (paths_arg_constr.datalen > 0)
16666 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
16668 paths_arg_constr.data = NULL;
16669 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
16670 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
16671 uint32_tArray arr_conv_12 = paths_arg_vals[m];
16672 LDKCVec_RouteHopZ arr_conv_12_constr;
16673 arr_conv_12_constr.datalen = *((uint32_t*)arr_conv_12);
16674 if (arr_conv_12_constr.datalen > 0)
16675 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16677 arr_conv_12_constr.data = NULL;
16678 uint32_t* arr_conv_12_vals = (uint32_t*)(arr_conv_12 + 4);
16679 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
16680 uint32_t arr_conv_10 = arr_conv_12_vals[k];
16681 LDKRouteHop arr_conv_10_conv;
16682 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
16683 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
16684 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
16685 arr_conv_12_constr.data[k] = arr_conv_10_conv;
16687 paths_arg_constr.data[m] = arr_conv_12_constr;
16689 LDKRoute ret_var = Route_new(paths_arg_constr);
16690 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16691 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16692 long ret_ref = (long)ret_var.inner;
16693 if (ret_var.is_owned) {
16699 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
16700 LDKRoute orig_conv;
16701 orig_conv.inner = (void*)(orig & (~1));
16702 orig_conv.is_owned = false;
16703 LDKRoute ret_var = Route_clone(&orig_conv);
16704 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16705 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16706 long ret_ref = (long)ret_var.inner;
16707 if (ret_var.is_owned) {
16713 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
16715 obj_conv.inner = (void*)(obj & (~1));
16716 obj_conv.is_owned = false;
16717 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
16718 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16719 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
16720 CVec_u8Z_free(arg_var);
16724 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
16725 LDKu8slice ser_ref;
16726 ser_ref.datalen = *((uint32_t*)ser);
16727 ser_ref.data = (int8_t*)(ser + 4);
16728 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
16729 *ret_conv = Route_read(ser_ref);
16730 return (long)ret_conv;
16733 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_ptr) {
16734 LDKRouteHint this_ptr_conv;
16735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16736 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16737 RouteHint_free(this_ptr_conv);
16740 int8_tArray __attribute__((visibility("default"))) TS_RouteHint_get_src_node_id(uint32_t this_ptr) {
16741 LDKRouteHint this_ptr_conv;
16742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16743 this_ptr_conv.is_owned = false;
16744 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16745 memcpy((uint8_t*)(arg_arr + 4), RouteHint_get_src_node_id(&this_ptr_conv).compressed_form, 33);
16749 void __attribute__((visibility("default"))) TS_RouteHint_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
16750 LDKRouteHint this_ptr_conv;
16751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16752 this_ptr_conv.is_owned = false;
16753 LDKPublicKey val_ref;
16754 CHECK(*((uint32_t*)val) == 33);
16755 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16756 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
16759 int64_t __attribute__((visibility("default"))) TS_RouteHint_get_short_channel_id(uint32_t this_ptr) {
16760 LDKRouteHint this_ptr_conv;
16761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16762 this_ptr_conv.is_owned = false;
16763 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
16767 void __attribute__((visibility("default"))) TS_RouteHint_set_short_channel_id(uint32_t this_ptr, int64_t val) {
16768 LDKRouteHint this_ptr_conv;
16769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16770 this_ptr_conv.is_owned = false;
16771 RouteHint_set_short_channel_id(&this_ptr_conv, val);
16774 uint32_t __attribute__((visibility("default"))) TS_RouteHint_get_fees(uint32_t this_ptr) {
16775 LDKRouteHint this_ptr_conv;
16776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16777 this_ptr_conv.is_owned = false;
16778 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
16779 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16780 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16781 long ret_ref = (long)ret_var.inner;
16782 if (ret_var.is_owned) {
16788 void __attribute__((visibility("default"))) TS_RouteHint_set_fees(uint32_t this_ptr, uint32_t val) {
16789 LDKRouteHint this_ptr_conv;
16790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16791 this_ptr_conv.is_owned = false;
16792 LDKRoutingFees val_conv;
16793 val_conv.inner = (void*)(val & (~1));
16794 val_conv.is_owned = (val & 1) || (val == 0);
16795 val_conv = RoutingFees_clone(&val_conv);
16796 RouteHint_set_fees(&this_ptr_conv, val_conv);
16799 int16_t __attribute__((visibility("default"))) TS_RouteHint_get_cltv_expiry_delta(uint32_t this_ptr) {
16800 LDKRouteHint this_ptr_conv;
16801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16802 this_ptr_conv.is_owned = false;
16803 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
16807 void __attribute__((visibility("default"))) TS_RouteHint_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
16808 LDKRouteHint this_ptr_conv;
16809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16810 this_ptr_conv.is_owned = false;
16811 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
16814 int64_t __attribute__((visibility("default"))) TS_RouteHint_get_htlc_minimum_msat(uint32_t this_ptr) {
16815 LDKRouteHint this_ptr_conv;
16816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16817 this_ptr_conv.is_owned = false;
16818 int64_t ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
16822 void __attribute__((visibility("default"))) TS_RouteHint_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
16823 LDKRouteHint this_ptr_conv;
16824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16825 this_ptr_conv.is_owned = false;
16826 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
16829 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, int64_t htlc_minimum_msat_arg) {
16830 LDKPublicKey src_node_id_arg_ref;
16831 CHECK(*((uint32_t*)src_node_id_arg) == 33);
16832 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
16833 LDKRoutingFees fees_arg_conv;
16834 fees_arg_conv.inner = (void*)(fees_arg & (~1));
16835 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
16836 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
16837 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);
16838 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16839 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16840 long ret_ref = (long)ret_var.inner;
16841 if (ret_var.is_owned) {
16847 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
16848 LDKRouteHint orig_conv;
16849 orig_conv.inner = (void*)(orig & (~1));
16850 orig_conv.is_owned = false;
16851 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
16852 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16853 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16854 long ret_ref = (long)ret_var.inner;
16855 if (ret_var.is_owned) {
16861 uint32_t __attribute__((visibility("default"))) TS_get_route(int8_tArray our_node_id, uint32_t network, int8_tArray target, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
16862 LDKPublicKey our_node_id_ref;
16863 CHECK(*((uint32_t*)our_node_id) == 33);
16864 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
16865 LDKNetworkGraph network_conv;
16866 network_conv.inner = (void*)(network & (~1));
16867 network_conv.is_owned = false;
16868 LDKPublicKey target_ref;
16869 CHECK(*((uint32_t*)target) == 33);
16870 memcpy(target_ref.compressed_form, (uint8_t*)(target + 4), 33);
16871 LDKCVec_ChannelDetailsZ first_hops_constr;
16872 first_hops_constr.datalen = *((uint32_t*)first_hops);
16873 if (first_hops_constr.datalen > 0)
16874 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
16876 first_hops_constr.data = NULL;
16877 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
16878 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
16879 uint32_t arr_conv_16 = first_hops_vals[q];
16880 LDKChannelDetails arr_conv_16_conv;
16881 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
16882 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
16883 first_hops_constr.data[q] = arr_conv_16_conv;
16885 LDKCVec_RouteHintZ last_hops_constr;
16886 last_hops_constr.datalen = *((uint32_t*)last_hops);
16887 if (last_hops_constr.datalen > 0)
16888 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
16890 last_hops_constr.data = NULL;
16891 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
16892 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
16893 uint32_t arr_conv_11 = last_hops_vals[l];
16894 LDKRouteHint arr_conv_11_conv;
16895 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
16896 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
16897 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
16898 last_hops_constr.data[l] = arr_conv_11_conv;
16900 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16901 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16902 *ret_conv = get_route(our_node_id_ref, &network_conv, target_ref, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
16903 FREE(first_hops_constr.data);
16904 return (long)ret_conv;
16907 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_ptr) {
16908 LDKNetworkGraph this_ptr_conv;
16909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16910 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16911 NetworkGraph_free(this_ptr_conv);
16914 void __attribute__((visibility("default"))) TS_LockedNetworkGraph_free(uint32_t this_ptr) {
16915 LDKLockedNetworkGraph this_ptr_conv;
16916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16917 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16918 LockedNetworkGraph_free(this_ptr_conv);
16921 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_ptr) {
16922 LDKNetGraphMsgHandler this_ptr_conv;
16923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16924 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16925 NetGraphMsgHandler_free(this_ptr_conv);
16928 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(int8_tArray genesis_hash, uint32_t chain_access, uint32_t logger) {
16929 LDKThirtyTwoBytes genesis_hash_ref;
16930 CHECK(*((uint32_t*)genesis_hash) == 32);
16931 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
16932 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
16933 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16934 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv, logger_conv);
16935 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16936 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16937 long ret_ref = (long)ret_var.inner;
16938 if (ret_var.is_owned) {
16944 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_from_net_graph(uint32_t chain_access, uint32_t logger, uint32_t network_graph) {
16945 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
16946 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16947 LDKNetworkGraph network_graph_conv;
16948 network_graph_conv.inner = (void*)(network_graph & (~1));
16949 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
16950 // Warning: we need a move here but no clone is available for LDKNetworkGraph
16951 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
16952 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16953 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16954 long ret_ref = (long)ret_var.inner;
16955 if (ret_var.is_owned) {
16961 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_read_locked_graph(uint32_t this_arg) {
16962 LDKNetGraphMsgHandler this_arg_conv;
16963 this_arg_conv.inner = (void*)(this_arg & (~1));
16964 this_arg_conv.is_owned = false;
16965 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
16966 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16967 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16968 long ret_ref = (long)ret_var.inner;
16969 if (ret_var.is_owned) {
16975 uint32_t __attribute__((visibility("default"))) TS_LockedNetworkGraph_graph(uint32_t this_arg) {
16976 LDKLockedNetworkGraph this_arg_conv;
16977 this_arg_conv.inner = (void*)(this_arg & (~1));
16978 this_arg_conv.is_owned = false;
16979 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
16980 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16981 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16982 long ret_ref = (long)ret_var.inner;
16983 if (ret_var.is_owned) {
16989 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
16990 LDKNetGraphMsgHandler this_arg_conv;
16991 this_arg_conv.inner = (void*)(this_arg & (~1));
16992 this_arg_conv.is_owned = false;
16993 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
16994 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
16998 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
16999 LDKNetGraphMsgHandler this_arg_conv;
17000 this_arg_conv.inner = (void*)(this_arg & (~1));
17001 this_arg_conv.is_owned = false;
17002 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
17003 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
17007 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_ptr) {
17008 LDKDirectionalChannelInfo this_ptr_conv;
17009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17010 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17011 DirectionalChannelInfo_free(this_ptr_conv);
17014 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
17015 LDKDirectionalChannelInfo this_ptr_conv;
17016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17017 this_ptr_conv.is_owned = false;
17018 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
17022 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
17023 LDKDirectionalChannelInfo this_ptr_conv;
17024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17025 this_ptr_conv.is_owned = false;
17026 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
17029 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
17030 LDKDirectionalChannelInfo this_ptr_conv;
17031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17032 this_ptr_conv.is_owned = false;
17033 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
17037 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
17038 LDKDirectionalChannelInfo this_ptr_conv;
17039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17040 this_ptr_conv.is_owned = false;
17041 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
17044 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
17045 LDKDirectionalChannelInfo this_ptr_conv;
17046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17047 this_ptr_conv.is_owned = false;
17048 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
17052 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
17053 LDKDirectionalChannelInfo this_ptr_conv;
17054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17055 this_ptr_conv.is_owned = false;
17056 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
17059 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
17060 LDKDirectionalChannelInfo this_ptr_conv;
17061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17062 this_ptr_conv.is_owned = false;
17063 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
17067 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17068 LDKDirectionalChannelInfo this_ptr_conv;
17069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17070 this_ptr_conv.is_owned = false;
17071 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
17074 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
17075 LDKDirectionalChannelInfo this_ptr_conv;
17076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17077 this_ptr_conv.is_owned = false;
17078 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
17079 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17080 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17081 long ret_ref = (long)ret_var.inner;
17082 if (ret_var.is_owned) {
17088 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
17089 LDKDirectionalChannelInfo this_ptr_conv;
17090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17091 this_ptr_conv.is_owned = false;
17092 LDKRoutingFees val_conv;
17093 val_conv.inner = (void*)(val & (~1));
17094 val_conv.is_owned = (val & 1) || (val == 0);
17095 val_conv = RoutingFees_clone(&val_conv);
17096 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
17099 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
17100 LDKDirectionalChannelInfo this_ptr_conv;
17101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17102 this_ptr_conv.is_owned = false;
17103 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
17104 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17105 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17106 long ret_ref = (long)ret_var.inner;
17107 if (ret_var.is_owned) {
17113 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
17114 LDKDirectionalChannelInfo this_ptr_conv;
17115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17116 this_ptr_conv.is_owned = false;
17117 LDKChannelUpdate val_conv;
17118 val_conv.inner = (void*)(val & (~1));
17119 val_conv.is_owned = (val & 1) || (val == 0);
17120 val_conv = ChannelUpdate_clone(&val_conv);
17121 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
17124 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
17125 LDKDirectionalChannelInfo orig_conv;
17126 orig_conv.inner = (void*)(orig & (~1));
17127 orig_conv.is_owned = false;
17128 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
17129 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17130 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17131 long ret_ref = (long)ret_var.inner;
17132 if (ret_var.is_owned) {
17138 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
17139 LDKDirectionalChannelInfo obj_conv;
17140 obj_conv.inner = (void*)(obj & (~1));
17141 obj_conv.is_owned = false;
17142 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
17143 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17144 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
17145 CVec_u8Z_free(arg_var);
17149 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
17150 LDKu8slice ser_ref;
17151 ser_ref.datalen = *((uint32_t*)ser);
17152 ser_ref.data = (int8_t*)(ser + 4);
17153 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
17154 *ret_conv = DirectionalChannelInfo_read(ser_ref);
17155 return (long)ret_conv;
17158 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_ptr) {
17159 LDKChannelInfo this_ptr_conv;
17160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17161 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17162 ChannelInfo_free(this_ptr_conv);
17165 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
17166 LDKChannelInfo this_ptr_conv;
17167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17168 this_ptr_conv.is_owned = false;
17169 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
17170 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17171 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17172 long ret_ref = (long)ret_var.inner;
17173 if (ret_var.is_owned) {
17179 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
17180 LDKChannelInfo this_ptr_conv;
17181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17182 this_ptr_conv.is_owned = false;
17183 LDKChannelFeatures val_conv;
17184 val_conv.inner = (void*)(val & (~1));
17185 val_conv.is_owned = (val & 1) || (val == 0);
17186 val_conv = ChannelFeatures_clone(&val_conv);
17187 ChannelInfo_set_features(&this_ptr_conv, val_conv);
17190 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
17191 LDKChannelInfo this_ptr_conv;
17192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17193 this_ptr_conv.is_owned = false;
17194 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17195 memcpy((uint8_t*)(arg_arr + 4), ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
17199 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, int8_tArray val) {
17200 LDKChannelInfo this_ptr_conv;
17201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17202 this_ptr_conv.is_owned = false;
17203 LDKPublicKey val_ref;
17204 CHECK(*((uint32_t*)val) == 33);
17205 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17206 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
17209 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
17210 LDKChannelInfo this_ptr_conv;
17211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17212 this_ptr_conv.is_owned = false;
17213 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
17214 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17215 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17216 long ret_ref = (long)ret_var.inner;
17217 if (ret_var.is_owned) {
17223 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
17224 LDKChannelInfo this_ptr_conv;
17225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17226 this_ptr_conv.is_owned = false;
17227 LDKDirectionalChannelInfo val_conv;
17228 val_conv.inner = (void*)(val & (~1));
17229 val_conv.is_owned = (val & 1) || (val == 0);
17230 val_conv = DirectionalChannelInfo_clone(&val_conv);
17231 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
17234 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
17235 LDKChannelInfo this_ptr_conv;
17236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17237 this_ptr_conv.is_owned = false;
17238 int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17239 memcpy((uint8_t*)(arg_arr + 4), ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
17243 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, int8_tArray val) {
17244 LDKChannelInfo this_ptr_conv;
17245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17246 this_ptr_conv.is_owned = false;
17247 LDKPublicKey val_ref;
17248 CHECK(*((uint32_t*)val) == 33);
17249 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17250 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
17253 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
17254 LDKChannelInfo this_ptr_conv;
17255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17256 this_ptr_conv.is_owned = false;
17257 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
17258 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17259 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17260 long ret_ref = (long)ret_var.inner;
17261 if (ret_var.is_owned) {
17267 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
17268 LDKChannelInfo this_ptr_conv;
17269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17270 this_ptr_conv.is_owned = false;
17271 LDKDirectionalChannelInfo val_conv;
17272 val_conv.inner = (void*)(val & (~1));
17273 val_conv.is_owned = (val & 1) || (val == 0);
17274 val_conv = DirectionalChannelInfo_clone(&val_conv);
17275 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
17278 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
17279 LDKChannelInfo this_ptr_conv;
17280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17281 this_ptr_conv.is_owned = false;
17282 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
17283 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17284 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17285 long ret_ref = (long)ret_var.inner;
17286 if (ret_var.is_owned) {
17292 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
17293 LDKChannelInfo this_ptr_conv;
17294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17295 this_ptr_conv.is_owned = false;
17296 LDKChannelAnnouncement val_conv;
17297 val_conv.inner = (void*)(val & (~1));
17298 val_conv.is_owned = (val & 1) || (val == 0);
17299 val_conv = ChannelAnnouncement_clone(&val_conv);
17300 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
17303 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
17304 LDKChannelInfo obj_conv;
17305 obj_conv.inner = (void*)(obj & (~1));
17306 obj_conv.is_owned = false;
17307 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
17308 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17309 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
17310 CVec_u8Z_free(arg_var);
17314 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
17315 LDKu8slice ser_ref;
17316 ser_ref.datalen = *((uint32_t*)ser);
17317 ser_ref.data = (int8_t*)(ser + 4);
17318 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17319 *ret_conv = ChannelInfo_read(ser_ref);
17320 return (long)ret_conv;
17323 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_ptr) {
17324 LDKRoutingFees this_ptr_conv;
17325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17326 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17327 RoutingFees_free(this_ptr_conv);
17330 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
17331 LDKRoutingFees this_ptr_conv;
17332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17333 this_ptr_conv.is_owned = false;
17334 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
17338 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
17339 LDKRoutingFees this_ptr_conv;
17340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17341 this_ptr_conv.is_owned = false;
17342 RoutingFees_set_base_msat(&this_ptr_conv, val);
17345 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
17346 LDKRoutingFees this_ptr_conv;
17347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17348 this_ptr_conv.is_owned = false;
17349 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
17353 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
17354 LDKRoutingFees this_ptr_conv;
17355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17356 this_ptr_conv.is_owned = false;
17357 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
17360 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
17361 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
17362 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17363 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17364 long ret_ref = (long)ret_var.inner;
17365 if (ret_var.is_owned) {
17371 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
17372 LDKRoutingFees orig_conv;
17373 orig_conv.inner = (void*)(orig & (~1));
17374 orig_conv.is_owned = false;
17375 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
17376 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17377 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17378 long ret_ref = (long)ret_var.inner;
17379 if (ret_var.is_owned) {
17385 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
17386 LDKu8slice ser_ref;
17387 ser_ref.datalen = *((uint32_t*)ser);
17388 ser_ref.data = (int8_t*)(ser + 4);
17389 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17390 *ret_conv = RoutingFees_read(ser_ref);
17391 return (long)ret_conv;
17394 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
17395 LDKRoutingFees obj_conv;
17396 obj_conv.inner = (void*)(obj & (~1));
17397 obj_conv.is_owned = false;
17398 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
17399 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17400 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
17401 CVec_u8Z_free(arg_var);
17405 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_ptr) {
17406 LDKNodeAnnouncementInfo this_ptr_conv;
17407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17408 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17409 NodeAnnouncementInfo_free(this_ptr_conv);
17412 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
17413 LDKNodeAnnouncementInfo this_ptr_conv;
17414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17415 this_ptr_conv.is_owned = false;
17416 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
17417 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17418 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17419 long ret_ref = (long)ret_var.inner;
17420 if (ret_var.is_owned) {
17426 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
17427 LDKNodeAnnouncementInfo this_ptr_conv;
17428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17429 this_ptr_conv.is_owned = false;
17430 LDKNodeFeatures val_conv;
17431 val_conv.inner = (void*)(val & (~1));
17432 val_conv.is_owned = (val & 1) || (val == 0);
17433 val_conv = NodeFeatures_clone(&val_conv);
17434 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
17437 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
17438 LDKNodeAnnouncementInfo this_ptr_conv;
17439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17440 this_ptr_conv.is_owned = false;
17441 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
17445 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
17446 LDKNodeAnnouncementInfo this_ptr_conv;
17447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17448 this_ptr_conv.is_owned = false;
17449 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
17452 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
17453 LDKNodeAnnouncementInfo this_ptr_conv;
17454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17455 this_ptr_conv.is_owned = false;
17456 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
17457 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
17461 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
17462 LDKNodeAnnouncementInfo this_ptr_conv;
17463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17464 this_ptr_conv.is_owned = false;
17465 LDKThreeBytes val_ref;
17466 CHECK(*((uint32_t*)val) == 3);
17467 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
17468 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
17471 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
17472 LDKNodeAnnouncementInfo this_ptr_conv;
17473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17474 this_ptr_conv.is_owned = false;
17475 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17476 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
17480 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
17481 LDKNodeAnnouncementInfo this_ptr_conv;
17482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17483 this_ptr_conv.is_owned = false;
17484 LDKThirtyTwoBytes val_ref;
17485 CHECK(*((uint32_t*)val) == 32);
17486 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17487 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
17490 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
17491 LDKNodeAnnouncementInfo this_ptr_conv;
17492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17493 this_ptr_conv.is_owned = false;
17494 LDKCVec_NetAddressZ val_constr;
17495 val_constr.datalen = *((uint32_t*)val);
17496 if (val_constr.datalen > 0)
17497 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17499 val_constr.data = NULL;
17500 uint32_t* val_vals = (uint32_t*)(val + 4);
17501 for (size_t m = 0; m < val_constr.datalen; m++) {
17502 uint32_t arr_conv_12 = val_vals[m];
17503 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
17504 FREE((void*)arr_conv_12);
17505 val_constr.data[m] = arr_conv_12_conv;
17507 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
17510 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
17511 LDKNodeAnnouncementInfo this_ptr_conv;
17512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17513 this_ptr_conv.is_owned = false;
17514 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
17515 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17516 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17517 long ret_ref = (long)ret_var.inner;
17518 if (ret_var.is_owned) {
17524 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
17525 LDKNodeAnnouncementInfo this_ptr_conv;
17526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17527 this_ptr_conv.is_owned = false;
17528 LDKNodeAnnouncement val_conv;
17529 val_conv.inner = (void*)(val & (~1));
17530 val_conv.is_owned = (val & 1) || (val == 0);
17531 val_conv = NodeAnnouncement_clone(&val_conv);
17532 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
17535 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) {
17536 LDKNodeFeatures features_arg_conv;
17537 features_arg_conv.inner = (void*)(features_arg & (~1));
17538 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
17539 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
17540 LDKThreeBytes rgb_arg_ref;
17541 CHECK(*((uint32_t*)rgb_arg) == 3);
17542 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
17543 LDKThirtyTwoBytes alias_arg_ref;
17544 CHECK(*((uint32_t*)alias_arg) == 32);
17545 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
17546 LDKCVec_NetAddressZ addresses_arg_constr;
17547 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
17548 if (addresses_arg_constr.datalen > 0)
17549 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17551 addresses_arg_constr.data = NULL;
17552 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
17553 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
17554 uint32_t arr_conv_12 = addresses_arg_vals[m];
17555 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
17556 FREE((void*)arr_conv_12);
17557 addresses_arg_constr.data[m] = arr_conv_12_conv;
17559 LDKNodeAnnouncement announcement_message_arg_conv;
17560 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
17561 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
17562 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
17563 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
17564 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17565 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17566 long ret_ref = (long)ret_var.inner;
17567 if (ret_var.is_owned) {
17573 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
17574 LDKNodeAnnouncementInfo orig_conv;
17575 orig_conv.inner = (void*)(orig & (~1));
17576 orig_conv.is_owned = false;
17577 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
17578 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17579 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17580 long ret_ref = (long)ret_var.inner;
17581 if (ret_var.is_owned) {
17587 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
17588 LDKNodeAnnouncementInfo obj_conv;
17589 obj_conv.inner = (void*)(obj & (~1));
17590 obj_conv.is_owned = false;
17591 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
17592 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17593 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
17594 CVec_u8Z_free(arg_var);
17598 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
17599 LDKu8slice ser_ref;
17600 ser_ref.datalen = *((uint32_t*)ser);
17601 ser_ref.data = (int8_t*)(ser + 4);
17602 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17603 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
17604 return (long)ret_conv;
17607 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_ptr) {
17608 LDKNodeInfo this_ptr_conv;
17609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17610 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17611 NodeInfo_free(this_ptr_conv);
17614 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
17615 LDKNodeInfo this_ptr_conv;
17616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17617 this_ptr_conv.is_owned = false;
17618 LDKCVec_u64Z val_constr;
17619 val_constr.datalen = *((uint32_t*)val);
17620 if (val_constr.datalen > 0)
17621 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17623 val_constr.data = NULL;
17624 int64_t* val_vals = (int64_t*)(val + 4);
17625 for (size_t i = 0; i < val_constr.datalen; i++) {
17626 int64_t arr_conv_8 = val_vals[i];
17627 val_constr.data[i] = arr_conv_8;
17629 NodeInfo_set_channels(&this_ptr_conv, val_constr);
17632 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
17633 LDKNodeInfo this_ptr_conv;
17634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17635 this_ptr_conv.is_owned = false;
17636 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
17637 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17638 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17639 long ret_ref = (long)ret_var.inner;
17640 if (ret_var.is_owned) {
17646 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
17647 LDKNodeInfo this_ptr_conv;
17648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17649 this_ptr_conv.is_owned = false;
17650 LDKRoutingFees val_conv;
17651 val_conv.inner = (void*)(val & (~1));
17652 val_conv.is_owned = (val & 1) || (val == 0);
17653 val_conv = RoutingFees_clone(&val_conv);
17654 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
17657 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
17658 LDKNodeInfo this_ptr_conv;
17659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17660 this_ptr_conv.is_owned = false;
17661 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
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 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
17672 LDKNodeInfo this_ptr_conv;
17673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17674 this_ptr_conv.is_owned = false;
17675 LDKNodeAnnouncementInfo val_conv;
17676 val_conv.inner = (void*)(val & (~1));
17677 val_conv.is_owned = (val & 1) || (val == 0);
17678 val_conv = NodeAnnouncementInfo_clone(&val_conv);
17679 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
17682 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
17683 LDKCVec_u64Z channels_arg_constr;
17684 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
17685 if (channels_arg_constr.datalen > 0)
17686 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17688 channels_arg_constr.data = NULL;
17689 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
17690 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
17691 int64_t arr_conv_8 = channels_arg_vals[i];
17692 channels_arg_constr.data[i] = arr_conv_8;
17694 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
17695 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
17696 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
17697 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
17698 LDKNodeAnnouncementInfo announcement_info_arg_conv;
17699 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
17700 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
17701 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
17702 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
17703 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17704 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17705 long ret_ref = (long)ret_var.inner;
17706 if (ret_var.is_owned) {
17712 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
17713 LDKNodeInfo orig_conv;
17714 orig_conv.inner = (void*)(orig & (~1));
17715 orig_conv.is_owned = false;
17716 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
17717 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17718 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17719 long ret_ref = (long)ret_var.inner;
17720 if (ret_var.is_owned) {
17726 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
17727 LDKNodeInfo obj_conv;
17728 obj_conv.inner = (void*)(obj & (~1));
17729 obj_conv.is_owned = false;
17730 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
17731 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17732 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
17733 CVec_u8Z_free(arg_var);
17737 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
17738 LDKu8slice ser_ref;
17739 ser_ref.datalen = *((uint32_t*)ser);
17740 ser_ref.data = (int8_t*)(ser + 4);
17741 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17742 *ret_conv = NodeInfo_read(ser_ref);
17743 return (long)ret_conv;
17746 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
17747 LDKNetworkGraph obj_conv;
17748 obj_conv.inner = (void*)(obj & (~1));
17749 obj_conv.is_owned = false;
17750 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
17751 int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17752 memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen);
17753 CVec_u8Z_free(arg_var);
17757 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
17758 LDKu8slice ser_ref;
17759 ser_ref.datalen = *((uint32_t*)ser);
17760 ser_ref.data = (int8_t*)(ser + 4);
17761 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17762 *ret_conv = NetworkGraph_read(ser_ref);
17763 return (long)ret_conv;
17766 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
17767 LDKThirtyTwoBytes genesis_hash_ref;
17768 CHECK(*((uint32_t*)genesis_hash) == 32);
17769 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
17770 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
17771 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17772 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17773 long ret_ref = (long)ret_var.inner;
17774 if (ret_var.is_owned) {
17780 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
17781 LDKNetworkGraph this_arg_conv;
17782 this_arg_conv.inner = (void*)(this_arg & (~1));
17783 this_arg_conv.is_owned = false;
17784 LDKNodeAnnouncement msg_conv;
17785 msg_conv.inner = (void*)(msg & (~1));
17786 msg_conv.is_owned = false;
17787 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17788 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
17789 return (long)ret_conv;
17792 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
17793 LDKNetworkGraph this_arg_conv;
17794 this_arg_conv.inner = (void*)(this_arg & (~1));
17795 this_arg_conv.is_owned = false;
17796 LDKUnsignedNodeAnnouncement msg_conv;
17797 msg_conv.inner = (void*)(msg & (~1));
17798 msg_conv.is_owned = false;
17799 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17800 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
17801 return (long)ret_conv;
17804 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
17805 LDKNetworkGraph this_arg_conv;
17806 this_arg_conv.inner = (void*)(this_arg & (~1));
17807 this_arg_conv.is_owned = false;
17808 LDKChannelAnnouncement msg_conv;
17809 msg_conv.inner = (void*)(msg & (~1));
17810 msg_conv.is_owned = false;
17811 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17812 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17813 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
17814 return (long)ret_conv;
17817 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
17818 LDKNetworkGraph this_arg_conv;
17819 this_arg_conv.inner = (void*)(this_arg & (~1));
17820 this_arg_conv.is_owned = false;
17821 LDKUnsignedChannelAnnouncement msg_conv;
17822 msg_conv.inner = (void*)(msg & (~1));
17823 msg_conv.is_owned = false;
17824 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17825 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17826 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
17827 return (long)ret_conv;
17830 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
17831 LDKNetworkGraph this_arg_conv;
17832 this_arg_conv.inner = (void*)(this_arg & (~1));
17833 this_arg_conv.is_owned = false;
17834 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
17837 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
17838 LDKNetworkGraph this_arg_conv;
17839 this_arg_conv.inner = (void*)(this_arg & (~1));
17840 this_arg_conv.is_owned = false;
17841 LDKChannelUpdate msg_conv;
17842 msg_conv.inner = (void*)(msg & (~1));
17843 msg_conv.is_owned = false;
17844 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17845 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
17846 return (long)ret_conv;
17849 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
17850 LDKNetworkGraph this_arg_conv;
17851 this_arg_conv.inner = (void*)(this_arg & (~1));
17852 this_arg_conv.is_owned = false;
17853 LDKUnsignedChannelUpdate msg_conv;
17854 msg_conv.inner = (void*)(msg & (~1));
17855 msg_conv.is_owned = false;
17856 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17857 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
17858 return (long)ret_conv;