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;
130 case 3: return LDKNetwork_Signet;
134 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
136 case LDKNetwork_Bitcoin: return 0;
137 case LDKNetwork_Testnet: return 1;
138 case LDKNetwork_Regtest: return 2;
139 case LDKNetwork_Signet: return 3;
143 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
145 case 0: return LDKSecp256k1Error_IncorrectSignature;
146 case 1: return LDKSecp256k1Error_InvalidMessage;
147 case 2: return LDKSecp256k1Error_InvalidPublicKey;
148 case 3: return LDKSecp256k1Error_InvalidSignature;
149 case 4: return LDKSecp256k1Error_InvalidSecretKey;
150 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
151 case 6: return LDKSecp256k1Error_InvalidTweak;
152 case 7: return LDKSecp256k1Error_TweakCheckFailed;
153 case 8: return LDKSecp256k1Error_NotEnoughMemory;
157 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
159 case LDKSecp256k1Error_IncorrectSignature: return 0;
160 case LDKSecp256k1Error_InvalidMessage: return 1;
161 case LDKSecp256k1Error_InvalidPublicKey: return 2;
162 case LDKSecp256k1Error_InvalidSignature: return 3;
163 case LDKSecp256k1Error_InvalidSecretKey: return 4;
164 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
165 case LDKSecp256k1Error_InvalidTweak: return 6;
166 case LDKSecp256k1Error_TweakCheckFailed: return 7;
167 case LDKSecp256k1Error_NotEnoughMemory: return 8;
171 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u8Z_new(int8_tArray elems) {
172 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
173 ret->datalen = *((uint32_t*)elems);
174 if (ret->datalen == 0) {
177 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
178 int8_t *java_elems = (int8_t*)(elems + 4);
179 for (size_t i = 0; i < ret->datalen; i++) {
180 ret->data[i] = java_elems[i];
185 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
186 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
187 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
190 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_result_ok(uint32_t arg) {
191 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
193 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_ok(uint32_t arg) {
194 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
195 CHECK(val->result_ok);
196 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
197 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).bytes, 32);
200 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_err(uint32_t arg) {
201 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
202 CHECK(!val->result_ok);
203 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
206 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_result_ok(uint32_t arg) {
207 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
209 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_ok(uint32_t arg) {
210 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
211 CHECK(val->result_ok);
212 int8_tArray res_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
213 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compressed_form, 33);
216 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_err(uint32_t arg) {
217 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
218 CHECK(!val->result_ok);
219 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
222 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_result_ok(uint32_t arg) {
223 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
225 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t arg) {
226 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
227 CHECK(val->result_ok);
228 LDKTxCreationKeys res_var = (*val->contents.result);
229 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
230 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
231 long res_ref = (long)res_var.inner & ~1;
234 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t arg) {
235 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
236 CHECK(!val->result_ok);
237 LDKDecodeError err_var = (*val->contents.err);
238 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
239 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
240 long err_ref = (long)err_var.inner & ~1;
243 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_result_ok(uint32_t arg) {
244 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
246 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t arg) {
247 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
248 CHECK(val->result_ok);
249 LDKChannelPublicKeys res_var = (*val->contents.result);
250 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
251 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
252 long res_ref = (long)res_var.inner & ~1;
255 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t arg) {
256 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
257 CHECK(!val->result_ok);
258 LDKDecodeError err_var = (*val->contents.err);
259 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
260 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
261 long err_ref = (long)err_var.inner & ~1;
264 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_result_ok(uint32_t arg) {
265 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
267 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_ok(uint32_t arg) {
268 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
269 CHECK(val->result_ok);
270 LDKTxCreationKeys res_var = (*val->contents.result);
271 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
272 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
273 long res_ref = (long)res_var.inner & ~1;
276 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_err(uint32_t arg) {
277 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
278 CHECK(!val->result_ok);
279 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
282 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_result_ok(uint32_t arg) {
283 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
285 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
286 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
287 CHECK(val->result_ok);
288 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
289 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
290 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
291 long res_ref = (long)res_var.inner & ~1;
294 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
295 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
296 CHECK(!val->result_ok);
297 LDKDecodeError err_var = (*val->contents.err);
298 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
299 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
300 long err_ref = (long)err_var.inner & ~1;
303 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
304 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
306 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
307 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
308 CHECK(val->result_ok);
309 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
310 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
311 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
312 long res_ref = (long)res_var.inner & ~1;
315 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
316 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
317 CHECK(!val->result_ok);
318 LDKDecodeError err_var = (*val->contents.err);
319 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
320 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
321 long err_ref = (long)err_var.inner & ~1;
324 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
325 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
327 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
328 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
329 CHECK(val->result_ok);
330 LDKChannelTransactionParameters res_var = (*val->contents.result);
331 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
332 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
333 long res_ref = (long)res_var.inner & ~1;
336 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
337 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
338 CHECK(!val->result_ok);
339 LDKDecodeError err_var = (*val->contents.err);
340 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
341 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
342 long err_ref = (long)err_var.inner & ~1;
345 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
346 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
348 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
349 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
350 CHECK(val->result_ok);
351 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
352 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
353 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
354 long res_ref = (long)res_var.inner & ~1;
357 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
358 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
359 CHECK(!val->result_ok);
360 LDKDecodeError err_var = (*val->contents.err);
361 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
362 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
363 long err_ref = (long)err_var.inner & ~1;
366 jboolean __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
367 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
369 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
370 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
371 CHECK(val->result_ok);
372 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
373 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
374 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
375 long res_ref = (long)res_var.inner & ~1;
378 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
379 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
380 CHECK(!val->result_ok);
381 LDKDecodeError err_var = (*val->contents.err);
382 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
383 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
384 long err_ref = (long)err_var.inner & ~1;
387 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
388 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
390 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
391 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
392 CHECK(val->result_ok);
393 LDKCommitmentTransaction res_var = (*val->contents.result);
394 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
395 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
396 long res_ref = (long)res_var.inner & ~1;
399 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
400 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
401 CHECK(!val->result_ok);
402 LDKDecodeError err_var = (*val->contents.err);
403 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
404 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
405 long err_ref = (long)err_var.inner & ~1;
408 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_result_ok(uint32_t arg) {
409 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
411 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
412 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
413 CHECK(val->result_ok);
414 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
415 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
416 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
417 long res_ref = (long)res_var.inner & ~1;
420 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
421 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
422 CHECK(!val->result_ok);
423 return *val->contents.err;
425 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_result_ok(uint32_t arg) {
426 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
428 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
429 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
430 CHECK(val->result_ok);
431 LDKCVec_SignatureZ res_var = (*val->contents.result);
432 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
433 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
434 for (size_t m = 0; m < res_var.datalen; m++) {
435 int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
436 memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64);
437 res_arr_ptr[m] = res_conv_12_arr;
441 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
442 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
443 CHECK(!val->result_ok);
444 return *val->contents.err;
446 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
447 LDKErrorAction *obj = (LDKErrorAction*)ptr;
449 case LDKErrorAction_DisconnectPeer: {
450 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
451 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
452 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
453 long msg_ref = (long)msg_var.inner & ~1;
454 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
456 case LDKErrorAction_IgnoreError: {
457 return 0 /* LDKErrorAction - IgnoreError */;
459 case LDKErrorAction_SendErrorMessage: {
460 LDKErrorMessage msg_var = obj->send_error_message.msg;
461 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
462 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
463 long msg_ref = (long)msg_var.inner & ~1;
464 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
469 uint32_t __attribute__((visibility("default"))) TS_LDKHTLCFailChannelUpdate_ref_from_ptr(uint32_t ptr) {
470 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
472 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
473 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
474 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
475 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
476 long msg_ref = (long)msg_var.inner & ~1;
477 return 0 /* LDKHTLCFailChannelUpdate - ChannelUpdateMessage */; (void) msg_ref;
479 case LDKHTLCFailChannelUpdate_ChannelClosed: {
480 return 0 /* LDKHTLCFailChannelUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
482 case LDKHTLCFailChannelUpdate_NodeFailure: {
483 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
484 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
485 return 0 /* LDKHTLCFailChannelUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
490 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
491 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
493 case LDKMessageSendEvent_SendAcceptChannel: {
494 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
495 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
496 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
497 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
498 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
499 long msg_ref = (long)msg_var.inner & ~1;
500 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
502 case LDKMessageSendEvent_SendOpenChannel: {
503 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
504 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
505 LDKOpenChannel msg_var = obj->send_open_channel.msg;
506 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
507 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
508 long msg_ref = (long)msg_var.inner & ~1;
509 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
511 case LDKMessageSendEvent_SendFundingCreated: {
512 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
513 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
514 LDKFundingCreated msg_var = obj->send_funding_created.msg;
515 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
516 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
517 long msg_ref = (long)msg_var.inner & ~1;
518 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
520 case LDKMessageSendEvent_SendFundingSigned: {
521 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
522 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
523 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
524 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
525 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
526 long msg_ref = (long)msg_var.inner & ~1;
527 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
529 case LDKMessageSendEvent_SendFundingLocked: {
530 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
531 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
532 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
533 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
534 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
535 long msg_ref = (long)msg_var.inner & ~1;
536 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
538 case LDKMessageSendEvent_SendAnnouncementSignatures: {
539 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
540 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
541 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
542 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
543 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
544 long msg_ref = (long)msg_var.inner & ~1;
545 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
547 case LDKMessageSendEvent_UpdateHTLCs: {
548 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
549 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
550 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
551 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
552 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
553 long updates_ref = (long)updates_var.inner & ~1;
554 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
556 case LDKMessageSendEvent_SendRevokeAndACK: {
557 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
558 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
559 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
560 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
561 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
562 long msg_ref = (long)msg_var.inner & ~1;
563 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
565 case LDKMessageSendEvent_SendClosingSigned: {
566 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
567 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
568 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
569 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
570 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
571 long msg_ref = (long)msg_var.inner & ~1;
572 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
574 case LDKMessageSendEvent_SendShutdown: {
575 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
576 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
577 LDKShutdown msg_var = obj->send_shutdown.msg;
578 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
579 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
580 long msg_ref = (long)msg_var.inner & ~1;
581 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
583 case LDKMessageSendEvent_SendChannelReestablish: {
584 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
585 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
586 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
587 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
588 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
589 long msg_ref = (long)msg_var.inner & ~1;
590 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
592 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
593 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
594 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
595 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
596 long msg_ref = (long)msg_var.inner & ~1;
597 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
598 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
599 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
600 long update_msg_ref = (long)update_msg_var.inner & ~1;
601 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
603 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
604 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
605 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
606 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
607 long msg_ref = (long)msg_var.inner & ~1;
608 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
610 case LDKMessageSendEvent_BroadcastChannelUpdate: {
611 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
612 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
613 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
614 long msg_ref = (long)msg_var.inner & ~1;
615 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
617 case LDKMessageSendEvent_HandleError: {
618 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
619 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
620 long action_ref = ((long)&obj->handle_error.action) | 1;
621 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
623 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
624 long update_ref = ((long)&obj->payment_failure_network_update.update) | 1;
625 return 0 /* LDKMessageSendEvent - PaymentFailureNetworkUpdate */; (void) update_ref;
627 case LDKMessageSendEvent_SendChannelRangeQuery: {
628 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
629 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
630 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
631 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
632 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
633 long msg_ref = (long)msg_var.inner & ~1;
634 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
636 case LDKMessageSendEvent_SendShortIdsQuery: {
637 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
638 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
639 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
640 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
641 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
642 long msg_ref = (long)msg_var.inner & ~1;
643 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
645 case LDKMessageSendEvent_SendReplyChannelRange: {
646 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
647 memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33);
648 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
649 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
650 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
651 long msg_ref = (long)msg_var.inner & ~1;
652 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
657 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MessageSendEventZ_new(uint32_tArray elems) {
658 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
659 ret->datalen = *((uint32_t*)elems);
660 if (ret->datalen == 0) {
663 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
664 uint32_t *java_elems = (uint32_t*)(elems + 4);
665 for (size_t i = 0; i < ret->datalen; i++) {
666 uint32_t arr_elem = java_elems[i];
667 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
668 FREE((void*)arr_elem);
669 ret->data[i] = arr_elem_conv;
674 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
675 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
676 for (size_t i = 0; i < ret.datalen; i++) {
677 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
681 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
682 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
684 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
685 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
686 CHECK(val->result_ok);
687 return *val->contents.result;
689 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
690 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
691 CHECK(!val->result_ok);
692 LDKLightningError err_var = (*val->contents.err);
693 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
694 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
695 long err_ref = (long)err_var.inner & ~1;
698 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
699 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
700 LDKChannelAnnouncement a_conv;
701 a_conv.inner = (void*)(a & (~1));
702 a_conv.is_owned = (a & 1) || (a == 0);
703 a_conv = ChannelAnnouncement_clone(&a_conv);
705 LDKChannelUpdate b_conv;
706 b_conv.inner = (void*)(b & (~1));
707 b_conv.is_owned = (b & 1) || (b == 0);
708 b_conv = ChannelUpdate_clone(&b_conv);
710 LDKChannelUpdate c_conv;
711 c_conv.inner = (void*)(c & (~1));
712 c_conv.is_owned = (c & 1) || (c == 0);
713 c_conv = ChannelUpdate_clone(&c_conv);
717 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t ptr) {
718 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
719 LDKChannelAnnouncement a_var = tuple->a;
720 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
721 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
722 long a_ref = (long)a_var.inner & ~1;
725 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t ptr) {
726 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
727 LDKChannelUpdate b_var = tuple->b;
728 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
729 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
730 long b_ref = (long)b_var.inner & ~1;
733 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t ptr) {
734 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
735 LDKChannelUpdate c_var = tuple->c;
736 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
737 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
738 long c_ref = (long)c_var.inner & ~1;
741 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
742 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
743 ret->datalen = *((uint32_t*)elems);
744 if (ret->datalen == 0) {
747 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
748 uint32_t *java_elems = (uint32_t*)(elems + 4);
749 for (size_t i = 0; i < ret->datalen; i++) {
750 uint32_t arr_elem = java_elems[i];
751 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
752 FREE((void*)arr_elem);
753 ret->data[i] = arr_elem_conv;
758 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
759 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
760 for (size_t i = 0; i < ret.datalen; i++) {
761 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
765 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
766 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
767 ret->datalen = *((uint32_t*)elems);
768 if (ret->datalen == 0) {
771 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
772 uint32_t *java_elems = (uint32_t*)(elems + 4);
773 for (size_t i = 0; i < ret->datalen; i++) {
774 uint32_t arr_elem = java_elems[i];
775 LDKNodeAnnouncement arr_elem_conv;
776 arr_elem_conv.inner = (void*)(arr_elem & (~1));
777 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
778 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
779 ret->data[i] = arr_elem_conv;
784 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
785 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
786 for (size_t i = 0; i < ret.datalen; i++) {
787 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
791 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
792 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
794 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
795 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
796 CHECK(val->result_ok);
797 return *val->contents.result;
799 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
800 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
801 CHECK(!val->result_ok);
802 LDKLightningError err_var = (*val->contents.err);
803 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
804 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
805 long err_ref = (long)err_var.inner & ~1;
808 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
809 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
811 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
812 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
813 CHECK(val->result_ok);
814 LDKCVec_u8Z res_var = (*val->contents.result);
815 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
816 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
819 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
820 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
821 CHECK(!val->result_ok);
822 LDKPeerHandleError err_var = (*val->contents.err);
823 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
824 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
825 long err_ref = (long)err_var.inner & ~1;
828 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
829 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
831 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
832 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
833 CHECK(val->result_ok);
834 return *val->contents.result;
836 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
837 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
838 CHECK(!val->result_ok);
839 LDKPeerHandleError err_var = (*val->contents.err);
840 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
841 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
842 long err_ref = (long)err_var.inner & ~1;
845 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
846 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
848 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
849 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
850 CHECK(val->result_ok);
851 return *val->contents.result;
853 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
854 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
855 CHECK(!val->result_ok);
856 LDKPeerHandleError err_var = (*val->contents.err);
857 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
858 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
859 long err_ref = (long)err_var.inner & ~1;
862 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
863 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
865 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
866 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
867 CHECK(val->result_ok);
868 LDKInitFeatures res_var = (*val->contents.result);
869 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
870 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
871 long res_ref = (long)res_var.inner & ~1;
874 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
875 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
876 CHECK(!val->result_ok);
877 LDKDecodeError err_var = (*val->contents.err);
878 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
879 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
880 long err_ref = (long)err_var.inner & ~1;
883 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
884 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
886 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
887 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
888 CHECK(val->result_ok);
889 LDKNodeFeatures res_var = (*val->contents.result);
890 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
891 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
892 long res_ref = (long)res_var.inner & ~1;
895 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
896 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
897 CHECK(!val->result_ok);
898 LDKDecodeError err_var = (*val->contents.err);
899 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
900 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
901 long err_ref = (long)err_var.inner & ~1;
904 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
905 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
907 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
908 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
909 CHECK(val->result_ok);
910 LDKChannelFeatures res_var = (*val->contents.result);
911 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
912 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
913 long res_ref = (long)res_var.inner & ~1;
916 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
917 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
918 CHECK(!val->result_ok);
919 LDKDecodeError err_var = (*val->contents.err);
920 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
921 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
922 long err_ref = (long)err_var.inner & ~1;
925 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
926 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
928 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
929 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
930 CHECK(val->result_ok);
931 LDKInvoiceFeatures res_var = (*val->contents.result);
932 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
933 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
934 long res_ref = (long)res_var.inner & ~1;
937 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) {
938 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
939 CHECK(!val->result_ok);
940 LDKDecodeError err_var = (*val->contents.err);
941 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
942 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
943 long err_ref = (long)err_var.inner & ~1;
946 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
947 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
949 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
950 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
951 CHECK(val->result_ok);
952 LDKChannelConfig res_var = (*val->contents.result);
953 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
954 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
955 long res_ref = (long)res_var.inner & ~1;
958 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
959 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
960 CHECK(!val->result_ok);
961 LDKDecodeError err_var = (*val->contents.err);
962 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
963 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
964 long err_ref = (long)err_var.inner & ~1;
967 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
968 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
970 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
971 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
972 CHECK(val->result_ok);
973 LDKDirectionalChannelInfo res_var = (*val->contents.result);
974 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
975 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
976 long res_ref = (long)res_var.inner & ~1;
979 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
980 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
981 CHECK(!val->result_ok);
982 LDKDecodeError err_var = (*val->contents.err);
983 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
984 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
985 long err_ref = (long)err_var.inner & ~1;
988 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
989 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
991 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
992 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
993 CHECK(val->result_ok);
994 LDKChannelInfo res_var = (*val->contents.result);
995 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
996 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
997 long res_ref = (long)res_var.inner & ~1;
1000 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
1001 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
1002 CHECK(!val->result_ok);
1003 LDKDecodeError err_var = (*val->contents.err);
1004 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1005 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1006 long err_ref = (long)err_var.inner & ~1;
1009 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
1010 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
1012 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
1013 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
1014 CHECK(val->result_ok);
1015 LDKRoutingFees res_var = (*val->contents.result);
1016 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1017 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1018 long res_ref = (long)res_var.inner & ~1;
1021 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
1022 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
1023 CHECK(!val->result_ok);
1024 LDKDecodeError err_var = (*val->contents.err);
1025 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1026 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1027 long err_ref = (long)err_var.inner & ~1;
1030 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
1031 LDKNetAddress *obj = (LDKNetAddress*)ptr;
1033 case LDKNetAddress_IPv4: {
1034 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
1035 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
1036 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
1038 case LDKNetAddress_IPv6: {
1039 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
1040 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
1041 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
1043 case LDKNetAddress_OnionV2: {
1044 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
1045 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
1046 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
1048 case LDKNetAddress_OnionV3: {
1049 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1050 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
1051 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
1056 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
1057 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
1058 ret->datalen = *((uint32_t*)elems);
1059 if (ret->datalen == 0) {
1062 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
1063 uint32_t *java_elems = (uint32_t*)(elems + 4);
1064 for (size_t i = 0; i < ret->datalen; i++) {
1065 uint32_t arr_elem = java_elems[i];
1066 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
1067 FREE((void*)arr_elem);
1068 ret->data[i] = arr_elem_conv;
1073 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
1074 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
1075 for (size_t i = 0; i < ret.datalen; i++) {
1076 ret.data[i] = NetAddress_clone(&orig->data[i]);
1080 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
1081 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
1083 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
1084 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1085 CHECK(val->result_ok);
1086 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
1087 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1088 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1089 long res_ref = (long)res_var.inner & ~1;
1092 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
1093 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1094 CHECK(!val->result_ok);
1095 LDKDecodeError err_var = (*val->contents.err);
1096 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1097 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1098 long err_ref = (long)err_var.inner & ~1;
1101 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
1102 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
1103 ret->datalen = *((uint32_t*)elems);
1104 if (ret->datalen == 0) {
1107 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
1108 int64_t *java_elems = (int64_t*)(elems + 4);
1109 for (size_t i = 0; i < ret->datalen; i++) {
1110 ret->data[i] = java_elems[i];
1115 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1116 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1117 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1120 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
1121 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
1123 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
1124 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1125 CHECK(val->result_ok);
1126 LDKNodeInfo res_var = (*val->contents.result);
1127 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1128 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1129 long res_ref = (long)res_var.inner & ~1;
1132 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
1133 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1134 CHECK(!val->result_ok);
1135 LDKDecodeError err_var = (*val->contents.err);
1136 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1137 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1138 long err_ref = (long)err_var.inner & ~1;
1141 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
1142 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
1144 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
1145 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1146 CHECK(val->result_ok);
1147 LDKNetworkGraph res_var = (*val->contents.result);
1148 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1149 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1150 long res_ref = (long)res_var.inner & ~1;
1153 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
1154 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1155 CHECK(!val->result_ok);
1156 LDKDecodeError err_var = (*val->contents.err);
1157 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1158 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1159 long err_ref = (long)err_var.inner & ~1;
1162 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
1163 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1165 LDKTransaction b_ref;
1166 b_ref.datalen = *((uint32_t*)b);
1167 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1168 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
1169 b_ref.data_is_owned = false;
1173 int64_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_a(uint32_t ptr) {
1174 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1177 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_b(uint32_t ptr) {
1178 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1179 LDKTransaction b_var = tuple->b;
1180 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1181 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
1184 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_usizeTransactionZZ_new(uint32_tArray elems) {
1185 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1186 ret->datalen = *((uint32_t*)elems);
1187 if (ret->datalen == 0) {
1190 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1191 uint32_t *java_elems = (uint32_t*)(elems + 4);
1192 for (size_t i = 0; i < ret->datalen; i++) {
1193 uint32_t arr_elem = java_elems[i];
1194 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1195 FREE((void*)arr_elem);
1196 ret->data[i] = arr_elem_conv;
1201 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(uint32_t arg) {
1202 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1204 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
1205 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1206 CHECK(val->result_ok);
1207 return *val->contents.result;
1209 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
1210 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1211 CHECK(!val->result_ok);
1212 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
1215 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
1216 LDKMonitorEvent *obj = (LDKMonitorEvent*)ptr;
1218 case LDKMonitorEvent_HTLCEvent: {
1219 return 0 /* LDKMonitorEvent - HTLCEvent */;
1221 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1222 return 0 /* LDKMonitorEvent - CommitmentTxBroadcasted */;
1227 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) {
1228 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1229 ret->datalen = *((uint32_t*)elems);
1230 if (ret->datalen == 0) {
1233 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1234 uint32_t *java_elems = (uint32_t*)(elems + 4);
1235 for (size_t i = 0; i < ret->datalen; i++) {
1236 uint32_t arr_elem = java_elems[i];
1237 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1238 FREE((void*)arr_elem);
1239 ret->data[i] = arr_elem_conv;
1244 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1245 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1246 for (size_t i = 0; i < ret.datalen; i++) {
1247 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1251 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
1252 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
1254 case LDKSpendableOutputDescriptor_StaticOutput: {
1255 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1256 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1257 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1258 long outpoint_ref = (long)outpoint_var.inner & ~1;
1259 long output_ref = ((long)&obj->static_output.output) | 1;
1260 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (long)output_ref;
1262 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1263 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */;
1265 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1266 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */;
1271 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_SpendableOutputDescriptorZ_new(uint32_tArray elems) {
1272 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1273 ret->datalen = *((uint32_t*)elems);
1274 if (ret->datalen == 0) {
1277 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1278 uint32_t *java_elems = (uint32_t*)(elems + 4);
1279 for (size_t i = 0; i < ret->datalen; i++) {
1280 uint32_t arr_elem = java_elems[i];
1281 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1282 FREE((void*)arr_elem);
1283 ret->data[i] = arr_elem_conv;
1288 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1289 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1290 for (size_t i = 0; i < ret.datalen; i++) {
1291 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1295 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
1296 LDKEvent *obj = (LDKEvent*)ptr;
1298 case LDKEvent_FundingGenerationReady: {
1299 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1300 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
1301 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1302 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1303 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
1304 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;
1306 case LDKEvent_FundingBroadcastSafe: {
1307 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1308 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1309 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1310 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1311 return 0 /* LDKEvent - FundingBroadcastSafe */; (void) funding_txo_ref; (void) obj->funding_broadcast_safe.user_channel_id;
1313 case LDKEvent_PaymentReceived: {
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_received.payment_hash.data, 32);
1316 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1317 memcpy((uint8_t*)(payment_secret_arr + 4), obj->payment_received.payment_secret.data, 32);
1318 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) payment_secret_arr; (void) obj->payment_received.amt;
1320 case LDKEvent_PaymentSent: {
1321 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1322 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
1323 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
1325 case LDKEvent_PaymentFailed: {
1326 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1327 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_failed.payment_hash.data, 32);
1328 return 0 /* LDKEvent - PaymentFailed */; (void) payment_hash_arr; (void) obj->payment_failed.rejected_by_dest;
1330 case LDKEvent_PendingHTLCsForwardable: {
1331 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
1333 case LDKEvent_SpendableOutputs: {
1334 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1335 uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1336 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
1337 for (size_t b = 0; b < outputs_var.datalen; b++) {
1338 long outputs_conv_27_ref = ((long)&outputs_var.data[b]) | 1;
1339 outputs_arr_ptr[b] = outputs_conv_27_ref;
1341 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
1346 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
1347 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1348 ret->datalen = *((uint32_t*)elems);
1349 if (ret->datalen == 0) {
1352 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
1353 uint32_t *java_elems = (uint32_t*)(elems + 4);
1354 for (size_t i = 0; i < ret->datalen; i++) {
1355 uint32_t arr_elem = java_elems[i];
1356 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
1357 FREE((void*)arr_elem);
1358 ret->data[i] = arr_elem_conv;
1363 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1364 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1365 for (size_t i = 0; i < ret.datalen; i++) {
1366 ret.data[i] = Event_clone(&orig->data[i]);
1370 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
1371 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
1373 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
1374 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1375 CHECK(val->result_ok);
1376 LDKOutPoint res_var = (*val->contents.result);
1377 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1378 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1379 long res_ref = (long)res_var.inner & ~1;
1382 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
1383 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1384 CHECK(!val->result_ok);
1385 LDKDecodeError err_var = (*val->contents.err);
1386 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1387 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1388 long err_ref = (long)err_var.inner & ~1;
1391 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
1392 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
1394 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
1395 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1396 CHECK(val->result_ok);
1397 LDKChannelMonitorUpdate res_var = (*val->contents.result);
1398 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1399 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1400 long res_ref = (long)res_var.inner & ~1;
1403 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
1404 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1405 CHECK(!val->result_ok);
1406 LDKDecodeError err_var = (*val->contents.err);
1407 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1408 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1409 long err_ref = (long)err_var.inner & ~1;
1412 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
1413 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
1415 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
1416 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1417 CHECK(val->result_ok);
1418 LDKHTLCUpdate res_var = (*val->contents.result);
1419 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1420 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1421 long res_ref = (long)res_var.inner & ~1;
1424 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
1425 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1426 CHECK(!val->result_ok);
1427 LDKDecodeError err_var = (*val->contents.err);
1428 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1429 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1430 long err_ref = (long)err_var.inner & ~1;
1433 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
1434 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
1436 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
1437 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1438 CHECK(val->result_ok);
1439 return *val->contents.result;
1441 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
1442 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1443 CHECK(!val->result_ok);
1444 LDKMonitorUpdateError err_var = (*val->contents.err);
1445 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1446 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1447 long err_ref = (long)err_var.inner & ~1;
1450 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
1451 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
1453 a_conv.inner = (void*)(a & (~1));
1454 a_conv.is_owned = (a & 1) || (a == 0);
1455 a_conv = OutPoint_clone(&a_conv);
1458 b_ref.datalen = *((uint32_t*)b);
1459 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
1460 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
1464 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_a(uint32_t ptr) {
1465 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1466 LDKOutPoint a_var = tuple->a;
1467 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1468 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1469 long a_ref = (long)a_var.inner & ~1;
1472 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_b(uint32_t ptr) {
1473 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1474 LDKCVec_u8Z b_var = tuple->b;
1475 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1476 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
1479 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
1480 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
1483 b_ref.datalen = *((uint32_t*)b);
1484 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
1485 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
1489 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_a(uint32_t ptr) {
1490 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
1493 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_b(uint32_t ptr) {
1494 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
1495 LDKCVec_u8Z b_var = tuple->b;
1496 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1497 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
1500 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32ScriptZZ_new(uint32_tArray elems) {
1501 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
1502 ret->datalen = *((uint32_t*)elems);
1503 if (ret->datalen == 0) {
1506 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
1507 uint32_t *java_elems = (uint32_t*)(elems + 4);
1508 for (size_t i = 0; i < ret->datalen; i++) {
1509 uint32_t arr_elem = java_elems[i];
1510 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
1511 FREE((void*)arr_elem);
1512 ret->data[i] = arr_elem_conv;
1517 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
1518 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
1519 for (size_t i = 0; i < ret.datalen; i++) {
1520 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
1524 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
1525 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
1526 LDKThirtyTwoBytes a_ref;
1527 CHECK(*((uint32_t*)a) == 32);
1528 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
1530 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
1531 b_constr.datalen = *((uint32_t*)b);
1532 if (b_constr.datalen > 0)
1533 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
1535 b_constr.data = NULL;
1536 uint32_t* b_vals = (uint32_t*)(b + 4);
1537 for (size_t e = 0; e < b_constr.datalen; e++) {
1538 uint32_t b_conv_30 = b_vals[e];
1539 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
1540 FREE((void*)b_conv_30);
1541 b_constr.data[e] = b_conv_30_conv;
1546 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t ptr) {
1547 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
1548 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1549 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
1552 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t ptr) {
1553 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
1554 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
1555 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1556 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
1557 for (size_t e = 0; e < b_var.datalen; e++) {
1558 long b_conv_30_ref = (long)(&b_var.data[e]) | 1;
1559 b_arr_ptr[e] = b_conv_30_ref;
1563 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_new(uint32_tArray elems) {
1564 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
1565 ret->datalen = *((uint32_t*)elems);
1566 if (ret->datalen == 0) {
1569 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
1570 uint32_t *java_elems = (uint32_t*)(elems + 4);
1571 for (size_t i = 0; i < ret->datalen; i++) {
1572 uint32_t arr_elem = java_elems[i];
1573 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
1574 FREE((void*)arr_elem);
1575 ret->data[i] = arr_elem_conv;
1580 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
1581 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
1583 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
1588 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_a(uint32_t ptr) {
1589 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1592 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_b(uint32_t ptr) {
1593 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1594 long b_ref = ((long)&tuple->b) | 1;
1597 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
1598 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
1599 ret->datalen = *((uint32_t*)elems);
1600 if (ret->datalen == 0) {
1603 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
1604 uint32_t *java_elems = (uint32_t*)(elems + 4);
1605 for (size_t i = 0; i < ret->datalen; i++) {
1606 uint32_t arr_elem = java_elems[i];
1607 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
1608 FREE((void*)arr_elem);
1609 ret->data[i] = arr_elem_conv;
1614 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
1615 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
1616 for (size_t i = 0; i < ret.datalen; i++) {
1617 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
1621 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
1622 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
1623 LDKThirtyTwoBytes a_ref;
1624 CHECK(*((uint32_t*)a) == 32);
1625 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
1627 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
1628 b_constr.datalen = *((uint32_t*)b);
1629 if (b_constr.datalen > 0)
1630 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
1632 b_constr.data = NULL;
1633 uint32_t* b_vals = (uint32_t*)(b + 4);
1634 for (size_t z = 0; z < b_constr.datalen; z++) {
1635 uint32_t b_conv_25 = b_vals[z];
1636 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
1637 FREE((void*)b_conv_25);
1638 b_constr.data[z] = b_conv_25_conv;
1643 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t ptr) {
1644 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
1645 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1646 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
1649 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t ptr) {
1650 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
1651 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
1652 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1653 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
1654 for (size_t z = 0; z < b_var.datalen; z++) {
1655 long b_conv_25_ref = (long)(&b_var.data[z]) | 1;
1656 b_arr_ptr[z] = b_conv_25_ref;
1660 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
1661 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
1662 ret->datalen = *((uint32_t*)elems);
1663 if (ret->datalen == 0) {
1666 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
1667 uint32_t *java_elems = (uint32_t*)(elems + 4);
1668 for (size_t i = 0; i < ret->datalen; i++) {
1669 uint32_t arr_elem = java_elems[i];
1670 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
1671 FREE((void*)arr_elem);
1672 ret->data[i] = arr_elem_conv;
1677 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
1678 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1680 CHECK(*((uint32_t*)a) == 64);
1681 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
1683 LDKCVec_SignatureZ b_constr;
1684 b_constr.datalen = *((uint32_t*)b);
1685 if (b_constr.datalen > 0)
1686 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1688 b_constr.data = NULL;
1689 int8_tArray* b_vals = (int8_tArray*)(b + 4);
1690 for (size_t m = 0; m < b_constr.datalen; m++) {
1691 int8_tArray b_conv_12 = b_vals[m];
1692 LDKSignature b_conv_12_ref;
1693 CHECK(*((uint32_t*)b_conv_12) == 64);
1694 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
1695 b_constr.data[m] = b_conv_12_ref;
1700 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t ptr) {
1701 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1702 int8_tArray a_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1703 memcpy((uint8_t*)(a_arr + 4), tuple->a.compact_form, 64);
1706 ptrArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t ptr) {
1707 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1708 LDKCVec_SignatureZ b_var = tuple->b;
1709 ptrArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1710 int8_tArray *b_arr_ptr = (int8_tArray*)(b_arr + 4);
1711 for (size_t m = 0; m < b_var.datalen; m++) {
1712 int8_tArray b_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1713 memcpy((uint8_t*)(b_conv_12_arr + 4), b_var.data[m].compact_form, 64);
1714 b_arr_ptr[m] = b_conv_12_arr;
1718 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(uint32_t arg) {
1719 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1721 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1722 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1723 CHECK(val->result_ok);
1724 long res_ref = (long)(&(*val->contents.result)) | 1;
1727 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1728 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1729 CHECK(!val->result_ok);
1730 return *val->contents.err;
1732 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_result_ok(uint32_t arg) {
1733 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1735 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1736 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1737 CHECK(val->result_ok);
1738 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1739 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1742 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1743 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1744 CHECK(!val->result_ok);
1745 return *val->contents.err;
1747 typedef struct LDKSign_JCalls {
1748 atomic_size_t refcnt;
1749 uint32_t get_per_commitment_point_meth;
1750 uint32_t release_commitment_secret_meth;
1751 uint32_t channel_keys_id_meth;
1752 uint32_t sign_counterparty_commitment_meth;
1753 uint32_t sign_holder_commitment_and_htlcs_meth;
1754 uint32_t sign_justice_transaction_meth;
1755 uint32_t sign_counterparty_htlc_transaction_meth;
1756 uint32_t sign_closing_transaction_meth;
1757 uint32_t sign_channel_announcement_meth;
1758 uint32_t ready_channel_meth;
1759 uint32_t write_meth;
1761 static void LDKSign_JCalls_free(void* this_arg) {
1762 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1763 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1764 js_free(j_calls->get_per_commitment_point_meth);
1765 js_free(j_calls->release_commitment_secret_meth);
1766 js_free(j_calls->channel_keys_id_meth);
1767 js_free(j_calls->sign_counterparty_commitment_meth);
1768 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1769 js_free(j_calls->sign_justice_transaction_meth);
1770 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1771 js_free(j_calls->sign_closing_transaction_meth);
1772 js_free(j_calls->sign_channel_announcement_meth);
1773 js_free(j_calls->ready_channel_meth);
1774 js_free(j_calls->write_meth);
1778 LDKPublicKey get_per_commitment_point_LDKSign_jcall(const void* this_arg, uint64_t idx) {
1779 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1780 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1781 LDKPublicKey ret_ref;
1782 CHECK(*((uint32_t*)ret) == 33);
1783 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1786 LDKThirtyTwoBytes release_commitment_secret_LDKSign_jcall(const void* this_arg, uint64_t idx) {
1787 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1788 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1789 LDKThirtyTwoBytes ret_ref;
1790 CHECK(*((uint32_t*)ret) == 32);
1791 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1794 LDKThirtyTwoBytes channel_keys_id_LDKSign_jcall(const void* this_arg) {
1795 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1796 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1797 LDKThirtyTwoBytes ret_ref;
1798 CHECK(*((uint32_t*)ret) == 32);
1799 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1802 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1803 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1804 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1805 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1806 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1807 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1808 long commitment_tx_ref = (long)commitment_tx_var.inner;
1809 if (commitment_tx_var.is_owned) {
1810 commitment_tx_ref |= 1;
1812 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1813 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1814 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
1817 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1818 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1819 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1820 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1821 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1822 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1823 long commitment_tx_ref = (long)commitment_tx_var.inner;
1824 if (commitment_tx_var.is_owned) {
1825 commitment_tx_ref |= 1;
1827 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1828 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1829 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
1832 LDKCResult_SignatureNoneZ sign_justice_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
1833 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1834 LDKTransaction justice_tx_var = justice_tx;
1835 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1836 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1837 Transaction_free(justice_tx_var);
1838 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1839 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1840 LDKHTLCOutputInCommitment htlc_var = *htlc;
1841 htlc_var = HTLCOutputInCommitment_clone(htlc);
1842 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1843 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1844 long htlc_ref = (long)htlc_var.inner;
1845 if (htlc_var.is_owned) {
1848 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);
1849 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1850 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1853 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
1854 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1855 LDKTransaction htlc_tx_var = htlc_tx;
1856 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1857 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1858 Transaction_free(htlc_tx_var);
1859 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1860 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1861 LDKHTLCOutputInCommitment htlc_var = *htlc;
1862 htlc_var = HTLCOutputInCommitment_clone(htlc);
1863 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1864 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1865 long htlc_ref = (long)htlc_var.inner;
1866 if (htlc_var.is_owned) {
1869 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);
1870 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1871 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1874 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
1875 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1876 LDKTransaction closing_tx_var = closing_tx;
1877 int8_tArray closing_tx_arr = init_arr(closing_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1878 memcpy((uint8_t*)(closing_tx_arr + 4), closing_tx_var.data, closing_tx_var.datalen);
1879 Transaction_free(closing_tx_var);
1880 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_arr);
1881 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1882 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1885 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1886 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1887 LDKUnsignedChannelAnnouncement msg_var = *msg;
1888 msg_var = UnsignedChannelAnnouncement_clone(msg);
1889 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1890 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1891 long msg_ref = (long)msg_var.inner;
1892 if (msg_var.is_owned) {
1895 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
1896 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1897 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1900 void ready_channel_LDKSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1901 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1902 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1903 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1904 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1905 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1906 long channel_parameters_ref = (long)channel_parameters_var.inner;
1907 if (channel_parameters_var.is_owned) {
1908 channel_parameters_ref |= 1;
1910 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
1912 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
1913 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1914 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
1915 LDKCVec_u8Z ret_ref;
1916 ret_ref.datalen = *((uint32_t*)ret);
1917 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
1918 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
1921 static void* LDKSign_JCalls_clone(const void* this_arg) {
1922 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1923 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1924 return (void*) this_arg;
1926 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1927 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
1928 atomic_init(&calls->refcnt, 1);
1929 //TODO: Assign calls->o from o
1931 LDKChannelPublicKeys pubkeys_conv;
1932 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1933 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1934 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1937 .this_arg = (void*) calls,
1938 .get_per_commitment_point = get_per_commitment_point_LDKSign_jcall,
1939 .release_commitment_secret = release_commitment_secret_LDKSign_jcall,
1940 .channel_keys_id = channel_keys_id_LDKSign_jcall,
1941 .sign_counterparty_commitment = sign_counterparty_commitment_LDKSign_jcall,
1942 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKSign_jcall,
1943 .sign_justice_transaction = sign_justice_transaction_LDKSign_jcall,
1944 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKSign_jcall,
1945 .sign_closing_transaction = sign_closing_transaction_LDKSign_jcall,
1946 .sign_channel_announcement = sign_channel_announcement_LDKSign_jcall,
1947 .ready_channel = ready_channel_LDKSign_jcall,
1948 .clone = LDKSign_JCalls_clone,
1949 .write = write_LDKSign_jcall,
1950 .free = LDKSign_JCalls_free,
1951 .pubkeys = pubkeys_conv,
1952 .set_pubkeys = NULL,
1956 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1957 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
1958 *res_ptr = LDKSign_init(o, pubkeys);
1959 return (long)res_ptr;
1961 int8_tArray __attribute__((visibility("default"))) TS_Sign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
1962 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
1963 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1964 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1968 int8_tArray __attribute__((visibility("default"))) TS_Sign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
1969 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
1970 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1971 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1975 int8_tArray __attribute__((visibility("default"))) TS_Sign_channel_keys_id(uint32_t this_arg) {
1976 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
1977 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1978 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1982 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
1983 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
1984 LDKCommitmentTransaction commitment_tx_conv;
1985 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1986 commitment_tx_conv.is_owned = false;
1987 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1988 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1989 return (long)ret_conv;
1992 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
1993 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
1994 LDKHolderCommitmentTransaction commitment_tx_conv;
1995 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1996 commitment_tx_conv.is_owned = false;
1997 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1998 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1999 return (long)ret_conv;
2002 uint32_t __attribute__((visibility("default"))) TS_Sign_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) {
2003 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2004 LDKTransaction justice_tx_ref;
2005 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
2006 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2007 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
2008 justice_tx_ref.data_is_owned = true;
2009 unsigned char per_commitment_key_arr[32];
2010 CHECK(*((uint32_t*)per_commitment_key) == 32);
2011 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
2012 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2013 LDKHTLCOutputInCommitment htlc_conv;
2014 htlc_conv.inner = (void*)(htlc & (~1));
2015 htlc_conv.is_owned = false;
2016 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2017 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
2018 return (long)ret_conv;
2021 uint32_t __attribute__((visibility("default"))) TS_Sign_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) {
2022 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2023 LDKTransaction htlc_tx_ref;
2024 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
2025 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2026 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
2027 htlc_tx_ref.data_is_owned = true;
2028 LDKPublicKey per_commitment_point_ref;
2029 CHECK(*((uint32_t*)per_commitment_point) == 33);
2030 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
2031 LDKHTLCOutputInCommitment htlc_conv;
2032 htlc_conv.inner = (void*)(htlc & (~1));
2033 htlc_conv.is_owned = false;
2034 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2035 *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);
2036 return (long)ret_conv;
2039 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_closing_transaction(uint32_t this_arg, int8_tArray closing_tx) {
2040 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2041 LDKTransaction closing_tx_ref;
2042 closing_tx_ref.datalen = *((uint32_t*)closing_tx);
2043 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2044 memcpy(closing_tx_ref.data, (uint8_t*)(closing_tx + 4), closing_tx_ref.datalen);
2045 closing_tx_ref.data_is_owned = true;
2046 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2047 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2048 return (long)ret_conv;
2051 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
2052 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2053 LDKUnsignedChannelAnnouncement msg_conv;
2054 msg_conv.inner = (void*)(msg & (~1));
2055 msg_conv.is_owned = false;
2056 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2057 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2058 return (long)ret_conv;
2061 void __attribute__((visibility("default"))) TS_Sign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
2062 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2063 LDKChannelTransactionParameters channel_parameters_conv;
2064 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2065 channel_parameters_conv.is_owned = false;
2066 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2069 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
2070 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2071 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2072 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2073 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2074 CVec_u8Z_free(ret_var);
2078 LDKChannelPublicKeys LDKSign_set_get_pubkeys(LDKSign* this_arg) {
2079 if (this_arg->set_pubkeys != NULL)
2080 this_arg->set_pubkeys(this_arg);
2081 return this_arg->pubkeys;
2083 uint32_t __attribute__((visibility("default"))) TS_Sign_get_pubkeys(uint32_t this_arg) {
2084 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2085 LDKChannelPublicKeys ret_var = LDKSign_set_get_pubkeys(this_arg_conv);
2086 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2087 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2088 long ret_ref = (long)ret_var.inner;
2089 if (ret_var.is_owned) {
2095 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
2096 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2097 LDKThirtyTwoBytes a_ref;
2098 CHECK(*((uint32_t*)a) == 32);
2099 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2101 LDKChannelMonitor b_conv;
2102 b_conv.inner = (void*)(b & (~1));
2103 b_conv.is_owned = (b & 1) || (b == 0);
2104 b_conv = ChannelMonitor_clone(&b_conv);
2108 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t ptr) {
2109 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2110 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2111 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2114 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t ptr) {
2115 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2116 LDKChannelMonitor b_var = tuple->b;
2117 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2118 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2119 long b_ref = (long)b_var.inner & ~1;
2122 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
2123 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
2125 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
2126 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2127 CHECK(val->result_ok);
2128 long res_ref = (long)(&(*val->contents.result)) | 1;
2131 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
2132 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2133 CHECK(!val->result_ok);
2134 LDKDecodeError err_var = (*val->contents.err);
2135 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2136 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2137 long err_ref = (long)err_var.inner & ~1;
2140 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_result_ok(uint32_t arg) {
2141 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
2143 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
2144 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2145 CHECK(val->result_ok);
2146 long res_ref = ((long)&(*val->contents.result)) | 1;
2147 return (long)res_ref;
2149 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
2150 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2151 CHECK(!val->result_ok);
2152 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
2155 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2156 LDKAPIError *obj = (LDKAPIError*)ptr;
2158 case LDKAPIError_APIMisuseError: {
2159 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
2160 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2161 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
2162 return 0 /* LDKAPIError - APIMisuseError */; (void) err_arr;
2164 case LDKAPIError_FeeRateTooHigh: {
2165 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
2166 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2167 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
2168 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_arr; (void) obj->fee_rate_too_high.feerate;
2170 case LDKAPIError_RouteError: {
2171 LDKStr err_str = obj->route_error.err;
2172 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2173 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2175 case LDKAPIError_ChannelUnavailable: {
2176 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
2177 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2178 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
2179 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_arr;
2181 case LDKAPIError_MonitorUpdateFailed: {
2182 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2187 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
2188 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2190 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2191 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2192 CHECK(val->result_ok);
2193 return *val->contents.result;
2195 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2196 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2197 CHECK(!val->result_ok);
2198 long err_ref = ((long)&(*val->contents.err)) | 1;
2201 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) {
2202 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2203 ret->datalen = *((uint32_t*)elems);
2204 if (ret->datalen == 0) {
2207 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2208 uint32_t *java_elems = (uint32_t*)(elems + 4);
2209 for (size_t i = 0; i < ret->datalen; i++) {
2210 uint32_t arr_elem = java_elems[i];
2211 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2212 FREE((void*)arr_elem);
2213 ret->data[i] = arr_elem_conv;
2218 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2219 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2220 for (size_t i = 0; i < ret.datalen; i++) {
2221 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2225 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) {
2226 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2227 ret->datalen = *((uint32_t*)elems);
2228 if (ret->datalen == 0) {
2231 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2232 uint32_t *java_elems = (uint32_t*)(elems + 4);
2233 for (size_t i = 0; i < ret->datalen; i++) {
2234 uint32_t arr_elem = java_elems[i];
2235 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
2236 FREE((void*)arr_elem);
2237 ret->data[i] = arr_elem_conv;
2242 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2243 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2244 for (size_t i = 0; i < ret.datalen; i++) {
2245 ret.data[i] = APIError_clone(&orig->data[i]);
2249 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) {
2250 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
2251 ret->datalen = *((uint32_t*)elems);
2252 if (ret->datalen == 0) {
2255 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
2256 uint32_t *java_elems = (uint32_t*)(elems + 4);
2257 for (size_t i = 0; i < ret->datalen; i++) {
2258 uint32_t arr_elem = java_elems[i];
2259 LDKChannelDetails arr_elem_conv;
2260 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2261 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2262 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2263 ret->data[i] = arr_elem_conv;
2268 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2269 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2270 for (size_t i = 0; i < ret.datalen; i++) {
2271 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2275 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2276 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)ptr;
2278 case LDKPaymentSendFailure_ParameterError: {
2279 return 0 /* LDKPaymentSendFailure - ParameterError */;
2281 case LDKPaymentSendFailure_PathParameterError: {
2282 return 0 /* LDKPaymentSendFailure - PathParameterError */;
2284 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2285 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */;
2287 case LDKPaymentSendFailure_PartialFailure: {
2288 return 0 /* LDKPaymentSendFailure - PartialFailure */;
2293 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
2294 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2296 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2297 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2298 CHECK(val->result_ok);
2299 return *val->contents.result;
2301 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2302 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2303 CHECK(!val->result_ok);
2304 long err_ref = ((long)&(*val->contents.err)) | 1;
2307 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
2308 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2309 ret->datalen = *((uint32_t*)elems);
2310 if (ret->datalen == 0) {
2313 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2314 uint32_t *java_elems = (uint32_t*)(elems + 4);
2315 for (size_t i = 0; i < ret->datalen; i++) {
2316 uint32_t arr_elem = java_elems[i];
2317 LDKChannelMonitor arr_elem_conv;
2318 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2319 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2320 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2321 ret->data[i] = arr_elem_conv;
2326 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2327 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2328 for (size_t i = 0; i < ret.datalen; i++) {
2329 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2333 typedef struct LDKWatch_JCalls {
2334 atomic_size_t refcnt;
2335 uint32_t watch_channel_meth;
2336 uint32_t update_channel_meth;
2337 uint32_t release_pending_monitor_events_meth;
2339 static void LDKWatch_JCalls_free(void* this_arg) {
2340 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2341 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2342 js_free(j_calls->watch_channel_meth);
2343 js_free(j_calls->update_channel_meth);
2344 js_free(j_calls->release_pending_monitor_events_meth);
2348 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2349 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2350 LDKOutPoint funding_txo_var = funding_txo;
2351 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2352 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2353 long funding_txo_ref = (long)funding_txo_var.inner;
2354 if (funding_txo_var.is_owned) {
2355 funding_txo_ref |= 1;
2357 LDKChannelMonitor monitor_var = monitor;
2358 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2359 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2360 long monitor_ref = (long)monitor_var.inner;
2361 if (monitor_var.is_owned) {
2364 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2365 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2366 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2369 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2370 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2371 LDKOutPoint funding_txo_var = funding_txo;
2372 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2373 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2374 long funding_txo_ref = (long)funding_txo_var.inner;
2375 if (funding_txo_var.is_owned) {
2376 funding_txo_ref |= 1;
2378 LDKChannelMonitorUpdate update_var = update;
2379 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2380 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2381 long update_ref = (long)update_var.inner;
2382 if (update_var.is_owned) {
2385 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2386 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2387 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2390 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
2391 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2392 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2393 LDKCVec_MonitorEventZ ret_constr;
2394 ret_constr.datalen = *((uint32_t*)ret);
2395 if (ret_constr.datalen > 0)
2396 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2398 ret_constr.data = NULL;
2399 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2400 for (size_t o = 0; o < ret_constr.datalen; o++) {
2401 uint32_t ret_conv_14 = ret_vals[o];
2402 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
2403 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)ret_conv_14);
2404 ret_constr.data[o] = ret_conv_14_conv;
2408 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2409 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2410 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2411 return (void*) this_arg;
2413 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2414 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2415 atomic_init(&calls->refcnt, 1);
2416 //TODO: Assign calls->o from o
2419 .this_arg = (void*) calls,
2420 .watch_channel = watch_channel_LDKWatch_jcall,
2421 .update_channel = update_channel_LDKWatch_jcall,
2422 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
2423 .free = LDKWatch_JCalls_free,
2427 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2428 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2429 *res_ptr = LDKWatch_init(o);
2430 return (long)res_ptr;
2432 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2433 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2434 LDKOutPoint funding_txo_conv;
2435 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2436 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2437 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2438 LDKChannelMonitor monitor_conv;
2439 monitor_conv.inner = (void*)(monitor & (~1));
2440 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2441 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2442 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2443 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2444 return (long)ret_conv;
2447 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
2448 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2449 LDKOutPoint funding_txo_conv;
2450 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2451 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2452 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2453 LDKChannelMonitorUpdate update_conv;
2454 update_conv.inner = (void*)(update & (~1));
2455 update_conv.is_owned = (update & 1) || (update == 0);
2456 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2457 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2458 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2459 return (long)ret_conv;
2462 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
2463 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2464 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2465 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2466 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
2467 for (size_t o = 0; o < ret_var.datalen; o++) {
2468 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2469 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
2470 long ret_conv_14_ref = (long)ret_conv_14_copy;
2471 ret_arr_ptr[o] = ret_conv_14_ref;
2477 typedef struct LDKBroadcasterInterface_JCalls {
2478 atomic_size_t refcnt;
2479 uint32_t broadcast_transaction_meth;
2480 } LDKBroadcasterInterface_JCalls;
2481 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2482 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2483 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2484 js_free(j_calls->broadcast_transaction_meth);
2488 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
2489 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2490 LDKTransaction tx_var = tx;
2491 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2492 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
2493 Transaction_free(tx_var);
2494 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
2496 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2497 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2498 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2499 return (void*) this_arg;
2501 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
2502 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2503 atomic_init(&calls->refcnt, 1);
2504 //TODO: Assign calls->o from o
2506 LDKBroadcasterInterface ret = {
2507 .this_arg = (void*) calls,
2508 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
2509 .free = LDKBroadcasterInterface_JCalls_free,
2513 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
2514 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2515 *res_ptr = LDKBroadcasterInterface_init(o);
2516 return (long)res_ptr;
2518 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
2519 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
2520 LDKTransaction tx_ref;
2521 tx_ref.datalen = *((uint32_t*)tx);
2522 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2523 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
2524 tx_ref.data_is_owned = true;
2525 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2528 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_result_ok(uint32_t arg) {
2529 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2531 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
2532 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2533 CHECK(val->result_ok);
2534 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2535 *ret = Sign_clone(&(*val->contents.result));
2538 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
2539 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2540 CHECK(!val->result_ok);
2541 LDKDecodeError err_var = (*val->contents.err);
2542 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2543 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2544 long err_ref = (long)err_var.inner & ~1;
2547 typedef struct LDKKeysInterface_JCalls {
2548 atomic_size_t refcnt;
2549 uint32_t get_node_secret_meth;
2550 uint32_t get_destination_script_meth;
2551 uint32_t get_shutdown_pubkey_meth;
2552 uint32_t get_channel_signer_meth;
2553 uint32_t get_secure_random_bytes_meth;
2554 uint32_t read_chan_signer_meth;
2555 } LDKKeysInterface_JCalls;
2556 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2557 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2558 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2559 js_free(j_calls->get_node_secret_meth);
2560 js_free(j_calls->get_destination_script_meth);
2561 js_free(j_calls->get_shutdown_pubkey_meth);
2562 js_free(j_calls->get_channel_signer_meth);
2563 js_free(j_calls->get_secure_random_bytes_meth);
2564 js_free(j_calls->read_chan_signer_meth);
2568 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
2569 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2570 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
2571 LDKSecretKey ret_ref;
2572 CHECK(*((uint32_t*)ret) == 32);
2573 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
2576 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
2577 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2578 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
2579 LDKCVec_u8Z ret_ref;
2580 ret_ref.datalen = *((uint32_t*)ret);
2581 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2582 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2585 LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
2586 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2587 int8_tArray ret = js_invoke_function_0(j_calls->get_shutdown_pubkey_meth);
2588 LDKPublicKey ret_ref;
2589 CHECK(*((uint32_t*)ret) == 33);
2590 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
2593 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2594 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2595 LDKSign* ret = (LDKSign*)js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
2596 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
2597 ret_conv = Sign_clone(ret);
2600 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
2601 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2602 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
2603 LDKThirtyTwoBytes ret_ref;
2604 CHECK(*((uint32_t*)ret) == 32);
2605 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
2608 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
2609 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2610 LDKu8slice reader_var = reader;
2611 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2612 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
2613 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
2614 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
2615 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)ret);
2618 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2619 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2620 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2621 return (void*) this_arg;
2623 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
2624 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2625 atomic_init(&calls->refcnt, 1);
2626 //TODO: Assign calls->o from o
2628 LDKKeysInterface ret = {
2629 .this_arg = (void*) calls,
2630 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
2631 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
2632 .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
2633 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
2634 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
2635 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
2636 .free = LDKKeysInterface_JCalls_free,
2640 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
2641 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2642 *res_ptr = LDKKeysInterface_init(o);
2643 return (long)res_ptr;
2645 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
2646 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2647 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2648 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
2652 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
2653 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2654 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2655 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2656 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2657 CVec_u8Z_free(ret_var);
2661 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_pubkey(uint32_t this_arg) {
2662 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2663 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
2664 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form, 33);
2668 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2669 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2670 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2671 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2675 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
2676 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2677 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2678 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
2682 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
2683 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2684 LDKu8slice reader_ref;
2685 reader_ref.datalen = *((uint32_t*)reader);
2686 reader_ref.data = (int8_t*)(reader + 4);
2687 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
2688 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2689 return (long)ret_conv;
2692 typedef struct LDKFeeEstimator_JCalls {
2693 atomic_size_t refcnt;
2694 uint32_t get_est_sat_per_1000_weight_meth;
2695 } LDKFeeEstimator_JCalls;
2696 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2697 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2698 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2699 js_free(j_calls->get_est_sat_per_1000_weight_meth);
2703 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2704 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2705 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
2706 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2708 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2709 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2710 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2711 return (void*) this_arg;
2713 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
2714 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2715 atomic_init(&calls->refcnt, 1);
2716 //TODO: Assign calls->o from o
2718 LDKFeeEstimator ret = {
2719 .this_arg = (void*) calls,
2720 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
2721 .free = LDKFeeEstimator_JCalls_free,
2725 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
2726 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2727 *res_ptr = LDKFeeEstimator_init(o);
2728 return (long)res_ptr;
2730 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
2731 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
2732 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
2733 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2737 typedef struct LDKLogger_JCalls {
2738 atomic_size_t refcnt;
2741 static void LDKLogger_JCalls_free(void* this_arg) {
2742 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2743 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2744 js_free(j_calls->log_meth);
2748 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
2749 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2750 const char* record_str = record;
2751 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
2752 js_invoke_function_1(j_calls->log_meth, record_conv);
2754 static void* LDKLogger_JCalls_clone(const void* this_arg) {
2755 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2756 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2757 return (void*) this_arg;
2759 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
2760 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2761 atomic_init(&calls->refcnt, 1);
2762 //TODO: Assign calls->o from o
2765 .this_arg = (void*) calls,
2766 .log = log_LDKLogger_jcall,
2767 .free = LDKLogger_JCalls_free,
2771 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
2772 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2773 *res_ptr = LDKLogger_init(o);
2774 return (long)res_ptr;
2776 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
2777 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2778 LDKThirtyTwoBytes a_ref;
2779 CHECK(*((uint32_t*)a) == 32);
2780 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2782 LDKChannelManager b_conv;
2783 b_conv.inner = (void*)(b & (~1));
2784 b_conv.is_owned = (b & 1) || (b == 0);
2785 // Warning: we need a move here but no clone is available for LDKChannelManager
2789 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_a(uint32_t ptr) {
2790 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2791 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2792 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2795 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_b(uint32_t ptr) {
2796 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2797 LDKChannelManager b_var = tuple->b;
2798 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2799 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2800 long b_ref = (long)b_var.inner & ~1;
2803 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
2804 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2806 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
2807 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2808 CHECK(val->result_ok);
2809 long res_ref = (long)(&(*val->contents.result)) | 1;
2812 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
2813 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2814 CHECK(!val->result_ok);
2815 LDKDecodeError err_var = (*val->contents.err);
2816 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2817 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2818 long err_ref = (long)err_var.inner & ~1;
2821 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
2822 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2824 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
2825 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2826 CHECK(val->result_ok);
2827 long res_ref = ((long)&(*val->contents.result)) | 1;
2830 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
2831 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2832 CHECK(!val->result_ok);
2833 LDKDecodeError err_var = (*val->contents.err);
2834 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2835 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2836 long err_ref = (long)err_var.inner & ~1;
2839 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2840 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2841 for (size_t i = 0; i < ret.datalen; i++) {
2842 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2846 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(uint32_t arg) {
2847 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2849 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
2850 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2851 CHECK(val->result_ok);
2852 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2853 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
2854 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
2855 for (size_t m = 0; m < res_var.datalen; m++) {
2856 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
2857 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2858 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
2859 res_arr_ptr[m] = res_conv_12_arr;
2863 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
2864 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2865 CHECK(!val->result_ok);
2866 return *val->contents.err;
2868 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_result_ok(uint32_t arg) {
2869 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2871 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
2872 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2873 CHECK(val->result_ok);
2874 LDKInMemorySigner res_var = (*val->contents.result);
2875 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2876 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2877 long res_ref = (long)res_var.inner & ~1;
2880 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
2881 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2882 CHECK(!val->result_ok);
2883 LDKDecodeError err_var = (*val->contents.err);
2884 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2885 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2886 long err_ref = (long)err_var.inner & ~1;
2889 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_TxOutZ_new(uint32_tArray elems) {
2890 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2891 ret->datalen = *((uint32_t*)elems);
2892 if (ret->datalen == 0) {
2895 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2896 uint32_t *java_elems = (uint32_t*)(elems + 4);
2897 for (size_t i = 0; i < ret->datalen; i++) {
2898 uint32_t arr_elem = java_elems[i];
2899 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
2900 FREE((void*)arr_elem);
2901 ret->data[i] = arr_elem_conv;
2906 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2907 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2908 for (size_t i = 0; i < ret.datalen; i++) {
2909 ret.data[i] = TxOut_clone(&orig->data[i]);
2913 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_result_ok(uint32_t arg) {
2914 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2916 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
2917 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2918 CHECK(val->result_ok);
2919 LDKTransaction res_var = (*val->contents.result);
2920 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2921 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
2924 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
2925 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2926 CHECK(!val->result_ok);
2927 return *val->contents.err;
2929 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) {
2930 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
2931 ret->datalen = *((uint32_t*)elems);
2932 if (ret->datalen == 0) {
2935 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
2936 uint32_t *java_elems = (uint32_t*)(elems + 4);
2937 for (size_t i = 0; i < ret->datalen; i++) {
2938 uint32_t arr_elem = java_elems[i];
2939 LDKRouteHop arr_elem_conv;
2940 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2941 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2942 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
2943 ret->data[i] = arr_elem_conv;
2948 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2949 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2950 for (size_t i = 0; i < ret.datalen; i++) {
2951 ret.data[i] = RouteHop_clone(&orig->data[i]);
2955 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
2956 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
2957 for (size_t i = 0; i < ret.datalen; i++) {
2958 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
2962 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_result_ok(uint32_t arg) {
2963 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
2965 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
2966 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
2967 CHECK(val->result_ok);
2968 LDKRoute res_var = (*val->contents.result);
2969 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2970 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2971 long res_ref = (long)res_var.inner & ~1;
2974 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
2975 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
2976 CHECK(!val->result_ok);
2977 LDKDecodeError err_var = (*val->contents.err);
2978 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2979 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2980 long err_ref = (long)err_var.inner & ~1;
2983 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintZ_new(uint32_tArray elems) {
2984 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
2985 ret->datalen = *((uint32_t*)elems);
2986 if (ret->datalen == 0) {
2989 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
2990 uint32_t *java_elems = (uint32_t*)(elems + 4);
2991 for (size_t i = 0; i < ret->datalen; i++) {
2992 uint32_t arr_elem = java_elems[i];
2993 LDKRouteHint arr_elem_conv;
2994 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2995 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2996 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
2997 ret->data[i] = arr_elem_conv;
3002 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
3003 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
3004 for (size_t i = 0; i < ret.datalen; i++) {
3005 ret.data[i] = RouteHint_clone(&orig->data[i]);
3009 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_result_ok(uint32_t arg) {
3010 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3012 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
3013 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3014 CHECK(val->result_ok);
3015 LDKRoute res_var = (*val->contents.result);
3016 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3017 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3018 long res_ref = (long)res_var.inner & ~1;
3021 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
3022 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3023 CHECK(!val->result_ok);
3024 LDKLightningError err_var = (*val->contents.err);
3025 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3026 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3027 long err_ref = (long)err_var.inner & ~1;
3030 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) {
3031 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
3033 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_ok(uint32_t arg) {
3034 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3035 CHECK(val->result_ok);
3036 long res_ref = ((long)&(*val->contents.result)) | 1;
3039 int8_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_err(uint32_t arg) {
3040 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3041 CHECK(!val->result_ok);
3042 return *val->contents.err;
3044 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_result_ok(uint32_t arg) {
3045 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
3047 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_ok(uint32_t arg) {
3048 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3049 CHECK(val->result_ok);
3050 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
3051 *res_conv = (*val->contents.result);
3052 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
3053 return (long)res_conv;
3055 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_err(uint32_t arg) {
3056 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3057 CHECK(!val->result_ok);
3058 LDKDecodeError err_var = (*val->contents.err);
3059 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3060 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3061 long err_ref = (long)err_var.inner & ~1;
3064 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
3065 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
3066 ret->datalen = *((uint32_t*)elems);
3067 if (ret->datalen == 0) {
3070 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
3071 uint32_t *java_elems = (uint32_t*)(elems + 4);
3072 for (size_t i = 0; i < ret->datalen; i++) {
3073 uint32_t arr_elem = java_elems[i];
3074 LDKUpdateAddHTLC arr_elem_conv;
3075 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3076 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3077 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3078 ret->data[i] = arr_elem_conv;
3083 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
3084 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
3085 for (size_t i = 0; i < ret.datalen; i++) {
3086 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
3090 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
3091 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
3092 ret->datalen = *((uint32_t*)elems);
3093 if (ret->datalen == 0) {
3096 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
3097 uint32_t *java_elems = (uint32_t*)(elems + 4);
3098 for (size_t i = 0; i < ret->datalen; i++) {
3099 uint32_t arr_elem = java_elems[i];
3100 LDKUpdateFulfillHTLC arr_elem_conv;
3101 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3102 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3103 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3104 ret->data[i] = arr_elem_conv;
3109 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
3110 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
3111 for (size_t i = 0; i < ret.datalen; i++) {
3112 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
3116 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
3117 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
3118 ret->datalen = *((uint32_t*)elems);
3119 if (ret->datalen == 0) {
3122 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
3123 uint32_t *java_elems = (uint32_t*)(elems + 4);
3124 for (size_t i = 0; i < ret->datalen; i++) {
3125 uint32_t arr_elem = java_elems[i];
3126 LDKUpdateFailHTLC arr_elem_conv;
3127 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3128 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3129 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3130 ret->data[i] = arr_elem_conv;
3135 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
3136 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
3137 for (size_t i = 0; i < ret.datalen; i++) {
3138 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
3142 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
3143 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
3144 ret->datalen = *((uint32_t*)elems);
3145 if (ret->datalen == 0) {
3148 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
3149 uint32_t *java_elems = (uint32_t*)(elems + 4);
3150 for (size_t i = 0; i < ret->datalen; i++) {
3151 uint32_t arr_elem = java_elems[i];
3152 LDKUpdateFailMalformedHTLC arr_elem_conv;
3153 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3154 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3155 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3156 ret->data[i] = arr_elem_conv;
3161 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
3162 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
3163 for (size_t i = 0; i < ret.datalen; i++) {
3164 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
3168 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
3169 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
3171 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
3172 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3173 CHECK(val->result_ok);
3174 LDKAcceptChannel res_var = (*val->contents.result);
3175 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3176 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3177 long res_ref = (long)res_var.inner & ~1;
3180 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
3181 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3182 CHECK(!val->result_ok);
3183 LDKDecodeError err_var = (*val->contents.err);
3184 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3185 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3186 long err_ref = (long)err_var.inner & ~1;
3189 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
3190 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
3192 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
3193 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
3194 CHECK(val->result_ok);
3195 LDKAnnouncementSignatures res_var = (*val->contents.result);
3196 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3197 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3198 long res_ref = (long)res_var.inner & ~1;
3201 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
3202 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
3203 CHECK(!val->result_ok);
3204 LDKDecodeError err_var = (*val->contents.err);
3205 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3206 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3207 long err_ref = (long)err_var.inner & ~1;
3210 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
3211 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
3213 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
3214 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3215 CHECK(val->result_ok);
3216 LDKChannelReestablish res_var = (*val->contents.result);
3217 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3218 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3219 long res_ref = (long)res_var.inner & ~1;
3222 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
3223 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3224 CHECK(!val->result_ok);
3225 LDKDecodeError err_var = (*val->contents.err);
3226 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3227 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3228 long err_ref = (long)err_var.inner & ~1;
3231 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
3232 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
3234 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
3235 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
3236 CHECK(val->result_ok);
3237 LDKClosingSigned res_var = (*val->contents.result);
3238 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3239 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3240 long res_ref = (long)res_var.inner & ~1;
3243 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
3244 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
3245 CHECK(!val->result_ok);
3246 LDKDecodeError err_var = (*val->contents.err);
3247 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3248 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3249 long err_ref = (long)err_var.inner & ~1;
3252 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
3253 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
3255 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
3256 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
3257 CHECK(val->result_ok);
3258 LDKCommitmentSigned res_var = (*val->contents.result);
3259 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3260 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3261 long res_ref = (long)res_var.inner & ~1;
3264 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
3265 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
3266 CHECK(!val->result_ok);
3267 LDKDecodeError err_var = (*val->contents.err);
3268 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3269 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3270 long err_ref = (long)err_var.inner & ~1;
3273 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
3274 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
3276 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
3277 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
3278 CHECK(val->result_ok);
3279 LDKFundingCreated res_var = (*val->contents.result);
3280 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3281 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3282 long res_ref = (long)res_var.inner & ~1;
3285 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
3286 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
3287 CHECK(!val->result_ok);
3288 LDKDecodeError err_var = (*val->contents.err);
3289 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3290 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3291 long err_ref = (long)err_var.inner & ~1;
3294 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
3295 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
3297 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
3298 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
3299 CHECK(val->result_ok);
3300 LDKFundingSigned res_var = (*val->contents.result);
3301 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3302 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3303 long res_ref = (long)res_var.inner & ~1;
3306 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
3307 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
3308 CHECK(!val->result_ok);
3309 LDKDecodeError err_var = (*val->contents.err);
3310 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3311 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3312 long err_ref = (long)err_var.inner & ~1;
3315 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
3316 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
3318 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
3319 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
3320 CHECK(val->result_ok);
3321 LDKFundingLocked res_var = (*val->contents.result);
3322 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3323 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3324 long res_ref = (long)res_var.inner & ~1;
3327 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
3328 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
3329 CHECK(!val->result_ok);
3330 LDKDecodeError err_var = (*val->contents.err);
3331 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3332 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3333 long err_ref = (long)err_var.inner & ~1;
3336 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_result_ok(uint32_t arg) {
3337 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
3339 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
3340 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
3341 CHECK(val->result_ok);
3342 LDKInit res_var = (*val->contents.result);
3343 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3344 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3345 long res_ref = (long)res_var.inner & ~1;
3348 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
3349 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
3350 CHECK(!val->result_ok);
3351 LDKDecodeError err_var = (*val->contents.err);
3352 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3353 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3354 long err_ref = (long)err_var.inner & ~1;
3357 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
3358 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
3360 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
3361 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
3362 CHECK(val->result_ok);
3363 LDKOpenChannel res_var = (*val->contents.result);
3364 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3365 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3366 long res_ref = (long)res_var.inner & ~1;
3369 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
3370 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
3371 CHECK(!val->result_ok);
3372 LDKDecodeError err_var = (*val->contents.err);
3373 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3374 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3375 long err_ref = (long)err_var.inner & ~1;
3378 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
3379 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
3381 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
3382 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
3383 CHECK(val->result_ok);
3384 LDKRevokeAndACK res_var = (*val->contents.result);
3385 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3386 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3387 long res_ref = (long)res_var.inner & ~1;
3390 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
3391 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
3392 CHECK(!val->result_ok);
3393 LDKDecodeError err_var = (*val->contents.err);
3394 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3395 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3396 long err_ref = (long)err_var.inner & ~1;
3399 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
3400 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
3402 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
3403 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
3404 CHECK(val->result_ok);
3405 LDKShutdown res_var = (*val->contents.result);
3406 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3407 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3408 long res_ref = (long)res_var.inner & ~1;
3411 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
3412 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
3413 CHECK(!val->result_ok);
3414 LDKDecodeError err_var = (*val->contents.err);
3415 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3416 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3417 long err_ref = (long)err_var.inner & ~1;
3420 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3421 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
3423 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3424 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
3425 CHECK(val->result_ok);
3426 LDKUpdateFailHTLC res_var = (*val->contents.result);
3427 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3428 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3429 long res_ref = (long)res_var.inner & ~1;
3432 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
3433 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
3434 CHECK(!val->result_ok);
3435 LDKDecodeError err_var = (*val->contents.err);
3436 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3437 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3438 long err_ref = (long)err_var.inner & ~1;
3441 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3442 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
3444 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3445 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
3446 CHECK(val->result_ok);
3447 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
3448 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3449 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3450 long res_ref = (long)res_var.inner & ~1;
3453 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
3454 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
3455 CHECK(!val->result_ok);
3456 LDKDecodeError err_var = (*val->contents.err);
3457 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3458 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3459 long err_ref = (long)err_var.inner & ~1;
3462 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
3463 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
3465 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
3466 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
3467 CHECK(val->result_ok);
3468 LDKUpdateFee res_var = (*val->contents.result);
3469 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3470 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3471 long res_ref = (long)res_var.inner & ~1;
3474 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
3475 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
3476 CHECK(!val->result_ok);
3477 LDKDecodeError err_var = (*val->contents.err);
3478 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3479 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3480 long err_ref = (long)err_var.inner & ~1;
3483 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3484 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
3486 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3487 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
3488 CHECK(val->result_ok);
3489 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
3490 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3491 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3492 long res_ref = (long)res_var.inner & ~1;
3495 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
3496 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
3497 CHECK(!val->result_ok);
3498 LDKDecodeError err_var = (*val->contents.err);
3499 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3500 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3501 long err_ref = (long)err_var.inner & ~1;
3504 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3505 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
3507 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3508 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
3509 CHECK(val->result_ok);
3510 LDKUpdateAddHTLC res_var = (*val->contents.result);
3511 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3512 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3513 long res_ref = (long)res_var.inner & ~1;
3516 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
3517 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
3518 CHECK(!val->result_ok);
3519 LDKDecodeError err_var = (*val->contents.err);
3520 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3521 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3522 long err_ref = (long)err_var.inner & ~1;
3525 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_result_ok(uint32_t arg) {
3526 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
3528 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
3529 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
3530 CHECK(val->result_ok);
3531 LDKPing res_var = (*val->contents.result);
3532 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3533 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3534 long res_ref = (long)res_var.inner & ~1;
3537 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
3538 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
3539 CHECK(!val->result_ok);
3540 LDKDecodeError err_var = (*val->contents.err);
3541 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3542 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3543 long err_ref = (long)err_var.inner & ~1;
3546 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_result_ok(uint32_t arg) {
3547 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
3549 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
3550 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
3551 CHECK(val->result_ok);
3552 LDKPong res_var = (*val->contents.result);
3553 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3554 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3555 long res_ref = (long)res_var.inner & ~1;
3558 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
3559 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
3560 CHECK(!val->result_ok);
3561 LDKDecodeError err_var = (*val->contents.err);
3562 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3563 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3564 long err_ref = (long)err_var.inner & ~1;
3567 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3568 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
3570 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3571 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3572 CHECK(val->result_ok);
3573 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
3574 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3575 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3576 long res_ref = (long)res_var.inner & ~1;
3579 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3580 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3581 CHECK(!val->result_ok);
3582 LDKDecodeError err_var = (*val->contents.err);
3583 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3584 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3585 long err_ref = (long)err_var.inner & ~1;
3588 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3589 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
3591 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3592 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3593 CHECK(val->result_ok);
3594 LDKChannelAnnouncement res_var = (*val->contents.result);
3595 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3596 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3597 long res_ref = (long)res_var.inner & ~1;
3600 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3601 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3602 CHECK(!val->result_ok);
3603 LDKDecodeError err_var = (*val->contents.err);
3604 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3605 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3606 long err_ref = (long)err_var.inner & ~1;
3609 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3610 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
3612 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3613 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
3614 CHECK(val->result_ok);
3615 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
3616 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3617 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3618 long res_ref = (long)res_var.inner & ~1;
3621 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
3622 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
3623 CHECK(!val->result_ok);
3624 LDKDecodeError err_var = (*val->contents.err);
3625 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3626 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3627 long err_ref = (long)err_var.inner & ~1;
3630 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3631 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
3633 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3634 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
3635 CHECK(val->result_ok);
3636 LDKChannelUpdate res_var = (*val->contents.result);
3637 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3638 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3639 long res_ref = (long)res_var.inner & ~1;
3642 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
3643 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
3644 CHECK(!val->result_ok);
3645 LDKDecodeError err_var = (*val->contents.err);
3646 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3647 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3648 long err_ref = (long)err_var.inner & ~1;
3651 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
3652 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
3654 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
3655 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3656 CHECK(val->result_ok);
3657 LDKErrorMessage res_var = (*val->contents.result);
3658 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3659 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3660 long res_ref = (long)res_var.inner & ~1;
3663 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
3664 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3665 CHECK(!val->result_ok);
3666 LDKDecodeError err_var = (*val->contents.err);
3667 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3668 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3669 long err_ref = (long)err_var.inner & ~1;
3672 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3673 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3675 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3676 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3677 CHECK(val->result_ok);
3678 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
3679 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3680 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3681 long res_ref = (long)res_var.inner & ~1;
3684 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3685 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3686 CHECK(!val->result_ok);
3687 LDKDecodeError err_var = (*val->contents.err);
3688 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3689 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3690 long err_ref = (long)err_var.inner & ~1;
3693 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3694 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3696 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3697 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
3698 CHECK(val->result_ok);
3699 LDKNodeAnnouncement res_var = (*val->contents.result);
3700 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3701 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3702 long res_ref = (long)res_var.inner & ~1;
3705 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3706 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
3707 CHECK(!val->result_ok);
3708 LDKDecodeError err_var = (*val->contents.err);
3709 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3710 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3711 long err_ref = (long)err_var.inner & ~1;
3714 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
3715 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
3717 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
3718 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3719 CHECK(val->result_ok);
3720 LDKQueryShortChannelIds res_var = (*val->contents.result);
3721 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3722 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3723 long res_ref = (long)res_var.inner & ~1;
3726 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
3727 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3728 CHECK(!val->result_ok);
3729 LDKDecodeError err_var = (*val->contents.err);
3730 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3731 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3732 long err_ref = (long)err_var.inner & ~1;
3735 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
3736 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
3738 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
3739 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3740 CHECK(val->result_ok);
3741 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
3742 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3743 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3744 long res_ref = (long)res_var.inner & ~1;
3747 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
3748 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3749 CHECK(!val->result_ok);
3750 LDKDecodeError err_var = (*val->contents.err);
3751 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3752 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3753 long err_ref = (long)err_var.inner & ~1;
3756 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
3757 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
3759 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
3760 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3761 CHECK(val->result_ok);
3762 LDKQueryChannelRange res_var = (*val->contents.result);
3763 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3764 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3765 long res_ref = (long)res_var.inner & ~1;
3768 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
3769 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3770 CHECK(!val->result_ok);
3771 LDKDecodeError err_var = (*val->contents.err);
3772 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3773 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3774 long err_ref = (long)err_var.inner & ~1;
3777 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
3778 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
3780 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
3781 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3782 CHECK(val->result_ok);
3783 LDKReplyChannelRange res_var = (*val->contents.result);
3784 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3785 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3786 long res_ref = (long)res_var.inner & ~1;
3789 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
3790 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3791 CHECK(!val->result_ok);
3792 LDKDecodeError err_var = (*val->contents.err);
3793 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3794 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3795 long err_ref = (long)err_var.inner & ~1;
3798 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
3799 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
3801 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
3802 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3803 CHECK(val->result_ok);
3804 LDKGossipTimestampFilter res_var = (*val->contents.result);
3805 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3806 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3807 long res_ref = (long)res_var.inner & ~1;
3810 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
3811 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3812 CHECK(!val->result_ok);
3813 LDKDecodeError err_var = (*val->contents.err);
3814 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3815 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3816 long err_ref = (long)err_var.inner & ~1;
3819 typedef struct LDKMessageSendEventsProvider_JCalls {
3820 atomic_size_t refcnt;
3821 uint32_t get_and_clear_pending_msg_events_meth;
3822 } LDKMessageSendEventsProvider_JCalls;
3823 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
3824 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3825 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3826 js_free(j_calls->get_and_clear_pending_msg_events_meth);
3830 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
3831 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3832 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
3833 LDKCVec_MessageSendEventZ ret_constr;
3834 ret_constr.datalen = *((uint32_t*)ret);
3835 if (ret_constr.datalen > 0)
3836 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
3838 ret_constr.data = NULL;
3839 uint32_t* ret_vals = (uint32_t*)(ret + 4);
3840 for (size_t s = 0; s < ret_constr.datalen; s++) {
3841 uint32_t ret_conv_18 = ret_vals[s];
3842 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
3843 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)ret_conv_18);
3844 ret_constr.data[s] = ret_conv_18_conv;
3848 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
3849 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3850 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3851 return (void*) this_arg;
3853 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
3854 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
3855 atomic_init(&calls->refcnt, 1);
3856 //TODO: Assign calls->o from o
3858 LDKMessageSendEventsProvider ret = {
3859 .this_arg = (void*) calls,
3860 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
3861 .free = LDKMessageSendEventsProvider_JCalls_free,
3865 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
3866 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
3867 *res_ptr = LDKMessageSendEventsProvider_init(o);
3868 return (long)res_ptr;
3870 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
3871 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
3872 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
3873 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3874 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3875 for (size_t s = 0; s < ret_var.datalen; s++) {
3876 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
3877 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
3878 long ret_conv_18_ref = (long)ret_conv_18_copy;
3879 ret_arr_ptr[s] = ret_conv_18_ref;
3885 typedef struct LDKEventsProvider_JCalls {
3886 atomic_size_t refcnt;
3887 uint32_t get_and_clear_pending_events_meth;
3888 } LDKEventsProvider_JCalls;
3889 static void LDKEventsProvider_JCalls_free(void* this_arg) {
3890 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3891 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3892 js_free(j_calls->get_and_clear_pending_events_meth);
3896 LDKCVec_EventZ get_and_clear_pending_events_LDKEventsProvider_jcall(const void* this_arg) {
3897 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3898 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_events_meth);
3899 LDKCVec_EventZ ret_constr;
3900 ret_constr.datalen = *((uint32_t*)ret);
3901 if (ret_constr.datalen > 0)
3902 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
3904 ret_constr.data = NULL;
3905 uint32_t* ret_vals = (uint32_t*)(ret + 4);
3906 for (size_t h = 0; h < ret_constr.datalen; h++) {
3907 uint32_t ret_conv_7 = ret_vals[h];
3908 LDKEvent ret_conv_7_conv = *(LDKEvent*)(((uint64_t)ret_conv_7) & ~1);
3909 ret_conv_7_conv = Event_clone((LDKEvent*)ret_conv_7);
3910 ret_constr.data[h] = ret_conv_7_conv;
3914 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
3915 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3916 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3917 return (void*) this_arg;
3919 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
3920 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
3921 atomic_init(&calls->refcnt, 1);
3922 //TODO: Assign calls->o from o
3924 LDKEventsProvider ret = {
3925 .this_arg = (void*) calls,
3926 .get_and_clear_pending_events = get_and_clear_pending_events_LDKEventsProvider_jcall,
3927 .free = LDKEventsProvider_JCalls_free,
3931 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
3932 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
3933 *res_ptr = LDKEventsProvider_init(o);
3934 return (long)res_ptr;
3936 uint32_tArray __attribute__((visibility("default"))) TS_EventsProvider_get_and_clear_pending_events(uint32_t this_arg) {
3937 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
3938 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
3939 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3940 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3941 for (size_t h = 0; h < ret_var.datalen; h++) {
3942 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
3943 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
3944 long ret_conv_7_ref = (long)ret_conv_7_copy;
3945 ret_arr_ptr[h] = ret_conv_7_ref;
3951 typedef struct LDKAccess_JCalls {
3952 atomic_size_t refcnt;
3953 uint32_t get_utxo_meth;
3955 static void LDKAccess_JCalls_free(void* this_arg) {
3956 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3957 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3958 js_free(j_calls->get_utxo_meth);
3962 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3963 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3964 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3965 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
3966 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
3967 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
3968 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)ret);
3971 static void* LDKAccess_JCalls_clone(const void* this_arg) {
3972 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3973 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3974 return (void*) this_arg;
3976 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
3977 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3978 atomic_init(&calls->refcnt, 1);
3979 //TODO: Assign calls->o from o
3982 .this_arg = (void*) calls,
3983 .get_utxo = get_utxo_LDKAccess_jcall,
3984 .free = LDKAccess_JCalls_free,
3988 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
3989 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3990 *res_ptr = LDKAccess_init(o);
3991 return (long)res_ptr;
3993 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
3994 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
3995 unsigned char genesis_hash_arr[32];
3996 CHECK(*((uint32_t*)genesis_hash) == 32);
3997 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
3998 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3999 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4000 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4001 return (long)ret_conv;
4004 typedef struct LDKListen_JCalls {
4005 atomic_size_t refcnt;
4006 uint32_t block_connected_meth;
4007 uint32_t block_disconnected_meth;
4009 static void LDKListen_JCalls_free(void* this_arg) {
4010 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4011 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4012 js_free(j_calls->block_connected_meth);
4013 js_free(j_calls->block_disconnected_meth);
4017 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
4018 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4019 LDKu8slice block_var = block;
4020 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4021 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
4022 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
4024 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
4025 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4026 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
4027 memcpy((uint8_t*)(header_arr + 4), *header, 80);
4028 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
4030 static void* LDKListen_JCalls_clone(const void* this_arg) {
4031 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4032 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4033 return (void*) this_arg;
4035 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
4036 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
4037 atomic_init(&calls->refcnt, 1);
4038 //TODO: Assign calls->o from o
4041 .this_arg = (void*) calls,
4042 .block_connected = block_connected_LDKListen_jcall,
4043 .block_disconnected = block_disconnected_LDKListen_jcall,
4044 .free = LDKListen_JCalls_free,
4048 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
4049 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
4050 *res_ptr = LDKListen_init(o);
4051 return (long)res_ptr;
4053 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
4054 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
4055 LDKu8slice block_ref;
4056 block_ref.datalen = *((uint32_t*)block);
4057 block_ref.data = (int8_t*)(block + 4);
4058 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
4061 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
4062 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
4063 unsigned char header_arr[80];
4064 CHECK(*((uint32_t*)header) == 80);
4065 memcpy(header_arr, (uint8_t*)(header + 4), 80);
4066 unsigned char (*header_ref)[80] = &header_arr;
4067 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
4070 typedef struct LDKFilter_JCalls {
4071 atomic_size_t refcnt;
4072 uint32_t register_tx_meth;
4073 uint32_t register_output_meth;
4075 static void LDKFilter_JCalls_free(void* this_arg) {
4076 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4077 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4078 js_free(j_calls->register_tx_meth);
4079 js_free(j_calls->register_output_meth);
4083 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
4084 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4085 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4086 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
4087 LDKu8slice script_pubkey_var = script_pubkey;
4088 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4089 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
4090 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
4092 void register_output_LDKFilter_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) {
4093 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4094 LDKOutPoint outpoint_var = *outpoint;
4095 outpoint_var = OutPoint_clone(outpoint);
4096 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4097 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4098 long outpoint_ref = (long)outpoint_var.inner;
4099 if (outpoint_var.is_owned) {
4102 LDKu8slice script_pubkey_var = script_pubkey;
4103 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4104 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
4105 js_invoke_function_2(j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
4107 static void* LDKFilter_JCalls_clone(const void* this_arg) {
4108 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4109 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4110 return (void*) this_arg;
4112 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
4113 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
4114 atomic_init(&calls->refcnt, 1);
4115 //TODO: Assign calls->o from o
4118 .this_arg = (void*) calls,
4119 .register_tx = register_tx_LDKFilter_jcall,
4120 .register_output = register_output_LDKFilter_jcall,
4121 .free = LDKFilter_JCalls_free,
4125 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
4126 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
4127 *res_ptr = LDKFilter_init(o);
4128 return (long)res_ptr;
4130 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
4131 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
4132 unsigned char txid_arr[32];
4133 CHECK(*((uint32_t*)txid) == 32);
4134 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
4135 unsigned char (*txid_ref)[32] = &txid_arr;
4136 LDKu8slice script_pubkey_ref;
4137 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
4138 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
4139 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
4142 void __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t outpoint, int8_tArray script_pubkey) {
4143 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
4144 LDKOutPoint outpoint_conv;
4145 outpoint_conv.inner = (void*)(outpoint & (~1));
4146 outpoint_conv.is_owned = false;
4147 LDKu8slice script_pubkey_ref;
4148 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
4149 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
4150 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
4153 typedef struct LDKPersist_JCalls {
4154 atomic_size_t refcnt;
4155 uint32_t persist_new_channel_meth;
4156 uint32_t update_persisted_channel_meth;
4157 } LDKPersist_JCalls;
4158 static void LDKPersist_JCalls_free(void* this_arg) {
4159 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4160 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4161 js_free(j_calls->persist_new_channel_meth);
4162 js_free(j_calls->update_persisted_channel_meth);
4166 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
4167 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4168 LDKOutPoint id_var = id;
4169 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4170 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4171 long id_ref = (long)id_var.inner;
4172 if (id_var.is_owned) {
4175 LDKChannelMonitor data_var = *data;
4176 data_var = ChannelMonitor_clone(data);
4177 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4178 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4179 long data_ref = (long)data_var.inner;
4180 if (data_var.is_owned) {
4183 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
4184 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4185 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
4188 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
4189 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4190 LDKOutPoint id_var = id;
4191 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4192 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4193 long id_ref = (long)id_var.inner;
4194 if (id_var.is_owned) {
4197 LDKChannelMonitorUpdate update_var = *update;
4198 update_var = ChannelMonitorUpdate_clone(update);
4199 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4200 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4201 long update_ref = (long)update_var.inner;
4202 if (update_var.is_owned) {
4205 LDKChannelMonitor data_var = *data;
4206 data_var = ChannelMonitor_clone(data);
4207 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4208 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4209 long data_ref = (long)data_var.inner;
4210 if (data_var.is_owned) {
4213 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
4214 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4215 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
4218 static void* LDKPersist_JCalls_clone(const void* this_arg) {
4219 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4220 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4221 return (void*) this_arg;
4223 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
4224 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
4225 atomic_init(&calls->refcnt, 1);
4226 //TODO: Assign calls->o from o
4229 .this_arg = (void*) calls,
4230 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
4231 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
4232 .free = LDKPersist_JCalls_free,
4236 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
4237 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
4238 *res_ptr = LDKPersist_init(o);
4239 return (long)res_ptr;
4241 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t id, uint32_t data) {
4242 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
4243 LDKOutPoint id_conv;
4244 id_conv.inner = (void*)(id & (~1));
4245 id_conv.is_owned = (id & 1) || (id == 0);
4246 id_conv = OutPoint_clone(&id_conv);
4247 LDKChannelMonitor data_conv;
4248 data_conv.inner = (void*)(data & (~1));
4249 data_conv.is_owned = false;
4250 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4251 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
4252 return (long)ret_conv;
4255 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
4256 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
4257 LDKOutPoint id_conv;
4258 id_conv.inner = (void*)(id & (~1));
4259 id_conv.is_owned = (id & 1) || (id == 0);
4260 id_conv = OutPoint_clone(&id_conv);
4261 LDKChannelMonitorUpdate update_conv;
4262 update_conv.inner = (void*)(update & (~1));
4263 update_conv.is_owned = false;
4264 LDKChannelMonitor data_conv;
4265 data_conv.inner = (void*)(data & (~1));
4266 data_conv.is_owned = false;
4267 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4268 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
4269 return (long)ret_conv;
4272 typedef struct LDKChannelMessageHandler_JCalls {
4273 atomic_size_t refcnt;
4274 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4275 uint32_t handle_open_channel_meth;
4276 uint32_t handle_accept_channel_meth;
4277 uint32_t handle_funding_created_meth;
4278 uint32_t handle_funding_signed_meth;
4279 uint32_t handle_funding_locked_meth;
4280 uint32_t handle_shutdown_meth;
4281 uint32_t handle_closing_signed_meth;
4282 uint32_t handle_update_add_htlc_meth;
4283 uint32_t handle_update_fulfill_htlc_meth;
4284 uint32_t handle_update_fail_htlc_meth;
4285 uint32_t handle_update_fail_malformed_htlc_meth;
4286 uint32_t handle_commitment_signed_meth;
4287 uint32_t handle_revoke_and_ack_meth;
4288 uint32_t handle_update_fee_meth;
4289 uint32_t handle_announcement_signatures_meth;
4290 uint32_t peer_disconnected_meth;
4291 uint32_t peer_connected_meth;
4292 uint32_t handle_channel_reestablish_meth;
4293 uint32_t handle_channel_update_meth;
4294 uint32_t handle_error_meth;
4295 } LDKChannelMessageHandler_JCalls;
4296 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
4297 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4298 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4299 js_free(j_calls->handle_open_channel_meth);
4300 js_free(j_calls->handle_accept_channel_meth);
4301 js_free(j_calls->handle_funding_created_meth);
4302 js_free(j_calls->handle_funding_signed_meth);
4303 js_free(j_calls->handle_funding_locked_meth);
4304 js_free(j_calls->handle_shutdown_meth);
4305 js_free(j_calls->handle_closing_signed_meth);
4306 js_free(j_calls->handle_update_add_htlc_meth);
4307 js_free(j_calls->handle_update_fulfill_htlc_meth);
4308 js_free(j_calls->handle_update_fail_htlc_meth);
4309 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
4310 js_free(j_calls->handle_commitment_signed_meth);
4311 js_free(j_calls->handle_revoke_and_ack_meth);
4312 js_free(j_calls->handle_update_fee_meth);
4313 js_free(j_calls->handle_announcement_signatures_meth);
4314 js_free(j_calls->peer_disconnected_meth);
4315 js_free(j_calls->peer_connected_meth);
4316 js_free(j_calls->handle_channel_reestablish_meth);
4317 js_free(j_calls->handle_channel_update_meth);
4318 js_free(j_calls->handle_error_meth);
4322 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
4323 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4324 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4325 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4326 LDKInitFeatures their_features_var = their_features;
4327 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4328 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4329 long their_features_ref = (long)their_features_var.inner;
4330 if (their_features_var.is_owned) {
4331 their_features_ref |= 1;
4333 LDKOpenChannel msg_var = *msg;
4334 msg_var = OpenChannel_clone(msg);
4335 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4336 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4337 long msg_ref = (long)msg_var.inner;
4338 if (msg_var.is_owned) {
4341 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4343 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
4344 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4345 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4346 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4347 LDKInitFeatures their_features_var = their_features;
4348 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4349 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4350 long their_features_ref = (long)their_features_var.inner;
4351 if (their_features_var.is_owned) {
4352 their_features_ref |= 1;
4354 LDKAcceptChannel msg_var = *msg;
4355 msg_var = AcceptChannel_clone(msg);
4356 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4357 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4358 long msg_ref = (long)msg_var.inner;
4359 if (msg_var.is_owned) {
4362 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4364 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
4365 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4366 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4367 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4368 LDKFundingCreated msg_var = *msg;
4369 msg_var = FundingCreated_clone(msg);
4370 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4371 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4372 long msg_ref = (long)msg_var.inner;
4373 if (msg_var.is_owned) {
4376 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
4378 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
4379 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4380 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4381 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4382 LDKFundingSigned msg_var = *msg;
4383 msg_var = FundingSigned_clone(msg);
4384 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4385 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4386 long msg_ref = (long)msg_var.inner;
4387 if (msg_var.is_owned) {
4390 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
4392 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
4393 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4394 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4395 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4396 LDKFundingLocked msg_var = *msg;
4397 msg_var = FundingLocked_clone(msg);
4398 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4399 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4400 long msg_ref = (long)msg_var.inner;
4401 if (msg_var.is_owned) {
4404 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
4406 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
4407 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4408 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4409 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4410 LDKInitFeatures their_features_var = *their_features;
4411 their_features_var = InitFeatures_clone(their_features);
4412 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4413 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4414 long their_features_ref = (long)their_features_var.inner;
4415 if (their_features_var.is_owned) {
4416 their_features_ref |= 1;
4418 LDKShutdown msg_var = *msg;
4419 msg_var = Shutdown_clone(msg);
4420 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4421 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4422 long msg_ref = (long)msg_var.inner;
4423 if (msg_var.is_owned) {
4426 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
4428 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
4429 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4430 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4431 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4432 LDKClosingSigned msg_var = *msg;
4433 msg_var = ClosingSigned_clone(msg);
4434 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4435 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4436 long msg_ref = (long)msg_var.inner;
4437 if (msg_var.is_owned) {
4440 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
4442 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
4443 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4444 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4445 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4446 LDKUpdateAddHTLC msg_var = *msg;
4447 msg_var = UpdateAddHTLC_clone(msg);
4448 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4449 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4450 long msg_ref = (long)msg_var.inner;
4451 if (msg_var.is_owned) {
4454 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
4456 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
4457 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4458 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4459 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4460 LDKUpdateFulfillHTLC msg_var = *msg;
4461 msg_var = UpdateFulfillHTLC_clone(msg);
4462 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4463 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4464 long msg_ref = (long)msg_var.inner;
4465 if (msg_var.is_owned) {
4468 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
4470 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
4471 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4472 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4473 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4474 LDKUpdateFailHTLC msg_var = *msg;
4475 msg_var = UpdateFailHTLC_clone(msg);
4476 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4477 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4478 long msg_ref = (long)msg_var.inner;
4479 if (msg_var.is_owned) {
4482 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
4484 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
4485 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4486 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4487 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4488 LDKUpdateFailMalformedHTLC msg_var = *msg;
4489 msg_var = UpdateFailMalformedHTLC_clone(msg);
4490 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4491 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4492 long msg_ref = (long)msg_var.inner;
4493 if (msg_var.is_owned) {
4496 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
4498 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
4499 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4500 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4501 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4502 LDKCommitmentSigned msg_var = *msg;
4503 msg_var = CommitmentSigned_clone(msg);
4504 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4505 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4506 long msg_ref = (long)msg_var.inner;
4507 if (msg_var.is_owned) {
4510 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
4512 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
4513 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4514 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4515 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4516 LDKRevokeAndACK msg_var = *msg;
4517 msg_var = RevokeAndACK_clone(msg);
4518 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4519 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4520 long msg_ref = (long)msg_var.inner;
4521 if (msg_var.is_owned) {
4524 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
4526 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
4527 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4528 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4529 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4530 LDKUpdateFee msg_var = *msg;
4531 msg_var = UpdateFee_clone(msg);
4532 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4533 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4534 long msg_ref = (long)msg_var.inner;
4535 if (msg_var.is_owned) {
4538 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
4540 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
4541 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4542 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4543 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4544 LDKAnnouncementSignatures msg_var = *msg;
4545 msg_var = AnnouncementSignatures_clone(msg);
4546 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4547 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4548 long msg_ref = (long)msg_var.inner;
4549 if (msg_var.is_owned) {
4552 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
4554 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
4555 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4556 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4557 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4558 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
4560 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
4561 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4562 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4563 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4564 LDKInit msg_var = *msg;
4565 msg_var = Init_clone(msg);
4566 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4567 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4568 long msg_ref = (long)msg_var.inner;
4569 if (msg_var.is_owned) {
4572 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
4574 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
4575 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4576 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4577 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4578 LDKChannelReestablish msg_var = *msg;
4579 msg_var = ChannelReestablish_clone(msg);
4580 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4581 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4582 long msg_ref = (long)msg_var.inner;
4583 if (msg_var.is_owned) {
4586 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
4588 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
4589 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4590 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4591 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4592 LDKChannelUpdate msg_var = *msg;
4593 msg_var = ChannelUpdate_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 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
4602 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
4603 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4604 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4605 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4606 LDKErrorMessage msg_var = *msg;
4607 msg_var = ErrorMessage_clone(msg);
4608 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4609 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4610 long msg_ref = (long)msg_var.inner;
4611 if (msg_var.is_owned) {
4614 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
4616 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
4617 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4618 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4619 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4620 return (void*) this_arg;
4622 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
4623 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
4624 atomic_init(&calls->refcnt, 1);
4625 //TODO: Assign calls->o from o
4627 LDKChannelMessageHandler ret = {
4628 .this_arg = (void*) calls,
4629 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
4630 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
4631 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
4632 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
4633 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
4634 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
4635 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
4636 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
4637 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
4638 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
4639 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
4640 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
4641 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
4642 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
4643 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
4644 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
4645 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
4646 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
4647 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
4648 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
4649 .free = LDKChannelMessageHandler_JCalls_free,
4650 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
4652 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
4655 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
4656 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
4657 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
4658 return (long)res_ptr;
4660 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) {
4661 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4662 LDKPublicKey their_node_id_ref;
4663 CHECK(*((uint32_t*)their_node_id) == 33);
4664 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4665 LDKInitFeatures their_features_conv;
4666 their_features_conv.inner = (void*)(their_features & (~1));
4667 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4668 their_features_conv = InitFeatures_clone(&their_features_conv);
4669 LDKOpenChannel msg_conv;
4670 msg_conv.inner = (void*)(msg & (~1));
4671 msg_conv.is_owned = false;
4672 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4675 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) {
4676 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4677 LDKPublicKey their_node_id_ref;
4678 CHECK(*((uint32_t*)their_node_id) == 33);
4679 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4680 LDKInitFeatures their_features_conv;
4681 their_features_conv.inner = (void*)(their_features & (~1));
4682 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4683 their_features_conv = InitFeatures_clone(&their_features_conv);
4684 LDKAcceptChannel msg_conv;
4685 msg_conv.inner = (void*)(msg & (~1));
4686 msg_conv.is_owned = false;
4687 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4690 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4691 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4692 LDKPublicKey their_node_id_ref;
4693 CHECK(*((uint32_t*)their_node_id) == 33);
4694 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4695 LDKFundingCreated msg_conv;
4696 msg_conv.inner = (void*)(msg & (~1));
4697 msg_conv.is_owned = false;
4698 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4701 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4702 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4703 LDKPublicKey their_node_id_ref;
4704 CHECK(*((uint32_t*)their_node_id) == 33);
4705 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4706 LDKFundingSigned msg_conv;
4707 msg_conv.inner = (void*)(msg & (~1));
4708 msg_conv.is_owned = false;
4709 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4712 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4713 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4714 LDKPublicKey their_node_id_ref;
4715 CHECK(*((uint32_t*)their_node_id) == 33);
4716 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4717 LDKFundingLocked msg_conv;
4718 msg_conv.inner = (void*)(msg & (~1));
4719 msg_conv.is_owned = false;
4720 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4723 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
4724 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4725 LDKPublicKey their_node_id_ref;
4726 CHECK(*((uint32_t*)their_node_id) == 33);
4727 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4728 LDKInitFeatures their_features_conv;
4729 their_features_conv.inner = (void*)(their_features & (~1));
4730 their_features_conv.is_owned = false;
4731 LDKShutdown msg_conv;
4732 msg_conv.inner = (void*)(msg & (~1));
4733 msg_conv.is_owned = false;
4734 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
4737 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4738 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4739 LDKPublicKey their_node_id_ref;
4740 CHECK(*((uint32_t*)their_node_id) == 33);
4741 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4742 LDKClosingSigned msg_conv;
4743 msg_conv.inner = (void*)(msg & (~1));
4744 msg_conv.is_owned = false;
4745 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4748 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4749 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4750 LDKPublicKey their_node_id_ref;
4751 CHECK(*((uint32_t*)their_node_id) == 33);
4752 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4753 LDKUpdateAddHTLC msg_conv;
4754 msg_conv.inner = (void*)(msg & (~1));
4755 msg_conv.is_owned = false;
4756 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4759 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4760 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4761 LDKPublicKey their_node_id_ref;
4762 CHECK(*((uint32_t*)their_node_id) == 33);
4763 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4764 LDKUpdateFulfillHTLC msg_conv;
4765 msg_conv.inner = (void*)(msg & (~1));
4766 msg_conv.is_owned = false;
4767 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4770 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4771 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4772 LDKPublicKey their_node_id_ref;
4773 CHECK(*((uint32_t*)their_node_id) == 33);
4774 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4775 LDKUpdateFailHTLC msg_conv;
4776 msg_conv.inner = (void*)(msg & (~1));
4777 msg_conv.is_owned = false;
4778 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4781 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4782 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4783 LDKPublicKey their_node_id_ref;
4784 CHECK(*((uint32_t*)their_node_id) == 33);
4785 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4786 LDKUpdateFailMalformedHTLC msg_conv;
4787 msg_conv.inner = (void*)(msg & (~1));
4788 msg_conv.is_owned = false;
4789 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4792 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4793 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4794 LDKPublicKey their_node_id_ref;
4795 CHECK(*((uint32_t*)their_node_id) == 33);
4796 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4797 LDKCommitmentSigned msg_conv;
4798 msg_conv.inner = (void*)(msg & (~1));
4799 msg_conv.is_owned = false;
4800 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4803 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4804 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4805 LDKPublicKey their_node_id_ref;
4806 CHECK(*((uint32_t*)their_node_id) == 33);
4807 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4808 LDKRevokeAndACK msg_conv;
4809 msg_conv.inner = (void*)(msg & (~1));
4810 msg_conv.is_owned = false;
4811 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4814 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4815 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4816 LDKPublicKey their_node_id_ref;
4817 CHECK(*((uint32_t*)their_node_id) == 33);
4818 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4819 LDKUpdateFee msg_conv;
4820 msg_conv.inner = (void*)(msg & (~1));
4821 msg_conv.is_owned = false;
4822 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4825 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4826 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4827 LDKPublicKey their_node_id_ref;
4828 CHECK(*((uint32_t*)their_node_id) == 33);
4829 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4830 LDKAnnouncementSignatures msg_conv;
4831 msg_conv.inner = (void*)(msg & (~1));
4832 msg_conv.is_owned = false;
4833 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4836 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
4837 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4838 LDKPublicKey their_node_id_ref;
4839 CHECK(*((uint32_t*)their_node_id) == 33);
4840 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4841 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
4844 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4845 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4846 LDKPublicKey their_node_id_ref;
4847 CHECK(*((uint32_t*)their_node_id) == 33);
4848 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4850 msg_conv.inner = (void*)(msg & (~1));
4851 msg_conv.is_owned = false;
4852 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4855 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4856 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4857 LDKPublicKey their_node_id_ref;
4858 CHECK(*((uint32_t*)their_node_id) == 33);
4859 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4860 LDKChannelReestablish msg_conv;
4861 msg_conv.inner = (void*)(msg & (~1));
4862 msg_conv.is_owned = false;
4863 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4866 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4867 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4868 LDKPublicKey their_node_id_ref;
4869 CHECK(*((uint32_t*)their_node_id) == 33);
4870 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4871 LDKChannelUpdate msg_conv;
4872 msg_conv.inner = (void*)(msg & (~1));
4873 msg_conv.is_owned = false;
4874 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4877 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4878 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4879 LDKPublicKey their_node_id_ref;
4880 CHECK(*((uint32_t*)their_node_id) == 33);
4881 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4882 LDKErrorMessage msg_conv;
4883 msg_conv.inner = (void*)(msg & (~1));
4884 msg_conv.is_owned = false;
4885 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4888 typedef struct LDKRoutingMessageHandler_JCalls {
4889 atomic_size_t refcnt;
4890 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4891 uint32_t handle_node_announcement_meth;
4892 uint32_t handle_channel_announcement_meth;
4893 uint32_t handle_channel_update_meth;
4894 uint32_t handle_htlc_fail_channel_update_meth;
4895 uint32_t get_next_channel_announcements_meth;
4896 uint32_t get_next_node_announcements_meth;
4897 uint32_t sync_routing_table_meth;
4898 uint32_t handle_reply_channel_range_meth;
4899 uint32_t handle_reply_short_channel_ids_end_meth;
4900 uint32_t handle_query_channel_range_meth;
4901 uint32_t handle_query_short_channel_ids_meth;
4902 } LDKRoutingMessageHandler_JCalls;
4903 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
4904 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4905 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4906 js_free(j_calls->handle_node_announcement_meth);
4907 js_free(j_calls->handle_channel_announcement_meth);
4908 js_free(j_calls->handle_channel_update_meth);
4909 js_free(j_calls->handle_htlc_fail_channel_update_meth);
4910 js_free(j_calls->get_next_channel_announcements_meth);
4911 js_free(j_calls->get_next_node_announcements_meth);
4912 js_free(j_calls->sync_routing_table_meth);
4913 js_free(j_calls->handle_reply_channel_range_meth);
4914 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
4915 js_free(j_calls->handle_query_channel_range_meth);
4916 js_free(j_calls->handle_query_short_channel_ids_meth);
4920 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
4921 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4922 LDKNodeAnnouncement msg_var = *msg;
4923 msg_var = NodeAnnouncement_clone(msg);
4924 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4925 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4926 long msg_ref = (long)msg_var.inner;
4927 if (msg_var.is_owned) {
4930 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
4931 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4932 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4935 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
4936 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4937 LDKChannelAnnouncement msg_var = *msg;
4938 msg_var = ChannelAnnouncement_clone(msg);
4939 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4940 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4941 long msg_ref = (long)msg_var.inner;
4942 if (msg_var.is_owned) {
4945 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
4946 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4947 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4950 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
4951 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4952 LDKChannelUpdate msg_var = *msg;
4953 msg_var = ChannelUpdate_clone(msg);
4954 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4955 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4956 long msg_ref = (long)msg_var.inner;
4957 if (msg_var.is_owned) {
4960 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
4961 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4962 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4965 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
4966 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4967 long ret_update = (long)update;
4968 js_invoke_function_1(j_calls->handle_htlc_fail_channel_update_meth, ret_update);
4970 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
4971 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4972 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
4973 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
4974 ret_constr.datalen = *((uint32_t*)ret);
4975 if (ret_constr.datalen > 0)
4976 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4978 ret_constr.data = NULL;
4979 uint32_t* ret_vals = (uint32_t*)(ret + 4);
4980 for (size_t l = 0; l < ret_constr.datalen; l++) {
4981 uint32_t ret_conv_63 = ret_vals[l];
4982 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
4983 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ret_conv_63);
4984 ret_constr.data[l] = ret_conv_63_conv;
4988 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
4989 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4990 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4991 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
4992 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
4993 LDKCVec_NodeAnnouncementZ ret_constr;
4994 ret_constr.datalen = *((uint32_t*)ret);
4995 if (ret_constr.datalen > 0)
4996 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4998 ret_constr.data = NULL;
4999 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5000 for (size_t s = 0; s < ret_constr.datalen; s++) {
5001 uint32_t ret_conv_18 = ret_vals[s];
5002 LDKNodeAnnouncement ret_conv_18_conv;
5003 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
5004 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
5005 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
5006 ret_constr.data[s] = ret_conv_18_conv;
5010 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
5011 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5012 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5013 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5014 LDKInit init_var = *init;
5015 init_var = Init_clone(init);
5016 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5017 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5018 long init_ref = (long)init_var.inner;
5019 if (init_var.is_owned) {
5022 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
5024 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
5025 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5026 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5027 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5028 LDKReplyChannelRange msg_var = msg;
5029 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5030 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5031 long msg_ref = (long)msg_var.inner;
5032 if (msg_var.is_owned) {
5035 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
5036 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5037 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5040 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
5041 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5042 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5043 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5044 LDKReplyShortChannelIdsEnd msg_var = msg;
5045 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5046 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5047 long msg_ref = (long)msg_var.inner;
5048 if (msg_var.is_owned) {
5051 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
5052 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5053 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5056 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
5057 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5058 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5059 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5060 LDKQueryChannelRange msg_var = msg;
5061 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5062 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5063 long msg_ref = (long)msg_var.inner;
5064 if (msg_var.is_owned) {
5067 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
5068 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5069 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5072 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
5073 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5074 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5075 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5076 LDKQueryShortChannelIds msg_var = msg;
5077 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5078 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5079 long msg_ref = (long)msg_var.inner;
5080 if (msg_var.is_owned) {
5083 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
5084 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5085 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5088 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
5089 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5090 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5091 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5092 return (void*) this_arg;
5094 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
5095 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
5096 atomic_init(&calls->refcnt, 1);
5097 //TODO: Assign calls->o from o
5099 LDKRoutingMessageHandler ret = {
5100 .this_arg = (void*) calls,
5101 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
5102 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
5103 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
5104 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
5105 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
5106 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
5107 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
5108 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
5109 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
5110 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
5111 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
5112 .free = LDKRoutingMessageHandler_JCalls_free,
5113 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
5115 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5118 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
5119 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
5120 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
5121 return (long)res_ptr;
5123 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
5124 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5125 LDKNodeAnnouncement msg_conv;
5126 msg_conv.inner = (void*)(msg & (~1));
5127 msg_conv.is_owned = false;
5128 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5129 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
5130 return (long)ret_conv;
5133 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
5134 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5135 LDKChannelAnnouncement msg_conv;
5136 msg_conv.inner = (void*)(msg & (~1));
5137 msg_conv.is_owned = false;
5138 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5139 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5140 return (long)ret_conv;
5143 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
5144 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5145 LDKChannelUpdate msg_conv;
5146 msg_conv.inner = (void*)(msg & (~1));
5147 msg_conv.is_owned = false;
5148 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5149 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
5150 return (long)ret_conv;
5153 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_htlc_fail_channel_update(uint32_t this_arg, uint32_t update) {
5154 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5155 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
5156 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
5159 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
5160 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5161 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
5162 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5163 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5164 for (size_t l = 0; l < ret_var.datalen; l++) {
5165 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5166 *ret_conv_63_ref = ret_var.data[l];
5167 ret_arr_ptr[l] = (long)ret_conv_63_ref;
5173 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
5174 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5175 LDKPublicKey starting_point_ref;
5176 CHECK(*((uint32_t*)starting_point) == 33);
5177 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
5178 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
5179 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5180 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5181 for (size_t s = 0; s < ret_var.datalen; s++) {
5182 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
5183 CHECK((((long)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5184 CHECK((((long)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5185 long ret_conv_18_ref = (long)ret_conv_18_var.inner;
5186 if (ret_conv_18_var.is_owned) {
5187 ret_conv_18_ref |= 1;
5189 ret_arr_ptr[s] = ret_conv_18_ref;
5195 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
5196 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5197 LDKPublicKey their_node_id_ref;
5198 CHECK(*((uint32_t*)their_node_id) == 33);
5199 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5201 init_conv.inner = (void*)(init & (~1));
5202 init_conv.is_owned = false;
5203 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
5206 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5207 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5208 LDKPublicKey their_node_id_ref;
5209 CHECK(*((uint32_t*)their_node_id) == 33);
5210 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5211 LDKReplyChannelRange msg_conv;
5212 msg_conv.inner = (void*)(msg & (~1));
5213 msg_conv.is_owned = (msg & 1) || (msg == 0);
5214 msg_conv = ReplyChannelRange_clone(&msg_conv);
5215 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5216 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5217 return (long)ret_conv;
5220 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) {
5221 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5222 LDKPublicKey their_node_id_ref;
5223 CHECK(*((uint32_t*)their_node_id) == 33);
5224 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5225 LDKReplyShortChannelIdsEnd msg_conv;
5226 msg_conv.inner = (void*)(msg & (~1));
5227 msg_conv.is_owned = (msg & 1) || (msg == 0);
5228 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
5229 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5230 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5231 return (long)ret_conv;
5234 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5235 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5236 LDKPublicKey their_node_id_ref;
5237 CHECK(*((uint32_t*)their_node_id) == 33);
5238 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5239 LDKQueryChannelRange msg_conv;
5240 msg_conv.inner = (void*)(msg & (~1));
5241 msg_conv.is_owned = (msg & 1) || (msg == 0);
5242 msg_conv = QueryChannelRange_clone(&msg_conv);
5243 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5244 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5245 return (long)ret_conv;
5248 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5249 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5250 LDKPublicKey their_node_id_ref;
5251 CHECK(*((uint32_t*)their_node_id) == 33);
5252 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5253 LDKQueryShortChannelIds msg_conv;
5254 msg_conv.inner = (void*)(msg & (~1));
5255 msg_conv.is_owned = (msg & 1) || (msg == 0);
5256 msg_conv = QueryShortChannelIds_clone(&msg_conv);
5257 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5258 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5259 return (long)ret_conv;
5262 typedef struct LDKSocketDescriptor_JCalls {
5263 atomic_size_t refcnt;
5264 uint32_t send_data_meth;
5265 uint32_t disconnect_socket_meth;
5268 } LDKSocketDescriptor_JCalls;
5269 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
5270 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5271 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5272 js_free(j_calls->send_data_meth);
5273 js_free(j_calls->disconnect_socket_meth);
5274 js_free(j_calls->eq_meth);
5275 js_free(j_calls->hash_meth);
5279 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
5280 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5281 LDKu8slice data_var = data;
5282 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5283 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
5284 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
5286 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
5287 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5288 js_invoke_function_0(j_calls->disconnect_socket_meth);
5290 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
5291 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5292 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5293 *other_arg_clone = SocketDescriptor_clone(other_arg);
5294 return js_invoke_function_1(j_calls->eq_meth, (long)other_arg_clone);
5296 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
5297 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5298 return js_invoke_function_0(j_calls->hash_meth);
5300 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
5301 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5302 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5303 return (void*) this_arg;
5305 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
5306 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
5307 atomic_init(&calls->refcnt, 1);
5308 //TODO: Assign calls->o from o
5310 LDKSocketDescriptor ret = {
5311 .this_arg = (void*) calls,
5312 .send_data = send_data_LDKSocketDescriptor_jcall,
5313 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
5314 .eq = eq_LDKSocketDescriptor_jcall,
5315 .hash = hash_LDKSocketDescriptor_jcall,
5316 .clone = LDKSocketDescriptor_JCalls_clone,
5317 .free = LDKSocketDescriptor_JCalls_free,
5321 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
5322 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5323 *res_ptr = LDKSocketDescriptor_init(o);
5324 return (long)res_ptr;
5326 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
5327 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
5328 LDKu8slice data_ref;
5329 data_ref.datalen = *((uint32_t*)data);
5330 data_ref.data = (int8_t*)(data + 4);
5331 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
5335 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
5336 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
5337 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
5340 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
5341 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
5342 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
5346 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
5347 LDKTransaction _res_ref;
5348 _res_ref.datalen = *((uint32_t*)_res);
5349 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5350 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
5351 _res_ref.data_is_owned = true;
5352 Transaction_free(_res_ref);
5355 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
5356 if ((_res & 1) != 0) return;
5357 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
5359 TxOut_free(_res_conv);
5362 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
5363 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
5364 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5365 *ret_ref = TxOut_clone(orig_conv);
5366 return (long)ret_ref;
5369 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
5371 CHECK(*((uint32_t*)o) == 32);
5372 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
5373 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
5374 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
5375 return (long)ret_conv;
5378 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
5379 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5380 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
5381 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
5382 return (long)ret_conv;
5385 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
5386 if ((_res & 1) != 0) return;
5387 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
5389 CResult_SecretKeyErrorZ_free(_res_conv);
5392 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
5394 CHECK(*((uint32_t*)o) == 33);
5395 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
5396 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
5397 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
5398 return (long)ret_conv;
5401 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
5402 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5403 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
5404 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
5405 return (long)ret_conv;
5408 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
5409 if ((_res & 1) != 0) return;
5410 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
5412 CResult_PublicKeyErrorZ_free(_res_conv);
5415 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
5416 LDKTxCreationKeys o_conv;
5417 o_conv.inner = (void*)(o & (~1));
5418 o_conv.is_owned = (o & 1) || (o == 0);
5419 o_conv = TxCreationKeys_clone(&o_conv);
5420 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5421 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
5422 return (long)ret_conv;
5425 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
5426 LDKDecodeError e_conv;
5427 e_conv.inner = (void*)(e & (~1));
5428 e_conv.is_owned = (e & 1) || (e == 0);
5429 e_conv = DecodeError_clone(&e_conv);
5430 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5431 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
5432 return (long)ret_conv;
5435 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
5436 if ((_res & 1) != 0) return;
5437 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
5439 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
5442 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
5443 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
5444 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5445 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
5446 return (long)ret_conv;
5449 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
5450 LDKChannelPublicKeys o_conv;
5451 o_conv.inner = (void*)(o & (~1));
5452 o_conv.is_owned = (o & 1) || (o == 0);
5453 o_conv = ChannelPublicKeys_clone(&o_conv);
5454 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5455 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
5456 return (long)ret_conv;
5459 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
5460 LDKDecodeError e_conv;
5461 e_conv.inner = (void*)(e & (~1));
5462 e_conv.is_owned = (e & 1) || (e == 0);
5463 e_conv = DecodeError_clone(&e_conv);
5464 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5465 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
5466 return (long)ret_conv;
5469 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
5470 if ((_res & 1) != 0) return;
5471 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
5473 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
5476 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
5477 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
5478 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5479 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
5480 return (long)ret_conv;
5483 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
5484 LDKTxCreationKeys o_conv;
5485 o_conv.inner = (void*)(o & (~1));
5486 o_conv.is_owned = (o & 1) || (o == 0);
5487 o_conv = TxCreationKeys_clone(&o_conv);
5488 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
5489 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
5490 return (long)ret_conv;
5493 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
5494 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5495 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
5496 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
5497 return (long)ret_conv;
5500 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
5501 if ((_res & 1) != 0) return;
5502 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
5504 CResult_TxCreationKeysErrorZ_free(_res_conv);
5507 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
5508 LDKHTLCOutputInCommitment o_conv;
5509 o_conv.inner = (void*)(o & (~1));
5510 o_conv.is_owned = (o & 1) || (o == 0);
5511 o_conv = HTLCOutputInCommitment_clone(&o_conv);
5512 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5513 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
5514 return (long)ret_conv;
5517 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
5518 LDKDecodeError e_conv;
5519 e_conv.inner = (void*)(e & (~1));
5520 e_conv.is_owned = (e & 1) || (e == 0);
5521 e_conv = DecodeError_clone(&e_conv);
5522 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5523 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
5524 return (long)ret_conv;
5527 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
5528 if ((_res & 1) != 0) return;
5529 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
5531 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
5534 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
5535 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
5536 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5537 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
5538 return (long)ret_conv;
5541 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
5542 LDKCounterpartyChannelTransactionParameters o_conv;
5543 o_conv.inner = (void*)(o & (~1));
5544 o_conv.is_owned = (o & 1) || (o == 0);
5545 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
5546 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5547 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
5548 return (long)ret_conv;
5551 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
5552 LDKDecodeError e_conv;
5553 e_conv.inner = (void*)(e & (~1));
5554 e_conv.is_owned = (e & 1) || (e == 0);
5555 e_conv = DecodeError_clone(&e_conv);
5556 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5557 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
5558 return (long)ret_conv;
5561 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
5562 if ((_res & 1) != 0) return;
5563 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
5565 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
5568 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
5569 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
5570 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5571 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
5572 return (long)ret_conv;
5575 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
5576 LDKChannelTransactionParameters o_conv;
5577 o_conv.inner = (void*)(o & (~1));
5578 o_conv.is_owned = (o & 1) || (o == 0);
5579 o_conv = ChannelTransactionParameters_clone(&o_conv);
5580 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5581 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
5582 return (long)ret_conv;
5585 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
5586 LDKDecodeError e_conv;
5587 e_conv.inner = (void*)(e & (~1));
5588 e_conv.is_owned = (e & 1) || (e == 0);
5589 e_conv = DecodeError_clone(&e_conv);
5590 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5591 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
5592 return (long)ret_conv;
5595 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
5596 if ((_res & 1) != 0) return;
5597 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
5599 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
5602 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
5603 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
5604 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5605 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
5606 return (long)ret_conv;
5609 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
5610 LDKCVec_SignatureZ _res_constr;
5611 _res_constr.datalen = *((uint32_t*)_res);
5612 if (_res_constr.datalen > 0)
5613 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5615 _res_constr.data = NULL;
5616 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
5617 for (size_t m = 0; m < _res_constr.datalen; m++) {
5618 int8_tArray _res_conv_12 = _res_vals[m];
5619 LDKSignature _res_conv_12_ref;
5620 CHECK(*((uint32_t*)_res_conv_12) == 64);
5621 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
5622 _res_constr.data[m] = _res_conv_12_ref;
5624 CVec_SignatureZ_free(_res_constr);
5627 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5628 LDKHolderCommitmentTransaction o_conv;
5629 o_conv.inner = (void*)(o & (~1));
5630 o_conv.is_owned = (o & 1) || (o == 0);
5631 o_conv = HolderCommitmentTransaction_clone(&o_conv);
5632 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5633 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
5634 return (long)ret_conv;
5637 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5638 LDKDecodeError e_conv;
5639 e_conv.inner = (void*)(e & (~1));
5640 e_conv.is_owned = (e & 1) || (e == 0);
5641 e_conv = DecodeError_clone(&e_conv);
5642 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5643 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
5644 return (long)ret_conv;
5647 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5648 if ((_res & 1) != 0) return;
5649 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5651 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
5654 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5655 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
5656 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5657 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
5658 return (long)ret_conv;
5661 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5662 LDKBuiltCommitmentTransaction o_conv;
5663 o_conv.inner = (void*)(o & (~1));
5664 o_conv.is_owned = (o & 1) || (o == 0);
5665 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
5666 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5667 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
5668 return (long)ret_conv;
5671 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5672 LDKDecodeError e_conv;
5673 e_conv.inner = (void*)(e & (~1));
5674 e_conv.is_owned = (e & 1) || (e == 0);
5675 e_conv = DecodeError_clone(&e_conv);
5676 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5677 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
5678 return (long)ret_conv;
5681 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5682 if ((_res & 1) != 0) return;
5683 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5685 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
5688 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5689 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
5690 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5691 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
5692 return (long)ret_conv;
5695 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5696 LDKCommitmentTransaction o_conv;
5697 o_conv.inner = (void*)(o & (~1));
5698 o_conv.is_owned = (o & 1) || (o == 0);
5699 o_conv = CommitmentTransaction_clone(&o_conv);
5700 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
5701 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
5702 return (long)ret_conv;
5705 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5706 LDKDecodeError e_conv;
5707 e_conv.inner = (void*)(e & (~1));
5708 e_conv.is_owned = (e & 1) || (e == 0);
5709 e_conv = DecodeError_clone(&e_conv);
5710 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
5711 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
5712 return (long)ret_conv;
5715 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5716 if ((_res & 1) != 0) return;
5717 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5719 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
5722 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5723 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
5724 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
5725 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
5726 return (long)ret_conv;
5729 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
5730 LDKTrustedCommitmentTransaction o_conv;
5731 o_conv.inner = (void*)(o & (~1));
5732 o_conv.is_owned = (o & 1) || (o == 0);
5733 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
5734 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
5735 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
5736 return (long)ret_conv;
5739 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
5740 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
5741 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
5742 return (long)ret_conv;
5745 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
5746 if ((_res & 1) != 0) return;
5747 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
5749 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
5752 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
5753 LDKCVec_SignatureZ o_constr;
5754 o_constr.datalen = *((uint32_t*)o);
5755 if (o_constr.datalen > 0)
5756 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5758 o_constr.data = NULL;
5759 int8_tArray* o_vals = (int8_tArray*)(o + 4);
5760 for (size_t m = 0; m < o_constr.datalen; m++) {
5761 int8_tArray o_conv_12 = o_vals[m];
5762 LDKSignature o_conv_12_ref;
5763 CHECK(*((uint32_t*)o_conv_12) == 64);
5764 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
5765 o_constr.data[m] = o_conv_12_ref;
5767 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5768 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
5769 return (long)ret_conv;
5772 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
5773 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5774 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
5775 return (long)ret_conv;
5778 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
5779 if ((_res & 1) != 0) return;
5780 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
5782 CResult_CVec_SignatureZNoneZ_free(_res_conv);
5785 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
5786 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
5787 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5788 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
5789 return (long)ret_conv;
5792 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
5793 LDKCVec_MessageSendEventZ _res_constr;
5794 _res_constr.datalen = *((uint32_t*)_res);
5795 if (_res_constr.datalen > 0)
5796 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5798 _res_constr.data = NULL;
5799 uint32_t* _res_vals = (uint32_t*)(_res + 4);
5800 for (size_t s = 0; s < _res_constr.datalen; s++) {
5801 uint32_t _res_conv_18 = _res_vals[s];
5802 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
5803 FREE((void*)_res_conv_18);
5804 _res_constr.data[s] = _res_conv_18_conv;
5806 CVec_MessageSendEventZ_free(_res_constr);
5809 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
5810 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5811 *ret_conv = CResult_boolLightningErrorZ_ok(o);
5812 return (long)ret_conv;
5815 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
5816 LDKLightningError e_conv;
5817 e_conv.inner = (void*)(e & (~1));
5818 e_conv.is_owned = (e & 1) || (e == 0);
5819 e_conv = LightningError_clone(&e_conv);
5820 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5821 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
5822 return (long)ret_conv;
5825 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
5826 if ((_res & 1) != 0) return;
5827 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
5829 CResult_boolLightningErrorZ_free(_res_conv);
5832 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
5833 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
5834 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5835 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
5836 return (long)ret_conv;
5839 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
5840 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
5841 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5842 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
5843 return (long)ret_ref;
5846 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
5847 LDKChannelAnnouncement a_conv;
5848 a_conv.inner = (void*)(a & (~1));
5849 a_conv.is_owned = (a & 1) || (a == 0);
5850 a_conv = ChannelAnnouncement_clone(&a_conv);
5851 LDKChannelUpdate b_conv;
5852 b_conv.inner = (void*)(b & (~1));
5853 b_conv.is_owned = (b & 1) || (b == 0);
5854 b_conv = ChannelUpdate_clone(&b_conv);
5855 LDKChannelUpdate c_conv;
5856 c_conv.inner = (void*)(c & (~1));
5857 c_conv.is_owned = (c & 1) || (c == 0);
5858 c_conv = ChannelUpdate_clone(&c_conv);
5859 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5860 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5861 return (long)ret_ref;
5864 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
5865 if ((_res & 1) != 0) return;
5866 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
5868 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
5871 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
5872 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
5873 _res_constr.datalen = *((uint32_t*)_res);
5874 if (_res_constr.datalen > 0)
5875 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5877 _res_constr.data = NULL;
5878 uint32_t* _res_vals = (uint32_t*)(_res + 4);
5879 for (size_t l = 0; l < _res_constr.datalen; l++) {
5880 uint32_t _res_conv_63 = _res_vals[l];
5881 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
5882 FREE((void*)_res_conv_63);
5883 _res_constr.data[l] = _res_conv_63_conv;
5885 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
5888 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
5889 LDKCVec_NodeAnnouncementZ _res_constr;
5890 _res_constr.datalen = *((uint32_t*)_res);
5891 if (_res_constr.datalen > 0)
5892 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5894 _res_constr.data = NULL;
5895 uint32_t* _res_vals = (uint32_t*)(_res + 4);
5896 for (size_t s = 0; s < _res_constr.datalen; s++) {
5897 uint32_t _res_conv_18 = _res_vals[s];
5898 LDKNodeAnnouncement _res_conv_18_conv;
5899 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
5900 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
5901 _res_constr.data[s] = _res_conv_18_conv;
5903 CVec_NodeAnnouncementZ_free(_res_constr);
5906 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
5907 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5908 *ret_conv = CResult_NoneLightningErrorZ_ok();
5909 return (long)ret_conv;
5912 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
5913 LDKLightningError e_conv;
5914 e_conv.inner = (void*)(e & (~1));
5915 e_conv.is_owned = (e & 1) || (e == 0);
5916 e_conv = LightningError_clone(&e_conv);
5917 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5918 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
5919 return (long)ret_conv;
5922 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
5923 if ((_res & 1) != 0) return;
5924 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
5926 CResult_NoneLightningErrorZ_free(_res_conv);
5929 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
5930 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
5931 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5932 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
5933 return (long)ret_conv;
5936 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
5937 LDKCVec_PublicKeyZ _res_constr;
5938 _res_constr.datalen = *((uint32_t*)_res);
5939 if (_res_constr.datalen > 0)
5940 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
5942 _res_constr.data = NULL;
5943 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
5944 for (size_t m = 0; m < _res_constr.datalen; m++) {
5945 int8_tArray _res_conv_12 = _res_vals[m];
5946 LDKPublicKey _res_conv_12_ref;
5947 CHECK(*((uint32_t*)_res_conv_12) == 33);
5948 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
5949 _res_constr.data[m] = _res_conv_12_ref;
5951 CVec_PublicKeyZ_free(_res_constr);
5954 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
5955 LDKCVec_u8Z _res_ref;
5956 _res_ref.datalen = *((uint32_t*)_res);
5957 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
5958 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
5959 CVec_u8Z_free(_res_ref);
5962 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
5964 o_ref.datalen = *((uint32_t*)o);
5965 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
5966 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
5967 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5968 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
5969 return (long)ret_conv;
5972 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
5973 LDKPeerHandleError e_conv;
5974 e_conv.inner = (void*)(e & (~1));
5975 e_conv.is_owned = (e & 1) || (e == 0);
5976 e_conv = PeerHandleError_clone(&e_conv);
5977 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5978 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
5979 return (long)ret_conv;
5982 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
5983 if ((_res & 1) != 0) return;
5984 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
5986 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
5989 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
5990 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
5991 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5992 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
5993 return (long)ret_conv;
5996 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
5997 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5998 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
5999 return (long)ret_conv;
6002 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
6003 LDKPeerHandleError e_conv;
6004 e_conv.inner = (void*)(e & (~1));
6005 e_conv.is_owned = (e & 1) || (e == 0);
6006 e_conv = PeerHandleError_clone(&e_conv);
6007 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6008 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
6009 return (long)ret_conv;
6012 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
6013 if ((_res & 1) != 0) return;
6014 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6016 CResult_NonePeerHandleErrorZ_free(_res_conv);
6019 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
6020 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
6021 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6022 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
6023 return (long)ret_conv;
6026 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
6027 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6028 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
6029 return (long)ret_conv;
6032 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
6033 LDKPeerHandleError e_conv;
6034 e_conv.inner = (void*)(e & (~1));
6035 e_conv.is_owned = (e & 1) || (e == 0);
6036 e_conv = PeerHandleError_clone(&e_conv);
6037 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6038 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
6039 return (long)ret_conv;
6042 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
6043 if ((_res & 1) != 0) return;
6044 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6046 CResult_boolPeerHandleErrorZ_free(_res_conv);
6049 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
6050 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
6051 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6052 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
6053 return (long)ret_conv;
6056 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
6057 LDKInitFeatures o_conv;
6058 o_conv.inner = (void*)(o & (~1));
6059 o_conv.is_owned = (o & 1) || (o == 0);
6060 o_conv = InitFeatures_clone(&o_conv);
6061 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
6062 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
6063 return (long)ret_conv;
6066 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
6067 LDKDecodeError e_conv;
6068 e_conv.inner = (void*)(e & (~1));
6069 e_conv.is_owned = (e & 1) || (e == 0);
6070 e_conv = DecodeError_clone(&e_conv);
6071 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
6072 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
6073 return (long)ret_conv;
6076 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
6077 if ((_res & 1) != 0) return;
6078 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6080 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
6083 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
6084 LDKNodeFeatures o_conv;
6085 o_conv.inner = (void*)(o & (~1));
6086 o_conv.is_owned = (o & 1) || (o == 0);
6087 o_conv = NodeFeatures_clone(&o_conv);
6088 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
6089 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
6090 return (long)ret_conv;
6093 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
6094 LDKDecodeError e_conv;
6095 e_conv.inner = (void*)(e & (~1));
6096 e_conv.is_owned = (e & 1) || (e == 0);
6097 e_conv = DecodeError_clone(&e_conv);
6098 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
6099 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
6100 return (long)ret_conv;
6103 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
6104 if ((_res & 1) != 0) return;
6105 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6107 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
6110 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
6111 LDKChannelFeatures o_conv;
6112 o_conv.inner = (void*)(o & (~1));
6113 o_conv.is_owned = (o & 1) || (o == 0);
6114 o_conv = ChannelFeatures_clone(&o_conv);
6115 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
6116 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
6117 return (long)ret_conv;
6120 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
6121 LDKDecodeError e_conv;
6122 e_conv.inner = (void*)(e & (~1));
6123 e_conv.is_owned = (e & 1) || (e == 0);
6124 e_conv = DecodeError_clone(&e_conv);
6125 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
6126 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
6127 return (long)ret_conv;
6130 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
6131 if ((_res & 1) != 0) return;
6132 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6134 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
6137 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
6138 LDKInvoiceFeatures o_conv;
6139 o_conv.inner = (void*)(o & (~1));
6140 o_conv.is_owned = (o & 1) || (o == 0);
6141 o_conv = InvoiceFeatures_clone(&o_conv);
6142 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
6143 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
6144 return (long)ret_conv;
6147 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
6148 LDKDecodeError e_conv;
6149 e_conv.inner = (void*)(e & (~1));
6150 e_conv.is_owned = (e & 1) || (e == 0);
6151 e_conv = DecodeError_clone(&e_conv);
6152 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
6153 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
6154 return (long)ret_conv;
6157 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
6158 if ((_res & 1) != 0) return;
6159 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6161 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
6164 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
6165 LDKChannelConfig o_conv;
6166 o_conv.inner = (void*)(o & (~1));
6167 o_conv.is_owned = (o & 1) || (o == 0);
6168 o_conv = ChannelConfig_clone(&o_conv);
6169 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
6170 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
6171 return (long)ret_conv;
6174 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
6175 LDKDecodeError e_conv;
6176 e_conv.inner = (void*)(e & (~1));
6177 e_conv.is_owned = (e & 1) || (e == 0);
6178 e_conv = DecodeError_clone(&e_conv);
6179 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
6180 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
6181 return (long)ret_conv;
6184 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
6185 if ((_res & 1) != 0) return;
6186 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
6188 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
6191 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
6192 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
6193 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
6194 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
6195 return (long)ret_conv;
6198 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
6199 LDKDirectionalChannelInfo o_conv;
6200 o_conv.inner = (void*)(o & (~1));
6201 o_conv.is_owned = (o & 1) || (o == 0);
6202 o_conv = DirectionalChannelInfo_clone(&o_conv);
6203 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
6204 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
6205 return (long)ret_conv;
6208 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
6209 LDKDecodeError e_conv;
6210 e_conv.inner = (void*)(e & (~1));
6211 e_conv.is_owned = (e & 1) || (e == 0);
6212 e_conv = DecodeError_clone(&e_conv);
6213 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
6214 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
6215 return (long)ret_conv;
6218 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
6219 if ((_res & 1) != 0) return;
6220 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6222 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
6225 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
6226 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
6227 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
6228 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
6229 return (long)ret_conv;
6232 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
6233 LDKChannelInfo o_conv;
6234 o_conv.inner = (void*)(o & (~1));
6235 o_conv.is_owned = (o & 1) || (o == 0);
6236 o_conv = ChannelInfo_clone(&o_conv);
6237 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
6238 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
6239 return (long)ret_conv;
6242 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
6243 LDKDecodeError e_conv;
6244 e_conv.inner = (void*)(e & (~1));
6245 e_conv.is_owned = (e & 1) || (e == 0);
6246 e_conv = DecodeError_clone(&e_conv);
6247 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
6248 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
6249 return (long)ret_conv;
6252 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
6253 if ((_res & 1) != 0) return;
6254 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6256 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
6259 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
6260 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
6261 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
6262 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
6263 return (long)ret_conv;
6266 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
6267 LDKRoutingFees o_conv;
6268 o_conv.inner = (void*)(o & (~1));
6269 o_conv.is_owned = (o & 1) || (o == 0);
6270 o_conv = RoutingFees_clone(&o_conv);
6271 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6272 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
6273 return (long)ret_conv;
6276 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
6277 LDKDecodeError e_conv;
6278 e_conv.inner = (void*)(e & (~1));
6279 e_conv.is_owned = (e & 1) || (e == 0);
6280 e_conv = DecodeError_clone(&e_conv);
6281 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6282 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
6283 return (long)ret_conv;
6286 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
6287 if ((_res & 1) != 0) return;
6288 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6290 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
6293 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
6294 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
6295 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6296 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
6297 return (long)ret_conv;
6300 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
6301 LDKCVec_NetAddressZ _res_constr;
6302 _res_constr.datalen = *((uint32_t*)_res);
6303 if (_res_constr.datalen > 0)
6304 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
6306 _res_constr.data = NULL;
6307 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6308 for (size_t m = 0; m < _res_constr.datalen; m++) {
6309 uint32_t _res_conv_12 = _res_vals[m];
6310 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
6311 FREE((void*)_res_conv_12);
6312 _res_constr.data[m] = _res_conv_12_conv;
6314 CVec_NetAddressZ_free(_res_constr);
6317 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
6318 LDKNodeAnnouncementInfo o_conv;
6319 o_conv.inner = (void*)(o & (~1));
6320 o_conv.is_owned = (o & 1) || (o == 0);
6321 o_conv = NodeAnnouncementInfo_clone(&o_conv);
6322 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6323 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
6324 return (long)ret_conv;
6327 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
6328 LDKDecodeError e_conv;
6329 e_conv.inner = (void*)(e & (~1));
6330 e_conv.is_owned = (e & 1) || (e == 0);
6331 e_conv = DecodeError_clone(&e_conv);
6332 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6333 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
6334 return (long)ret_conv;
6337 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
6338 if ((_res & 1) != 0) return;
6339 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6341 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
6344 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
6345 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
6346 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6347 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
6348 return (long)ret_conv;
6351 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
6352 LDKCVec_u64Z _res_constr;
6353 _res_constr.datalen = *((uint32_t*)_res);
6354 if (_res_constr.datalen > 0)
6355 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
6357 _res_constr.data = NULL;
6358 int64_t* _res_vals = (int64_t*)(_res + 4);
6359 for (size_t i = 0; i < _res_constr.datalen; i++) {
6360 int64_t _res_conv_8 = _res_vals[i];
6361 _res_constr.data[i] = _res_conv_8;
6363 CVec_u64Z_free(_res_constr);
6366 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
6368 o_conv.inner = (void*)(o & (~1));
6369 o_conv.is_owned = (o & 1) || (o == 0);
6370 o_conv = NodeInfo_clone(&o_conv);
6371 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6372 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
6373 return (long)ret_conv;
6376 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
6377 LDKDecodeError e_conv;
6378 e_conv.inner = (void*)(e & (~1));
6379 e_conv.is_owned = (e & 1) || (e == 0);
6380 e_conv = DecodeError_clone(&e_conv);
6381 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6382 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
6383 return (long)ret_conv;
6386 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
6387 if ((_res & 1) != 0) return;
6388 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6390 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
6393 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
6394 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
6395 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6396 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
6397 return (long)ret_conv;
6400 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
6401 LDKNetworkGraph o_conv;
6402 o_conv.inner = (void*)(o & (~1));
6403 o_conv.is_owned = (o & 1) || (o == 0);
6404 o_conv = NetworkGraph_clone(&o_conv);
6405 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6406 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
6407 return (long)ret_conv;
6410 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
6411 LDKDecodeError e_conv;
6412 e_conv.inner = (void*)(e & (~1));
6413 e_conv.is_owned = (e & 1) || (e == 0);
6414 e_conv = DecodeError_clone(&e_conv);
6415 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6416 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
6417 return (long)ret_conv;
6420 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
6421 if ((_res & 1) != 0) return;
6422 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
6424 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
6427 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
6428 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
6429 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6430 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
6431 return (long)ret_conv;
6434 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
6435 LDKTransaction b_ref;
6436 b_ref.datalen = *((uint32_t*)b);
6437 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
6438 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6439 b_ref.data_is_owned = true;
6440 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6441 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
6442 return (long)ret_ref;
6445 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
6446 if ((_res & 1) != 0) return;
6447 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
6449 C2Tuple_usizeTransactionZ_free(_res_conv);
6452 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
6453 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
6454 _res_constr.datalen = *((uint32_t*)_res);
6455 if (_res_constr.datalen > 0)
6456 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6458 _res_constr.data = NULL;
6459 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6460 for (size_t e = 0; e < _res_constr.datalen; e++) {
6461 uint32_t _res_conv_30 = _res_vals[e];
6462 LDKC2Tuple_usizeTransactionZ _res_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_30) & ~1);
6463 FREE((void*)_res_conv_30);
6464 _res_constr.data[e] = _res_conv_30_conv;
6466 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
6469 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
6470 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6471 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
6472 return (long)ret_conv;
6475 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
6476 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
6477 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6478 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
6479 return (long)ret_conv;
6482 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
6483 if ((_res & 1) != 0) return;
6484 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
6486 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
6489 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
6490 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
6491 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6492 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
6493 return (long)ret_conv;
6496 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
6497 LDKCVec_MonitorEventZ _res_constr;
6498 _res_constr.datalen = *((uint32_t*)_res);
6499 if (_res_constr.datalen > 0)
6500 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
6502 _res_constr.data = NULL;
6503 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6504 for (size_t o = 0; o < _res_constr.datalen; o++) {
6505 uint32_t _res_conv_14 = _res_vals[o];
6506 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
6507 FREE((void*)_res_conv_14);
6508 _res_constr.data[o] = _res_conv_14_conv;
6510 CVec_MonitorEventZ_free(_res_constr);
6513 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
6514 LDKCVec_EventZ _res_constr;
6515 _res_constr.datalen = *((uint32_t*)_res);
6516 if (_res_constr.datalen > 0)
6517 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
6519 _res_constr.data = NULL;
6520 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6521 for (size_t h = 0; h < _res_constr.datalen; h++) {
6522 uint32_t _res_conv_7 = _res_vals[h];
6523 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
6524 FREE((void*)_res_conv_7);
6525 _res_constr.data[h] = _res_conv_7_conv;
6527 CVec_EventZ_free(_res_constr);
6530 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
6532 o_conv.inner = (void*)(o & (~1));
6533 o_conv.is_owned = (o & 1) || (o == 0);
6534 o_conv = OutPoint_clone(&o_conv);
6535 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
6536 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
6537 return (long)ret_conv;
6540 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
6541 LDKDecodeError e_conv;
6542 e_conv.inner = (void*)(e & (~1));
6543 e_conv.is_owned = (e & 1) || (e == 0);
6544 e_conv = DecodeError_clone(&e_conv);
6545 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
6546 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
6547 return (long)ret_conv;
6550 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
6551 if ((_res & 1) != 0) return;
6552 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
6554 CResult_OutPointDecodeErrorZ_free(_res_conv);
6557 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
6558 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
6559 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
6560 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
6561 return (long)ret_conv;
6564 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
6565 LDKChannelMonitorUpdate o_conv;
6566 o_conv.inner = (void*)(o & (~1));
6567 o_conv.is_owned = (o & 1) || (o == 0);
6568 o_conv = ChannelMonitorUpdate_clone(&o_conv);
6569 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6570 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
6571 return (long)ret_conv;
6574 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
6575 LDKDecodeError e_conv;
6576 e_conv.inner = (void*)(e & (~1));
6577 e_conv.is_owned = (e & 1) || (e == 0);
6578 e_conv = DecodeError_clone(&e_conv);
6579 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6580 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
6581 return (long)ret_conv;
6584 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
6585 if ((_res & 1) != 0) return;
6586 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
6588 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
6591 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
6592 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
6593 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6594 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
6595 return (long)ret_conv;
6598 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
6599 LDKHTLCUpdate o_conv;
6600 o_conv.inner = (void*)(o & (~1));
6601 o_conv.is_owned = (o & 1) || (o == 0);
6602 o_conv = HTLCUpdate_clone(&o_conv);
6603 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6604 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
6605 return (long)ret_conv;
6608 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
6609 LDKDecodeError e_conv;
6610 e_conv.inner = (void*)(e & (~1));
6611 e_conv.is_owned = (e & 1) || (e == 0);
6612 e_conv = DecodeError_clone(&e_conv);
6613 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6614 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
6615 return (long)ret_conv;
6618 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
6619 if ((_res & 1) != 0) return;
6620 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
6622 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
6625 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
6626 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
6627 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6628 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
6629 return (long)ret_conv;
6632 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
6633 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6634 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
6635 return (long)ret_conv;
6638 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
6639 LDKMonitorUpdateError e_conv;
6640 e_conv.inner = (void*)(e & (~1));
6641 e_conv.is_owned = (e & 1) || (e == 0);
6642 e_conv = MonitorUpdateError_clone(&e_conv);
6643 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6644 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
6645 return (long)ret_conv;
6648 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
6649 if ((_res & 1) != 0) return;
6650 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
6652 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
6655 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
6656 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
6657 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6658 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
6659 return (long)ret_conv;
6662 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
6663 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
6664 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6665 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
6666 return (long)ret_ref;
6669 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
6671 a_conv.inner = (void*)(a & (~1));
6672 a_conv.is_owned = (a & 1) || (a == 0);
6673 a_conv = OutPoint_clone(&a_conv);
6675 b_ref.datalen = *((uint32_t*)b);
6676 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
6677 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6678 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6679 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
6680 return (long)ret_ref;
6683 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
6684 if ((_res & 1) != 0) return;
6685 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
6687 C2Tuple_OutPointScriptZ_free(_res_conv);
6690 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
6691 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
6692 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6693 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
6694 return (long)ret_ref;
6697 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
6699 b_ref.datalen = *((uint32_t*)b);
6700 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
6701 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6702 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6703 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
6704 return (long)ret_ref;
6707 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
6708 if ((_res & 1) != 0) return;
6709 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
6711 C2Tuple_u32ScriptZ_free(_res_conv);
6714 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
6715 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
6716 _res_constr.datalen = *((uint32_t*)_res);
6717 if (_res_constr.datalen > 0)
6718 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
6720 _res_constr.data = NULL;
6721 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6722 for (size_t e = 0; e < _res_constr.datalen; e++) {
6723 uint32_t _res_conv_30 = _res_vals[e];
6724 LDKC2Tuple_u32ScriptZ _res_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_30) & ~1);
6725 FREE((void*)_res_conv_30);
6726 _res_constr.data[e] = _res_conv_30_conv;
6728 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
6731 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
6732 LDKThirtyTwoBytes a_ref;
6733 CHECK(*((uint32_t*)a) == 32);
6734 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6735 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
6736 b_constr.datalen = *((uint32_t*)b);
6737 if (b_constr.datalen > 0)
6738 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
6740 b_constr.data = NULL;
6741 uint32_t* b_vals = (uint32_t*)(b + 4);
6742 for (size_t e = 0; e < b_constr.datalen; e++) {
6743 uint32_t b_conv_30 = b_vals[e];
6744 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
6745 FREE((void*)b_conv_30);
6746 b_constr.data[e] = b_conv_30_conv;
6748 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
6749 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
6750 return (long)ret_ref;
6753 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
6754 if ((_res & 1) != 0) return;
6755 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
6757 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
6760 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
6761 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
6762 _res_constr.datalen = *((uint32_t*)_res);
6763 if (_res_constr.datalen > 0)
6764 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
6766 _res_constr.data = NULL;
6767 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6768 for (size_t c = 0; c < _res_constr.datalen; c++) {
6769 uint32_t _res_conv_54 = _res_vals[c];
6770 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_54_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_54) & ~1);
6771 FREE((void*)_res_conv_54);
6772 _res_constr.data[c] = _res_conv_54_conv;
6774 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
6777 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
6778 LDKCVec_TransactionZ _res_constr;
6779 _res_constr.datalen = *((uint32_t*)_res);
6780 if (_res_constr.datalen > 0)
6781 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
6783 _res_constr.data = NULL;
6784 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
6785 for (size_t m = 0; m < _res_constr.datalen; m++) {
6786 int8_tArray _res_conv_12 = _res_vals[m];
6787 LDKTransaction _res_conv_12_ref;
6788 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
6789 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
6790 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
6791 _res_conv_12_ref.data_is_owned = true;
6792 _res_constr.data[m] = _res_conv_12_ref;
6794 CVec_TransactionZ_free(_res_constr);
6797 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
6798 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
6799 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6800 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
6801 return (long)ret_ref;
6804 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
6805 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
6807 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6808 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
6809 return (long)ret_ref;
6812 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
6813 if ((_res & 1) != 0) return;
6814 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
6816 C2Tuple_u32TxOutZ_free(_res_conv);
6819 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
6820 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
6821 _res_constr.datalen = *((uint32_t*)_res);
6822 if (_res_constr.datalen > 0)
6823 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
6825 _res_constr.data = NULL;
6826 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6827 for (size_t z = 0; z < _res_constr.datalen; z++) {
6828 uint32_t _res_conv_25 = _res_vals[z];
6829 LDKC2Tuple_u32TxOutZ _res_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_25) & ~1);
6830 FREE((void*)_res_conv_25);
6831 _res_constr.data[z] = _res_conv_25_conv;
6833 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
6836 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
6837 LDKThirtyTwoBytes a_ref;
6838 CHECK(*((uint32_t*)a) == 32);
6839 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6840 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
6841 b_constr.datalen = *((uint32_t*)b);
6842 if (b_constr.datalen > 0)
6843 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
6845 b_constr.data = NULL;
6846 uint32_t* b_vals = (uint32_t*)(b + 4);
6847 for (size_t z = 0; z < b_constr.datalen; z++) {
6848 uint32_t b_conv_25 = b_vals[z];
6849 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
6850 FREE((void*)b_conv_25);
6851 b_constr.data[z] = b_conv_25_conv;
6853 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
6854 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
6855 return (long)ret_ref;
6858 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
6859 if ((_res & 1) != 0) return;
6860 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
6862 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
6865 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
6866 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
6867 _res_constr.datalen = *((uint32_t*)_res);
6868 if (_res_constr.datalen > 0)
6869 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
6871 _res_constr.data = NULL;
6872 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6873 for (size_t x = 0; x < _res_constr.datalen; x++) {
6874 uint32_t _res_conv_49 = _res_vals[x];
6875 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_49) & ~1);
6876 FREE((void*)_res_conv_49);
6877 _res_constr.data[x] = _res_conv_49_conv;
6879 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
6882 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
6883 LDKThirtyTwoBytes a_ref;
6884 CHECK(*((uint32_t*)a) == 32);
6885 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6886 LDKChannelMonitor b_conv;
6887 b_conv.inner = (void*)(b & (~1));
6888 b_conv.is_owned = (b & 1) || (b == 0);
6889 b_conv = ChannelMonitor_clone(&b_conv);
6890 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6891 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
6892 return (long)ret_ref;
6895 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
6896 if ((_res & 1) != 0) return;
6897 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
6899 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
6902 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
6903 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
6905 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
6906 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
6907 return (long)ret_conv;
6910 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
6911 LDKDecodeError e_conv;
6912 e_conv.inner = (void*)(e & (~1));
6913 e_conv.is_owned = (e & 1) || (e == 0);
6914 e_conv = DecodeError_clone(&e_conv);
6915 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
6916 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
6917 return (long)ret_conv;
6920 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
6921 if ((_res & 1) != 0) return;
6922 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
6924 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
6927 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
6928 LDKCVec_SpendableOutputDescriptorZ _res_constr;
6929 _res_constr.datalen = *((uint32_t*)_res);
6930 if (_res_constr.datalen > 0)
6931 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
6933 _res_constr.data = NULL;
6934 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6935 for (size_t b = 0; b < _res_constr.datalen; b++) {
6936 uint32_t _res_conv_27 = _res_vals[b];
6937 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
6938 FREE((void*)_res_conv_27);
6939 _res_constr.data[b] = _res_conv_27_conv;
6941 CVec_SpendableOutputDescriptorZ_free(_res_constr);
6944 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
6945 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
6947 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6948 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
6949 return (long)ret_conv;
6952 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
6953 LDKAccessError e_conv = LDKAccessError_from_js(e);
6954 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6955 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
6956 return (long)ret_conv;
6959 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
6960 if ((_res & 1) != 0) return;
6961 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
6963 CResult_TxOutAccessErrorZ_free(_res_conv);
6966 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
6967 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
6968 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6969 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
6970 return (long)ret_conv;
6973 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
6974 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6975 *ret_conv = CResult_NoneAPIErrorZ_ok();
6976 return (long)ret_conv;
6979 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
6980 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
6982 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6983 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
6984 return (long)ret_conv;
6987 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
6988 if ((_res & 1) != 0) return;
6989 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
6991 CResult_NoneAPIErrorZ_free(_res_conv);
6994 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
6995 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
6996 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6997 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
6998 return (long)ret_conv;
7001 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
7002 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
7003 _res_constr.datalen = *((uint32_t*)_res);
7004 if (_res_constr.datalen > 0)
7005 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
7007 _res_constr.data = NULL;
7008 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7009 for (size_t w = 0; w < _res_constr.datalen; w++) {
7010 uint32_t _res_conv_22 = _res_vals[w];
7011 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
7012 FREE((void*)_res_conv_22);
7013 _res_constr.data[w] = _res_conv_22_conv;
7015 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
7018 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
7019 LDKCVec_APIErrorZ _res_constr;
7020 _res_constr.datalen = *((uint32_t*)_res);
7021 if (_res_constr.datalen > 0)
7022 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
7024 _res_constr.data = NULL;
7025 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7026 for (size_t k = 0; k < _res_constr.datalen; k++) {
7027 uint32_t _res_conv_10 = _res_vals[k];
7028 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
7029 FREE((void*)_res_conv_10);
7030 _res_constr.data[k] = _res_conv_10_conv;
7032 CVec_APIErrorZ_free(_res_constr);
7035 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
7036 LDKCVec_ChannelDetailsZ _res_constr;
7037 _res_constr.datalen = *((uint32_t*)_res);
7038 if (_res_constr.datalen > 0)
7039 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7041 _res_constr.data = NULL;
7042 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7043 for (size_t q = 0; q < _res_constr.datalen; q++) {
7044 uint32_t _res_conv_16 = _res_vals[q];
7045 LDKChannelDetails _res_conv_16_conv;
7046 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7047 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7048 _res_constr.data[q] = _res_conv_16_conv;
7050 CVec_ChannelDetailsZ_free(_res_constr);
7053 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
7054 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7055 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
7056 return (long)ret_conv;
7059 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
7060 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
7062 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7063 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
7064 return (long)ret_conv;
7067 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
7068 if ((_res & 1) != 0) return;
7069 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
7071 CResult_NonePaymentSendFailureZ_free(_res_conv);
7074 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
7075 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
7076 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7077 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
7078 return (long)ret_conv;
7081 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
7082 LDKCVec_ChannelMonitorZ _res_constr;
7083 _res_constr.datalen = *((uint32_t*)_res);
7084 if (_res_constr.datalen > 0)
7085 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7087 _res_constr.data = NULL;
7088 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7089 for (size_t q = 0; q < _res_constr.datalen; q++) {
7090 uint32_t _res_conv_16 = _res_vals[q];
7091 LDKChannelMonitor _res_conv_16_conv;
7092 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7093 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7094 _res_constr.data[q] = _res_conv_16_conv;
7096 CVec_ChannelMonitorZ_free(_res_constr);
7099 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
7100 LDKThirtyTwoBytes a_ref;
7101 CHECK(*((uint32_t*)a) == 32);
7102 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
7103 LDKChannelManager b_conv;
7104 b_conv.inner = (void*)(b & (~1));
7105 b_conv.is_owned = (b & 1) || (b == 0);
7106 // Warning: we need a move here but no clone is available for LDKChannelManager
7107 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
7108 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
7109 return (long)ret_ref;
7112 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
7113 if ((_res & 1) != 0) return;
7114 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
7116 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
7119 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
7120 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
7122 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
7123 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
7124 return (long)ret_conv;
7127 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
7128 LDKDecodeError e_conv;
7129 e_conv.inner = (void*)(e & (~1));
7130 e_conv.is_owned = (e & 1) || (e == 0);
7131 e_conv = DecodeError_clone(&e_conv);
7132 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
7133 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
7134 return (long)ret_conv;
7137 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
7138 if ((_res & 1) != 0) return;
7139 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
7141 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
7144 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
7145 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
7147 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7148 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
7149 return (long)ret_conv;
7152 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
7153 LDKDecodeError e_conv;
7154 e_conv.inner = (void*)(e & (~1));
7155 e_conv.is_owned = (e & 1) || (e == 0);
7156 e_conv = DecodeError_clone(&e_conv);
7157 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7158 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
7159 return (long)ret_conv;
7162 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
7163 if ((_res & 1) != 0) return;
7164 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
7166 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
7169 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
7170 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
7171 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7172 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
7173 return (long)ret_conv;
7176 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
7177 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
7178 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
7179 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
7180 return (long)ret_ref;
7183 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
7185 CHECK(*((uint32_t*)a) == 64);
7186 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
7187 LDKCVec_SignatureZ b_constr;
7188 b_constr.datalen = *((uint32_t*)b);
7189 if (b_constr.datalen > 0)
7190 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7192 b_constr.data = NULL;
7193 int8_tArray* b_vals = (int8_tArray*)(b + 4);
7194 for (size_t m = 0; m < b_constr.datalen; m++) {
7195 int8_tArray b_conv_12 = b_vals[m];
7196 LDKSignature b_conv_12_ref;
7197 CHECK(*((uint32_t*)b_conv_12) == 64);
7198 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
7199 b_constr.data[m] = b_conv_12_ref;
7201 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
7202 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
7203 return (long)ret_ref;
7206 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
7207 if ((_res & 1) != 0) return;
7208 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
7210 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
7213 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
7214 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
7216 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7217 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
7218 return (long)ret_conv;
7221 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
7222 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7223 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
7224 return (long)ret_conv;
7227 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
7228 if ((_res & 1) != 0) return;
7229 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
7231 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
7234 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
7235 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
7236 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7237 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
7238 return (long)ret_conv;
7241 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
7243 CHECK(*((uint32_t*)o) == 64);
7244 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
7245 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7246 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
7247 return (long)ret_conv;
7250 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
7251 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7252 *ret_conv = CResult_SignatureNoneZ_err();
7253 return (long)ret_conv;
7256 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
7257 if ((_res & 1) != 0) return;
7258 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
7260 CResult_SignatureNoneZ_free(_res_conv);
7263 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
7264 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
7265 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7266 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
7267 return (long)ret_conv;
7270 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
7271 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
7272 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7273 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
7274 return (long)ret_conv;
7277 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
7278 LDKDecodeError e_conv;
7279 e_conv.inner = (void*)(e & (~1));
7280 e_conv.is_owned = (e & 1) || (e == 0);
7281 e_conv = DecodeError_clone(&e_conv);
7282 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7283 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
7284 return (long)ret_conv;
7287 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
7288 if ((_res & 1) != 0) return;
7289 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
7291 CResult_SignDecodeErrorZ_free(_res_conv);
7294 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
7295 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
7296 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7297 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
7298 return (long)ret_conv;
7301 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
7302 LDKCVec_CVec_u8ZZ _res_constr;
7303 _res_constr.datalen = *((uint32_t*)_res);
7304 if (_res_constr.datalen > 0)
7305 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
7307 _res_constr.data = NULL;
7308 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7309 for (size_t m = 0; m < _res_constr.datalen; m++) {
7310 int8_tArray _res_conv_12 = _res_vals[m];
7311 LDKCVec_u8Z _res_conv_12_ref;
7312 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
7313 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
7314 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
7315 _res_constr.data[m] = _res_conv_12_ref;
7317 CVec_CVec_u8ZZ_free(_res_constr);
7320 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
7321 LDKCVec_CVec_u8ZZ o_constr;
7322 o_constr.datalen = *((uint32_t*)o);
7323 if (o_constr.datalen > 0)
7324 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
7326 o_constr.data = NULL;
7327 int8_tArray* o_vals = (int8_tArray*)(o + 4);
7328 for (size_t m = 0; m < o_constr.datalen; m++) {
7329 int8_tArray o_conv_12 = o_vals[m];
7330 LDKCVec_u8Z o_conv_12_ref;
7331 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
7332 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
7333 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
7334 o_constr.data[m] = o_conv_12_ref;
7336 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7337 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
7338 return (long)ret_conv;
7341 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
7342 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7343 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
7344 return (long)ret_conv;
7347 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
7348 if ((_res & 1) != 0) return;
7349 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
7351 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
7354 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
7355 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
7356 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7357 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
7358 return (long)ret_conv;
7361 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
7362 LDKInMemorySigner o_conv;
7363 o_conv.inner = (void*)(o & (~1));
7364 o_conv.is_owned = (o & 1) || (o == 0);
7365 o_conv = InMemorySigner_clone(&o_conv);
7366 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7367 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
7368 return (long)ret_conv;
7371 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
7372 LDKDecodeError e_conv;
7373 e_conv.inner = (void*)(e & (~1));
7374 e_conv.is_owned = (e & 1) || (e == 0);
7375 e_conv = DecodeError_clone(&e_conv);
7376 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7377 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
7378 return (long)ret_conv;
7381 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
7382 if ((_res & 1) != 0) return;
7383 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
7385 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
7388 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
7389 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
7390 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7391 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
7392 return (long)ret_conv;
7395 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
7396 LDKCVec_TxOutZ _res_constr;
7397 _res_constr.datalen = *((uint32_t*)_res);
7398 if (_res_constr.datalen > 0)
7399 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
7401 _res_constr.data = NULL;
7402 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7403 for (size_t h = 0; h < _res_constr.datalen; h++) {
7404 uint32_t _res_conv_7 = _res_vals[h];
7405 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
7406 FREE((void*)_res_conv_7);
7407 _res_constr.data[h] = _res_conv_7_conv;
7409 CVec_TxOutZ_free(_res_constr);
7412 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
7413 LDKTransaction o_ref;
7414 o_ref.datalen = *((uint32_t*)o);
7415 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
7416 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
7417 o_ref.data_is_owned = true;
7418 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
7419 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
7420 return (long)ret_conv;
7423 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
7424 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
7425 *ret_conv = CResult_TransactionNoneZ_err();
7426 return (long)ret_conv;
7429 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
7430 if ((_res & 1) != 0) return;
7431 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
7433 CResult_TransactionNoneZ_free(_res_conv);
7436 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
7437 LDKCVec_RouteHopZ _res_constr;
7438 _res_constr.datalen = *((uint32_t*)_res);
7439 if (_res_constr.datalen > 0)
7440 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7442 _res_constr.data = NULL;
7443 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7444 for (size_t k = 0; k < _res_constr.datalen; k++) {
7445 uint32_t _res_conv_10 = _res_vals[k];
7446 LDKRouteHop _res_conv_10_conv;
7447 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
7448 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
7449 _res_constr.data[k] = _res_conv_10_conv;
7451 CVec_RouteHopZ_free(_res_constr);
7454 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
7455 LDKCVec_CVec_RouteHopZZ _res_constr;
7456 _res_constr.datalen = *((uint32_t*)_res);
7457 if (_res_constr.datalen > 0)
7458 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
7460 _res_constr.data = NULL;
7461 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
7462 for (size_t m = 0; m < _res_constr.datalen; m++) {
7463 uint32_tArray _res_conv_12 = _res_vals[m];
7464 LDKCVec_RouteHopZ _res_conv_12_constr;
7465 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
7466 if (_res_conv_12_constr.datalen > 0)
7467 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7469 _res_conv_12_constr.data = NULL;
7470 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
7471 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
7472 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
7473 LDKRouteHop _res_conv_12_conv_10_conv;
7474 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
7475 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
7476 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
7478 _res_constr.data[m] = _res_conv_12_constr;
7480 CVec_CVec_RouteHopZZ_free(_res_constr);
7483 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
7485 o_conv.inner = (void*)(o & (~1));
7486 o_conv.is_owned = (o & 1) || (o == 0);
7487 o_conv = Route_clone(&o_conv);
7488 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7489 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
7490 return (long)ret_conv;
7493 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
7494 LDKDecodeError e_conv;
7495 e_conv.inner = (void*)(e & (~1));
7496 e_conv.is_owned = (e & 1) || (e == 0);
7497 e_conv = DecodeError_clone(&e_conv);
7498 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7499 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
7500 return (long)ret_conv;
7503 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
7504 if ((_res & 1) != 0) return;
7505 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
7507 CResult_RouteDecodeErrorZ_free(_res_conv);
7510 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
7511 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
7512 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7513 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
7514 return (long)ret_conv;
7517 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
7518 LDKCVec_RouteHintZ _res_constr;
7519 _res_constr.datalen = *((uint32_t*)_res);
7520 if (_res_constr.datalen > 0)
7521 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
7523 _res_constr.data = NULL;
7524 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7525 for (size_t l = 0; l < _res_constr.datalen; l++) {
7526 uint32_t _res_conv_11 = _res_vals[l];
7527 LDKRouteHint _res_conv_11_conv;
7528 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
7529 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
7530 _res_constr.data[l] = _res_conv_11_conv;
7532 CVec_RouteHintZ_free(_res_constr);
7535 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
7537 o_conv.inner = (void*)(o & (~1));
7538 o_conv.is_owned = (o & 1) || (o == 0);
7539 o_conv = Route_clone(&o_conv);
7540 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7541 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
7542 return (long)ret_conv;
7545 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
7546 LDKLightningError e_conv;
7547 e_conv.inner = (void*)(e & (~1));
7548 e_conv.is_owned = (e & 1) || (e == 0);
7549 e_conv = LightningError_clone(&e_conv);
7550 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7551 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
7552 return (long)ret_conv;
7555 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
7556 if ((_res & 1) != 0) return;
7557 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
7559 CResult_RouteLightningErrorZ_free(_res_conv);
7562 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
7563 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
7564 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7565 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
7566 return (long)ret_conv;
7569 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
7570 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
7572 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7573 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
7574 return (long)ret_conv;
7577 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_err(int8_t e) {
7578 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7579 *ret_conv = CResult_NetAddressu8Z_err(e);
7580 return (long)ret_conv;
7583 void __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_free(uint32_t _res) {
7584 if ((_res & 1) != 0) return;
7585 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
7587 CResult_NetAddressu8Z_free(_res_conv);
7590 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_clone(uint32_t orig) {
7591 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
7592 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7593 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
7594 return (long)ret_conv;
7597 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
7598 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
7600 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7601 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
7602 return (long)ret_conv;
7605 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_err(uint32_t e) {
7606 LDKDecodeError e_conv;
7607 e_conv.inner = (void*)(e & (~1));
7608 e_conv.is_owned = (e & 1) || (e == 0);
7609 e_conv = DecodeError_clone(&e_conv);
7610 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7611 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
7612 return (long)ret_conv;
7615 void __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_free(uint32_t _res) {
7616 if ((_res & 1) != 0) return;
7617 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
7619 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
7622 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(uint32_t orig) {
7623 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
7624 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7625 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
7626 return (long)ret_conv;
7629 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
7630 LDKCVec_UpdateAddHTLCZ _res_constr;
7631 _res_constr.datalen = *((uint32_t*)_res);
7632 if (_res_constr.datalen > 0)
7633 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
7635 _res_constr.data = NULL;
7636 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7637 for (size_t p = 0; p < _res_constr.datalen; p++) {
7638 uint32_t _res_conv_15 = _res_vals[p];
7639 LDKUpdateAddHTLC _res_conv_15_conv;
7640 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
7641 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
7642 _res_constr.data[p] = _res_conv_15_conv;
7644 CVec_UpdateAddHTLCZ_free(_res_constr);
7647 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
7648 LDKCVec_UpdateFulfillHTLCZ _res_constr;
7649 _res_constr.datalen = *((uint32_t*)_res);
7650 if (_res_constr.datalen > 0)
7651 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
7653 _res_constr.data = NULL;
7654 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7655 for (size_t t = 0; t < _res_constr.datalen; t++) {
7656 uint32_t _res_conv_19 = _res_vals[t];
7657 LDKUpdateFulfillHTLC _res_conv_19_conv;
7658 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
7659 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
7660 _res_constr.data[t] = _res_conv_19_conv;
7662 CVec_UpdateFulfillHTLCZ_free(_res_constr);
7665 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
7666 LDKCVec_UpdateFailHTLCZ _res_constr;
7667 _res_constr.datalen = *((uint32_t*)_res);
7668 if (_res_constr.datalen > 0)
7669 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
7671 _res_constr.data = NULL;
7672 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7673 for (size_t q = 0; q < _res_constr.datalen; q++) {
7674 uint32_t _res_conv_16 = _res_vals[q];
7675 LDKUpdateFailHTLC _res_conv_16_conv;
7676 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7677 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7678 _res_constr.data[q] = _res_conv_16_conv;
7680 CVec_UpdateFailHTLCZ_free(_res_constr);
7683 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
7684 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
7685 _res_constr.datalen = *((uint32_t*)_res);
7686 if (_res_constr.datalen > 0)
7687 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
7689 _res_constr.data = NULL;
7690 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7691 for (size_t z = 0; z < _res_constr.datalen; z++) {
7692 uint32_t _res_conv_25 = _res_vals[z];
7693 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
7694 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
7695 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
7696 _res_constr.data[z] = _res_conv_25_conv;
7698 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
7701 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
7702 LDKAcceptChannel o_conv;
7703 o_conv.inner = (void*)(o & (~1));
7704 o_conv.is_owned = (o & 1) || (o == 0);
7705 o_conv = AcceptChannel_clone(&o_conv);
7706 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7707 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
7708 return (long)ret_conv;
7711 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
7712 LDKDecodeError e_conv;
7713 e_conv.inner = (void*)(e & (~1));
7714 e_conv.is_owned = (e & 1) || (e == 0);
7715 e_conv = DecodeError_clone(&e_conv);
7716 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7717 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
7718 return (long)ret_conv;
7721 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
7722 if ((_res & 1) != 0) return;
7723 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
7725 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
7728 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
7729 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
7730 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7731 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
7732 return (long)ret_conv;
7735 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
7736 LDKAnnouncementSignatures o_conv;
7737 o_conv.inner = (void*)(o & (~1));
7738 o_conv.is_owned = (o & 1) || (o == 0);
7739 o_conv = AnnouncementSignatures_clone(&o_conv);
7740 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7741 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
7742 return (long)ret_conv;
7745 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
7746 LDKDecodeError e_conv;
7747 e_conv.inner = (void*)(e & (~1));
7748 e_conv.is_owned = (e & 1) || (e == 0);
7749 e_conv = DecodeError_clone(&e_conv);
7750 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7751 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
7752 return (long)ret_conv;
7755 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
7756 if ((_res & 1) != 0) return;
7757 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7759 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
7762 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
7763 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
7764 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7765 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
7766 return (long)ret_conv;
7769 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
7770 LDKChannelReestablish o_conv;
7771 o_conv.inner = (void*)(o & (~1));
7772 o_conv.is_owned = (o & 1) || (o == 0);
7773 o_conv = ChannelReestablish_clone(&o_conv);
7774 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7775 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
7776 return (long)ret_conv;
7779 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
7780 LDKDecodeError e_conv;
7781 e_conv.inner = (void*)(e & (~1));
7782 e_conv.is_owned = (e & 1) || (e == 0);
7783 e_conv = DecodeError_clone(&e_conv);
7784 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7785 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
7786 return (long)ret_conv;
7789 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
7790 if ((_res & 1) != 0) return;
7791 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
7793 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
7796 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
7797 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
7798 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7799 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
7800 return (long)ret_conv;
7803 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
7804 LDKClosingSigned o_conv;
7805 o_conv.inner = (void*)(o & (~1));
7806 o_conv.is_owned = (o & 1) || (o == 0);
7807 o_conv = ClosingSigned_clone(&o_conv);
7808 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7809 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
7810 return (long)ret_conv;
7813 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
7814 LDKDecodeError e_conv;
7815 e_conv.inner = (void*)(e & (~1));
7816 e_conv.is_owned = (e & 1) || (e == 0);
7817 e_conv = DecodeError_clone(&e_conv);
7818 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7819 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
7820 return (long)ret_conv;
7823 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
7824 if ((_res & 1) != 0) return;
7825 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7827 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
7830 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
7831 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
7832 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7833 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
7834 return (long)ret_conv;
7837 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
7838 LDKCommitmentSigned o_conv;
7839 o_conv.inner = (void*)(o & (~1));
7840 o_conv.is_owned = (o & 1) || (o == 0);
7841 o_conv = CommitmentSigned_clone(&o_conv);
7842 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7843 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
7844 return (long)ret_conv;
7847 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
7848 LDKDecodeError e_conv;
7849 e_conv.inner = (void*)(e & (~1));
7850 e_conv.is_owned = (e & 1) || (e == 0);
7851 e_conv = DecodeError_clone(&e_conv);
7852 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7853 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
7854 return (long)ret_conv;
7857 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
7858 if ((_res & 1) != 0) return;
7859 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7861 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
7864 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
7865 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
7866 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7867 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
7868 return (long)ret_conv;
7871 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
7872 LDKFundingCreated o_conv;
7873 o_conv.inner = (void*)(o & (~1));
7874 o_conv.is_owned = (o & 1) || (o == 0);
7875 o_conv = FundingCreated_clone(&o_conv);
7876 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7877 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
7878 return (long)ret_conv;
7881 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
7882 LDKDecodeError e_conv;
7883 e_conv.inner = (void*)(e & (~1));
7884 e_conv.is_owned = (e & 1) || (e == 0);
7885 e_conv = DecodeError_clone(&e_conv);
7886 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7887 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
7888 return (long)ret_conv;
7891 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
7892 if ((_res & 1) != 0) return;
7893 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7895 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
7898 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
7899 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
7900 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7901 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
7902 return (long)ret_conv;
7905 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
7906 LDKFundingSigned o_conv;
7907 o_conv.inner = (void*)(o & (~1));
7908 o_conv.is_owned = (o & 1) || (o == 0);
7909 o_conv = FundingSigned_clone(&o_conv);
7910 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7911 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
7912 return (long)ret_conv;
7915 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
7916 LDKDecodeError e_conv;
7917 e_conv.inner = (void*)(e & (~1));
7918 e_conv.is_owned = (e & 1) || (e == 0);
7919 e_conv = DecodeError_clone(&e_conv);
7920 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7921 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
7922 return (long)ret_conv;
7925 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
7926 if ((_res & 1) != 0) return;
7927 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7929 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
7932 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
7933 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
7934 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7935 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
7936 return (long)ret_conv;
7939 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
7940 LDKFundingLocked o_conv;
7941 o_conv.inner = (void*)(o & (~1));
7942 o_conv.is_owned = (o & 1) || (o == 0);
7943 o_conv = FundingLocked_clone(&o_conv);
7944 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7945 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
7946 return (long)ret_conv;
7949 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
7950 LDKDecodeError e_conv;
7951 e_conv.inner = (void*)(e & (~1));
7952 e_conv.is_owned = (e & 1) || (e == 0);
7953 e_conv = DecodeError_clone(&e_conv);
7954 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7955 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
7956 return (long)ret_conv;
7959 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
7960 if ((_res & 1) != 0) return;
7961 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7963 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
7966 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
7967 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
7968 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7969 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
7970 return (long)ret_conv;
7973 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
7975 o_conv.inner = (void*)(o & (~1));
7976 o_conv.is_owned = (o & 1) || (o == 0);
7977 o_conv = Init_clone(&o_conv);
7978 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7979 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
7980 return (long)ret_conv;
7983 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
7984 LDKDecodeError e_conv;
7985 e_conv.inner = (void*)(e & (~1));
7986 e_conv.is_owned = (e & 1) || (e == 0);
7987 e_conv = DecodeError_clone(&e_conv);
7988 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7989 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
7990 return (long)ret_conv;
7993 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
7994 if ((_res & 1) != 0) return;
7995 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
7997 CResult_InitDecodeErrorZ_free(_res_conv);
8000 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
8001 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
8002 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
8003 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
8004 return (long)ret_conv;
8007 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
8008 LDKOpenChannel o_conv;
8009 o_conv.inner = (void*)(o & (~1));
8010 o_conv.is_owned = (o & 1) || (o == 0);
8011 o_conv = OpenChannel_clone(&o_conv);
8012 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
8013 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
8014 return (long)ret_conv;
8017 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
8018 LDKDecodeError e_conv;
8019 e_conv.inner = (void*)(e & (~1));
8020 e_conv.is_owned = (e & 1) || (e == 0);
8021 e_conv = DecodeError_clone(&e_conv);
8022 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
8023 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
8024 return (long)ret_conv;
8027 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
8028 if ((_res & 1) != 0) return;
8029 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
8031 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
8034 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
8035 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
8036 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
8037 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
8038 return (long)ret_conv;
8041 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
8042 LDKRevokeAndACK o_conv;
8043 o_conv.inner = (void*)(o & (~1));
8044 o_conv.is_owned = (o & 1) || (o == 0);
8045 o_conv = RevokeAndACK_clone(&o_conv);
8046 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
8047 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
8048 return (long)ret_conv;
8051 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
8052 LDKDecodeError e_conv;
8053 e_conv.inner = (void*)(e & (~1));
8054 e_conv.is_owned = (e & 1) || (e == 0);
8055 e_conv = DecodeError_clone(&e_conv);
8056 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
8057 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
8058 return (long)ret_conv;
8061 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
8062 if ((_res & 1) != 0) return;
8063 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
8065 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
8068 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
8069 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
8070 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
8071 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
8072 return (long)ret_conv;
8075 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
8077 o_conv.inner = (void*)(o & (~1));
8078 o_conv.is_owned = (o & 1) || (o == 0);
8079 o_conv = Shutdown_clone(&o_conv);
8080 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
8081 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
8082 return (long)ret_conv;
8085 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
8086 LDKDecodeError e_conv;
8087 e_conv.inner = (void*)(e & (~1));
8088 e_conv.is_owned = (e & 1) || (e == 0);
8089 e_conv = DecodeError_clone(&e_conv);
8090 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
8091 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
8092 return (long)ret_conv;
8095 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
8096 if ((_res & 1) != 0) return;
8097 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
8099 CResult_ShutdownDecodeErrorZ_free(_res_conv);
8102 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
8103 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
8104 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
8105 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
8106 return (long)ret_conv;
8109 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
8110 LDKUpdateFailHTLC o_conv;
8111 o_conv.inner = (void*)(o & (~1));
8112 o_conv.is_owned = (o & 1) || (o == 0);
8113 o_conv = UpdateFailHTLC_clone(&o_conv);
8114 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
8115 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
8116 return (long)ret_conv;
8119 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
8120 LDKDecodeError e_conv;
8121 e_conv.inner = (void*)(e & (~1));
8122 e_conv.is_owned = (e & 1) || (e == 0);
8123 e_conv = DecodeError_clone(&e_conv);
8124 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
8125 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
8126 return (long)ret_conv;
8129 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
8130 if ((_res & 1) != 0) return;
8131 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8133 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
8136 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
8137 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
8138 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
8139 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
8140 return (long)ret_conv;
8143 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
8144 LDKUpdateFailMalformedHTLC o_conv;
8145 o_conv.inner = (void*)(o & (~1));
8146 o_conv.is_owned = (o & 1) || (o == 0);
8147 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
8148 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8149 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
8150 return (long)ret_conv;
8153 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
8154 LDKDecodeError e_conv;
8155 e_conv.inner = (void*)(e & (~1));
8156 e_conv.is_owned = (e & 1) || (e == 0);
8157 e_conv = DecodeError_clone(&e_conv);
8158 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8159 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
8160 return (long)ret_conv;
8163 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
8164 if ((_res & 1) != 0) return;
8165 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8167 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
8170 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
8171 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
8172 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8173 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
8174 return (long)ret_conv;
8177 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
8178 LDKUpdateFee o_conv;
8179 o_conv.inner = (void*)(o & (~1));
8180 o_conv.is_owned = (o & 1) || (o == 0);
8181 o_conv = UpdateFee_clone(&o_conv);
8182 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8183 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
8184 return (long)ret_conv;
8187 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
8188 LDKDecodeError e_conv;
8189 e_conv.inner = (void*)(e & (~1));
8190 e_conv.is_owned = (e & 1) || (e == 0);
8191 e_conv = DecodeError_clone(&e_conv);
8192 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8193 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
8194 return (long)ret_conv;
8197 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
8198 if ((_res & 1) != 0) return;
8199 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8201 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
8204 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
8205 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
8206 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8207 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
8208 return (long)ret_conv;
8211 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
8212 LDKUpdateFulfillHTLC o_conv;
8213 o_conv.inner = (void*)(o & (~1));
8214 o_conv.is_owned = (o & 1) || (o == 0);
8215 o_conv = UpdateFulfillHTLC_clone(&o_conv);
8216 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8217 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
8218 return (long)ret_conv;
8221 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
8222 LDKDecodeError e_conv;
8223 e_conv.inner = (void*)(e & (~1));
8224 e_conv.is_owned = (e & 1) || (e == 0);
8225 e_conv = DecodeError_clone(&e_conv);
8226 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8227 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
8228 return (long)ret_conv;
8231 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
8232 if ((_res & 1) != 0) return;
8233 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8235 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
8238 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
8239 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
8240 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8241 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
8242 return (long)ret_conv;
8245 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
8246 LDKUpdateAddHTLC o_conv;
8247 o_conv.inner = (void*)(o & (~1));
8248 o_conv.is_owned = (o & 1) || (o == 0);
8249 o_conv = UpdateAddHTLC_clone(&o_conv);
8250 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8251 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
8252 return (long)ret_conv;
8255 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
8256 LDKDecodeError e_conv;
8257 e_conv.inner = (void*)(e & (~1));
8258 e_conv.is_owned = (e & 1) || (e == 0);
8259 e_conv = DecodeError_clone(&e_conv);
8260 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8261 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
8262 return (long)ret_conv;
8265 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
8266 if ((_res & 1) != 0) return;
8267 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8269 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
8272 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
8273 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
8274 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8275 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
8276 return (long)ret_conv;
8279 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
8281 o_conv.inner = (void*)(o & (~1));
8282 o_conv.is_owned = (o & 1) || (o == 0);
8283 o_conv = Ping_clone(&o_conv);
8284 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8285 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
8286 return (long)ret_conv;
8289 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
8290 LDKDecodeError e_conv;
8291 e_conv.inner = (void*)(e & (~1));
8292 e_conv.is_owned = (e & 1) || (e == 0);
8293 e_conv = DecodeError_clone(&e_conv);
8294 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8295 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
8296 return (long)ret_conv;
8299 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
8300 if ((_res & 1) != 0) return;
8301 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
8303 CResult_PingDecodeErrorZ_free(_res_conv);
8306 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
8307 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
8308 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8309 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
8310 return (long)ret_conv;
8313 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
8315 o_conv.inner = (void*)(o & (~1));
8316 o_conv.is_owned = (o & 1) || (o == 0);
8317 o_conv = Pong_clone(&o_conv);
8318 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8319 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
8320 return (long)ret_conv;
8323 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
8324 LDKDecodeError e_conv;
8325 e_conv.inner = (void*)(e & (~1));
8326 e_conv.is_owned = (e & 1) || (e == 0);
8327 e_conv = DecodeError_clone(&e_conv);
8328 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8329 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
8330 return (long)ret_conv;
8333 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
8334 if ((_res & 1) != 0) return;
8335 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
8337 CResult_PongDecodeErrorZ_free(_res_conv);
8340 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
8341 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
8342 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8343 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
8344 return (long)ret_conv;
8347 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
8348 LDKUnsignedChannelAnnouncement o_conv;
8349 o_conv.inner = (void*)(o & (~1));
8350 o_conv.is_owned = (o & 1) || (o == 0);
8351 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
8352 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8353 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
8354 return (long)ret_conv;
8357 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
8358 LDKDecodeError e_conv;
8359 e_conv.inner = (void*)(e & (~1));
8360 e_conv.is_owned = (e & 1) || (e == 0);
8361 e_conv = DecodeError_clone(&e_conv);
8362 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8363 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
8364 return (long)ret_conv;
8367 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
8368 if ((_res & 1) != 0) return;
8369 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8371 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
8374 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8375 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
8376 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8377 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
8378 return (long)ret_conv;
8381 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
8382 LDKChannelAnnouncement o_conv;
8383 o_conv.inner = (void*)(o & (~1));
8384 o_conv.is_owned = (o & 1) || (o == 0);
8385 o_conv = ChannelAnnouncement_clone(&o_conv);
8386 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8387 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
8388 return (long)ret_conv;
8391 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
8392 LDKDecodeError e_conv;
8393 e_conv.inner = (void*)(e & (~1));
8394 e_conv.is_owned = (e & 1) || (e == 0);
8395 e_conv = DecodeError_clone(&e_conv);
8396 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8397 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
8398 return (long)ret_conv;
8401 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
8402 if ((_res & 1) != 0) return;
8403 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8405 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
8408 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8409 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
8410 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8411 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
8412 return (long)ret_conv;
8415 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
8416 LDKUnsignedChannelUpdate o_conv;
8417 o_conv.inner = (void*)(o & (~1));
8418 o_conv.is_owned = (o & 1) || (o == 0);
8419 o_conv = UnsignedChannelUpdate_clone(&o_conv);
8420 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8421 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
8422 return (long)ret_conv;
8425 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
8426 LDKDecodeError e_conv;
8427 e_conv.inner = (void*)(e & (~1));
8428 e_conv.is_owned = (e & 1) || (e == 0);
8429 e_conv = DecodeError_clone(&e_conv);
8430 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8431 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
8432 return (long)ret_conv;
8435 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
8436 if ((_res & 1) != 0) return;
8437 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8439 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
8442 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
8443 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
8444 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8445 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
8446 return (long)ret_conv;
8449 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
8450 LDKChannelUpdate o_conv;
8451 o_conv.inner = (void*)(o & (~1));
8452 o_conv.is_owned = (o & 1) || (o == 0);
8453 o_conv = ChannelUpdate_clone(&o_conv);
8454 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8455 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
8456 return (long)ret_conv;
8459 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
8460 LDKDecodeError e_conv;
8461 e_conv.inner = (void*)(e & (~1));
8462 e_conv.is_owned = (e & 1) || (e == 0);
8463 e_conv = DecodeError_clone(&e_conv);
8464 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8465 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
8466 return (long)ret_conv;
8469 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
8470 if ((_res & 1) != 0) return;
8471 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8473 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
8476 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
8477 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
8478 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8479 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
8480 return (long)ret_conv;
8483 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
8484 LDKErrorMessage o_conv;
8485 o_conv.inner = (void*)(o & (~1));
8486 o_conv.is_owned = (o & 1) || (o == 0);
8487 o_conv = ErrorMessage_clone(&o_conv);
8488 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8489 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
8490 return (long)ret_conv;
8493 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
8494 LDKDecodeError e_conv;
8495 e_conv.inner = (void*)(e & (~1));
8496 e_conv.is_owned = (e & 1) || (e == 0);
8497 e_conv = DecodeError_clone(&e_conv);
8498 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8499 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
8500 return (long)ret_conv;
8503 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
8504 if ((_res & 1) != 0) return;
8505 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
8507 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
8510 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
8511 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
8512 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8513 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
8514 return (long)ret_conv;
8517 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
8518 LDKUnsignedNodeAnnouncement o_conv;
8519 o_conv.inner = (void*)(o & (~1));
8520 o_conv.is_owned = (o & 1) || (o == 0);
8521 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
8522 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8523 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
8524 return (long)ret_conv;
8527 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
8528 LDKDecodeError e_conv;
8529 e_conv.inner = (void*)(e & (~1));
8530 e_conv.is_owned = (e & 1) || (e == 0);
8531 e_conv = DecodeError_clone(&e_conv);
8532 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8533 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
8534 return (long)ret_conv;
8537 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
8538 if ((_res & 1) != 0) return;
8539 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8541 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
8544 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8545 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
8546 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8547 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
8548 return (long)ret_conv;
8551 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
8552 LDKNodeAnnouncement o_conv;
8553 o_conv.inner = (void*)(o & (~1));
8554 o_conv.is_owned = (o & 1) || (o == 0);
8555 o_conv = NodeAnnouncement_clone(&o_conv);
8556 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8557 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
8558 return (long)ret_conv;
8561 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
8562 LDKDecodeError e_conv;
8563 e_conv.inner = (void*)(e & (~1));
8564 e_conv.is_owned = (e & 1) || (e == 0);
8565 e_conv = DecodeError_clone(&e_conv);
8566 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8567 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
8568 return (long)ret_conv;
8571 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
8572 if ((_res & 1) != 0) return;
8573 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8575 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
8578 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8579 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
8580 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8581 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
8582 return (long)ret_conv;
8585 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
8586 LDKQueryShortChannelIds o_conv;
8587 o_conv.inner = (void*)(o & (~1));
8588 o_conv.is_owned = (o & 1) || (o == 0);
8589 o_conv = QueryShortChannelIds_clone(&o_conv);
8590 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8591 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
8592 return (long)ret_conv;
8595 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
8596 LDKDecodeError e_conv;
8597 e_conv.inner = (void*)(e & (~1));
8598 e_conv.is_owned = (e & 1) || (e == 0);
8599 e_conv = DecodeError_clone(&e_conv);
8600 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8601 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
8602 return (long)ret_conv;
8605 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
8606 if ((_res & 1) != 0) return;
8607 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
8609 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
8612 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
8613 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
8614 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8615 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
8616 return (long)ret_conv;
8619 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
8620 LDKReplyShortChannelIdsEnd o_conv;
8621 o_conv.inner = (void*)(o & (~1));
8622 o_conv.is_owned = (o & 1) || (o == 0);
8623 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
8624 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8625 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
8626 return (long)ret_conv;
8629 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
8630 LDKDecodeError e_conv;
8631 e_conv.inner = (void*)(e & (~1));
8632 e_conv.is_owned = (e & 1) || (e == 0);
8633 e_conv = DecodeError_clone(&e_conv);
8634 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8635 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
8636 return (long)ret_conv;
8639 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
8640 if ((_res & 1) != 0) return;
8641 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
8643 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
8646 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
8647 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
8648 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8649 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
8650 return (long)ret_conv;
8653 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
8654 LDKQueryChannelRange o_conv;
8655 o_conv.inner = (void*)(o & (~1));
8656 o_conv.is_owned = (o & 1) || (o == 0);
8657 o_conv = QueryChannelRange_clone(&o_conv);
8658 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8659 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
8660 return (long)ret_conv;
8663 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
8664 LDKDecodeError e_conv;
8665 e_conv.inner = (void*)(e & (~1));
8666 e_conv.is_owned = (e & 1) || (e == 0);
8667 e_conv = DecodeError_clone(&e_conv);
8668 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8669 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
8670 return (long)ret_conv;
8673 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
8674 if ((_res & 1) != 0) return;
8675 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8677 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
8680 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
8681 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
8682 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8683 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
8684 return (long)ret_conv;
8687 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
8688 LDKReplyChannelRange o_conv;
8689 o_conv.inner = (void*)(o & (~1));
8690 o_conv.is_owned = (o & 1) || (o == 0);
8691 o_conv = ReplyChannelRange_clone(&o_conv);
8692 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8693 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
8694 return (long)ret_conv;
8697 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
8698 LDKDecodeError e_conv;
8699 e_conv.inner = (void*)(e & (~1));
8700 e_conv.is_owned = (e & 1) || (e == 0);
8701 e_conv = DecodeError_clone(&e_conv);
8702 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8703 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
8704 return (long)ret_conv;
8707 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
8708 if ((_res & 1) != 0) return;
8709 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8711 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
8714 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
8715 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
8716 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8717 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
8718 return (long)ret_conv;
8721 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
8722 LDKGossipTimestampFilter o_conv;
8723 o_conv.inner = (void*)(o & (~1));
8724 o_conv.is_owned = (o & 1) || (o == 0);
8725 o_conv = GossipTimestampFilter_clone(&o_conv);
8726 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8727 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
8728 return (long)ret_conv;
8731 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
8732 LDKDecodeError e_conv;
8733 e_conv.inner = (void*)(e & (~1));
8734 e_conv.is_owned = (e & 1) || (e == 0);
8735 e_conv = DecodeError_clone(&e_conv);
8736 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8737 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
8738 return (long)ret_conv;
8741 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
8742 if ((_res & 1) != 0) return;
8743 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
8745 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
8748 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
8749 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
8750 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8751 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
8752 return (long)ret_conv;
8755 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
8756 if ((this_ptr & 1) != 0) return;
8757 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
8758 FREE((void*)this_ptr);
8759 Event_free(this_ptr_conv);
8762 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
8763 LDKEvent* orig_conv = (LDKEvent*)orig;
8764 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
8765 *ret_copy = Event_clone(orig_conv);
8766 long ret_ref = (long)ret_copy;
8770 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
8771 LDKEvent* obj_conv = (LDKEvent*)obj;
8772 LDKCVec_u8Z ret_var = Event_write(obj_conv);
8773 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
8774 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
8775 CVec_u8Z_free(ret_var);
8779 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
8780 if ((this_ptr & 1) != 0) return;
8781 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
8782 FREE((void*)this_ptr);
8783 MessageSendEvent_free(this_ptr_conv);
8786 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
8787 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
8788 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
8789 *ret_copy = MessageSendEvent_clone(orig_conv);
8790 long ret_ref = (long)ret_copy;
8794 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
8795 if ((this_ptr & 1) != 0) return;
8796 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
8797 FREE((void*)this_ptr);
8798 MessageSendEventsProvider_free(this_ptr_conv);
8801 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
8802 if ((this_ptr & 1) != 0) return;
8803 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
8804 FREE((void*)this_ptr);
8805 EventsProvider_free(this_ptr_conv);
8808 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
8809 if ((this_ptr & 1) != 0) return;
8810 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
8811 FREE((void*)this_ptr);
8812 APIError_free(this_ptr_conv);
8815 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
8816 LDKAPIError* orig_conv = (LDKAPIError*)orig;
8817 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
8818 *ret_copy = APIError_clone(orig_conv);
8819 long ret_ref = (long)ret_copy;
8823 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
8824 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
8825 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
8829 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
8830 uint32_t ret_conv = LDKLevel_to_js(Level_max());
8834 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
8835 if ((this_ptr & 1) != 0) return;
8836 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
8837 FREE((void*)this_ptr);
8838 Logger_free(this_ptr_conv);
8841 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
8842 LDKChannelHandshakeConfig this_obj_conv;
8843 this_obj_conv.inner = (void*)(this_obj & (~1));
8844 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
8845 ChannelHandshakeConfig_free(this_obj_conv);
8848 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
8849 LDKChannelHandshakeConfig this_ptr_conv;
8850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8851 this_ptr_conv.is_owned = false;
8852 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
8856 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
8857 LDKChannelHandshakeConfig this_ptr_conv;
8858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8859 this_ptr_conv.is_owned = false;
8860 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
8863 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
8864 LDKChannelHandshakeConfig this_ptr_conv;
8865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8866 this_ptr_conv.is_owned = false;
8867 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
8871 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
8872 LDKChannelHandshakeConfig this_ptr_conv;
8873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8874 this_ptr_conv.is_owned = false;
8875 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
8878 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
8879 LDKChannelHandshakeConfig this_ptr_conv;
8880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8881 this_ptr_conv.is_owned = false;
8882 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
8886 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
8887 LDKChannelHandshakeConfig this_ptr_conv;
8888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8889 this_ptr_conv.is_owned = false;
8890 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
8893 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) {
8894 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
8895 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8896 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8897 long ret_ref = (long)ret_var.inner;
8898 if (ret_var.is_owned) {
8904 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
8905 LDKChannelHandshakeConfig orig_conv;
8906 orig_conv.inner = (void*)(orig & (~1));
8907 orig_conv.is_owned = false;
8908 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
8909 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8910 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8911 long ret_ref = (long)ret_var.inner;
8912 if (ret_var.is_owned) {
8918 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
8919 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
8920 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8921 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8922 long ret_ref = (long)ret_var.inner;
8923 if (ret_var.is_owned) {
8929 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
8930 LDKChannelHandshakeLimits this_obj_conv;
8931 this_obj_conv.inner = (void*)(this_obj & (~1));
8932 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
8933 ChannelHandshakeLimits_free(this_obj_conv);
8936 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
8937 LDKChannelHandshakeLimits this_ptr_conv;
8938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8939 this_ptr_conv.is_owned = false;
8940 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
8944 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
8945 LDKChannelHandshakeLimits this_ptr_conv;
8946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8947 this_ptr_conv.is_owned = false;
8948 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
8951 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
8952 LDKChannelHandshakeLimits this_ptr_conv;
8953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8954 this_ptr_conv.is_owned = false;
8955 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
8959 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
8960 LDKChannelHandshakeLimits this_ptr_conv;
8961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8962 this_ptr_conv.is_owned = false;
8963 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
8966 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
8967 LDKChannelHandshakeLimits this_ptr_conv;
8968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8969 this_ptr_conv.is_owned = false;
8970 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
8974 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
8975 LDKChannelHandshakeLimits this_ptr_conv;
8976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8977 this_ptr_conv.is_owned = false;
8978 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8981 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
8982 LDKChannelHandshakeLimits this_ptr_conv;
8983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8984 this_ptr_conv.is_owned = false;
8985 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
8989 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
8990 LDKChannelHandshakeLimits this_ptr_conv;
8991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8992 this_ptr_conv.is_owned = false;
8993 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
8996 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
8997 LDKChannelHandshakeLimits this_ptr_conv;
8998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8999 this_ptr_conv.is_owned = false;
9000 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
9004 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
9005 LDKChannelHandshakeLimits this_ptr_conv;
9006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9007 this_ptr_conv.is_owned = false;
9008 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
9011 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_dust_limit_satoshis(uint32_t this_ptr) {
9012 LDKChannelHandshakeLimits this_ptr_conv;
9013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9014 this_ptr_conv.is_owned = false;
9015 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
9019 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
9020 LDKChannelHandshakeLimits this_ptr_conv;
9021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9022 this_ptr_conv.is_owned = false;
9023 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
9026 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_dust_limit_satoshis(uint32_t this_ptr) {
9027 LDKChannelHandshakeLimits this_ptr_conv;
9028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9029 this_ptr_conv.is_owned = false;
9030 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
9034 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
9035 LDKChannelHandshakeLimits this_ptr_conv;
9036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9037 this_ptr_conv.is_owned = false;
9038 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
9041 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
9042 LDKChannelHandshakeLimits this_ptr_conv;
9043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9044 this_ptr_conv.is_owned = false;
9045 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
9049 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
9050 LDKChannelHandshakeLimits this_ptr_conv;
9051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9052 this_ptr_conv.is_owned = false;
9053 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
9056 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
9057 LDKChannelHandshakeLimits this_ptr_conv;
9058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9059 this_ptr_conv.is_owned = false;
9060 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
9064 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
9065 LDKChannelHandshakeLimits this_ptr_conv;
9066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9067 this_ptr_conv.is_owned = false;
9068 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
9071 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
9072 LDKChannelHandshakeLimits this_ptr_conv;
9073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9074 this_ptr_conv.is_owned = false;
9075 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
9079 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
9080 LDKChannelHandshakeLimits this_ptr_conv;
9081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9082 this_ptr_conv.is_owned = false;
9083 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
9086 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) {
9087 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);
9088 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9089 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9090 long ret_ref = (long)ret_var.inner;
9091 if (ret_var.is_owned) {
9097 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
9098 LDKChannelHandshakeLimits orig_conv;
9099 orig_conv.inner = (void*)(orig & (~1));
9100 orig_conv.is_owned = false;
9101 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
9102 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9103 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9104 long ret_ref = (long)ret_var.inner;
9105 if (ret_var.is_owned) {
9111 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
9112 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
9113 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9114 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9115 long ret_ref = (long)ret_var.inner;
9116 if (ret_var.is_owned) {
9122 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
9123 LDKChannelConfig this_obj_conv;
9124 this_obj_conv.inner = (void*)(this_obj & (~1));
9125 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9126 ChannelConfig_free(this_obj_conv);
9129 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_fee_proportional_millionths(uint32_t this_ptr) {
9130 LDKChannelConfig this_ptr_conv;
9131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9132 this_ptr_conv.is_owned = false;
9133 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
9137 void __attribute__((visibility("default"))) TS_ChannelConfig_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
9138 LDKChannelConfig this_ptr_conv;
9139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9140 this_ptr_conv.is_owned = false;
9141 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
9144 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
9145 LDKChannelConfig this_ptr_conv;
9146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9147 this_ptr_conv.is_owned = false;
9148 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
9152 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
9153 LDKChannelConfig this_ptr_conv;
9154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9155 this_ptr_conv.is_owned = false;
9156 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
9159 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
9160 LDKChannelConfig this_ptr_conv;
9161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9162 this_ptr_conv.is_owned = false;
9163 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
9167 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
9168 LDKChannelConfig this_ptr_conv;
9169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9170 this_ptr_conv.is_owned = false;
9171 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
9174 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
9175 LDKChannelConfig this_ptr_conv;
9176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9177 this_ptr_conv.is_owned = false;
9178 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
9182 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
9183 LDKChannelConfig this_ptr_conv;
9184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9185 this_ptr_conv.is_owned = false;
9186 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
9189 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_new(int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
9190 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
9191 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9192 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9193 long ret_ref = (long)ret_var.inner;
9194 if (ret_var.is_owned) {
9200 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
9201 LDKChannelConfig orig_conv;
9202 orig_conv.inner = (void*)(orig & (~1));
9203 orig_conv.is_owned = false;
9204 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
9205 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9206 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9207 long ret_ref = (long)ret_var.inner;
9208 if (ret_var.is_owned) {
9214 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
9215 LDKChannelConfig ret_var = ChannelConfig_default();
9216 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9217 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9218 long ret_ref = (long)ret_var.inner;
9219 if (ret_var.is_owned) {
9225 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
9226 LDKChannelConfig obj_conv;
9227 obj_conv.inner = (void*)(obj & (~1));
9228 obj_conv.is_owned = false;
9229 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
9230 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9231 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9232 CVec_u8Z_free(ret_var);
9236 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
9238 ser_ref.datalen = *((uint32_t*)ser);
9239 ser_ref.data = (int8_t*)(ser + 4);
9240 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9241 *ret_conv = ChannelConfig_read(ser_ref);
9242 return (long)ret_conv;
9245 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
9246 LDKUserConfig this_obj_conv;
9247 this_obj_conv.inner = (void*)(this_obj & (~1));
9248 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9249 UserConfig_free(this_obj_conv);
9252 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
9253 LDKUserConfig this_ptr_conv;
9254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9255 this_ptr_conv.is_owned = false;
9256 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
9257 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9258 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9259 long ret_ref = (long)ret_var.inner;
9260 if (ret_var.is_owned) {
9266 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
9267 LDKUserConfig this_ptr_conv;
9268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9269 this_ptr_conv.is_owned = false;
9270 LDKChannelHandshakeConfig val_conv;
9271 val_conv.inner = (void*)(val & (~1));
9272 val_conv.is_owned = (val & 1) || (val == 0);
9273 val_conv = ChannelHandshakeConfig_clone(&val_conv);
9274 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
9277 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
9278 LDKUserConfig this_ptr_conv;
9279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9280 this_ptr_conv.is_owned = false;
9281 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
9282 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9283 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9284 long ret_ref = (long)ret_var.inner;
9285 if (ret_var.is_owned) {
9291 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
9292 LDKUserConfig this_ptr_conv;
9293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9294 this_ptr_conv.is_owned = false;
9295 LDKChannelHandshakeLimits val_conv;
9296 val_conv.inner = (void*)(val & (~1));
9297 val_conv.is_owned = (val & 1) || (val == 0);
9298 val_conv = ChannelHandshakeLimits_clone(&val_conv);
9299 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
9302 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
9303 LDKUserConfig this_ptr_conv;
9304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9305 this_ptr_conv.is_owned = false;
9306 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
9307 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9308 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9309 long ret_ref = (long)ret_var.inner;
9310 if (ret_var.is_owned) {
9316 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
9317 LDKUserConfig this_ptr_conv;
9318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9319 this_ptr_conv.is_owned = false;
9320 LDKChannelConfig val_conv;
9321 val_conv.inner = (void*)(val & (~1));
9322 val_conv.is_owned = (val & 1) || (val == 0);
9323 val_conv = ChannelConfig_clone(&val_conv);
9324 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
9327 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) {
9328 LDKChannelHandshakeConfig own_channel_config_arg_conv;
9329 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
9330 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
9331 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
9332 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
9333 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
9334 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
9335 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
9336 LDKChannelConfig channel_options_arg_conv;
9337 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
9338 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
9339 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
9340 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
9341 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9342 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9343 long ret_ref = (long)ret_var.inner;
9344 if (ret_var.is_owned) {
9350 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
9351 LDKUserConfig orig_conv;
9352 orig_conv.inner = (void*)(orig & (~1));
9353 orig_conv.is_owned = false;
9354 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
9355 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9356 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9357 long ret_ref = (long)ret_var.inner;
9358 if (ret_var.is_owned) {
9364 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
9365 LDKUserConfig ret_var = UserConfig_default();
9366 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9367 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9368 long ret_ref = (long)ret_var.inner;
9369 if (ret_var.is_owned) {
9375 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
9376 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
9377 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
9381 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
9382 if ((this_ptr & 1) != 0) return;
9383 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
9384 FREE((void*)this_ptr);
9385 Access_free(this_ptr_conv);
9388 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
9389 if ((this_ptr & 1) != 0) return;
9390 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
9391 FREE((void*)this_ptr);
9392 Listen_free(this_ptr_conv);
9395 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
9396 if ((this_ptr & 1) != 0) return;
9397 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
9398 FREE((void*)this_ptr);
9399 Watch_free(this_ptr_conv);
9402 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
9403 if ((this_ptr & 1) != 0) return;
9404 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
9405 FREE((void*)this_ptr);
9406 Filter_free(this_ptr_conv);
9409 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
9410 if ((this_ptr & 1) != 0) return;
9411 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
9412 FREE((void*)this_ptr);
9413 BroadcasterInterface_free(this_ptr_conv);
9416 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
9417 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
9418 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
9422 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
9423 if ((this_ptr & 1) != 0) return;
9424 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
9425 FREE((void*)this_ptr);
9426 FeeEstimator_free(this_ptr_conv);
9429 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
9430 LDKChainMonitor this_obj_conv;
9431 this_obj_conv.inner = (void*)(this_obj & (~1));
9432 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9433 ChainMonitor_free(this_obj_conv);
9436 void __attribute__((visibility("default"))) TS_ChainMonitor_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
9437 LDKChainMonitor this_arg_conv;
9438 this_arg_conv.inner = (void*)(this_arg & (~1));
9439 this_arg_conv.is_owned = false;
9440 unsigned char header_arr[80];
9441 CHECK(*((uint32_t*)header) == 80);
9442 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9443 unsigned char (*header_ref)[80] = &header_arr;
9444 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9445 txdata_constr.datalen = *((uint32_t*)txdata);
9446 if (txdata_constr.datalen > 0)
9447 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9449 txdata_constr.data = NULL;
9450 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
9451 for (size_t e = 0; e < txdata_constr.datalen; e++) {
9452 uint32_t txdata_conv_30 = txdata_vals[e];
9453 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
9454 FREE((void*)txdata_conv_30);
9455 txdata_constr.data[e] = txdata_conv_30_conv;
9457 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
9460 void __attribute__((visibility("default"))) TS_ChainMonitor_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t disconnected_height) {
9461 LDKChainMonitor this_arg_conv;
9462 this_arg_conv.inner = (void*)(this_arg & (~1));
9463 this_arg_conv.is_owned = false;
9464 unsigned char header_arr[80];
9465 CHECK(*((uint32_t*)header) == 80);
9466 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9467 unsigned char (*header_ref)[80] = &header_arr;
9468 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
9471 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
9472 LDKFilter *chain_source_conv_ptr = NULL;
9473 if (chain_source != 0) {
9474 LDKFilter chain_source_conv;
9475 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
9476 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
9477 *chain_source_conv_ptr = chain_source_conv;
9479 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
9480 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9481 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
9482 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
9483 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
9484 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9485 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9486 long ret_ref = (long)ret_var.inner;
9487 if (ret_var.is_owned) {
9493 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
9494 LDKChainMonitor this_arg_conv;
9495 this_arg_conv.inner = (void*)(this_arg & (~1));
9496 this_arg_conv.is_owned = false;
9497 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
9498 *ret = ChainMonitor_as_Watch(&this_arg_conv);
9502 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
9503 LDKChainMonitor this_arg_conv;
9504 this_arg_conv.inner = (void*)(this_arg & (~1));
9505 this_arg_conv.is_owned = false;
9506 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9507 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
9511 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
9512 LDKChannelMonitorUpdate this_obj_conv;
9513 this_obj_conv.inner = (void*)(this_obj & (~1));
9514 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9515 ChannelMonitorUpdate_free(this_obj_conv);
9518 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
9519 LDKChannelMonitorUpdate this_ptr_conv;
9520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9521 this_ptr_conv.is_owned = false;
9522 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
9526 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
9527 LDKChannelMonitorUpdate this_ptr_conv;
9528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9529 this_ptr_conv.is_owned = false;
9530 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
9533 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
9534 LDKChannelMonitorUpdate orig_conv;
9535 orig_conv.inner = (void*)(orig & (~1));
9536 orig_conv.is_owned = false;
9537 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
9538 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9539 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9540 long ret_ref = (long)ret_var.inner;
9541 if (ret_var.is_owned) {
9547 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
9548 LDKChannelMonitorUpdate obj_conv;
9549 obj_conv.inner = (void*)(obj & (~1));
9550 obj_conv.is_owned = false;
9551 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
9552 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9553 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9554 CVec_u8Z_free(ret_var);
9558 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
9560 ser_ref.datalen = *((uint32_t*)ser);
9561 ser_ref.data = (int8_t*)(ser + 4);
9562 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9563 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
9564 return (long)ret_conv;
9567 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
9568 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
9569 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
9573 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) {
9574 LDKMonitorUpdateError this_obj_conv;
9575 this_obj_conv.inner = (void*)(this_obj & (~1));
9576 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9577 MonitorUpdateError_free(this_obj_conv);
9580 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
9581 LDKMonitorUpdateError orig_conv;
9582 orig_conv.inner = (void*)(orig & (~1));
9583 orig_conv.is_owned = false;
9584 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
9585 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9586 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9587 long ret_ref = (long)ret_var.inner;
9588 if (ret_var.is_owned) {
9594 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
9595 if ((this_ptr & 1) != 0) return;
9596 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
9597 FREE((void*)this_ptr);
9598 MonitorEvent_free(this_ptr_conv);
9601 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
9602 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
9603 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
9604 *ret_copy = MonitorEvent_clone(orig_conv);
9605 long ret_ref = (long)ret_copy;
9609 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
9610 LDKHTLCUpdate this_obj_conv;
9611 this_obj_conv.inner = (void*)(this_obj & (~1));
9612 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9613 HTLCUpdate_free(this_obj_conv);
9616 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
9617 LDKHTLCUpdate orig_conv;
9618 orig_conv.inner = (void*)(orig & (~1));
9619 orig_conv.is_owned = false;
9620 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
9621 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9622 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9623 long ret_ref = (long)ret_var.inner;
9624 if (ret_var.is_owned) {
9630 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
9631 LDKHTLCUpdate obj_conv;
9632 obj_conv.inner = (void*)(obj & (~1));
9633 obj_conv.is_owned = false;
9634 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
9635 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9636 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9637 CVec_u8Z_free(ret_var);
9641 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
9643 ser_ref.datalen = *((uint32_t*)ser);
9644 ser_ref.data = (int8_t*)(ser + 4);
9645 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9646 *ret_conv = HTLCUpdate_read(ser_ref);
9647 return (long)ret_conv;
9650 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
9651 LDKChannelMonitor this_obj_conv;
9652 this_obj_conv.inner = (void*)(this_obj & (~1));
9653 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9654 ChannelMonitor_free(this_obj_conv);
9657 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
9658 LDKChannelMonitor orig_conv;
9659 orig_conv.inner = (void*)(orig & (~1));
9660 orig_conv.is_owned = false;
9661 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
9662 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9663 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9664 long ret_ref = (long)ret_var.inner;
9665 if (ret_var.is_owned) {
9671 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
9672 LDKChannelMonitor obj_conv;
9673 obj_conv.inner = (void*)(obj & (~1));
9674 obj_conv.is_owned = false;
9675 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
9676 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9677 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9678 CVec_u8Z_free(ret_var);
9682 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) {
9683 LDKChannelMonitor this_arg_conv;
9684 this_arg_conv.inner = (void*)(this_arg & (~1));
9685 this_arg_conv.is_owned = false;
9686 LDKChannelMonitorUpdate updates_conv;
9687 updates_conv.inner = (void*)(updates & (~1));
9688 updates_conv.is_owned = false;
9689 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
9690 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
9691 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
9692 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
9693 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
9694 return (long)ret_conv;
9697 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
9698 LDKChannelMonitor this_arg_conv;
9699 this_arg_conv.inner = (void*)(this_arg & (~1));
9700 this_arg_conv.is_owned = false;
9701 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
9705 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
9706 LDKChannelMonitor this_arg_conv;
9707 this_arg_conv.inner = (void*)(this_arg & (~1));
9708 this_arg_conv.is_owned = false;
9709 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
9710 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
9711 return (long)ret_ref;
9714 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
9715 LDKChannelMonitor this_arg_conv;
9716 this_arg_conv.inner = (void*)(this_arg & (~1));
9717 this_arg_conv.is_owned = false;
9718 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
9719 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9720 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9721 for (size_t c = 0; c < ret_var.datalen; c++) {
9722 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_54_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
9723 *ret_conv_54_ref = ret_var.data[c];
9724 ret_arr_ptr[c] = (long)ret_conv_54_ref;
9730 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
9731 LDKChannelMonitor this_arg_conv;
9732 this_arg_conv.inner = (void*)(this_arg & (~1));
9733 this_arg_conv.is_owned = false;
9734 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
9735 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
9738 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
9739 LDKChannelMonitor this_arg_conv;
9740 this_arg_conv.inner = (void*)(this_arg & (~1));
9741 this_arg_conv.is_owned = false;
9742 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
9743 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9744 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9745 for (size_t o = 0; o < ret_var.datalen; o++) {
9746 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
9747 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
9748 long ret_conv_14_ref = (long)ret_conv_14_copy;
9749 ret_arr_ptr[o] = ret_conv_14_ref;
9755 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
9756 LDKChannelMonitor this_arg_conv;
9757 this_arg_conv.inner = (void*)(this_arg & (~1));
9758 this_arg_conv.is_owned = false;
9759 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
9760 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9761 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9762 for (size_t h = 0; h < ret_var.datalen; h++) {
9763 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
9764 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
9765 long ret_conv_7_ref = (long)ret_conv_7_copy;
9766 ret_arr_ptr[h] = ret_conv_7_ref;
9772 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
9773 LDKChannelMonitor this_arg_conv;
9774 this_arg_conv.inner = (void*)(this_arg & (~1));
9775 this_arg_conv.is_owned = false;
9776 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
9777 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
9778 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
9779 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
9780 for (size_t m = 0; m < ret_var.datalen; m++) {
9781 LDKTransaction ret_conv_12_var = ret_var.data[m];
9782 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9783 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
9784 Transaction_free(ret_conv_12_var);
9785 ret_arr_ptr[m] = ret_conv_12_arr;
9791 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) {
9792 LDKChannelMonitor this_arg_conv;
9793 this_arg_conv.inner = (void*)(this_arg & (~1));
9794 this_arg_conv.is_owned = false;
9795 unsigned char header_arr[80];
9796 CHECK(*((uint32_t*)header) == 80);
9797 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9798 unsigned char (*header_ref)[80] = &header_arr;
9799 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9800 txdata_constr.datalen = *((uint32_t*)txdata);
9801 if (txdata_constr.datalen > 0)
9802 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9804 txdata_constr.data = NULL;
9805 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
9806 for (size_t e = 0; e < txdata_constr.datalen; e++) {
9807 uint32_t txdata_conv_30 = txdata_vals[e];
9808 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
9809 FREE((void*)txdata_conv_30);
9810 txdata_constr.data[e] = txdata_conv_30_conv;
9812 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
9813 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
9814 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9815 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);
9816 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9817 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9818 for (size_t x = 0; x < ret_var.datalen; x++) {
9819 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
9820 *ret_conv_49_ref = ret_var.data[x];
9821 ret_arr_ptr[x] = (long)ret_conv_49_ref;
9827 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) {
9828 LDKChannelMonitor this_arg_conv;
9829 this_arg_conv.inner = (void*)(this_arg & (~1));
9830 this_arg_conv.is_owned = false;
9831 unsigned char header_arr[80];
9832 CHECK(*((uint32_t*)header) == 80);
9833 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9834 unsigned char (*header_ref)[80] = &header_arr;
9835 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
9836 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
9837 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9838 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
9841 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
9842 if ((this_ptr & 1) != 0) return;
9843 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
9844 FREE((void*)this_ptr);
9845 Persist_free(this_ptr_conv);
9848 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
9850 ser_ref.datalen = *((uint32_t*)ser);
9851 ser_ref.data = (int8_t*)(ser + 4);
9852 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
9853 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
9854 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
9855 return (long)ret_conv;
9858 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
9859 LDKOutPoint this_obj_conv;
9860 this_obj_conv.inner = (void*)(this_obj & (~1));
9861 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9862 OutPoint_free(this_obj_conv);
9865 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
9866 LDKOutPoint this_ptr_conv;
9867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9868 this_ptr_conv.is_owned = false;
9869 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9870 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
9874 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
9875 LDKOutPoint this_ptr_conv;
9876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9877 this_ptr_conv.is_owned = false;
9878 LDKThirtyTwoBytes val_ref;
9879 CHECK(*((uint32_t*)val) == 32);
9880 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
9881 OutPoint_set_txid(&this_ptr_conv, val_ref);
9884 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
9885 LDKOutPoint this_ptr_conv;
9886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9887 this_ptr_conv.is_owned = false;
9888 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
9892 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
9893 LDKOutPoint this_ptr_conv;
9894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9895 this_ptr_conv.is_owned = false;
9896 OutPoint_set_index(&this_ptr_conv, val);
9899 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
9900 LDKThirtyTwoBytes txid_arg_ref;
9901 CHECK(*((uint32_t*)txid_arg) == 32);
9902 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
9903 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
9904 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9905 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9906 long ret_ref = (long)ret_var.inner;
9907 if (ret_var.is_owned) {
9913 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
9914 LDKOutPoint orig_conv;
9915 orig_conv.inner = (void*)(orig & (~1));
9916 orig_conv.is_owned = false;
9917 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
9918 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9919 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9920 long ret_ref = (long)ret_var.inner;
9921 if (ret_var.is_owned) {
9927 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
9928 LDKOutPoint this_arg_conv;
9929 this_arg_conv.inner = (void*)(this_arg & (~1));
9930 this_arg_conv.is_owned = false;
9931 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9932 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
9936 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
9937 LDKOutPoint obj_conv;
9938 obj_conv.inner = (void*)(obj & (~1));
9939 obj_conv.is_owned = false;
9940 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
9941 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9942 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9943 CVec_u8Z_free(ret_var);
9947 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
9949 ser_ref.datalen = *((uint32_t*)ser);
9950 ser_ref.data = (int8_t*)(ser + 4);
9951 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9952 *ret_conv = OutPoint_read(ser_ref);
9953 return (long)ret_conv;
9956 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
9957 LDKDelayedPaymentOutputDescriptor this_obj_conv;
9958 this_obj_conv.inner = (void*)(this_obj & (~1));
9959 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9960 DelayedPaymentOutputDescriptor_free(this_obj_conv);
9963 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
9964 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9966 this_ptr_conv.is_owned = false;
9967 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
9968 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9969 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9970 long ret_ref = (long)ret_var.inner;
9971 if (ret_var.is_owned) {
9977 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
9978 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9980 this_ptr_conv.is_owned = false;
9981 LDKOutPoint val_conv;
9982 val_conv.inner = (void*)(val & (~1));
9983 val_conv.is_owned = (val & 1) || (val == 0);
9984 val_conv = OutPoint_clone(&val_conv);
9985 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
9988 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
9989 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9991 this_ptr_conv.is_owned = false;
9992 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
9993 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
9997 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
9998 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10000 this_ptr_conv.is_owned = false;
10001 LDKPublicKey val_ref;
10002 CHECK(*((uint32_t*)val) == 33);
10003 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10004 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
10007 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
10008 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10010 this_ptr_conv.is_owned = false;
10011 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
10015 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
10016 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10018 this_ptr_conv.is_owned = false;
10019 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
10022 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
10023 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10025 this_ptr_conv.is_owned = false;
10026 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
10028 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
10031 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
10032 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10034 this_ptr_conv.is_owned = false;
10035 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10036 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
10040 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
10041 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10043 this_ptr_conv.is_owned = false;
10044 LDKPublicKey val_ref;
10045 CHECK(*((uint32_t*)val) == 33);
10046 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10047 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
10050 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
10051 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10053 this_ptr_conv.is_owned = false;
10054 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10055 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
10059 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
10060 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10062 this_ptr_conv.is_owned = false;
10063 LDKThirtyTwoBytes val_ref;
10064 CHECK(*((uint32_t*)val) == 32);
10065 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10066 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
10069 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
10070 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10072 this_ptr_conv.is_owned = false;
10073 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
10077 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
10078 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10080 this_ptr_conv.is_owned = false;
10081 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
10084 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_new(uint32_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, uint32_t output_arg, int8_tArray revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
10085 LDKOutPoint outpoint_arg_conv;
10086 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
10087 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
10088 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
10089 LDKPublicKey per_commitment_point_arg_ref;
10090 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
10091 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
10092 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
10093 FREE((void*)output_arg);
10094 LDKPublicKey revocation_pubkey_arg_ref;
10095 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
10096 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
10097 LDKThirtyTwoBytes channel_keys_id_arg_ref;
10098 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
10099 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
10100 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_ref, channel_keys_id_arg_ref, channel_value_satoshis_arg);
10101 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10102 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10103 long ret_ref = (long)ret_var.inner;
10104 if (ret_var.is_owned) {
10110 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
10111 LDKDelayedPaymentOutputDescriptor orig_conv;
10112 orig_conv.inner = (void*)(orig & (~1));
10113 orig_conv.is_owned = false;
10114 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
10115 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10116 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10117 long ret_ref = (long)ret_var.inner;
10118 if (ret_var.is_owned) {
10124 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
10125 LDKStaticPaymentOutputDescriptor this_obj_conv;
10126 this_obj_conv.inner = (void*)(this_obj & (~1));
10127 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10128 StaticPaymentOutputDescriptor_free(this_obj_conv);
10131 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
10132 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10134 this_ptr_conv.is_owned = false;
10135 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
10136 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10137 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10138 long ret_ref = (long)ret_var.inner;
10139 if (ret_var.is_owned) {
10145 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
10146 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10148 this_ptr_conv.is_owned = false;
10149 LDKOutPoint val_conv;
10150 val_conv.inner = (void*)(val & (~1));
10151 val_conv.is_owned = (val & 1) || (val == 0);
10152 val_conv = OutPoint_clone(&val_conv);
10153 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
10156 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
10157 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10159 this_ptr_conv.is_owned = false;
10160 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
10162 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
10165 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
10166 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10168 this_ptr_conv.is_owned = false;
10169 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10170 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
10174 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
10175 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10177 this_ptr_conv.is_owned = false;
10178 LDKThirtyTwoBytes val_ref;
10179 CHECK(*((uint32_t*)val) == 32);
10180 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10181 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
10184 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
10185 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10187 this_ptr_conv.is_owned = false;
10188 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
10192 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
10193 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10195 this_ptr_conv.is_owned = false;
10196 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
10199 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_new(uint32_t outpoint_arg, uint32_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
10200 LDKOutPoint outpoint_arg_conv;
10201 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
10202 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
10203 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
10204 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
10205 FREE((void*)output_arg);
10206 LDKThirtyTwoBytes channel_keys_id_arg_ref;
10207 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
10208 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
10209 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
10210 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10211 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10212 long ret_ref = (long)ret_var.inner;
10213 if (ret_var.is_owned) {
10219 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
10220 LDKStaticPaymentOutputDescriptor orig_conv;
10221 orig_conv.inner = (void*)(orig & (~1));
10222 orig_conv.is_owned = false;
10223 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
10224 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10225 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10226 long ret_ref = (long)ret_var.inner;
10227 if (ret_var.is_owned) {
10233 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
10234 if ((this_ptr & 1) != 0) return;
10235 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
10236 FREE((void*)this_ptr);
10237 SpendableOutputDescriptor_free(this_ptr_conv);
10240 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
10241 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
10242 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
10243 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
10244 long ret_ref = (long)ret_copy;
10248 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
10249 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
10250 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
10251 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10252 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10253 CVec_u8Z_free(ret_var);
10257 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
10258 LDKu8slice ser_ref;
10259 ser_ref.datalen = *((uint32_t*)ser);
10260 ser_ref.data = (int8_t*)(ser + 4);
10261 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10262 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
10263 return (long)ret_conv;
10266 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
10267 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
10268 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
10269 *ret = Sign_clone(orig_conv);
10273 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
10274 if ((this_ptr & 1) != 0) return;
10275 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
10276 FREE((void*)this_ptr);
10277 Sign_free(this_ptr_conv);
10280 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
10281 if ((this_ptr & 1) != 0) return;
10282 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
10283 FREE((void*)this_ptr);
10284 KeysInterface_free(this_ptr_conv);
10287 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
10288 LDKInMemorySigner this_obj_conv;
10289 this_obj_conv.inner = (void*)(this_obj & (~1));
10290 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10291 InMemorySigner_free(this_obj_conv);
10294 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
10295 LDKInMemorySigner this_ptr_conv;
10296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10297 this_ptr_conv.is_owned = false;
10298 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10299 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
10303 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
10304 LDKInMemorySigner this_ptr_conv;
10305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10306 this_ptr_conv.is_owned = false;
10307 LDKSecretKey val_ref;
10308 CHECK(*((uint32_t*)val) == 32);
10309 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10310 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
10313 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
10314 LDKInMemorySigner this_ptr_conv;
10315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10316 this_ptr_conv.is_owned = false;
10317 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10318 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
10322 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
10323 LDKInMemorySigner this_ptr_conv;
10324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10325 this_ptr_conv.is_owned = false;
10326 LDKSecretKey val_ref;
10327 CHECK(*((uint32_t*)val) == 32);
10328 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10329 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
10332 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
10333 LDKInMemorySigner this_ptr_conv;
10334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10335 this_ptr_conv.is_owned = false;
10336 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10337 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
10341 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
10342 LDKInMemorySigner this_ptr_conv;
10343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10344 this_ptr_conv.is_owned = false;
10345 LDKSecretKey val_ref;
10346 CHECK(*((uint32_t*)val) == 32);
10347 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10348 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
10351 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
10352 LDKInMemorySigner this_ptr_conv;
10353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10354 this_ptr_conv.is_owned = false;
10355 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10356 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
10360 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
10361 LDKInMemorySigner this_ptr_conv;
10362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10363 this_ptr_conv.is_owned = false;
10364 LDKSecretKey val_ref;
10365 CHECK(*((uint32_t*)val) == 32);
10366 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10367 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
10370 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
10371 LDKInMemorySigner this_ptr_conv;
10372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10373 this_ptr_conv.is_owned = false;
10374 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10375 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
10379 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
10380 LDKInMemorySigner this_ptr_conv;
10381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10382 this_ptr_conv.is_owned = false;
10383 LDKSecretKey val_ref;
10384 CHECK(*((uint32_t*)val) == 32);
10385 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10386 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
10389 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
10390 LDKInMemorySigner this_ptr_conv;
10391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10392 this_ptr_conv.is_owned = false;
10393 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10394 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
10398 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
10399 LDKInMemorySigner this_ptr_conv;
10400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10401 this_ptr_conv.is_owned = false;
10402 LDKThirtyTwoBytes val_ref;
10403 CHECK(*((uint32_t*)val) == 32);
10404 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10405 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
10408 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
10409 LDKInMemorySigner orig_conv;
10410 orig_conv.inner = (void*)(orig & (~1));
10411 orig_conv.is_owned = false;
10412 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
10413 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10414 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10415 long ret_ref = (long)ret_var.inner;
10416 if (ret_var.is_owned) {
10422 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_new(int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int8_tArray channel_keys_id) {
10423 LDKSecretKey funding_key_ref;
10424 CHECK(*((uint32_t*)funding_key) == 32);
10425 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
10426 LDKSecretKey revocation_base_key_ref;
10427 CHECK(*((uint32_t*)revocation_base_key) == 32);
10428 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
10429 LDKSecretKey payment_key_ref;
10430 CHECK(*((uint32_t*)payment_key) == 32);
10431 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
10432 LDKSecretKey delayed_payment_base_key_ref;
10433 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
10434 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
10435 LDKSecretKey htlc_base_key_ref;
10436 CHECK(*((uint32_t*)htlc_base_key) == 32);
10437 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
10438 LDKThirtyTwoBytes commitment_seed_ref;
10439 CHECK(*((uint32_t*)commitment_seed) == 32);
10440 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
10441 LDKThirtyTwoBytes channel_keys_id_ref;
10442 CHECK(*((uint32_t*)channel_keys_id) == 32);
10443 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
10444 LDKInMemorySigner ret_var = InMemorySigner_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, channel_keys_id_ref);
10445 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10446 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10447 long ret_ref = (long)ret_var.inner;
10448 if (ret_var.is_owned) {
10454 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
10455 LDKInMemorySigner this_arg_conv;
10456 this_arg_conv.inner = (void*)(this_arg & (~1));
10457 this_arg_conv.is_owned = false;
10458 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
10459 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10460 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10461 long ret_ref = (long)ret_var.inner;
10462 if (ret_var.is_owned) {
10468 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
10469 LDKInMemorySigner this_arg_conv;
10470 this_arg_conv.inner = (void*)(this_arg & (~1));
10471 this_arg_conv.is_owned = false;
10472 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
10476 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
10477 LDKInMemorySigner this_arg_conv;
10478 this_arg_conv.inner = (void*)(this_arg & (~1));
10479 this_arg_conv.is_owned = false;
10480 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
10484 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
10485 LDKInMemorySigner this_arg_conv;
10486 this_arg_conv.inner = (void*)(this_arg & (~1));
10487 this_arg_conv.is_owned = false;
10488 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
10492 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
10493 LDKInMemorySigner this_arg_conv;
10494 this_arg_conv.inner = (void*)(this_arg & (~1));
10495 this_arg_conv.is_owned = false;
10496 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
10497 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10498 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10499 long ret_ref = (long)ret_var.inner;
10500 if (ret_var.is_owned) {
10506 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
10507 LDKInMemorySigner this_arg_conv;
10508 this_arg_conv.inner = (void*)(this_arg & (~1));
10509 this_arg_conv.is_owned = false;
10510 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
10511 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10512 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10513 long ret_ref = (long)ret_var.inner;
10514 if (ret_var.is_owned) {
10520 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_sign_counterparty_payment_input(uint32_t this_arg, int8_tArray spend_tx, int64_t input_idx, uint32_t descriptor) {
10521 LDKInMemorySigner this_arg_conv;
10522 this_arg_conv.inner = (void*)(this_arg & (~1));
10523 this_arg_conv.is_owned = false;
10524 LDKTransaction spend_tx_ref;
10525 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
10526 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
10527 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
10528 spend_tx_ref.data_is_owned = true;
10529 LDKStaticPaymentOutputDescriptor descriptor_conv;
10530 descriptor_conv.inner = (void*)(descriptor & (~1));
10531 descriptor_conv.is_owned = false;
10532 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10533 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
10534 return (long)ret_conv;
10537 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_sign_dynamic_p2wsh_input(uint32_t this_arg, int8_tArray spend_tx, int64_t input_idx, uint32_t descriptor) {
10538 LDKInMemorySigner this_arg_conv;
10539 this_arg_conv.inner = (void*)(this_arg & (~1));
10540 this_arg_conv.is_owned = false;
10541 LDKTransaction spend_tx_ref;
10542 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
10543 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
10544 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
10545 spend_tx_ref.data_is_owned = true;
10546 LDKDelayedPaymentOutputDescriptor descriptor_conv;
10547 descriptor_conv.inner = (void*)(descriptor & (~1));
10548 descriptor_conv.is_owned = false;
10549 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10550 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
10551 return (long)ret_conv;
10554 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
10555 LDKInMemorySigner this_arg_conv;
10556 this_arg_conv.inner = (void*)(this_arg & (~1));
10557 this_arg_conv.is_owned = false;
10558 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
10559 *ret = InMemorySigner_as_Sign(&this_arg_conv);
10563 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
10564 LDKInMemorySigner obj_conv;
10565 obj_conv.inner = (void*)(obj & (~1));
10566 obj_conv.is_owned = false;
10567 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
10568 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10569 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10570 CVec_u8Z_free(ret_var);
10574 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
10575 LDKu8slice ser_ref;
10576 ser_ref.datalen = *((uint32_t*)ser);
10577 ser_ref.data = (int8_t*)(ser + 4);
10578 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10579 *ret_conv = InMemorySigner_read(ser_ref);
10580 return (long)ret_conv;
10583 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
10584 LDKKeysManager this_obj_conv;
10585 this_obj_conv.inner = (void*)(this_obj & (~1));
10586 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10587 KeysManager_free(this_obj_conv);
10590 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
10591 unsigned char seed_arr[32];
10592 CHECK(*((uint32_t*)seed) == 32);
10593 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
10594 unsigned char (*seed_ref)[32] = &seed_arr;
10595 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
10596 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10597 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10598 long ret_ref = (long)ret_var.inner;
10599 if (ret_var.is_owned) {
10605 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
10606 LDKKeysManager this_arg_conv;
10607 this_arg_conv.inner = (void*)(this_arg & (~1));
10608 this_arg_conv.is_owned = false;
10609 unsigned char params_arr[32];
10610 CHECK(*((uint32_t*)params) == 32);
10611 memcpy(params_arr, (uint8_t*)(params + 4), 32);
10612 unsigned char (*params_ref)[32] = ¶ms_arr;
10613 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
10614 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10615 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10616 long ret_ref = (long)ret_var.inner;
10617 if (ret_var.is_owned) {
10623 uint32_t __attribute__((visibility("default"))) TS_KeysManager_spend_spendable_outputs(uint32_t this_arg, uint32_tArray descriptors, uint32_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight) {
10624 LDKKeysManager this_arg_conv;
10625 this_arg_conv.inner = (void*)(this_arg & (~1));
10626 this_arg_conv.is_owned = false;
10627 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
10628 descriptors_constr.datalen = *((uint32_t*)descriptors);
10629 if (descriptors_constr.datalen > 0)
10630 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
10632 descriptors_constr.data = NULL;
10633 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
10634 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
10635 uint32_t descriptors_conv_27 = descriptors_vals[b];
10636 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
10637 FREE((void*)descriptors_conv_27);
10638 descriptors_constr.data[b] = descriptors_conv_27_conv;
10640 LDKCVec_TxOutZ outputs_constr;
10641 outputs_constr.datalen = *((uint32_t*)outputs);
10642 if (outputs_constr.datalen > 0)
10643 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
10645 outputs_constr.data = NULL;
10646 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
10647 for (size_t h = 0; h < outputs_constr.datalen; h++) {
10648 uint32_t outputs_conv_7 = outputs_vals[h];
10649 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
10650 FREE((void*)outputs_conv_7);
10651 outputs_constr.data[h] = outputs_conv_7_conv;
10653 LDKCVec_u8Z change_destination_script_ref;
10654 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
10655 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
10656 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
10657 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10658 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
10659 return (long)ret_conv;
10662 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
10663 LDKKeysManager this_arg_conv;
10664 this_arg_conv.inner = (void*)(this_arg & (~1));
10665 this_arg_conv.is_owned = false;
10666 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
10667 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
10671 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
10672 LDKChannelManager this_obj_conv;
10673 this_obj_conv.inner = (void*)(this_obj & (~1));
10674 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10675 ChannelManager_free(this_obj_conv);
10678 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
10679 LDKChainParameters this_obj_conv;
10680 this_obj_conv.inner = (void*)(this_obj & (~1));
10681 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10682 ChainParameters_free(this_obj_conv);
10685 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
10686 LDKChainParameters this_ptr_conv;
10687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10688 this_ptr_conv.is_owned = false;
10689 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
10693 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
10694 LDKChainParameters this_ptr_conv;
10695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10696 this_ptr_conv.is_owned = false;
10697 LDKNetwork val_conv = LDKNetwork_from_js(val);
10698 ChainParameters_set_network(&this_ptr_conv, val_conv);
10701 int8_tArray __attribute__((visibility("default"))) TS_ChainParameters_get_latest_hash(uint32_t this_ptr) {
10702 LDKChainParameters this_ptr_conv;
10703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10704 this_ptr_conv.is_owned = false;
10705 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10706 memcpy((uint8_t*)(ret_arr + 4), *ChainParameters_get_latest_hash(&this_ptr_conv), 32);
10710 void __attribute__((visibility("default"))) TS_ChainParameters_set_latest_hash(uint32_t this_ptr, int8_tArray val) {
10711 LDKChainParameters this_ptr_conv;
10712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10713 this_ptr_conv.is_owned = false;
10714 LDKThirtyTwoBytes val_ref;
10715 CHECK(*((uint32_t*)val) == 32);
10716 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10717 ChainParameters_set_latest_hash(&this_ptr_conv, val_ref);
10720 int64_t __attribute__((visibility("default"))) TS_ChainParameters_get_latest_height(uint32_t this_ptr) {
10721 LDKChainParameters this_ptr_conv;
10722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10723 this_ptr_conv.is_owned = false;
10724 int64_t ret_val = ChainParameters_get_latest_height(&this_ptr_conv);
10728 void __attribute__((visibility("default"))) TS_ChainParameters_set_latest_height(uint32_t this_ptr, int64_t val) {
10729 LDKChainParameters this_ptr_conv;
10730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10731 this_ptr_conv.is_owned = false;
10732 ChainParameters_set_latest_height(&this_ptr_conv, val);
10735 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, int8_tArray latest_hash_arg, int64_t latest_height_arg) {
10736 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
10737 LDKThirtyTwoBytes latest_hash_arg_ref;
10738 CHECK(*((uint32_t*)latest_hash_arg) == 32);
10739 memcpy(latest_hash_arg_ref.data, (uint8_t*)(latest_hash_arg + 4), 32);
10740 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, latest_hash_arg_ref, latest_height_arg);
10741 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10742 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10743 long ret_ref = (long)ret_var.inner;
10744 if (ret_var.is_owned) {
10750 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
10751 LDKChannelDetails this_obj_conv;
10752 this_obj_conv.inner = (void*)(this_obj & (~1));
10753 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10754 ChannelDetails_free(this_obj_conv);
10757 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
10758 LDKChannelDetails this_ptr_conv;
10759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10760 this_ptr_conv.is_owned = false;
10761 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10762 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
10766 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
10767 LDKChannelDetails this_ptr_conv;
10768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10769 this_ptr_conv.is_owned = false;
10770 LDKThirtyTwoBytes val_ref;
10771 CHECK(*((uint32_t*)val) == 32);
10772 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10773 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
10776 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_remote_network_id(uint32_t this_ptr) {
10777 LDKChannelDetails this_ptr_conv;
10778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10779 this_ptr_conv.is_owned = false;
10780 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10781 memcpy((uint8_t*)(ret_arr + 4), ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form, 33);
10785 void __attribute__((visibility("default"))) TS_ChannelDetails_set_remote_network_id(uint32_t this_ptr, int8_tArray val) {
10786 LDKChannelDetails this_ptr_conv;
10787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10788 this_ptr_conv.is_owned = false;
10789 LDKPublicKey val_ref;
10790 CHECK(*((uint32_t*)val) == 33);
10791 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10792 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
10795 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty_features(uint32_t this_ptr) {
10796 LDKChannelDetails this_ptr_conv;
10797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10798 this_ptr_conv.is_owned = false;
10799 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
10800 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10801 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10802 long ret_ref = (long)ret_var.inner;
10803 if (ret_var.is_owned) {
10809 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty_features(uint32_t this_ptr, uint32_t val) {
10810 LDKChannelDetails this_ptr_conv;
10811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10812 this_ptr_conv.is_owned = false;
10813 LDKInitFeatures val_conv;
10814 val_conv.inner = (void*)(val & (~1));
10815 val_conv.is_owned = (val & 1) || (val == 0);
10816 val_conv = InitFeatures_clone(&val_conv);
10817 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
10820 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
10821 LDKChannelDetails this_ptr_conv;
10822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10823 this_ptr_conv.is_owned = false;
10824 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
10828 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
10829 LDKChannelDetails this_ptr_conv;
10830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10831 this_ptr_conv.is_owned = false;
10832 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
10835 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_id(uint32_t this_ptr) {
10836 LDKChannelDetails this_ptr_conv;
10837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10838 this_ptr_conv.is_owned = false;
10839 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
10843 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_id(uint32_t this_ptr, int64_t val) {
10844 LDKChannelDetails this_ptr_conv;
10845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10846 this_ptr_conv.is_owned = false;
10847 ChannelDetails_set_user_id(&this_ptr_conv, val);
10850 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
10851 LDKChannelDetails this_ptr_conv;
10852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10853 this_ptr_conv.is_owned = false;
10854 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
10858 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
10859 LDKChannelDetails this_ptr_conv;
10860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10861 this_ptr_conv.is_owned = false;
10862 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
10865 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
10866 LDKChannelDetails this_ptr_conv;
10867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10868 this_ptr_conv.is_owned = false;
10869 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
10873 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
10874 LDKChannelDetails this_ptr_conv;
10875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10876 this_ptr_conv.is_owned = false;
10877 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
10880 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_live(uint32_t this_ptr) {
10881 LDKChannelDetails this_ptr_conv;
10882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10883 this_ptr_conv.is_owned = false;
10884 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
10888 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_live(uint32_t this_ptr, jboolean val) {
10889 LDKChannelDetails this_ptr_conv;
10890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10891 this_ptr_conv.is_owned = false;
10892 ChannelDetails_set_is_live(&this_ptr_conv, val);
10895 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
10896 LDKChannelDetails orig_conv;
10897 orig_conv.inner = (void*)(orig & (~1));
10898 orig_conv.is_owned = false;
10899 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
10900 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10901 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10902 long ret_ref = (long)ret_var.inner;
10903 if (ret_var.is_owned) {
10909 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
10910 if ((this_ptr & 1) != 0) return;
10911 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
10912 FREE((void*)this_ptr);
10913 PaymentSendFailure_free(this_ptr_conv);
10916 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
10917 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
10918 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
10919 *ret_copy = PaymentSendFailure_clone(orig_conv);
10920 long ret_ref = (long)ret_copy;
10924 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_new(uint32_t fee_est, uint32_t chain_monitor, uint32_t tx_broadcaster, uint32_t logger, uint32_t keys_manager, uint32_t config, uint32_t params) {
10925 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
10926 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
10927 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
10928 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10929 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
10930 LDKUserConfig config_conv;
10931 config_conv.inner = (void*)(config & (~1));
10932 config_conv.is_owned = (config & 1) || (config == 0);
10933 config_conv = UserConfig_clone(&config_conv);
10934 LDKChainParameters params_conv;
10935 params_conv.inner = (void*)(params & (~1));
10936 params_conv.is_owned = (params & 1) || (params == 0);
10937 // Warning: we need a move here but no clone is available for LDKChainParameters
10938 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
10939 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10940 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10941 long ret_ref = (long)ret_var.inner;
10942 if (ret_var.is_owned) {
10948 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) {
10949 LDKChannelManager this_arg_conv;
10950 this_arg_conv.inner = (void*)(this_arg & (~1));
10951 this_arg_conv.is_owned = false;
10952 LDKPublicKey their_network_key_ref;
10953 CHECK(*((uint32_t*)their_network_key) == 33);
10954 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
10955 LDKUserConfig override_config_conv;
10956 override_config_conv.inner = (void*)(override_config & (~1));
10957 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
10958 override_config_conv = UserConfig_clone(&override_config_conv);
10959 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10960 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
10961 return (long)ret_conv;
10964 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
10965 LDKChannelManager this_arg_conv;
10966 this_arg_conv.inner = (void*)(this_arg & (~1));
10967 this_arg_conv.is_owned = false;
10968 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
10969 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10970 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10971 for (size_t q = 0; q < ret_var.datalen; q++) {
10972 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
10973 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10974 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10975 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
10976 if (ret_conv_16_var.is_owned) {
10977 ret_conv_16_ref |= 1;
10979 ret_arr_ptr[q] = ret_conv_16_ref;
10981 FREE(ret_var.data);
10985 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
10986 LDKChannelManager this_arg_conv;
10987 this_arg_conv.inner = (void*)(this_arg & (~1));
10988 this_arg_conv.is_owned = false;
10989 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
10990 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10991 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10992 for (size_t q = 0; q < ret_var.datalen; q++) {
10993 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
10994 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10995 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10996 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
10997 if (ret_conv_16_var.is_owned) {
10998 ret_conv_16_ref |= 1;
11000 ret_arr_ptr[q] = ret_conv_16_ref;
11002 FREE(ret_var.data);
11006 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
11007 LDKChannelManager this_arg_conv;
11008 this_arg_conv.inner = (void*)(this_arg & (~1));
11009 this_arg_conv.is_owned = false;
11010 unsigned char channel_id_arr[32];
11011 CHECK(*((uint32_t*)channel_id) == 32);
11012 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
11013 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
11014 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11015 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
11016 return (long)ret_conv;
11019 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
11020 LDKChannelManager this_arg_conv;
11021 this_arg_conv.inner = (void*)(this_arg & (~1));
11022 this_arg_conv.is_owned = false;
11023 unsigned char channel_id_arr[32];
11024 CHECK(*((uint32_t*)channel_id) == 32);
11025 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
11026 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
11027 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11028 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
11029 return (long)ret_conv;
11032 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
11033 LDKChannelManager this_arg_conv;
11034 this_arg_conv.inner = (void*)(this_arg & (~1));
11035 this_arg_conv.is_owned = false;
11036 ChannelManager_force_close_all_channels(&this_arg_conv);
11039 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
11040 LDKChannelManager this_arg_conv;
11041 this_arg_conv.inner = (void*)(this_arg & (~1));
11042 this_arg_conv.is_owned = false;
11043 LDKRoute route_conv;
11044 route_conv.inner = (void*)(route & (~1));
11045 route_conv.is_owned = false;
11046 LDKThirtyTwoBytes payment_hash_ref;
11047 CHECK(*((uint32_t*)payment_hash) == 32);
11048 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
11049 LDKThirtyTwoBytes payment_secret_ref;
11050 CHECK(*((uint32_t*)payment_secret) == 32);
11051 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
11052 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11053 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
11054 return (long)ret_conv;
11057 void __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, uint32_t funding_txo) {
11058 LDKChannelManager this_arg_conv;
11059 this_arg_conv.inner = (void*)(this_arg & (~1));
11060 this_arg_conv.is_owned = false;
11061 unsigned char temporary_channel_id_arr[32];
11062 CHECK(*((uint32_t*)temporary_channel_id) == 32);
11063 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
11064 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
11065 LDKOutPoint funding_txo_conv;
11066 funding_txo_conv.inner = (void*)(funding_txo & (~1));
11067 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
11068 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
11069 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
11072 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
11073 LDKChannelManager this_arg_conv;
11074 this_arg_conv.inner = (void*)(this_arg & (~1));
11075 this_arg_conv.is_owned = false;
11076 LDKThreeBytes rgb_ref;
11077 CHECK(*((uint32_t*)rgb) == 3);
11078 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
11079 LDKThirtyTwoBytes alias_ref;
11080 CHECK(*((uint32_t*)alias) == 32);
11081 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
11082 LDKCVec_NetAddressZ addresses_constr;
11083 addresses_constr.datalen = *((uint32_t*)addresses);
11084 if (addresses_constr.datalen > 0)
11085 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11087 addresses_constr.data = NULL;
11088 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
11089 for (size_t m = 0; m < addresses_constr.datalen; m++) {
11090 uint32_t addresses_conv_12 = addresses_vals[m];
11091 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
11092 FREE((void*)addresses_conv_12);
11093 addresses_constr.data[m] = addresses_conv_12_conv;
11095 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
11098 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
11099 LDKChannelManager this_arg_conv;
11100 this_arg_conv.inner = (void*)(this_arg & (~1));
11101 this_arg_conv.is_owned = false;
11102 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
11105 void __attribute__((visibility("default"))) TS_ChannelManager_timer_chan_freshness_every_min(uint32_t this_arg) {
11106 LDKChannelManager this_arg_conv;
11107 this_arg_conv.inner = (void*)(this_arg & (~1));
11108 this_arg_conv.is_owned = false;
11109 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
11112 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
11113 LDKChannelManager this_arg_conv;
11114 this_arg_conv.inner = (void*)(this_arg & (~1));
11115 this_arg_conv.is_owned = false;
11116 unsigned char payment_hash_arr[32];
11117 CHECK(*((uint32_t*)payment_hash) == 32);
11118 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
11119 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
11120 LDKThirtyTwoBytes payment_secret_ref;
11121 CHECK(*((uint32_t*)payment_secret) == 32);
11122 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
11123 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
11127 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t expected_amount) {
11128 LDKChannelManager this_arg_conv;
11129 this_arg_conv.inner = (void*)(this_arg & (~1));
11130 this_arg_conv.is_owned = false;
11131 LDKThirtyTwoBytes payment_preimage_ref;
11132 CHECK(*((uint32_t*)payment_preimage) == 32);
11133 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
11134 LDKThirtyTwoBytes payment_secret_ref;
11135 CHECK(*((uint32_t*)payment_secret) == 32);
11136 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
11137 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
11141 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
11142 LDKChannelManager this_arg_conv;
11143 this_arg_conv.inner = (void*)(this_arg & (~1));
11144 this_arg_conv.is_owned = false;
11145 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11146 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
11150 void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
11151 LDKChannelManager this_arg_conv;
11152 this_arg_conv.inner = (void*)(this_arg & (~1));
11153 this_arg_conv.is_owned = false;
11154 LDKOutPoint funding_txo_conv;
11155 funding_txo_conv.inner = (void*)(funding_txo & (~1));
11156 funding_txo_conv.is_owned = false;
11157 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
11160 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
11161 LDKChannelManager this_arg_conv;
11162 this_arg_conv.inner = (void*)(this_arg & (~1));
11163 this_arg_conv.is_owned = false;
11164 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
11165 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
11169 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
11170 LDKChannelManager this_arg_conv;
11171 this_arg_conv.inner = (void*)(this_arg & (~1));
11172 this_arg_conv.is_owned = false;
11173 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
11174 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
11178 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
11179 LDKChannelManager this_arg_conv;
11180 this_arg_conv.inner = (void*)(this_arg & (~1));
11181 this_arg_conv.is_owned = false;
11182 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
11183 *ret = ChannelManager_as_Listen(&this_arg_conv);
11187 void __attribute__((visibility("default"))) TS_ChannelManager_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
11188 LDKChannelManager this_arg_conv;
11189 this_arg_conv.inner = (void*)(this_arg & (~1));
11190 this_arg_conv.is_owned = false;
11191 unsigned char header_arr[80];
11192 CHECK(*((uint32_t*)header) == 80);
11193 memcpy(header_arr, (uint8_t*)(header + 4), 80);
11194 unsigned char (*header_ref)[80] = &header_arr;
11195 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11196 txdata_constr.datalen = *((uint32_t*)txdata);
11197 if (txdata_constr.datalen > 0)
11198 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11200 txdata_constr.data = NULL;
11201 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
11202 for (size_t e = 0; e < txdata_constr.datalen; e++) {
11203 uint32_t txdata_conv_30 = txdata_vals[e];
11204 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
11205 FREE((void*)txdata_conv_30);
11206 txdata_constr.data[e] = txdata_conv_30_conv;
11208 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
11211 void __attribute__((visibility("default"))) TS_ChannelManager_block_disconnected(uint32_t this_arg, int8_tArray header) {
11212 LDKChannelManager this_arg_conv;
11213 this_arg_conv.inner = (void*)(this_arg & (~1));
11214 this_arg_conv.is_owned = false;
11215 unsigned char header_arr[80];
11216 CHECK(*((uint32_t*)header) == 80);
11217 memcpy(header_arr, (uint8_t*)(header + 4), 80);
11218 unsigned char (*header_ref)[80] = &header_arr;
11219 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
11222 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
11223 LDKChannelManager this_arg_conv;
11224 this_arg_conv.inner = (void*)(this_arg & (~1));
11225 this_arg_conv.is_owned = false;
11226 ChannelManager_await_persistable_update(&this_arg_conv);
11229 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
11230 LDKChannelManager this_arg_conv;
11231 this_arg_conv.inner = (void*)(this_arg & (~1));
11232 this_arg_conv.is_owned = false;
11233 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
11234 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
11238 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
11239 LDKChannelManager obj_conv;
11240 obj_conv.inner = (void*)(obj & (~1));
11241 obj_conv.is_owned = false;
11242 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
11243 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11244 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
11245 CVec_u8Z_free(ret_var);
11249 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
11250 LDKChannelManagerReadArgs this_obj_conv;
11251 this_obj_conv.inner = (void*)(this_obj & (~1));
11252 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11253 ChannelManagerReadArgs_free(this_obj_conv);
11256 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
11257 LDKChannelManagerReadArgs this_ptr_conv;
11258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11259 this_ptr_conv.is_owned = false;
11260 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
11264 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
11265 LDKChannelManagerReadArgs this_ptr_conv;
11266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11267 this_ptr_conv.is_owned = false;
11268 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
11269 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
11272 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
11273 LDKChannelManagerReadArgs this_ptr_conv;
11274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11275 this_ptr_conv.is_owned = false;
11276 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
11280 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
11281 LDKChannelManagerReadArgs this_ptr_conv;
11282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11283 this_ptr_conv.is_owned = false;
11284 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
11285 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
11288 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
11289 LDKChannelManagerReadArgs this_ptr_conv;
11290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11291 this_ptr_conv.is_owned = false;
11292 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
11296 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
11297 LDKChannelManagerReadArgs this_ptr_conv;
11298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11299 this_ptr_conv.is_owned = false;
11300 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
11301 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
11304 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
11305 LDKChannelManagerReadArgs this_ptr_conv;
11306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11307 this_ptr_conv.is_owned = false;
11308 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
11312 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
11313 LDKChannelManagerReadArgs this_ptr_conv;
11314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11315 this_ptr_conv.is_owned = false;
11316 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
11317 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
11320 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
11321 LDKChannelManagerReadArgs this_ptr_conv;
11322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11323 this_ptr_conv.is_owned = false;
11324 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
11328 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
11329 LDKChannelManagerReadArgs this_ptr_conv;
11330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11331 this_ptr_conv.is_owned = false;
11332 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
11333 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
11336 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
11337 LDKChannelManagerReadArgs this_ptr_conv;
11338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11339 this_ptr_conv.is_owned = false;
11340 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
11341 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11342 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11343 long ret_ref = (long)ret_var.inner;
11344 if (ret_var.is_owned) {
11350 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
11351 LDKChannelManagerReadArgs this_ptr_conv;
11352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11353 this_ptr_conv.is_owned = false;
11354 LDKUserConfig val_conv;
11355 val_conv.inner = (void*)(val & (~1));
11356 val_conv.is_owned = (val & 1) || (val == 0);
11357 val_conv = UserConfig_clone(&val_conv);
11358 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
11361 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) {
11362 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
11363 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
11364 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
11365 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
11366 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
11367 LDKUserConfig default_config_conv;
11368 default_config_conv.inner = (void*)(default_config & (~1));
11369 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
11370 default_config_conv = UserConfig_clone(&default_config_conv);
11371 LDKCVec_ChannelMonitorZ channel_monitors_constr;
11372 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
11373 if (channel_monitors_constr.datalen > 0)
11374 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
11376 channel_monitors_constr.data = NULL;
11377 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
11378 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
11379 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
11380 LDKChannelMonitor channel_monitors_conv_16_conv;
11381 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
11382 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
11383 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
11385 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);
11386 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11387 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11388 long ret_ref = (long)ret_var.inner;
11389 if (ret_var.is_owned) {
11395 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
11396 LDKu8slice ser_ref;
11397 ser_ref.datalen = *((uint32_t*)ser);
11398 ser_ref.data = (int8_t*)(ser + 4);
11399 LDKChannelManagerReadArgs arg_conv;
11400 arg_conv.inner = (void*)(arg & (~1));
11401 arg_conv.is_owned = (arg & 1) || (arg == 0);
11402 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
11403 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
11404 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
11405 return (long)ret_conv;
11408 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
11409 LDKDecodeError this_obj_conv;
11410 this_obj_conv.inner = (void*)(this_obj & (~1));
11411 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11412 DecodeError_free(this_obj_conv);
11415 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
11416 LDKDecodeError orig_conv;
11417 orig_conv.inner = (void*)(orig & (~1));
11418 orig_conv.is_owned = false;
11419 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
11420 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11421 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11422 long ret_ref = (long)ret_var.inner;
11423 if (ret_var.is_owned) {
11429 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
11430 LDKInit this_obj_conv;
11431 this_obj_conv.inner = (void*)(this_obj & (~1));
11432 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11433 Init_free(this_obj_conv);
11436 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
11437 LDKInit this_ptr_conv;
11438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11439 this_ptr_conv.is_owned = false;
11440 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
11441 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11442 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11443 long ret_ref = (long)ret_var.inner;
11444 if (ret_var.is_owned) {
11450 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
11451 LDKInit this_ptr_conv;
11452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11453 this_ptr_conv.is_owned = false;
11454 LDKInitFeatures val_conv;
11455 val_conv.inner = (void*)(val & (~1));
11456 val_conv.is_owned = (val & 1) || (val == 0);
11457 val_conv = InitFeatures_clone(&val_conv);
11458 Init_set_features(&this_ptr_conv, val_conv);
11461 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
11462 LDKInitFeatures features_arg_conv;
11463 features_arg_conv.inner = (void*)(features_arg & (~1));
11464 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
11465 features_arg_conv = InitFeatures_clone(&features_arg_conv);
11466 LDKInit ret_var = Init_new(features_arg_conv);
11467 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11468 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11469 long ret_ref = (long)ret_var.inner;
11470 if (ret_var.is_owned) {
11476 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
11478 orig_conv.inner = (void*)(orig & (~1));
11479 orig_conv.is_owned = false;
11480 LDKInit ret_var = Init_clone(&orig_conv);
11481 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11482 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11483 long ret_ref = (long)ret_var.inner;
11484 if (ret_var.is_owned) {
11490 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
11491 LDKErrorMessage this_obj_conv;
11492 this_obj_conv.inner = (void*)(this_obj & (~1));
11493 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11494 ErrorMessage_free(this_obj_conv);
11497 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
11498 LDKErrorMessage this_ptr_conv;
11499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11500 this_ptr_conv.is_owned = false;
11501 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11502 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
11506 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
11507 LDKErrorMessage this_ptr_conv;
11508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11509 this_ptr_conv.is_owned = false;
11510 LDKThirtyTwoBytes val_ref;
11511 CHECK(*((uint32_t*)val) == 32);
11512 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11513 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
11516 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
11517 LDKErrorMessage this_ptr_conv;
11518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11519 this_ptr_conv.is_owned = false;
11520 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
11521 jstring _conv = str_ref_to_ts(_str.chars, _str.len);
11525 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, int8_tArray val) {
11526 LDKErrorMessage this_ptr_conv;
11527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11528 this_ptr_conv.is_owned = false;
11529 LDKCVec_u8Z val_ref;
11530 val_ref.datalen = *((uint32_t*)val);
11531 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
11532 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
11533 ErrorMessage_set_data(&this_ptr_conv, val_ref);
11536 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
11537 LDKThirtyTwoBytes channel_id_arg_ref;
11538 CHECK(*((uint32_t*)channel_id_arg) == 32);
11539 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
11540 LDKCVec_u8Z data_arg_ref;
11541 data_arg_ref.datalen = *((uint32_t*)data_arg);
11542 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
11543 memcpy(data_arg_ref.data, (uint8_t*)(data_arg + 4), data_arg_ref.datalen);
11544 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
11545 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11546 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11547 long ret_ref = (long)ret_var.inner;
11548 if (ret_var.is_owned) {
11554 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
11555 LDKErrorMessage orig_conv;
11556 orig_conv.inner = (void*)(orig & (~1));
11557 orig_conv.is_owned = false;
11558 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
11559 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11560 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11561 long ret_ref = (long)ret_var.inner;
11562 if (ret_var.is_owned) {
11568 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
11569 LDKPing this_obj_conv;
11570 this_obj_conv.inner = (void*)(this_obj & (~1));
11571 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11572 Ping_free(this_obj_conv);
11575 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
11576 LDKPing this_ptr_conv;
11577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11578 this_ptr_conv.is_owned = false;
11579 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
11583 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
11584 LDKPing this_ptr_conv;
11585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11586 this_ptr_conv.is_owned = false;
11587 Ping_set_ponglen(&this_ptr_conv, val);
11590 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
11591 LDKPing this_ptr_conv;
11592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11593 this_ptr_conv.is_owned = false;
11594 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
11598 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
11599 LDKPing this_ptr_conv;
11600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11601 this_ptr_conv.is_owned = false;
11602 Ping_set_byteslen(&this_ptr_conv, val);
11605 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
11606 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
11607 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11608 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11609 long ret_ref = (long)ret_var.inner;
11610 if (ret_var.is_owned) {
11616 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
11618 orig_conv.inner = (void*)(orig & (~1));
11619 orig_conv.is_owned = false;
11620 LDKPing ret_var = Ping_clone(&orig_conv);
11621 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11622 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11623 long ret_ref = (long)ret_var.inner;
11624 if (ret_var.is_owned) {
11630 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
11631 LDKPong this_obj_conv;
11632 this_obj_conv.inner = (void*)(this_obj & (~1));
11633 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11634 Pong_free(this_obj_conv);
11637 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
11638 LDKPong this_ptr_conv;
11639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11640 this_ptr_conv.is_owned = false;
11641 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
11645 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
11646 LDKPong this_ptr_conv;
11647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11648 this_ptr_conv.is_owned = false;
11649 Pong_set_byteslen(&this_ptr_conv, val);
11652 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
11653 LDKPong ret_var = Pong_new(byteslen_arg);
11654 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11655 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11656 long ret_ref = (long)ret_var.inner;
11657 if (ret_var.is_owned) {
11663 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
11665 orig_conv.inner = (void*)(orig & (~1));
11666 orig_conv.is_owned = false;
11667 LDKPong ret_var = Pong_clone(&orig_conv);
11668 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11669 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11670 long ret_ref = (long)ret_var.inner;
11671 if (ret_var.is_owned) {
11677 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
11678 LDKOpenChannel this_obj_conv;
11679 this_obj_conv.inner = (void*)(this_obj & (~1));
11680 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11681 OpenChannel_free(this_obj_conv);
11684 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
11685 LDKOpenChannel this_ptr_conv;
11686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11687 this_ptr_conv.is_owned = false;
11688 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11689 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
11693 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
11694 LDKOpenChannel this_ptr_conv;
11695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11696 this_ptr_conv.is_owned = false;
11697 LDKThirtyTwoBytes val_ref;
11698 CHECK(*((uint32_t*)val) == 32);
11699 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11700 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
11703 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
11704 LDKOpenChannel this_ptr_conv;
11705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11706 this_ptr_conv.is_owned = false;
11707 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11708 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
11712 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
11713 LDKOpenChannel this_ptr_conv;
11714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11715 this_ptr_conv.is_owned = false;
11716 LDKThirtyTwoBytes val_ref;
11717 CHECK(*((uint32_t*)val) == 32);
11718 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11719 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
11722 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
11723 LDKOpenChannel this_ptr_conv;
11724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11725 this_ptr_conv.is_owned = false;
11726 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
11730 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
11731 LDKOpenChannel this_ptr_conv;
11732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11733 this_ptr_conv.is_owned = false;
11734 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
11737 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
11738 LDKOpenChannel this_ptr_conv;
11739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11740 this_ptr_conv.is_owned = false;
11741 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
11745 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
11746 LDKOpenChannel this_ptr_conv;
11747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11748 this_ptr_conv.is_owned = false;
11749 OpenChannel_set_push_msat(&this_ptr_conv, val);
11752 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
11753 LDKOpenChannel this_ptr_conv;
11754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11755 this_ptr_conv.is_owned = false;
11756 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
11760 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
11761 LDKOpenChannel this_ptr_conv;
11762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11763 this_ptr_conv.is_owned = false;
11764 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
11767 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
11768 LDKOpenChannel this_ptr_conv;
11769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11770 this_ptr_conv.is_owned = false;
11771 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
11775 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
11776 LDKOpenChannel this_ptr_conv;
11777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11778 this_ptr_conv.is_owned = false;
11779 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
11782 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
11783 LDKOpenChannel this_ptr_conv;
11784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11785 this_ptr_conv.is_owned = false;
11786 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
11790 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
11791 LDKOpenChannel this_ptr_conv;
11792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11793 this_ptr_conv.is_owned = false;
11794 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
11797 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
11798 LDKOpenChannel this_ptr_conv;
11799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11800 this_ptr_conv.is_owned = false;
11801 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
11805 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
11806 LDKOpenChannel this_ptr_conv;
11807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11808 this_ptr_conv.is_owned = false;
11809 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
11812 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
11813 LDKOpenChannel this_ptr_conv;
11814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11815 this_ptr_conv.is_owned = false;
11816 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
11820 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
11821 LDKOpenChannel this_ptr_conv;
11822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11823 this_ptr_conv.is_owned = false;
11824 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
11827 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
11828 LDKOpenChannel this_ptr_conv;
11829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11830 this_ptr_conv.is_owned = false;
11831 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
11835 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
11836 LDKOpenChannel this_ptr_conv;
11837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11838 this_ptr_conv.is_owned = false;
11839 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
11842 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
11843 LDKOpenChannel this_ptr_conv;
11844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11845 this_ptr_conv.is_owned = false;
11846 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
11850 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
11851 LDKOpenChannel this_ptr_conv;
11852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11853 this_ptr_conv.is_owned = false;
11854 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
11857 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
11858 LDKOpenChannel this_ptr_conv;
11859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11860 this_ptr_conv.is_owned = false;
11861 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11862 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
11866 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
11867 LDKOpenChannel this_ptr_conv;
11868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11869 this_ptr_conv.is_owned = false;
11870 LDKPublicKey val_ref;
11871 CHECK(*((uint32_t*)val) == 33);
11872 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11873 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
11876 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
11877 LDKOpenChannel this_ptr_conv;
11878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11879 this_ptr_conv.is_owned = false;
11880 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11881 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
11885 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
11886 LDKOpenChannel this_ptr_conv;
11887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11888 this_ptr_conv.is_owned = false;
11889 LDKPublicKey val_ref;
11890 CHECK(*((uint32_t*)val) == 33);
11891 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11892 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
11895 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
11896 LDKOpenChannel this_ptr_conv;
11897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11898 this_ptr_conv.is_owned = false;
11899 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11900 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
11904 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
11905 LDKOpenChannel this_ptr_conv;
11906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11907 this_ptr_conv.is_owned = false;
11908 LDKPublicKey val_ref;
11909 CHECK(*((uint32_t*)val) == 33);
11910 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11911 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
11914 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
11915 LDKOpenChannel this_ptr_conv;
11916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11917 this_ptr_conv.is_owned = false;
11918 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11919 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
11923 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
11924 LDKOpenChannel this_ptr_conv;
11925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11926 this_ptr_conv.is_owned = false;
11927 LDKPublicKey val_ref;
11928 CHECK(*((uint32_t*)val) == 33);
11929 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11930 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
11933 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
11934 LDKOpenChannel this_ptr_conv;
11935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11936 this_ptr_conv.is_owned = false;
11937 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11938 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
11942 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
11943 LDKOpenChannel this_ptr_conv;
11944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11945 this_ptr_conv.is_owned = false;
11946 LDKPublicKey val_ref;
11947 CHECK(*((uint32_t*)val) == 33);
11948 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11949 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
11952 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
11953 LDKOpenChannel this_ptr_conv;
11954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11955 this_ptr_conv.is_owned = false;
11956 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11957 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
11961 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
11962 LDKOpenChannel this_ptr_conv;
11963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11964 this_ptr_conv.is_owned = false;
11965 LDKPublicKey val_ref;
11966 CHECK(*((uint32_t*)val) == 33);
11967 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11968 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
11971 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
11972 LDKOpenChannel this_ptr_conv;
11973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11974 this_ptr_conv.is_owned = false;
11975 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
11979 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
11980 LDKOpenChannel this_ptr_conv;
11981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11982 this_ptr_conv.is_owned = false;
11983 OpenChannel_set_channel_flags(&this_ptr_conv, val);
11986 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
11987 LDKOpenChannel orig_conv;
11988 orig_conv.inner = (void*)(orig & (~1));
11989 orig_conv.is_owned = false;
11990 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
11991 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11992 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11993 long ret_ref = (long)ret_var.inner;
11994 if (ret_var.is_owned) {
12000 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
12001 LDKAcceptChannel this_obj_conv;
12002 this_obj_conv.inner = (void*)(this_obj & (~1));
12003 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12004 AcceptChannel_free(this_obj_conv);
12007 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
12008 LDKAcceptChannel this_ptr_conv;
12009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12010 this_ptr_conv.is_owned = false;
12011 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12012 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
12016 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
12017 LDKAcceptChannel this_ptr_conv;
12018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12019 this_ptr_conv.is_owned = false;
12020 LDKThirtyTwoBytes val_ref;
12021 CHECK(*((uint32_t*)val) == 32);
12022 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12023 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
12026 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
12027 LDKAcceptChannel this_ptr_conv;
12028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12029 this_ptr_conv.is_owned = false;
12030 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
12034 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
12035 LDKAcceptChannel this_ptr_conv;
12036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12037 this_ptr_conv.is_owned = false;
12038 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
12041 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
12042 LDKAcceptChannel this_ptr_conv;
12043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12044 this_ptr_conv.is_owned = false;
12045 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
12049 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
12050 LDKAcceptChannel this_ptr_conv;
12051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12052 this_ptr_conv.is_owned = false;
12053 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
12056 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
12057 LDKAcceptChannel this_ptr_conv;
12058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12059 this_ptr_conv.is_owned = false;
12060 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
12064 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
12065 LDKAcceptChannel this_ptr_conv;
12066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12067 this_ptr_conv.is_owned = false;
12068 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
12071 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
12072 LDKAcceptChannel this_ptr_conv;
12073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12074 this_ptr_conv.is_owned = false;
12075 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
12079 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
12080 LDKAcceptChannel this_ptr_conv;
12081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12082 this_ptr_conv.is_owned = false;
12083 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
12086 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
12087 LDKAcceptChannel this_ptr_conv;
12088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12089 this_ptr_conv.is_owned = false;
12090 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
12094 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
12095 LDKAcceptChannel this_ptr_conv;
12096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12097 this_ptr_conv.is_owned = false;
12098 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
12101 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
12102 LDKAcceptChannel this_ptr_conv;
12103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12104 this_ptr_conv.is_owned = false;
12105 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
12109 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
12110 LDKAcceptChannel this_ptr_conv;
12111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12112 this_ptr_conv.is_owned = false;
12113 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
12116 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
12117 LDKAcceptChannel this_ptr_conv;
12118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12119 this_ptr_conv.is_owned = false;
12120 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
12124 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
12125 LDKAcceptChannel this_ptr_conv;
12126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12127 this_ptr_conv.is_owned = false;
12128 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
12131 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
12132 LDKAcceptChannel this_ptr_conv;
12133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12134 this_ptr_conv.is_owned = false;
12135 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12136 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
12140 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
12141 LDKAcceptChannel this_ptr_conv;
12142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12143 this_ptr_conv.is_owned = false;
12144 LDKPublicKey val_ref;
12145 CHECK(*((uint32_t*)val) == 33);
12146 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12147 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
12150 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
12151 LDKAcceptChannel this_ptr_conv;
12152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12153 this_ptr_conv.is_owned = false;
12154 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12155 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
12159 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
12160 LDKAcceptChannel this_ptr_conv;
12161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12162 this_ptr_conv.is_owned = false;
12163 LDKPublicKey val_ref;
12164 CHECK(*((uint32_t*)val) == 33);
12165 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12166 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
12169 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
12170 LDKAcceptChannel this_ptr_conv;
12171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12172 this_ptr_conv.is_owned = false;
12173 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12174 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
12178 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
12179 LDKAcceptChannel this_ptr_conv;
12180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12181 this_ptr_conv.is_owned = false;
12182 LDKPublicKey val_ref;
12183 CHECK(*((uint32_t*)val) == 33);
12184 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12185 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
12188 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
12189 LDKAcceptChannel this_ptr_conv;
12190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12191 this_ptr_conv.is_owned = false;
12192 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12193 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
12197 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
12198 LDKAcceptChannel this_ptr_conv;
12199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12200 this_ptr_conv.is_owned = false;
12201 LDKPublicKey val_ref;
12202 CHECK(*((uint32_t*)val) == 33);
12203 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12204 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12207 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
12208 LDKAcceptChannel this_ptr_conv;
12209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12210 this_ptr_conv.is_owned = false;
12211 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12212 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
12216 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
12217 LDKAcceptChannel this_ptr_conv;
12218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12219 this_ptr_conv.is_owned = false;
12220 LDKPublicKey val_ref;
12221 CHECK(*((uint32_t*)val) == 33);
12222 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12223 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
12226 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
12227 LDKAcceptChannel this_ptr_conv;
12228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12229 this_ptr_conv.is_owned = false;
12230 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12231 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12235 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12236 LDKAcceptChannel this_ptr_conv;
12237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12238 this_ptr_conv.is_owned = false;
12239 LDKPublicKey val_ref;
12240 CHECK(*((uint32_t*)val) == 33);
12241 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12242 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
12245 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
12246 LDKAcceptChannel orig_conv;
12247 orig_conv.inner = (void*)(orig & (~1));
12248 orig_conv.is_owned = false;
12249 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
12250 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12251 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12252 long ret_ref = (long)ret_var.inner;
12253 if (ret_var.is_owned) {
12259 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
12260 LDKFundingCreated this_obj_conv;
12261 this_obj_conv.inner = (void*)(this_obj & (~1));
12262 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12263 FundingCreated_free(this_obj_conv);
12266 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
12267 LDKFundingCreated this_ptr_conv;
12268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12269 this_ptr_conv.is_owned = false;
12270 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12271 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
12275 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
12276 LDKFundingCreated this_ptr_conv;
12277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12278 this_ptr_conv.is_owned = false;
12279 LDKThirtyTwoBytes val_ref;
12280 CHECK(*((uint32_t*)val) == 32);
12281 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12282 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
12285 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
12286 LDKFundingCreated this_ptr_conv;
12287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12288 this_ptr_conv.is_owned = false;
12289 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12290 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
12294 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
12295 LDKFundingCreated this_ptr_conv;
12296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12297 this_ptr_conv.is_owned = false;
12298 LDKThirtyTwoBytes val_ref;
12299 CHECK(*((uint32_t*)val) == 32);
12300 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12301 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
12304 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
12305 LDKFundingCreated this_ptr_conv;
12306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12307 this_ptr_conv.is_owned = false;
12308 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
12312 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
12313 LDKFundingCreated this_ptr_conv;
12314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12315 this_ptr_conv.is_owned = false;
12316 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
12319 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
12320 LDKFundingCreated this_ptr_conv;
12321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12322 this_ptr_conv.is_owned = false;
12323 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12324 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
12328 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
12329 LDKFundingCreated this_ptr_conv;
12330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12331 this_ptr_conv.is_owned = false;
12332 LDKSignature val_ref;
12333 CHECK(*((uint32_t*)val) == 64);
12334 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12335 FundingCreated_set_signature(&this_ptr_conv, val_ref);
12338 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) {
12339 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
12340 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
12341 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
12342 LDKThirtyTwoBytes funding_txid_arg_ref;
12343 CHECK(*((uint32_t*)funding_txid_arg) == 32);
12344 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
12345 LDKSignature signature_arg_ref;
12346 CHECK(*((uint32_t*)signature_arg) == 64);
12347 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
12348 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
12349 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12350 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12351 long ret_ref = (long)ret_var.inner;
12352 if (ret_var.is_owned) {
12358 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
12359 LDKFundingCreated orig_conv;
12360 orig_conv.inner = (void*)(orig & (~1));
12361 orig_conv.is_owned = false;
12362 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
12363 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12364 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12365 long ret_ref = (long)ret_var.inner;
12366 if (ret_var.is_owned) {
12372 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
12373 LDKFundingSigned this_obj_conv;
12374 this_obj_conv.inner = (void*)(this_obj & (~1));
12375 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12376 FundingSigned_free(this_obj_conv);
12379 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
12380 LDKFundingSigned this_ptr_conv;
12381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12382 this_ptr_conv.is_owned = false;
12383 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12384 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
12388 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12389 LDKFundingSigned this_ptr_conv;
12390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12391 this_ptr_conv.is_owned = false;
12392 LDKThirtyTwoBytes val_ref;
12393 CHECK(*((uint32_t*)val) == 32);
12394 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12395 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
12398 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
12399 LDKFundingSigned this_ptr_conv;
12400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12401 this_ptr_conv.is_owned = false;
12402 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12403 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
12407 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
12408 LDKFundingSigned this_ptr_conv;
12409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12410 this_ptr_conv.is_owned = false;
12411 LDKSignature val_ref;
12412 CHECK(*((uint32_t*)val) == 64);
12413 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12414 FundingSigned_set_signature(&this_ptr_conv, val_ref);
12417 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
12418 LDKThirtyTwoBytes channel_id_arg_ref;
12419 CHECK(*((uint32_t*)channel_id_arg) == 32);
12420 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12421 LDKSignature signature_arg_ref;
12422 CHECK(*((uint32_t*)signature_arg) == 64);
12423 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
12424 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
12425 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12426 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12427 long ret_ref = (long)ret_var.inner;
12428 if (ret_var.is_owned) {
12434 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
12435 LDKFundingSigned orig_conv;
12436 orig_conv.inner = (void*)(orig & (~1));
12437 orig_conv.is_owned = false;
12438 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
12439 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12440 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12441 long ret_ref = (long)ret_var.inner;
12442 if (ret_var.is_owned) {
12448 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
12449 LDKFundingLocked this_obj_conv;
12450 this_obj_conv.inner = (void*)(this_obj & (~1));
12451 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12452 FundingLocked_free(this_obj_conv);
12455 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
12456 LDKFundingLocked this_ptr_conv;
12457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12458 this_ptr_conv.is_owned = false;
12459 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12460 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
12464 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12465 LDKFundingLocked this_ptr_conv;
12466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12467 this_ptr_conv.is_owned = false;
12468 LDKThirtyTwoBytes val_ref;
12469 CHECK(*((uint32_t*)val) == 32);
12470 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12471 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
12474 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
12475 LDKFundingLocked this_ptr_conv;
12476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12477 this_ptr_conv.is_owned = false;
12478 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12479 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12483 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12484 LDKFundingLocked this_ptr_conv;
12485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12486 this_ptr_conv.is_owned = false;
12487 LDKPublicKey val_ref;
12488 CHECK(*((uint32_t*)val) == 33);
12489 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12490 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
12493 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
12494 LDKThirtyTwoBytes channel_id_arg_ref;
12495 CHECK(*((uint32_t*)channel_id_arg) == 32);
12496 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12497 LDKPublicKey next_per_commitment_point_arg_ref;
12498 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
12499 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
12500 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
12501 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12502 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12503 long ret_ref = (long)ret_var.inner;
12504 if (ret_var.is_owned) {
12510 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
12511 LDKFundingLocked orig_conv;
12512 orig_conv.inner = (void*)(orig & (~1));
12513 orig_conv.is_owned = false;
12514 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
12515 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12516 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12517 long ret_ref = (long)ret_var.inner;
12518 if (ret_var.is_owned) {
12524 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
12525 LDKShutdown this_obj_conv;
12526 this_obj_conv.inner = (void*)(this_obj & (~1));
12527 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12528 Shutdown_free(this_obj_conv);
12531 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
12532 LDKShutdown this_ptr_conv;
12533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12534 this_ptr_conv.is_owned = false;
12535 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12536 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
12540 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12541 LDKShutdown this_ptr_conv;
12542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12543 this_ptr_conv.is_owned = false;
12544 LDKThirtyTwoBytes val_ref;
12545 CHECK(*((uint32_t*)val) == 32);
12546 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12547 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
12550 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
12551 LDKShutdown this_ptr_conv;
12552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12553 this_ptr_conv.is_owned = false;
12554 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
12555 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12556 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12560 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
12561 LDKShutdown this_ptr_conv;
12562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12563 this_ptr_conv.is_owned = false;
12564 LDKCVec_u8Z val_ref;
12565 val_ref.datalen = *((uint32_t*)val);
12566 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
12567 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
12568 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
12571 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
12572 LDKThirtyTwoBytes channel_id_arg_ref;
12573 CHECK(*((uint32_t*)channel_id_arg) == 32);
12574 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12575 LDKCVec_u8Z scriptpubkey_arg_ref;
12576 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
12577 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
12578 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
12579 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
12580 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12581 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12582 long ret_ref = (long)ret_var.inner;
12583 if (ret_var.is_owned) {
12589 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
12590 LDKShutdown orig_conv;
12591 orig_conv.inner = (void*)(orig & (~1));
12592 orig_conv.is_owned = false;
12593 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
12594 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12595 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12596 long ret_ref = (long)ret_var.inner;
12597 if (ret_var.is_owned) {
12603 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
12604 LDKClosingSigned this_obj_conv;
12605 this_obj_conv.inner = (void*)(this_obj & (~1));
12606 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12607 ClosingSigned_free(this_obj_conv);
12610 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
12611 LDKClosingSigned this_ptr_conv;
12612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12613 this_ptr_conv.is_owned = false;
12614 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12615 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
12619 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12620 LDKClosingSigned this_ptr_conv;
12621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12622 this_ptr_conv.is_owned = false;
12623 LDKThirtyTwoBytes val_ref;
12624 CHECK(*((uint32_t*)val) == 32);
12625 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12626 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
12629 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
12630 LDKClosingSigned this_ptr_conv;
12631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12632 this_ptr_conv.is_owned = false;
12633 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
12637 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
12638 LDKClosingSigned this_ptr_conv;
12639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12640 this_ptr_conv.is_owned = false;
12641 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
12644 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
12645 LDKClosingSigned this_ptr_conv;
12646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12647 this_ptr_conv.is_owned = false;
12648 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12649 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
12653 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
12654 LDKClosingSigned this_ptr_conv;
12655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12656 this_ptr_conv.is_owned = false;
12657 LDKSignature val_ref;
12658 CHECK(*((uint32_t*)val) == 64);
12659 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12660 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
12663 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
12664 LDKThirtyTwoBytes channel_id_arg_ref;
12665 CHECK(*((uint32_t*)channel_id_arg) == 32);
12666 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12667 LDKSignature signature_arg_ref;
12668 CHECK(*((uint32_t*)signature_arg) == 64);
12669 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
12670 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
12671 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12672 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12673 long ret_ref = (long)ret_var.inner;
12674 if (ret_var.is_owned) {
12680 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
12681 LDKClosingSigned orig_conv;
12682 orig_conv.inner = (void*)(orig & (~1));
12683 orig_conv.is_owned = false;
12684 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
12685 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12686 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12687 long ret_ref = (long)ret_var.inner;
12688 if (ret_var.is_owned) {
12694 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
12695 LDKUpdateAddHTLC this_obj_conv;
12696 this_obj_conv.inner = (void*)(this_obj & (~1));
12697 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12698 UpdateAddHTLC_free(this_obj_conv);
12701 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
12702 LDKUpdateAddHTLC this_ptr_conv;
12703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12704 this_ptr_conv.is_owned = false;
12705 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12706 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
12710 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12711 LDKUpdateAddHTLC this_ptr_conv;
12712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12713 this_ptr_conv.is_owned = false;
12714 LDKThirtyTwoBytes val_ref;
12715 CHECK(*((uint32_t*)val) == 32);
12716 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12717 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
12720 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
12721 LDKUpdateAddHTLC this_ptr_conv;
12722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12723 this_ptr_conv.is_owned = false;
12724 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
12728 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
12729 LDKUpdateAddHTLC this_ptr_conv;
12730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12731 this_ptr_conv.is_owned = false;
12732 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
12735 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
12736 LDKUpdateAddHTLC this_ptr_conv;
12737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12738 this_ptr_conv.is_owned = false;
12739 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
12743 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
12744 LDKUpdateAddHTLC this_ptr_conv;
12745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12746 this_ptr_conv.is_owned = false;
12747 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
12750 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
12751 LDKUpdateAddHTLC this_ptr_conv;
12752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12753 this_ptr_conv.is_owned = false;
12754 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12755 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
12759 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
12760 LDKUpdateAddHTLC this_ptr_conv;
12761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12762 this_ptr_conv.is_owned = false;
12763 LDKThirtyTwoBytes val_ref;
12764 CHECK(*((uint32_t*)val) == 32);
12765 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12766 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
12769 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
12770 LDKUpdateAddHTLC this_ptr_conv;
12771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12772 this_ptr_conv.is_owned = false;
12773 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
12777 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
12778 LDKUpdateAddHTLC this_ptr_conv;
12779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12780 this_ptr_conv.is_owned = false;
12781 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
12784 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
12785 LDKUpdateAddHTLC orig_conv;
12786 orig_conv.inner = (void*)(orig & (~1));
12787 orig_conv.is_owned = false;
12788 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
12789 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12790 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12791 long ret_ref = (long)ret_var.inner;
12792 if (ret_var.is_owned) {
12798 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
12799 LDKUpdateFulfillHTLC this_obj_conv;
12800 this_obj_conv.inner = (void*)(this_obj & (~1));
12801 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12802 UpdateFulfillHTLC_free(this_obj_conv);
12805 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
12806 LDKUpdateFulfillHTLC this_ptr_conv;
12807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12808 this_ptr_conv.is_owned = false;
12809 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12810 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
12814 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12815 LDKUpdateFulfillHTLC this_ptr_conv;
12816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12817 this_ptr_conv.is_owned = false;
12818 LDKThirtyTwoBytes val_ref;
12819 CHECK(*((uint32_t*)val) == 32);
12820 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12821 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
12824 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
12825 LDKUpdateFulfillHTLC this_ptr_conv;
12826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12827 this_ptr_conv.is_owned = false;
12828 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
12832 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
12833 LDKUpdateFulfillHTLC this_ptr_conv;
12834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12835 this_ptr_conv.is_owned = false;
12836 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
12839 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
12840 LDKUpdateFulfillHTLC this_ptr_conv;
12841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12842 this_ptr_conv.is_owned = false;
12843 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12844 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
12848 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
12849 LDKUpdateFulfillHTLC this_ptr_conv;
12850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12851 this_ptr_conv.is_owned = false;
12852 LDKThirtyTwoBytes val_ref;
12853 CHECK(*((uint32_t*)val) == 32);
12854 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12855 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
12858 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
12859 LDKThirtyTwoBytes channel_id_arg_ref;
12860 CHECK(*((uint32_t*)channel_id_arg) == 32);
12861 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12862 LDKThirtyTwoBytes payment_preimage_arg_ref;
12863 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
12864 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
12865 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
12866 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12867 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12868 long ret_ref = (long)ret_var.inner;
12869 if (ret_var.is_owned) {
12875 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
12876 LDKUpdateFulfillHTLC orig_conv;
12877 orig_conv.inner = (void*)(orig & (~1));
12878 orig_conv.is_owned = false;
12879 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
12880 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12881 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12882 long ret_ref = (long)ret_var.inner;
12883 if (ret_var.is_owned) {
12889 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
12890 LDKUpdateFailHTLC this_obj_conv;
12891 this_obj_conv.inner = (void*)(this_obj & (~1));
12892 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12893 UpdateFailHTLC_free(this_obj_conv);
12896 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
12897 LDKUpdateFailHTLC this_ptr_conv;
12898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12899 this_ptr_conv.is_owned = false;
12900 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12901 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
12905 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12906 LDKUpdateFailHTLC this_ptr_conv;
12907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12908 this_ptr_conv.is_owned = false;
12909 LDKThirtyTwoBytes val_ref;
12910 CHECK(*((uint32_t*)val) == 32);
12911 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12912 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
12915 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
12916 LDKUpdateFailHTLC this_ptr_conv;
12917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12918 this_ptr_conv.is_owned = false;
12919 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
12923 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
12924 LDKUpdateFailHTLC this_ptr_conv;
12925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12926 this_ptr_conv.is_owned = false;
12927 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
12930 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
12931 LDKUpdateFailHTLC orig_conv;
12932 orig_conv.inner = (void*)(orig & (~1));
12933 orig_conv.is_owned = false;
12934 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
12935 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12936 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12937 long ret_ref = (long)ret_var.inner;
12938 if (ret_var.is_owned) {
12944 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
12945 LDKUpdateFailMalformedHTLC this_obj_conv;
12946 this_obj_conv.inner = (void*)(this_obj & (~1));
12947 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12948 UpdateFailMalformedHTLC_free(this_obj_conv);
12951 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
12952 LDKUpdateFailMalformedHTLC this_ptr_conv;
12953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12954 this_ptr_conv.is_owned = false;
12955 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12956 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
12960 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12961 LDKUpdateFailMalformedHTLC this_ptr_conv;
12962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12963 this_ptr_conv.is_owned = false;
12964 LDKThirtyTwoBytes val_ref;
12965 CHECK(*((uint32_t*)val) == 32);
12966 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12967 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
12970 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
12971 LDKUpdateFailMalformedHTLC this_ptr_conv;
12972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12973 this_ptr_conv.is_owned = false;
12974 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
12978 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
12979 LDKUpdateFailMalformedHTLC this_ptr_conv;
12980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12981 this_ptr_conv.is_owned = false;
12982 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
12985 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
12986 LDKUpdateFailMalformedHTLC this_ptr_conv;
12987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12988 this_ptr_conv.is_owned = false;
12989 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
12993 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
12994 LDKUpdateFailMalformedHTLC this_ptr_conv;
12995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12996 this_ptr_conv.is_owned = false;
12997 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
13000 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
13001 LDKUpdateFailMalformedHTLC orig_conv;
13002 orig_conv.inner = (void*)(orig & (~1));
13003 orig_conv.is_owned = false;
13004 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
13005 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13006 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13007 long ret_ref = (long)ret_var.inner;
13008 if (ret_var.is_owned) {
13014 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_obj) {
13015 LDKCommitmentSigned this_obj_conv;
13016 this_obj_conv.inner = (void*)(this_obj & (~1));
13017 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13018 CommitmentSigned_free(this_obj_conv);
13021 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
13022 LDKCommitmentSigned this_ptr_conv;
13023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13024 this_ptr_conv.is_owned = false;
13025 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13026 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
13030 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13031 LDKCommitmentSigned this_ptr_conv;
13032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13033 this_ptr_conv.is_owned = false;
13034 LDKThirtyTwoBytes val_ref;
13035 CHECK(*((uint32_t*)val) == 32);
13036 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13037 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
13040 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
13041 LDKCommitmentSigned this_ptr_conv;
13042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13043 this_ptr_conv.is_owned = false;
13044 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13045 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
13049 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
13050 LDKCommitmentSigned this_ptr_conv;
13051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13052 this_ptr_conv.is_owned = false;
13053 LDKSignature val_ref;
13054 CHECK(*((uint32_t*)val) == 64);
13055 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13056 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
13059 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
13060 LDKCommitmentSigned this_ptr_conv;
13061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13062 this_ptr_conv.is_owned = false;
13063 LDKCVec_SignatureZ val_constr;
13064 val_constr.datalen = *((uint32_t*)val);
13065 if (val_constr.datalen > 0)
13066 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13068 val_constr.data = NULL;
13069 int8_tArray* val_vals = (int8_tArray*)(val + 4);
13070 for (size_t m = 0; m < val_constr.datalen; m++) {
13071 int8_tArray val_conv_12 = val_vals[m];
13072 LDKSignature val_conv_12_ref;
13073 CHECK(*((uint32_t*)val_conv_12) == 64);
13074 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
13075 val_constr.data[m] = val_conv_12_ref;
13077 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
13080 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
13081 LDKThirtyTwoBytes channel_id_arg_ref;
13082 CHECK(*((uint32_t*)channel_id_arg) == 32);
13083 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13084 LDKSignature signature_arg_ref;
13085 CHECK(*((uint32_t*)signature_arg) == 64);
13086 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
13087 LDKCVec_SignatureZ htlc_signatures_arg_constr;
13088 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
13089 if (htlc_signatures_arg_constr.datalen > 0)
13090 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13092 htlc_signatures_arg_constr.data = NULL;
13093 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
13094 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
13095 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
13096 LDKSignature htlc_signatures_arg_conv_12_ref;
13097 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
13098 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
13099 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
13101 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
13102 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13103 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13104 long ret_ref = (long)ret_var.inner;
13105 if (ret_var.is_owned) {
13111 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
13112 LDKCommitmentSigned orig_conv;
13113 orig_conv.inner = (void*)(orig & (~1));
13114 orig_conv.is_owned = false;
13115 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
13116 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13117 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13118 long ret_ref = (long)ret_var.inner;
13119 if (ret_var.is_owned) {
13125 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
13126 LDKRevokeAndACK this_obj_conv;
13127 this_obj_conv.inner = (void*)(this_obj & (~1));
13128 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13129 RevokeAndACK_free(this_obj_conv);
13132 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
13133 LDKRevokeAndACK this_ptr_conv;
13134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13135 this_ptr_conv.is_owned = false;
13136 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13137 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
13141 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13142 LDKRevokeAndACK this_ptr_conv;
13143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13144 this_ptr_conv.is_owned = false;
13145 LDKThirtyTwoBytes val_ref;
13146 CHECK(*((uint32_t*)val) == 32);
13147 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13148 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
13151 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
13152 LDKRevokeAndACK this_ptr_conv;
13153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13154 this_ptr_conv.is_owned = false;
13155 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13156 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
13160 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
13161 LDKRevokeAndACK this_ptr_conv;
13162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13163 this_ptr_conv.is_owned = false;
13164 LDKThirtyTwoBytes val_ref;
13165 CHECK(*((uint32_t*)val) == 32);
13166 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13167 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
13170 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
13171 LDKRevokeAndACK this_ptr_conv;
13172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13173 this_ptr_conv.is_owned = false;
13174 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13175 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
13179 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
13180 LDKRevokeAndACK this_ptr_conv;
13181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13182 this_ptr_conv.is_owned = false;
13183 LDKPublicKey val_ref;
13184 CHECK(*((uint32_t*)val) == 33);
13185 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13186 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
13189 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) {
13190 LDKThirtyTwoBytes channel_id_arg_ref;
13191 CHECK(*((uint32_t*)channel_id_arg) == 32);
13192 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13193 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
13194 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
13195 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
13196 LDKPublicKey next_per_commitment_point_arg_ref;
13197 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
13198 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
13199 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
13200 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13201 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13202 long ret_ref = (long)ret_var.inner;
13203 if (ret_var.is_owned) {
13209 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
13210 LDKRevokeAndACK orig_conv;
13211 orig_conv.inner = (void*)(orig & (~1));
13212 orig_conv.is_owned = false;
13213 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
13214 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13215 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13216 long ret_ref = (long)ret_var.inner;
13217 if (ret_var.is_owned) {
13223 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
13224 LDKUpdateFee this_obj_conv;
13225 this_obj_conv.inner = (void*)(this_obj & (~1));
13226 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13227 UpdateFee_free(this_obj_conv);
13230 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
13231 LDKUpdateFee this_ptr_conv;
13232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13233 this_ptr_conv.is_owned = false;
13234 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13235 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
13239 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13240 LDKUpdateFee this_ptr_conv;
13241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13242 this_ptr_conv.is_owned = false;
13243 LDKThirtyTwoBytes val_ref;
13244 CHECK(*((uint32_t*)val) == 32);
13245 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13246 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
13249 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
13250 LDKUpdateFee this_ptr_conv;
13251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13252 this_ptr_conv.is_owned = false;
13253 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
13257 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
13258 LDKUpdateFee this_ptr_conv;
13259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13260 this_ptr_conv.is_owned = false;
13261 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
13264 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
13265 LDKThirtyTwoBytes channel_id_arg_ref;
13266 CHECK(*((uint32_t*)channel_id_arg) == 32);
13267 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13268 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
13269 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13270 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13271 long ret_ref = (long)ret_var.inner;
13272 if (ret_var.is_owned) {
13278 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
13279 LDKUpdateFee orig_conv;
13280 orig_conv.inner = (void*)(orig & (~1));
13281 orig_conv.is_owned = false;
13282 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
13283 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13284 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13285 long ret_ref = (long)ret_var.inner;
13286 if (ret_var.is_owned) {
13292 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
13293 LDKDataLossProtect this_obj_conv;
13294 this_obj_conv.inner = (void*)(this_obj & (~1));
13295 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13296 DataLossProtect_free(this_obj_conv);
13299 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
13300 LDKDataLossProtect this_ptr_conv;
13301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13302 this_ptr_conv.is_owned = false;
13303 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13304 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
13308 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
13309 LDKDataLossProtect this_ptr_conv;
13310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13311 this_ptr_conv.is_owned = false;
13312 LDKThirtyTwoBytes val_ref;
13313 CHECK(*((uint32_t*)val) == 32);
13314 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13315 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
13318 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
13319 LDKDataLossProtect this_ptr_conv;
13320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13321 this_ptr_conv.is_owned = false;
13322 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13323 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
13327 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
13328 LDKDataLossProtect this_ptr_conv;
13329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13330 this_ptr_conv.is_owned = false;
13331 LDKPublicKey val_ref;
13332 CHECK(*((uint32_t*)val) == 33);
13333 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13334 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
13337 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
13338 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
13339 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
13340 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
13341 LDKPublicKey my_current_per_commitment_point_arg_ref;
13342 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
13343 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
13344 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
13345 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13346 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13347 long ret_ref = (long)ret_var.inner;
13348 if (ret_var.is_owned) {
13354 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
13355 LDKDataLossProtect orig_conv;
13356 orig_conv.inner = (void*)(orig & (~1));
13357 orig_conv.is_owned = false;
13358 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
13359 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13360 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13361 long ret_ref = (long)ret_var.inner;
13362 if (ret_var.is_owned) {
13368 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
13369 LDKChannelReestablish this_obj_conv;
13370 this_obj_conv.inner = (void*)(this_obj & (~1));
13371 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13372 ChannelReestablish_free(this_obj_conv);
13375 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
13376 LDKChannelReestablish this_ptr_conv;
13377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13378 this_ptr_conv.is_owned = false;
13379 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13380 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
13384 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13385 LDKChannelReestablish this_ptr_conv;
13386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13387 this_ptr_conv.is_owned = false;
13388 LDKThirtyTwoBytes val_ref;
13389 CHECK(*((uint32_t*)val) == 32);
13390 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13391 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
13394 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
13395 LDKChannelReestablish this_ptr_conv;
13396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13397 this_ptr_conv.is_owned = false;
13398 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
13402 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
13403 LDKChannelReestablish this_ptr_conv;
13404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13405 this_ptr_conv.is_owned = false;
13406 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
13409 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
13410 LDKChannelReestablish this_ptr_conv;
13411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13412 this_ptr_conv.is_owned = false;
13413 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
13417 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
13418 LDKChannelReestablish this_ptr_conv;
13419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13420 this_ptr_conv.is_owned = false;
13421 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
13424 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
13425 LDKChannelReestablish orig_conv;
13426 orig_conv.inner = (void*)(orig & (~1));
13427 orig_conv.is_owned = false;
13428 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
13429 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13430 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13431 long ret_ref = (long)ret_var.inner;
13432 if (ret_var.is_owned) {
13438 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
13439 LDKAnnouncementSignatures this_obj_conv;
13440 this_obj_conv.inner = (void*)(this_obj & (~1));
13441 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13442 AnnouncementSignatures_free(this_obj_conv);
13445 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
13446 LDKAnnouncementSignatures this_ptr_conv;
13447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13448 this_ptr_conv.is_owned = false;
13449 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13450 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
13454 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13455 LDKAnnouncementSignatures this_ptr_conv;
13456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13457 this_ptr_conv.is_owned = false;
13458 LDKThirtyTwoBytes val_ref;
13459 CHECK(*((uint32_t*)val) == 32);
13460 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13461 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
13464 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
13465 LDKAnnouncementSignatures this_ptr_conv;
13466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13467 this_ptr_conv.is_owned = false;
13468 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
13472 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
13473 LDKAnnouncementSignatures this_ptr_conv;
13474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13475 this_ptr_conv.is_owned = false;
13476 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
13479 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
13480 LDKAnnouncementSignatures this_ptr_conv;
13481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13482 this_ptr_conv.is_owned = false;
13483 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13484 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
13488 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
13489 LDKAnnouncementSignatures this_ptr_conv;
13490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13491 this_ptr_conv.is_owned = false;
13492 LDKSignature val_ref;
13493 CHECK(*((uint32_t*)val) == 64);
13494 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13495 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
13498 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
13499 LDKAnnouncementSignatures this_ptr_conv;
13500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13501 this_ptr_conv.is_owned = false;
13502 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13503 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
13507 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
13508 LDKAnnouncementSignatures this_ptr_conv;
13509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13510 this_ptr_conv.is_owned = false;
13511 LDKSignature val_ref;
13512 CHECK(*((uint32_t*)val) == 64);
13513 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13514 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
13517 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) {
13518 LDKThirtyTwoBytes channel_id_arg_ref;
13519 CHECK(*((uint32_t*)channel_id_arg) == 32);
13520 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13521 LDKSignature node_signature_arg_ref;
13522 CHECK(*((uint32_t*)node_signature_arg) == 64);
13523 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
13524 LDKSignature bitcoin_signature_arg_ref;
13525 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
13526 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
13527 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
13528 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13529 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13530 long ret_ref = (long)ret_var.inner;
13531 if (ret_var.is_owned) {
13537 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
13538 LDKAnnouncementSignatures orig_conv;
13539 orig_conv.inner = (void*)(orig & (~1));
13540 orig_conv.is_owned = false;
13541 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
13542 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13543 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13544 long ret_ref = (long)ret_var.inner;
13545 if (ret_var.is_owned) {
13551 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
13552 if ((this_ptr & 1) != 0) return;
13553 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
13554 FREE((void*)this_ptr);
13555 NetAddress_free(this_ptr_conv);
13558 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
13559 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
13560 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
13561 *ret_copy = NetAddress_clone(orig_conv);
13562 long ret_ref = (long)ret_copy;
13566 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
13567 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
13568 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
13569 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13570 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13571 CVec_u8Z_free(ret_var);
13575 uint32_t __attribute__((visibility("default"))) TS_Result_read(int8_tArray ser) {
13576 LDKu8slice ser_ref;
13577 ser_ref.datalen = *((uint32_t*)ser);
13578 ser_ref.data = (int8_t*)(ser + 4);
13579 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
13580 *ret_conv = Result_read(ser_ref);
13581 return (long)ret_conv;
13584 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
13585 LDKUnsignedNodeAnnouncement this_obj_conv;
13586 this_obj_conv.inner = (void*)(this_obj & (~1));
13587 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13588 UnsignedNodeAnnouncement_free(this_obj_conv);
13591 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
13592 LDKUnsignedNodeAnnouncement this_ptr_conv;
13593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13594 this_ptr_conv.is_owned = false;
13595 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
13596 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13597 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13598 long ret_ref = (long)ret_var.inner;
13599 if (ret_var.is_owned) {
13605 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
13606 LDKUnsignedNodeAnnouncement this_ptr_conv;
13607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13608 this_ptr_conv.is_owned = false;
13609 LDKNodeFeatures val_conv;
13610 val_conv.inner = (void*)(val & (~1));
13611 val_conv.is_owned = (val & 1) || (val == 0);
13612 val_conv = NodeFeatures_clone(&val_conv);
13613 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
13616 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
13617 LDKUnsignedNodeAnnouncement this_ptr_conv;
13618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13619 this_ptr_conv.is_owned = false;
13620 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
13624 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
13625 LDKUnsignedNodeAnnouncement this_ptr_conv;
13626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13627 this_ptr_conv.is_owned = false;
13628 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
13631 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
13632 LDKUnsignedNodeAnnouncement this_ptr_conv;
13633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13634 this_ptr_conv.is_owned = false;
13635 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13636 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
13640 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
13641 LDKUnsignedNodeAnnouncement this_ptr_conv;
13642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13643 this_ptr_conv.is_owned = false;
13644 LDKPublicKey val_ref;
13645 CHECK(*((uint32_t*)val) == 33);
13646 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13647 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
13650 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
13651 LDKUnsignedNodeAnnouncement this_ptr_conv;
13652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13653 this_ptr_conv.is_owned = false;
13654 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
13655 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
13659 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
13660 LDKUnsignedNodeAnnouncement this_ptr_conv;
13661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13662 this_ptr_conv.is_owned = false;
13663 LDKThreeBytes val_ref;
13664 CHECK(*((uint32_t*)val) == 3);
13665 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
13666 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
13669 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
13670 LDKUnsignedNodeAnnouncement this_ptr_conv;
13671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13672 this_ptr_conv.is_owned = false;
13673 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13674 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
13678 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
13679 LDKUnsignedNodeAnnouncement this_ptr_conv;
13680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13681 this_ptr_conv.is_owned = false;
13682 LDKThirtyTwoBytes val_ref;
13683 CHECK(*((uint32_t*)val) == 32);
13684 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13685 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
13688 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
13689 LDKUnsignedNodeAnnouncement this_ptr_conv;
13690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13691 this_ptr_conv.is_owned = false;
13692 LDKCVec_NetAddressZ val_constr;
13693 val_constr.datalen = *((uint32_t*)val);
13694 if (val_constr.datalen > 0)
13695 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
13697 val_constr.data = NULL;
13698 uint32_t* val_vals = (uint32_t*)(val + 4);
13699 for (size_t m = 0; m < val_constr.datalen; m++) {
13700 uint32_t val_conv_12 = val_vals[m];
13701 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
13702 FREE((void*)val_conv_12);
13703 val_constr.data[m] = val_conv_12_conv;
13705 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
13708 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
13709 LDKUnsignedNodeAnnouncement orig_conv;
13710 orig_conv.inner = (void*)(orig & (~1));
13711 orig_conv.is_owned = false;
13712 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
13713 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13714 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13715 long ret_ref = (long)ret_var.inner;
13716 if (ret_var.is_owned) {
13722 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
13723 LDKNodeAnnouncement this_obj_conv;
13724 this_obj_conv.inner = (void*)(this_obj & (~1));
13725 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13726 NodeAnnouncement_free(this_obj_conv);
13729 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
13730 LDKNodeAnnouncement this_ptr_conv;
13731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13732 this_ptr_conv.is_owned = false;
13733 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13734 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
13738 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
13739 LDKNodeAnnouncement this_ptr_conv;
13740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13741 this_ptr_conv.is_owned = false;
13742 LDKSignature val_ref;
13743 CHECK(*((uint32_t*)val) == 64);
13744 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13745 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
13748 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
13749 LDKNodeAnnouncement this_ptr_conv;
13750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13751 this_ptr_conv.is_owned = false;
13752 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
13753 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13754 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13755 long ret_ref = (long)ret_var.inner;
13756 if (ret_var.is_owned) {
13762 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
13763 LDKNodeAnnouncement this_ptr_conv;
13764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13765 this_ptr_conv.is_owned = false;
13766 LDKUnsignedNodeAnnouncement val_conv;
13767 val_conv.inner = (void*)(val & (~1));
13768 val_conv.is_owned = (val & 1) || (val == 0);
13769 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
13770 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
13773 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
13774 LDKSignature signature_arg_ref;
13775 CHECK(*((uint32_t*)signature_arg) == 64);
13776 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
13777 LDKUnsignedNodeAnnouncement contents_arg_conv;
13778 contents_arg_conv.inner = (void*)(contents_arg & (~1));
13779 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
13780 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
13781 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
13782 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13783 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13784 long ret_ref = (long)ret_var.inner;
13785 if (ret_var.is_owned) {
13791 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
13792 LDKNodeAnnouncement orig_conv;
13793 orig_conv.inner = (void*)(orig & (~1));
13794 orig_conv.is_owned = false;
13795 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
13796 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13797 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13798 long ret_ref = (long)ret_var.inner;
13799 if (ret_var.is_owned) {
13805 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
13806 LDKUnsignedChannelAnnouncement this_obj_conv;
13807 this_obj_conv.inner = (void*)(this_obj & (~1));
13808 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13809 UnsignedChannelAnnouncement_free(this_obj_conv);
13812 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
13813 LDKUnsignedChannelAnnouncement this_ptr_conv;
13814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13815 this_ptr_conv.is_owned = false;
13816 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
13817 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13818 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13819 long ret_ref = (long)ret_var.inner;
13820 if (ret_var.is_owned) {
13826 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
13827 LDKUnsignedChannelAnnouncement this_ptr_conv;
13828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13829 this_ptr_conv.is_owned = false;
13830 LDKChannelFeatures val_conv;
13831 val_conv.inner = (void*)(val & (~1));
13832 val_conv.is_owned = (val & 1) || (val == 0);
13833 val_conv = ChannelFeatures_clone(&val_conv);
13834 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
13837 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
13838 LDKUnsignedChannelAnnouncement this_ptr_conv;
13839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13840 this_ptr_conv.is_owned = false;
13841 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13842 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
13846 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
13847 LDKUnsignedChannelAnnouncement this_ptr_conv;
13848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13849 this_ptr_conv.is_owned = false;
13850 LDKThirtyTwoBytes val_ref;
13851 CHECK(*((uint32_t*)val) == 32);
13852 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13853 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
13856 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
13857 LDKUnsignedChannelAnnouncement this_ptr_conv;
13858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13859 this_ptr_conv.is_owned = false;
13860 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
13864 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
13865 LDKUnsignedChannelAnnouncement this_ptr_conv;
13866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13867 this_ptr_conv.is_owned = false;
13868 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
13871 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
13872 LDKUnsignedChannelAnnouncement this_ptr_conv;
13873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13874 this_ptr_conv.is_owned = false;
13875 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13876 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
13880 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
13881 LDKUnsignedChannelAnnouncement this_ptr_conv;
13882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13883 this_ptr_conv.is_owned = false;
13884 LDKPublicKey val_ref;
13885 CHECK(*((uint32_t*)val) == 33);
13886 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13887 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
13890 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
13891 LDKUnsignedChannelAnnouncement this_ptr_conv;
13892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13893 this_ptr_conv.is_owned = false;
13894 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13895 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
13899 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
13900 LDKUnsignedChannelAnnouncement this_ptr_conv;
13901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13902 this_ptr_conv.is_owned = false;
13903 LDKPublicKey val_ref;
13904 CHECK(*((uint32_t*)val) == 33);
13905 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13906 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
13909 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
13910 LDKUnsignedChannelAnnouncement this_ptr_conv;
13911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13912 this_ptr_conv.is_owned = false;
13913 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13914 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
13918 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
13919 LDKUnsignedChannelAnnouncement this_ptr_conv;
13920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13921 this_ptr_conv.is_owned = false;
13922 LDKPublicKey val_ref;
13923 CHECK(*((uint32_t*)val) == 33);
13924 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13925 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
13928 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
13929 LDKUnsignedChannelAnnouncement this_ptr_conv;
13930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13931 this_ptr_conv.is_owned = false;
13932 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13933 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
13937 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
13938 LDKUnsignedChannelAnnouncement this_ptr_conv;
13939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13940 this_ptr_conv.is_owned = false;
13941 LDKPublicKey val_ref;
13942 CHECK(*((uint32_t*)val) == 33);
13943 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13944 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
13947 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
13948 LDKUnsignedChannelAnnouncement orig_conv;
13949 orig_conv.inner = (void*)(orig & (~1));
13950 orig_conv.is_owned = false;
13951 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
13952 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13953 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13954 long ret_ref = (long)ret_var.inner;
13955 if (ret_var.is_owned) {
13961 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
13962 LDKChannelAnnouncement this_obj_conv;
13963 this_obj_conv.inner = (void*)(this_obj & (~1));
13964 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13965 ChannelAnnouncement_free(this_obj_conv);
13968 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
13969 LDKChannelAnnouncement this_ptr_conv;
13970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13971 this_ptr_conv.is_owned = false;
13972 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13973 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
13977 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
13978 LDKChannelAnnouncement this_ptr_conv;
13979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13980 this_ptr_conv.is_owned = false;
13981 LDKSignature val_ref;
13982 CHECK(*((uint32_t*)val) == 64);
13983 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13984 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
13987 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
13988 LDKChannelAnnouncement this_ptr_conv;
13989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13990 this_ptr_conv.is_owned = false;
13991 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13992 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
13996 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
13997 LDKChannelAnnouncement this_ptr_conv;
13998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13999 this_ptr_conv.is_owned = false;
14000 LDKSignature val_ref;
14001 CHECK(*((uint32_t*)val) == 64);
14002 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14003 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
14006 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
14007 LDKChannelAnnouncement this_ptr_conv;
14008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14009 this_ptr_conv.is_owned = false;
14010 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14011 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
14015 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
14016 LDKChannelAnnouncement this_ptr_conv;
14017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14018 this_ptr_conv.is_owned = false;
14019 LDKSignature val_ref;
14020 CHECK(*((uint32_t*)val) == 64);
14021 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14022 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
14025 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
14026 LDKChannelAnnouncement this_ptr_conv;
14027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14028 this_ptr_conv.is_owned = false;
14029 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14030 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
14034 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
14035 LDKChannelAnnouncement this_ptr_conv;
14036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14037 this_ptr_conv.is_owned = false;
14038 LDKSignature val_ref;
14039 CHECK(*((uint32_t*)val) == 64);
14040 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14041 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
14044 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
14045 LDKChannelAnnouncement this_ptr_conv;
14046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14047 this_ptr_conv.is_owned = false;
14048 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
14049 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14050 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14051 long ret_ref = (long)ret_var.inner;
14052 if (ret_var.is_owned) {
14058 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
14059 LDKChannelAnnouncement this_ptr_conv;
14060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14061 this_ptr_conv.is_owned = false;
14062 LDKUnsignedChannelAnnouncement val_conv;
14063 val_conv.inner = (void*)(val & (~1));
14064 val_conv.is_owned = (val & 1) || (val == 0);
14065 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
14066 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
14069 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) {
14070 LDKSignature node_signature_1_arg_ref;
14071 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
14072 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
14073 LDKSignature node_signature_2_arg_ref;
14074 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
14075 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
14076 LDKSignature bitcoin_signature_1_arg_ref;
14077 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
14078 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
14079 LDKSignature bitcoin_signature_2_arg_ref;
14080 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
14081 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
14082 LDKUnsignedChannelAnnouncement contents_arg_conv;
14083 contents_arg_conv.inner = (void*)(contents_arg & (~1));
14084 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
14085 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
14086 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);
14087 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14088 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14089 long ret_ref = (long)ret_var.inner;
14090 if (ret_var.is_owned) {
14096 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
14097 LDKChannelAnnouncement orig_conv;
14098 orig_conv.inner = (void*)(orig & (~1));
14099 orig_conv.is_owned = false;
14100 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
14101 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14102 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14103 long ret_ref = (long)ret_var.inner;
14104 if (ret_var.is_owned) {
14110 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
14111 LDKUnsignedChannelUpdate this_obj_conv;
14112 this_obj_conv.inner = (void*)(this_obj & (~1));
14113 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14114 UnsignedChannelUpdate_free(this_obj_conv);
14117 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
14118 LDKUnsignedChannelUpdate this_ptr_conv;
14119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14120 this_ptr_conv.is_owned = false;
14121 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14122 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
14126 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14127 LDKUnsignedChannelUpdate this_ptr_conv;
14128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14129 this_ptr_conv.is_owned = false;
14130 LDKThirtyTwoBytes val_ref;
14131 CHECK(*((uint32_t*)val) == 32);
14132 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14133 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
14136 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
14137 LDKUnsignedChannelUpdate this_ptr_conv;
14138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14139 this_ptr_conv.is_owned = false;
14140 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
14144 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
14145 LDKUnsignedChannelUpdate this_ptr_conv;
14146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14147 this_ptr_conv.is_owned = false;
14148 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
14151 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
14152 LDKUnsignedChannelUpdate this_ptr_conv;
14153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14154 this_ptr_conv.is_owned = false;
14155 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
14159 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
14160 LDKUnsignedChannelUpdate this_ptr_conv;
14161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14162 this_ptr_conv.is_owned = false;
14163 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
14166 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
14167 LDKUnsignedChannelUpdate this_ptr_conv;
14168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14169 this_ptr_conv.is_owned = false;
14170 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
14174 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
14175 LDKUnsignedChannelUpdate this_ptr_conv;
14176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14177 this_ptr_conv.is_owned = false;
14178 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
14181 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
14182 LDKUnsignedChannelUpdate this_ptr_conv;
14183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14184 this_ptr_conv.is_owned = false;
14185 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
14189 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
14190 LDKUnsignedChannelUpdate this_ptr_conv;
14191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14192 this_ptr_conv.is_owned = false;
14193 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
14196 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
14197 LDKUnsignedChannelUpdate this_ptr_conv;
14198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14199 this_ptr_conv.is_owned = false;
14200 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
14204 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
14205 LDKUnsignedChannelUpdate this_ptr_conv;
14206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14207 this_ptr_conv.is_owned = false;
14208 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
14211 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
14212 LDKUnsignedChannelUpdate this_ptr_conv;
14213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14214 this_ptr_conv.is_owned = false;
14215 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
14219 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
14220 LDKUnsignedChannelUpdate this_ptr_conv;
14221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14222 this_ptr_conv.is_owned = false;
14223 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
14226 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
14227 LDKUnsignedChannelUpdate this_ptr_conv;
14228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14229 this_ptr_conv.is_owned = false;
14230 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
14234 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
14235 LDKUnsignedChannelUpdate this_ptr_conv;
14236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14237 this_ptr_conv.is_owned = false;
14238 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
14241 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
14242 LDKUnsignedChannelUpdate orig_conv;
14243 orig_conv.inner = (void*)(orig & (~1));
14244 orig_conv.is_owned = false;
14245 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
14246 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14247 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14248 long ret_ref = (long)ret_var.inner;
14249 if (ret_var.is_owned) {
14255 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
14256 LDKChannelUpdate this_obj_conv;
14257 this_obj_conv.inner = (void*)(this_obj & (~1));
14258 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14259 ChannelUpdate_free(this_obj_conv);
14262 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
14263 LDKChannelUpdate this_ptr_conv;
14264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14265 this_ptr_conv.is_owned = false;
14266 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14267 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
14271 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
14272 LDKChannelUpdate this_ptr_conv;
14273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14274 this_ptr_conv.is_owned = false;
14275 LDKSignature val_ref;
14276 CHECK(*((uint32_t*)val) == 64);
14277 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14278 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
14281 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
14282 LDKChannelUpdate this_ptr_conv;
14283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14284 this_ptr_conv.is_owned = false;
14285 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
14286 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14287 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14288 long ret_ref = (long)ret_var.inner;
14289 if (ret_var.is_owned) {
14295 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
14296 LDKChannelUpdate this_ptr_conv;
14297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14298 this_ptr_conv.is_owned = false;
14299 LDKUnsignedChannelUpdate val_conv;
14300 val_conv.inner = (void*)(val & (~1));
14301 val_conv.is_owned = (val & 1) || (val == 0);
14302 val_conv = UnsignedChannelUpdate_clone(&val_conv);
14303 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
14306 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
14307 LDKSignature signature_arg_ref;
14308 CHECK(*((uint32_t*)signature_arg) == 64);
14309 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
14310 LDKUnsignedChannelUpdate contents_arg_conv;
14311 contents_arg_conv.inner = (void*)(contents_arg & (~1));
14312 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
14313 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
14314 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
14315 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14316 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14317 long ret_ref = (long)ret_var.inner;
14318 if (ret_var.is_owned) {
14324 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
14325 LDKChannelUpdate orig_conv;
14326 orig_conv.inner = (void*)(orig & (~1));
14327 orig_conv.is_owned = false;
14328 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
14329 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14330 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14331 long ret_ref = (long)ret_var.inner;
14332 if (ret_var.is_owned) {
14338 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
14339 LDKQueryChannelRange this_obj_conv;
14340 this_obj_conv.inner = (void*)(this_obj & (~1));
14341 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14342 QueryChannelRange_free(this_obj_conv);
14345 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
14346 LDKQueryChannelRange this_ptr_conv;
14347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14348 this_ptr_conv.is_owned = false;
14349 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14350 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
14354 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14355 LDKQueryChannelRange this_ptr_conv;
14356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14357 this_ptr_conv.is_owned = false;
14358 LDKThirtyTwoBytes val_ref;
14359 CHECK(*((uint32_t*)val) == 32);
14360 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14361 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
14364 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
14365 LDKQueryChannelRange this_ptr_conv;
14366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14367 this_ptr_conv.is_owned = false;
14368 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
14372 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
14373 LDKQueryChannelRange this_ptr_conv;
14374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14375 this_ptr_conv.is_owned = false;
14376 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
14379 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
14380 LDKQueryChannelRange this_ptr_conv;
14381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14382 this_ptr_conv.is_owned = false;
14383 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
14387 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
14388 LDKQueryChannelRange this_ptr_conv;
14389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14390 this_ptr_conv.is_owned = false;
14391 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
14394 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
14395 LDKThirtyTwoBytes chain_hash_arg_ref;
14396 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14397 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14398 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
14399 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14400 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14401 long ret_ref = (long)ret_var.inner;
14402 if (ret_var.is_owned) {
14408 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
14409 LDKQueryChannelRange orig_conv;
14410 orig_conv.inner = (void*)(orig & (~1));
14411 orig_conv.is_owned = false;
14412 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
14413 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14414 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14415 long ret_ref = (long)ret_var.inner;
14416 if (ret_var.is_owned) {
14422 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
14423 LDKReplyChannelRange this_obj_conv;
14424 this_obj_conv.inner = (void*)(this_obj & (~1));
14425 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14426 ReplyChannelRange_free(this_obj_conv);
14429 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
14430 LDKReplyChannelRange this_ptr_conv;
14431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14432 this_ptr_conv.is_owned = false;
14433 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14434 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
14438 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14439 LDKReplyChannelRange this_ptr_conv;
14440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14441 this_ptr_conv.is_owned = false;
14442 LDKThirtyTwoBytes val_ref;
14443 CHECK(*((uint32_t*)val) == 32);
14444 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14445 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
14448 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
14449 LDKReplyChannelRange this_ptr_conv;
14450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14451 this_ptr_conv.is_owned = false;
14452 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
14456 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
14457 LDKReplyChannelRange this_ptr_conv;
14458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14459 this_ptr_conv.is_owned = false;
14460 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
14463 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
14464 LDKReplyChannelRange this_ptr_conv;
14465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14466 this_ptr_conv.is_owned = false;
14467 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
14471 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
14472 LDKReplyChannelRange this_ptr_conv;
14473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14474 this_ptr_conv.is_owned = false;
14475 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
14478 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
14479 LDKReplyChannelRange this_ptr_conv;
14480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14481 this_ptr_conv.is_owned = false;
14482 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
14486 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
14487 LDKReplyChannelRange this_ptr_conv;
14488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14489 this_ptr_conv.is_owned = false;
14490 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
14493 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
14494 LDKReplyChannelRange this_ptr_conv;
14495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14496 this_ptr_conv.is_owned = false;
14497 LDKCVec_u64Z val_constr;
14498 val_constr.datalen = *((uint32_t*)val);
14499 if (val_constr.datalen > 0)
14500 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14502 val_constr.data = NULL;
14503 int64_t* val_vals = (int64_t*)(val + 4);
14504 for (size_t i = 0; i < val_constr.datalen; i++) {
14505 int64_t val_conv_8 = val_vals[i];
14506 val_constr.data[i] = val_conv_8;
14508 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
14511 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) {
14512 LDKThirtyTwoBytes chain_hash_arg_ref;
14513 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14514 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14515 LDKCVec_u64Z short_channel_ids_arg_constr;
14516 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
14517 if (short_channel_ids_arg_constr.datalen > 0)
14518 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14520 short_channel_ids_arg_constr.data = NULL;
14521 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
14522 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
14523 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
14524 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
14526 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
14527 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14528 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14529 long ret_ref = (long)ret_var.inner;
14530 if (ret_var.is_owned) {
14536 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
14537 LDKReplyChannelRange orig_conv;
14538 orig_conv.inner = (void*)(orig & (~1));
14539 orig_conv.is_owned = false;
14540 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
14541 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14542 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14543 long ret_ref = (long)ret_var.inner;
14544 if (ret_var.is_owned) {
14550 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
14551 LDKQueryShortChannelIds this_obj_conv;
14552 this_obj_conv.inner = (void*)(this_obj & (~1));
14553 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14554 QueryShortChannelIds_free(this_obj_conv);
14557 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
14558 LDKQueryShortChannelIds this_ptr_conv;
14559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14560 this_ptr_conv.is_owned = false;
14561 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14562 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
14566 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14567 LDKQueryShortChannelIds this_ptr_conv;
14568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14569 this_ptr_conv.is_owned = false;
14570 LDKThirtyTwoBytes val_ref;
14571 CHECK(*((uint32_t*)val) == 32);
14572 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14573 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
14576 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
14577 LDKQueryShortChannelIds this_ptr_conv;
14578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14579 this_ptr_conv.is_owned = false;
14580 LDKCVec_u64Z val_constr;
14581 val_constr.datalen = *((uint32_t*)val);
14582 if (val_constr.datalen > 0)
14583 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14585 val_constr.data = NULL;
14586 int64_t* val_vals = (int64_t*)(val + 4);
14587 for (size_t i = 0; i < val_constr.datalen; i++) {
14588 int64_t val_conv_8 = val_vals[i];
14589 val_constr.data[i] = val_conv_8;
14591 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
14594 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
14595 LDKThirtyTwoBytes chain_hash_arg_ref;
14596 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14597 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14598 LDKCVec_u64Z short_channel_ids_arg_constr;
14599 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
14600 if (short_channel_ids_arg_constr.datalen > 0)
14601 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14603 short_channel_ids_arg_constr.data = NULL;
14604 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
14605 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
14606 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
14607 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
14609 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
14610 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14611 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14612 long ret_ref = (long)ret_var.inner;
14613 if (ret_var.is_owned) {
14619 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
14620 LDKQueryShortChannelIds orig_conv;
14621 orig_conv.inner = (void*)(orig & (~1));
14622 orig_conv.is_owned = false;
14623 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
14624 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14625 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14626 long ret_ref = (long)ret_var.inner;
14627 if (ret_var.is_owned) {
14633 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
14634 LDKReplyShortChannelIdsEnd this_obj_conv;
14635 this_obj_conv.inner = (void*)(this_obj & (~1));
14636 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14637 ReplyShortChannelIdsEnd_free(this_obj_conv);
14640 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
14641 LDKReplyShortChannelIdsEnd this_ptr_conv;
14642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14643 this_ptr_conv.is_owned = false;
14644 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14645 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
14649 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14650 LDKReplyShortChannelIdsEnd this_ptr_conv;
14651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14652 this_ptr_conv.is_owned = false;
14653 LDKThirtyTwoBytes val_ref;
14654 CHECK(*((uint32_t*)val) == 32);
14655 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14656 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
14659 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
14660 LDKReplyShortChannelIdsEnd this_ptr_conv;
14661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14662 this_ptr_conv.is_owned = false;
14663 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
14667 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
14668 LDKReplyShortChannelIdsEnd this_ptr_conv;
14669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14670 this_ptr_conv.is_owned = false;
14671 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
14674 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
14675 LDKThirtyTwoBytes chain_hash_arg_ref;
14676 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14677 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14678 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
14679 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14680 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14681 long ret_ref = (long)ret_var.inner;
14682 if (ret_var.is_owned) {
14688 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
14689 LDKReplyShortChannelIdsEnd orig_conv;
14690 orig_conv.inner = (void*)(orig & (~1));
14691 orig_conv.is_owned = false;
14692 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
14693 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14694 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14695 long ret_ref = (long)ret_var.inner;
14696 if (ret_var.is_owned) {
14702 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
14703 LDKGossipTimestampFilter this_obj_conv;
14704 this_obj_conv.inner = (void*)(this_obj & (~1));
14705 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14706 GossipTimestampFilter_free(this_obj_conv);
14709 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
14710 LDKGossipTimestampFilter this_ptr_conv;
14711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14712 this_ptr_conv.is_owned = false;
14713 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14714 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
14718 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14719 LDKGossipTimestampFilter this_ptr_conv;
14720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14721 this_ptr_conv.is_owned = false;
14722 LDKThirtyTwoBytes val_ref;
14723 CHECK(*((uint32_t*)val) == 32);
14724 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14725 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
14728 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
14729 LDKGossipTimestampFilter this_ptr_conv;
14730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14731 this_ptr_conv.is_owned = false;
14732 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
14736 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
14737 LDKGossipTimestampFilter this_ptr_conv;
14738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14739 this_ptr_conv.is_owned = false;
14740 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
14743 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
14744 LDKGossipTimestampFilter this_ptr_conv;
14745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14746 this_ptr_conv.is_owned = false;
14747 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
14751 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
14752 LDKGossipTimestampFilter this_ptr_conv;
14753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14754 this_ptr_conv.is_owned = false;
14755 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
14758 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
14759 LDKThirtyTwoBytes chain_hash_arg_ref;
14760 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14761 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14762 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
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 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
14773 LDKGossipTimestampFilter orig_conv;
14774 orig_conv.inner = (void*)(orig & (~1));
14775 orig_conv.is_owned = false;
14776 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
14777 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14778 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14779 long ret_ref = (long)ret_var.inner;
14780 if (ret_var.is_owned) {
14786 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
14787 if ((this_ptr & 1) != 0) return;
14788 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
14789 FREE((void*)this_ptr);
14790 ErrorAction_free(this_ptr_conv);
14793 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
14794 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
14795 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
14796 *ret_copy = ErrorAction_clone(orig_conv);
14797 long ret_ref = (long)ret_copy;
14801 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
14802 LDKLightningError this_obj_conv;
14803 this_obj_conv.inner = (void*)(this_obj & (~1));
14804 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14805 LightningError_free(this_obj_conv);
14808 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
14809 LDKLightningError this_ptr_conv;
14810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14811 this_ptr_conv.is_owned = false;
14812 LDKStr _str = LightningError_get_err(&this_ptr_conv);
14813 jstring _conv = str_ref_to_ts(_str.chars, _str.len);
14817 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, int8_tArray val) {
14818 LDKLightningError this_ptr_conv;
14819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14820 this_ptr_conv.is_owned = false;
14821 LDKCVec_u8Z val_ref;
14822 val_ref.datalen = *((uint32_t*)val);
14823 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
14824 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
14825 LightningError_set_err(&this_ptr_conv, val_ref);
14828 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
14829 LDKLightningError this_ptr_conv;
14830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14831 this_ptr_conv.is_owned = false;
14832 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
14833 *ret_copy = LightningError_get_action(&this_ptr_conv);
14834 long ret_ref = (long)ret_copy;
14838 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
14839 LDKLightningError this_ptr_conv;
14840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14841 this_ptr_conv.is_owned = false;
14842 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
14844 LightningError_set_action(&this_ptr_conv, val_conv);
14847 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(int8_tArray err_arg, uint32_t action_arg) {
14848 LDKCVec_u8Z err_arg_ref;
14849 err_arg_ref.datalen = *((uint32_t*)err_arg);
14850 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
14851 memcpy(err_arg_ref.data, (uint8_t*)(err_arg + 4), err_arg_ref.datalen);
14852 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
14853 FREE((void*)action_arg);
14854 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
14855 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14856 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14857 long ret_ref = (long)ret_var.inner;
14858 if (ret_var.is_owned) {
14864 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
14865 LDKLightningError orig_conv;
14866 orig_conv.inner = (void*)(orig & (~1));
14867 orig_conv.is_owned = false;
14868 LDKLightningError ret_var = LightningError_clone(&orig_conv);
14869 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14870 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14871 long ret_ref = (long)ret_var.inner;
14872 if (ret_var.is_owned) {
14878 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
14879 LDKCommitmentUpdate this_obj_conv;
14880 this_obj_conv.inner = (void*)(this_obj & (~1));
14881 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14882 CommitmentUpdate_free(this_obj_conv);
14885 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
14886 LDKCommitmentUpdate this_ptr_conv;
14887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14888 this_ptr_conv.is_owned = false;
14889 LDKCVec_UpdateAddHTLCZ val_constr;
14890 val_constr.datalen = *((uint32_t*)val);
14891 if (val_constr.datalen > 0)
14892 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
14894 val_constr.data = NULL;
14895 uint32_t* val_vals = (uint32_t*)(val + 4);
14896 for (size_t p = 0; p < val_constr.datalen; p++) {
14897 uint32_t val_conv_15 = val_vals[p];
14898 LDKUpdateAddHTLC val_conv_15_conv;
14899 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
14900 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
14901 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
14902 val_constr.data[p] = val_conv_15_conv;
14904 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
14907 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
14908 LDKCommitmentUpdate this_ptr_conv;
14909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14910 this_ptr_conv.is_owned = false;
14911 LDKCVec_UpdateFulfillHTLCZ val_constr;
14912 val_constr.datalen = *((uint32_t*)val);
14913 if (val_constr.datalen > 0)
14914 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
14916 val_constr.data = NULL;
14917 uint32_t* val_vals = (uint32_t*)(val + 4);
14918 for (size_t t = 0; t < val_constr.datalen; t++) {
14919 uint32_t val_conv_19 = val_vals[t];
14920 LDKUpdateFulfillHTLC val_conv_19_conv;
14921 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
14922 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
14923 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
14924 val_constr.data[t] = val_conv_19_conv;
14926 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
14929 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
14930 LDKCommitmentUpdate this_ptr_conv;
14931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14932 this_ptr_conv.is_owned = false;
14933 LDKCVec_UpdateFailHTLCZ val_constr;
14934 val_constr.datalen = *((uint32_t*)val);
14935 if (val_constr.datalen > 0)
14936 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
14938 val_constr.data = NULL;
14939 uint32_t* val_vals = (uint32_t*)(val + 4);
14940 for (size_t q = 0; q < val_constr.datalen; q++) {
14941 uint32_t val_conv_16 = val_vals[q];
14942 LDKUpdateFailHTLC val_conv_16_conv;
14943 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
14944 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
14945 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
14946 val_constr.data[q] = val_conv_16_conv;
14948 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
14951 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
14952 LDKCommitmentUpdate this_ptr_conv;
14953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14954 this_ptr_conv.is_owned = false;
14955 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
14956 val_constr.datalen = *((uint32_t*)val);
14957 if (val_constr.datalen > 0)
14958 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
14960 val_constr.data = NULL;
14961 uint32_t* val_vals = (uint32_t*)(val + 4);
14962 for (size_t z = 0; z < val_constr.datalen; z++) {
14963 uint32_t val_conv_25 = val_vals[z];
14964 LDKUpdateFailMalformedHTLC val_conv_25_conv;
14965 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
14966 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
14967 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
14968 val_constr.data[z] = val_conv_25_conv;
14970 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
14973 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
14974 LDKCommitmentUpdate this_ptr_conv;
14975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14976 this_ptr_conv.is_owned = false;
14977 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
14978 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14979 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14980 long ret_ref = (long)ret_var.inner;
14981 if (ret_var.is_owned) {
14987 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
14988 LDKCommitmentUpdate this_ptr_conv;
14989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14990 this_ptr_conv.is_owned = false;
14991 LDKUpdateFee val_conv;
14992 val_conv.inner = (void*)(val & (~1));
14993 val_conv.is_owned = (val & 1) || (val == 0);
14994 val_conv = UpdateFee_clone(&val_conv);
14995 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
14998 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
14999 LDKCommitmentUpdate this_ptr_conv;
15000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15001 this_ptr_conv.is_owned = false;
15002 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
15003 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15004 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15005 long ret_ref = (long)ret_var.inner;
15006 if (ret_var.is_owned) {
15012 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
15013 LDKCommitmentUpdate this_ptr_conv;
15014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15015 this_ptr_conv.is_owned = false;
15016 LDKCommitmentSigned val_conv;
15017 val_conv.inner = (void*)(val & (~1));
15018 val_conv.is_owned = (val & 1) || (val == 0);
15019 val_conv = CommitmentSigned_clone(&val_conv);
15020 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
15023 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) {
15024 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
15025 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
15026 if (update_add_htlcs_arg_constr.datalen > 0)
15027 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
15029 update_add_htlcs_arg_constr.data = NULL;
15030 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
15031 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
15032 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
15033 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
15034 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
15035 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
15036 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
15037 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
15039 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
15040 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
15041 if (update_fulfill_htlcs_arg_constr.datalen > 0)
15042 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
15044 update_fulfill_htlcs_arg_constr.data = NULL;
15045 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
15046 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
15047 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
15048 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
15049 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
15050 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
15051 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
15052 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
15054 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
15055 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
15056 if (update_fail_htlcs_arg_constr.datalen > 0)
15057 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
15059 update_fail_htlcs_arg_constr.data = NULL;
15060 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
15061 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
15062 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
15063 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
15064 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
15065 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
15066 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
15067 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
15069 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
15070 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
15071 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
15072 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
15074 update_fail_malformed_htlcs_arg_constr.data = NULL;
15075 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
15076 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
15077 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
15078 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
15079 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
15080 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = (update_fail_malformed_htlcs_arg_conv_25 & 1) || (update_fail_malformed_htlcs_arg_conv_25 == 0);
15081 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
15082 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
15084 LDKUpdateFee update_fee_arg_conv;
15085 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
15086 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
15087 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
15088 LDKCommitmentSigned commitment_signed_arg_conv;
15089 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
15090 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
15091 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
15092 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);
15093 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15094 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15095 long ret_ref = (long)ret_var.inner;
15096 if (ret_var.is_owned) {
15102 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
15103 LDKCommitmentUpdate orig_conv;
15104 orig_conv.inner = (void*)(orig & (~1));
15105 orig_conv.is_owned = false;
15106 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
15107 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15108 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15109 long ret_ref = (long)ret_var.inner;
15110 if (ret_var.is_owned) {
15116 void __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_free(uint32_t this_ptr) {
15117 if ((this_ptr & 1) != 0) return;
15118 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
15119 FREE((void*)this_ptr);
15120 HTLCFailChannelUpdate_free(this_ptr_conv);
15123 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_clone(uint32_t orig) {
15124 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
15125 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
15126 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
15127 long ret_ref = (long)ret_copy;
15131 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
15132 if ((this_ptr & 1) != 0) return;
15133 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
15134 FREE((void*)this_ptr);
15135 ChannelMessageHandler_free(this_ptr_conv);
15138 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
15139 if ((this_ptr & 1) != 0) return;
15140 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
15141 FREE((void*)this_ptr);
15142 RoutingMessageHandler_free(this_ptr_conv);
15145 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
15146 LDKAcceptChannel obj_conv;
15147 obj_conv.inner = (void*)(obj & (~1));
15148 obj_conv.is_owned = false;
15149 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
15150 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15151 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15152 CVec_u8Z_free(ret_var);
15156 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
15157 LDKu8slice ser_ref;
15158 ser_ref.datalen = *((uint32_t*)ser);
15159 ser_ref.data = (int8_t*)(ser + 4);
15160 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
15161 *ret_conv = AcceptChannel_read(ser_ref);
15162 return (long)ret_conv;
15165 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
15166 LDKAnnouncementSignatures obj_conv;
15167 obj_conv.inner = (void*)(obj & (~1));
15168 obj_conv.is_owned = false;
15169 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
15170 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15171 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15172 CVec_u8Z_free(ret_var);
15176 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
15177 LDKu8slice ser_ref;
15178 ser_ref.datalen = *((uint32_t*)ser);
15179 ser_ref.data = (int8_t*)(ser + 4);
15180 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
15181 *ret_conv = AnnouncementSignatures_read(ser_ref);
15182 return (long)ret_conv;
15185 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
15186 LDKChannelReestablish obj_conv;
15187 obj_conv.inner = (void*)(obj & (~1));
15188 obj_conv.is_owned = false;
15189 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
15190 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15191 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15192 CVec_u8Z_free(ret_var);
15196 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
15197 LDKu8slice ser_ref;
15198 ser_ref.datalen = *((uint32_t*)ser);
15199 ser_ref.data = (int8_t*)(ser + 4);
15200 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
15201 *ret_conv = ChannelReestablish_read(ser_ref);
15202 return (long)ret_conv;
15205 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
15206 LDKClosingSigned obj_conv;
15207 obj_conv.inner = (void*)(obj & (~1));
15208 obj_conv.is_owned = false;
15209 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
15210 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15211 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15212 CVec_u8Z_free(ret_var);
15216 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
15217 LDKu8slice ser_ref;
15218 ser_ref.datalen = *((uint32_t*)ser);
15219 ser_ref.data = (int8_t*)(ser + 4);
15220 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
15221 *ret_conv = ClosingSigned_read(ser_ref);
15222 return (long)ret_conv;
15225 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
15226 LDKCommitmentSigned obj_conv;
15227 obj_conv.inner = (void*)(obj & (~1));
15228 obj_conv.is_owned = false;
15229 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
15230 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15231 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15232 CVec_u8Z_free(ret_var);
15236 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
15237 LDKu8slice ser_ref;
15238 ser_ref.datalen = *((uint32_t*)ser);
15239 ser_ref.data = (int8_t*)(ser + 4);
15240 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
15241 *ret_conv = CommitmentSigned_read(ser_ref);
15242 return (long)ret_conv;
15245 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
15246 LDKFundingCreated obj_conv;
15247 obj_conv.inner = (void*)(obj & (~1));
15248 obj_conv.is_owned = false;
15249 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
15250 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15251 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15252 CVec_u8Z_free(ret_var);
15256 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
15257 LDKu8slice ser_ref;
15258 ser_ref.datalen = *((uint32_t*)ser);
15259 ser_ref.data = (int8_t*)(ser + 4);
15260 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
15261 *ret_conv = FundingCreated_read(ser_ref);
15262 return (long)ret_conv;
15265 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
15266 LDKFundingSigned obj_conv;
15267 obj_conv.inner = (void*)(obj & (~1));
15268 obj_conv.is_owned = false;
15269 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
15270 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15271 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15272 CVec_u8Z_free(ret_var);
15276 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
15277 LDKu8slice ser_ref;
15278 ser_ref.datalen = *((uint32_t*)ser);
15279 ser_ref.data = (int8_t*)(ser + 4);
15280 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
15281 *ret_conv = FundingSigned_read(ser_ref);
15282 return (long)ret_conv;
15285 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
15286 LDKFundingLocked obj_conv;
15287 obj_conv.inner = (void*)(obj & (~1));
15288 obj_conv.is_owned = false;
15289 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
15290 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15291 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15292 CVec_u8Z_free(ret_var);
15296 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
15297 LDKu8slice ser_ref;
15298 ser_ref.datalen = *((uint32_t*)ser);
15299 ser_ref.data = (int8_t*)(ser + 4);
15300 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
15301 *ret_conv = FundingLocked_read(ser_ref);
15302 return (long)ret_conv;
15305 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
15307 obj_conv.inner = (void*)(obj & (~1));
15308 obj_conv.is_owned = false;
15309 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
15310 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15311 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15312 CVec_u8Z_free(ret_var);
15316 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
15317 LDKu8slice ser_ref;
15318 ser_ref.datalen = *((uint32_t*)ser);
15319 ser_ref.data = (int8_t*)(ser + 4);
15320 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
15321 *ret_conv = Init_read(ser_ref);
15322 return (long)ret_conv;
15325 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
15326 LDKOpenChannel obj_conv;
15327 obj_conv.inner = (void*)(obj & (~1));
15328 obj_conv.is_owned = false;
15329 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
15330 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15331 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15332 CVec_u8Z_free(ret_var);
15336 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
15337 LDKu8slice ser_ref;
15338 ser_ref.datalen = *((uint32_t*)ser);
15339 ser_ref.data = (int8_t*)(ser + 4);
15340 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
15341 *ret_conv = OpenChannel_read(ser_ref);
15342 return (long)ret_conv;
15345 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
15346 LDKRevokeAndACK obj_conv;
15347 obj_conv.inner = (void*)(obj & (~1));
15348 obj_conv.is_owned = false;
15349 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
15350 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15351 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15352 CVec_u8Z_free(ret_var);
15356 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
15357 LDKu8slice ser_ref;
15358 ser_ref.datalen = *((uint32_t*)ser);
15359 ser_ref.data = (int8_t*)(ser + 4);
15360 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
15361 *ret_conv = RevokeAndACK_read(ser_ref);
15362 return (long)ret_conv;
15365 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
15366 LDKShutdown obj_conv;
15367 obj_conv.inner = (void*)(obj & (~1));
15368 obj_conv.is_owned = false;
15369 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
15370 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15371 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15372 CVec_u8Z_free(ret_var);
15376 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
15377 LDKu8slice ser_ref;
15378 ser_ref.datalen = *((uint32_t*)ser);
15379 ser_ref.data = (int8_t*)(ser + 4);
15380 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
15381 *ret_conv = Shutdown_read(ser_ref);
15382 return (long)ret_conv;
15385 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
15386 LDKUpdateFailHTLC obj_conv;
15387 obj_conv.inner = (void*)(obj & (~1));
15388 obj_conv.is_owned = false;
15389 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
15390 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15391 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15392 CVec_u8Z_free(ret_var);
15396 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
15397 LDKu8slice ser_ref;
15398 ser_ref.datalen = *((uint32_t*)ser);
15399 ser_ref.data = (int8_t*)(ser + 4);
15400 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
15401 *ret_conv = UpdateFailHTLC_read(ser_ref);
15402 return (long)ret_conv;
15405 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
15406 LDKUpdateFailMalformedHTLC obj_conv;
15407 obj_conv.inner = (void*)(obj & (~1));
15408 obj_conv.is_owned = false;
15409 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
15410 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15411 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15412 CVec_u8Z_free(ret_var);
15416 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
15417 LDKu8slice ser_ref;
15418 ser_ref.datalen = *((uint32_t*)ser);
15419 ser_ref.data = (int8_t*)(ser + 4);
15420 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
15421 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
15422 return (long)ret_conv;
15425 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
15426 LDKUpdateFee obj_conv;
15427 obj_conv.inner = (void*)(obj & (~1));
15428 obj_conv.is_owned = false;
15429 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
15430 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15431 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15432 CVec_u8Z_free(ret_var);
15436 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
15437 LDKu8slice ser_ref;
15438 ser_ref.datalen = *((uint32_t*)ser);
15439 ser_ref.data = (int8_t*)(ser + 4);
15440 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
15441 *ret_conv = UpdateFee_read(ser_ref);
15442 return (long)ret_conv;
15445 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
15446 LDKUpdateFulfillHTLC obj_conv;
15447 obj_conv.inner = (void*)(obj & (~1));
15448 obj_conv.is_owned = false;
15449 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
15450 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15451 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15452 CVec_u8Z_free(ret_var);
15456 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
15457 LDKu8slice ser_ref;
15458 ser_ref.datalen = *((uint32_t*)ser);
15459 ser_ref.data = (int8_t*)(ser + 4);
15460 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
15461 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
15462 return (long)ret_conv;
15465 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
15466 LDKUpdateAddHTLC obj_conv;
15467 obj_conv.inner = (void*)(obj & (~1));
15468 obj_conv.is_owned = false;
15469 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
15470 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15471 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15472 CVec_u8Z_free(ret_var);
15476 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
15477 LDKu8slice ser_ref;
15478 ser_ref.datalen = *((uint32_t*)ser);
15479 ser_ref.data = (int8_t*)(ser + 4);
15480 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15481 *ret_conv = UpdateAddHTLC_read(ser_ref);
15482 return (long)ret_conv;
15485 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
15487 obj_conv.inner = (void*)(obj & (~1));
15488 obj_conv.is_owned = false;
15489 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
15490 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15491 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15492 CVec_u8Z_free(ret_var);
15496 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
15497 LDKu8slice ser_ref;
15498 ser_ref.datalen = *((uint32_t*)ser);
15499 ser_ref.data = (int8_t*)(ser + 4);
15500 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15501 *ret_conv = Ping_read(ser_ref);
15502 return (long)ret_conv;
15505 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
15507 obj_conv.inner = (void*)(obj & (~1));
15508 obj_conv.is_owned = false;
15509 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
15510 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15511 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15512 CVec_u8Z_free(ret_var);
15516 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
15517 LDKu8slice ser_ref;
15518 ser_ref.datalen = *((uint32_t*)ser);
15519 ser_ref.data = (int8_t*)(ser + 4);
15520 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15521 *ret_conv = Pong_read(ser_ref);
15522 return (long)ret_conv;
15525 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
15526 LDKUnsignedChannelAnnouncement obj_conv;
15527 obj_conv.inner = (void*)(obj & (~1));
15528 obj_conv.is_owned = false;
15529 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
15530 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15531 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15532 CVec_u8Z_free(ret_var);
15536 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
15537 LDKu8slice ser_ref;
15538 ser_ref.datalen = *((uint32_t*)ser);
15539 ser_ref.data = (int8_t*)(ser + 4);
15540 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15541 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
15542 return (long)ret_conv;
15545 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
15546 LDKChannelAnnouncement obj_conv;
15547 obj_conv.inner = (void*)(obj & (~1));
15548 obj_conv.is_owned = false;
15549 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
15550 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15551 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15552 CVec_u8Z_free(ret_var);
15556 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
15557 LDKu8slice ser_ref;
15558 ser_ref.datalen = *((uint32_t*)ser);
15559 ser_ref.data = (int8_t*)(ser + 4);
15560 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15561 *ret_conv = ChannelAnnouncement_read(ser_ref);
15562 return (long)ret_conv;
15565 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
15566 LDKUnsignedChannelUpdate obj_conv;
15567 obj_conv.inner = (void*)(obj & (~1));
15568 obj_conv.is_owned = false;
15569 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
15570 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15571 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15572 CVec_u8Z_free(ret_var);
15576 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
15577 LDKu8slice ser_ref;
15578 ser_ref.datalen = *((uint32_t*)ser);
15579 ser_ref.data = (int8_t*)(ser + 4);
15580 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15581 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
15582 return (long)ret_conv;
15585 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
15586 LDKChannelUpdate obj_conv;
15587 obj_conv.inner = (void*)(obj & (~1));
15588 obj_conv.is_owned = false;
15589 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
15590 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15591 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15592 CVec_u8Z_free(ret_var);
15596 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
15597 LDKu8slice ser_ref;
15598 ser_ref.datalen = *((uint32_t*)ser);
15599 ser_ref.data = (int8_t*)(ser + 4);
15600 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15601 *ret_conv = ChannelUpdate_read(ser_ref);
15602 return (long)ret_conv;
15605 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
15606 LDKErrorMessage obj_conv;
15607 obj_conv.inner = (void*)(obj & (~1));
15608 obj_conv.is_owned = false;
15609 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
15610 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15611 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15612 CVec_u8Z_free(ret_var);
15616 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
15617 LDKu8slice ser_ref;
15618 ser_ref.datalen = *((uint32_t*)ser);
15619 ser_ref.data = (int8_t*)(ser + 4);
15620 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15621 *ret_conv = ErrorMessage_read(ser_ref);
15622 return (long)ret_conv;
15625 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
15626 LDKUnsignedNodeAnnouncement obj_conv;
15627 obj_conv.inner = (void*)(obj & (~1));
15628 obj_conv.is_owned = false;
15629 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
15630 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15631 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15632 CVec_u8Z_free(ret_var);
15636 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
15637 LDKu8slice ser_ref;
15638 ser_ref.datalen = *((uint32_t*)ser);
15639 ser_ref.data = (int8_t*)(ser + 4);
15640 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15641 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
15642 return (long)ret_conv;
15645 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
15646 LDKNodeAnnouncement obj_conv;
15647 obj_conv.inner = (void*)(obj & (~1));
15648 obj_conv.is_owned = false;
15649 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
15650 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15651 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15652 CVec_u8Z_free(ret_var);
15656 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
15657 LDKu8slice ser_ref;
15658 ser_ref.datalen = *((uint32_t*)ser);
15659 ser_ref.data = (int8_t*)(ser + 4);
15660 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15661 *ret_conv = NodeAnnouncement_read(ser_ref);
15662 return (long)ret_conv;
15665 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
15666 LDKu8slice ser_ref;
15667 ser_ref.datalen = *((uint32_t*)ser);
15668 ser_ref.data = (int8_t*)(ser + 4);
15669 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15670 *ret_conv = QueryShortChannelIds_read(ser_ref);
15671 return (long)ret_conv;
15674 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
15675 LDKQueryShortChannelIds obj_conv;
15676 obj_conv.inner = (void*)(obj & (~1));
15677 obj_conv.is_owned = false;
15678 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
15679 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15680 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15681 CVec_u8Z_free(ret_var);
15685 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
15686 LDKu8slice ser_ref;
15687 ser_ref.datalen = *((uint32_t*)ser);
15688 ser_ref.data = (int8_t*)(ser + 4);
15689 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15690 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
15691 return (long)ret_conv;
15694 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
15695 LDKReplyShortChannelIdsEnd obj_conv;
15696 obj_conv.inner = (void*)(obj & (~1));
15697 obj_conv.is_owned = false;
15698 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
15699 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15700 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15701 CVec_u8Z_free(ret_var);
15705 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
15706 LDKQueryChannelRange this_arg_conv;
15707 this_arg_conv.inner = (void*)(this_arg & (~1));
15708 this_arg_conv.is_owned = false;
15709 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
15713 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
15714 LDKu8slice ser_ref;
15715 ser_ref.datalen = *((uint32_t*)ser);
15716 ser_ref.data = (int8_t*)(ser + 4);
15717 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15718 *ret_conv = QueryChannelRange_read(ser_ref);
15719 return (long)ret_conv;
15722 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
15723 LDKQueryChannelRange obj_conv;
15724 obj_conv.inner = (void*)(obj & (~1));
15725 obj_conv.is_owned = false;
15726 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
15727 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15728 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15729 CVec_u8Z_free(ret_var);
15733 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
15734 LDKu8slice ser_ref;
15735 ser_ref.datalen = *((uint32_t*)ser);
15736 ser_ref.data = (int8_t*)(ser + 4);
15737 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15738 *ret_conv = ReplyChannelRange_read(ser_ref);
15739 return (long)ret_conv;
15742 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
15743 LDKReplyChannelRange obj_conv;
15744 obj_conv.inner = (void*)(obj & (~1));
15745 obj_conv.is_owned = false;
15746 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
15747 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15748 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15749 CVec_u8Z_free(ret_var);
15753 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
15754 LDKu8slice ser_ref;
15755 ser_ref.datalen = *((uint32_t*)ser);
15756 ser_ref.data = (int8_t*)(ser + 4);
15757 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15758 *ret_conv = GossipTimestampFilter_read(ser_ref);
15759 return (long)ret_conv;
15762 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
15763 LDKGossipTimestampFilter obj_conv;
15764 obj_conv.inner = (void*)(obj & (~1));
15765 obj_conv.is_owned = false;
15766 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
15767 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15768 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15769 CVec_u8Z_free(ret_var);
15773 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
15774 LDKIgnoringMessageHandler this_obj_conv;
15775 this_obj_conv.inner = (void*)(this_obj & (~1));
15776 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15777 IgnoringMessageHandler_free(this_obj_conv);
15780 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
15781 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
15782 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15783 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15784 long ret_ref = (long)ret_var.inner;
15785 if (ret_var.is_owned) {
15791 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
15792 LDKIgnoringMessageHandler this_arg_conv;
15793 this_arg_conv.inner = (void*)(this_arg & (~1));
15794 this_arg_conv.is_owned = false;
15795 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
15796 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
15800 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
15801 LDKIgnoringMessageHandler this_arg_conv;
15802 this_arg_conv.inner = (void*)(this_arg & (~1));
15803 this_arg_conv.is_owned = false;
15804 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
15805 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
15809 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
15810 LDKErroringMessageHandler this_obj_conv;
15811 this_obj_conv.inner = (void*)(this_obj & (~1));
15812 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15813 ErroringMessageHandler_free(this_obj_conv);
15816 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
15817 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
15818 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15819 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15820 long ret_ref = (long)ret_var.inner;
15821 if (ret_var.is_owned) {
15827 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
15828 LDKErroringMessageHandler this_arg_conv;
15829 this_arg_conv.inner = (void*)(this_arg & (~1));
15830 this_arg_conv.is_owned = false;
15831 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
15832 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
15836 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
15837 LDKErroringMessageHandler this_arg_conv;
15838 this_arg_conv.inner = (void*)(this_arg & (~1));
15839 this_arg_conv.is_owned = false;
15840 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
15841 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
15845 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
15846 LDKMessageHandler this_obj_conv;
15847 this_obj_conv.inner = (void*)(this_obj & (~1));
15848 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15849 MessageHandler_free(this_obj_conv);
15852 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
15853 LDKMessageHandler this_ptr_conv;
15854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15855 this_ptr_conv.is_owned = false;
15856 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
15860 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
15861 LDKMessageHandler this_ptr_conv;
15862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15863 this_ptr_conv.is_owned = false;
15864 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
15865 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
15868 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
15869 LDKMessageHandler this_ptr_conv;
15870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15871 this_ptr_conv.is_owned = false;
15872 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
15876 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
15877 LDKMessageHandler this_ptr_conv;
15878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15879 this_ptr_conv.is_owned = false;
15880 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
15881 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
15884 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
15885 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
15886 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
15887 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
15888 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15889 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15890 long ret_ref = (long)ret_var.inner;
15891 if (ret_var.is_owned) {
15897 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
15898 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
15899 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
15900 *ret = SocketDescriptor_clone(orig_conv);
15904 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
15905 if ((this_ptr & 1) != 0) return;
15906 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
15907 FREE((void*)this_ptr);
15908 SocketDescriptor_free(this_ptr_conv);
15911 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
15912 LDKPeerHandleError this_obj_conv;
15913 this_obj_conv.inner = (void*)(this_obj & (~1));
15914 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15915 PeerHandleError_free(this_obj_conv);
15918 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
15919 LDKPeerHandleError this_ptr_conv;
15920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15921 this_ptr_conv.is_owned = false;
15922 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
15926 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
15927 LDKPeerHandleError this_ptr_conv;
15928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15929 this_ptr_conv.is_owned = false;
15930 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
15933 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
15934 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
15935 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15936 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15937 long ret_ref = (long)ret_var.inner;
15938 if (ret_var.is_owned) {
15944 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
15945 LDKPeerHandleError orig_conv;
15946 orig_conv.inner = (void*)(orig & (~1));
15947 orig_conv.is_owned = false;
15948 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
15949 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15950 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15951 long ret_ref = (long)ret_var.inner;
15952 if (ret_var.is_owned) {
15958 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
15959 LDKPeerManager this_obj_conv;
15960 this_obj_conv.inner = (void*)(this_obj & (~1));
15961 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15962 PeerManager_free(this_obj_conv);
15965 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) {
15966 LDKMessageHandler message_handler_conv;
15967 message_handler_conv.inner = (void*)(message_handler & (~1));
15968 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
15969 // Warning: we need a move here but no clone is available for LDKMessageHandler
15970 LDKSecretKey our_node_secret_ref;
15971 CHECK(*((uint32_t*)our_node_secret) == 32);
15972 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
15973 unsigned char ephemeral_random_data_arr[32];
15974 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
15975 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
15976 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
15977 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15978 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
15979 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15980 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15981 long ret_ref = (long)ret_var.inner;
15982 if (ret_var.is_owned) {
15988 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
15989 LDKPeerManager this_arg_conv;
15990 this_arg_conv.inner = (void*)(this_arg & (~1));
15991 this_arg_conv.is_owned = false;
15992 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
15993 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
15994 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
15995 for (size_t m = 0; m < ret_var.datalen; m++) {
15996 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15997 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
15998 ret_arr_ptr[m] = ret_conv_12_arr;
16000 FREE(ret_var.data);
16004 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
16005 LDKPeerManager this_arg_conv;
16006 this_arg_conv.inner = (void*)(this_arg & (~1));
16007 this_arg_conv.is_owned = false;
16008 LDKPublicKey their_node_id_ref;
16009 CHECK(*((uint32_t*)their_node_id) == 33);
16010 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
16011 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16012 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
16013 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
16014 return (long)ret_conv;
16017 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
16018 LDKPeerManager this_arg_conv;
16019 this_arg_conv.inner = (void*)(this_arg & (~1));
16020 this_arg_conv.is_owned = false;
16021 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16022 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16023 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
16024 return (long)ret_conv;
16027 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
16028 LDKPeerManager this_arg_conv;
16029 this_arg_conv.inner = (void*)(this_arg & (~1));
16030 this_arg_conv.is_owned = false;
16031 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16032 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16033 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
16034 return (long)ret_conv;
16037 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
16038 LDKPeerManager this_arg_conv;
16039 this_arg_conv.inner = (void*)(this_arg & (~1));
16040 this_arg_conv.is_owned = false;
16041 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
16042 LDKu8slice data_ref;
16043 data_ref.datalen = *((uint32_t*)data);
16044 data_ref.data = (int8_t*)(data + 4);
16045 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
16046 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
16047 return (long)ret_conv;
16050 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
16051 LDKPeerManager this_arg_conv;
16052 this_arg_conv.inner = (void*)(this_arg & (~1));
16053 this_arg_conv.is_owned = false;
16054 PeerManager_process_events(&this_arg_conv);
16057 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
16058 LDKPeerManager this_arg_conv;
16059 this_arg_conv.inner = (void*)(this_arg & (~1));
16060 this_arg_conv.is_owned = false;
16061 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16062 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
16065 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
16066 LDKPeerManager this_arg_conv;
16067 this_arg_conv.inner = (void*)(this_arg & (~1));
16068 this_arg_conv.is_owned = false;
16069 LDKPublicKey node_id_ref;
16070 CHECK(*((uint32_t*)node_id) == 33);
16071 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16072 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
16075 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
16076 LDKPeerManager this_arg_conv;
16077 this_arg_conv.inner = (void*)(this_arg & (~1));
16078 this_arg_conv.is_owned = false;
16079 PeerManager_timer_tick_occurred(&this_arg_conv);
16082 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
16083 unsigned char commitment_seed_arr[32];
16084 CHECK(*((uint32_t*)commitment_seed) == 32);
16085 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
16086 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
16087 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16088 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
16092 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
16093 LDKPublicKey per_commitment_point_ref;
16094 CHECK(*((uint32_t*)per_commitment_point) == 33);
16095 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16096 unsigned char base_secret_arr[32];
16097 CHECK(*((uint32_t*)base_secret) == 32);
16098 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
16099 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
16100 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
16101 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
16102 return (long)ret_conv;
16105 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
16106 LDKPublicKey per_commitment_point_ref;
16107 CHECK(*((uint32_t*)per_commitment_point) == 33);
16108 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16109 LDKPublicKey base_point_ref;
16110 CHECK(*((uint32_t*)base_point) == 33);
16111 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
16112 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
16113 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
16114 return (long)ret_conv;
16117 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
16118 unsigned char per_commitment_secret_arr[32];
16119 CHECK(*((uint32_t*)per_commitment_secret) == 32);
16120 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
16121 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
16122 unsigned char countersignatory_revocation_base_secret_arr[32];
16123 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
16124 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
16125 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
16126 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
16127 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
16128 return (long)ret_conv;
16131 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
16132 LDKPublicKey per_commitment_point_ref;
16133 CHECK(*((uint32_t*)per_commitment_point) == 33);
16134 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16135 LDKPublicKey countersignatory_revocation_base_point_ref;
16136 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
16137 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
16138 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
16139 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
16140 return (long)ret_conv;
16143 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
16144 LDKTxCreationKeys this_obj_conv;
16145 this_obj_conv.inner = (void*)(this_obj & (~1));
16146 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16147 TxCreationKeys_free(this_obj_conv);
16150 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
16151 LDKTxCreationKeys this_ptr_conv;
16152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16153 this_ptr_conv.is_owned = false;
16154 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16155 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16159 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16160 LDKTxCreationKeys this_ptr_conv;
16161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16162 this_ptr_conv.is_owned = false;
16163 LDKPublicKey val_ref;
16164 CHECK(*((uint32_t*)val) == 33);
16165 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16166 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
16169 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
16170 LDKTxCreationKeys this_ptr_conv;
16171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16172 this_ptr_conv.is_owned = false;
16173 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16174 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
16178 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
16179 LDKTxCreationKeys this_ptr_conv;
16180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16181 this_ptr_conv.is_owned = false;
16182 LDKPublicKey val_ref;
16183 CHECK(*((uint32_t*)val) == 33);
16184 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16185 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
16188 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
16189 LDKTxCreationKeys this_ptr_conv;
16190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16191 this_ptr_conv.is_owned = false;
16192 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16193 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
16197 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
16198 LDKTxCreationKeys this_ptr_conv;
16199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16200 this_ptr_conv.is_owned = false;
16201 LDKPublicKey val_ref;
16202 CHECK(*((uint32_t*)val) == 33);
16203 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16204 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
16207 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
16208 LDKTxCreationKeys this_ptr_conv;
16209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16210 this_ptr_conv.is_owned = false;
16211 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16212 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
16216 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
16217 LDKTxCreationKeys this_ptr_conv;
16218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16219 this_ptr_conv.is_owned = false;
16220 LDKPublicKey val_ref;
16221 CHECK(*((uint32_t*)val) == 33);
16222 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16223 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
16226 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
16227 LDKTxCreationKeys this_ptr_conv;
16228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16229 this_ptr_conv.is_owned = false;
16230 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16231 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
16235 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
16236 LDKTxCreationKeys this_ptr_conv;
16237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16238 this_ptr_conv.is_owned = false;
16239 LDKPublicKey val_ref;
16240 CHECK(*((uint32_t*)val) == 33);
16241 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16242 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
16245 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) {
16246 LDKPublicKey per_commitment_point_arg_ref;
16247 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
16248 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
16249 LDKPublicKey revocation_key_arg_ref;
16250 CHECK(*((uint32_t*)revocation_key_arg) == 33);
16251 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
16252 LDKPublicKey broadcaster_htlc_key_arg_ref;
16253 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
16254 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
16255 LDKPublicKey countersignatory_htlc_key_arg_ref;
16256 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
16257 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
16258 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
16259 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
16260 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
16261 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);
16262 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16263 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16264 long ret_ref = (long)ret_var.inner;
16265 if (ret_var.is_owned) {
16271 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
16272 LDKTxCreationKeys orig_conv;
16273 orig_conv.inner = (void*)(orig & (~1));
16274 orig_conv.is_owned = false;
16275 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
16276 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16277 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16278 long ret_ref = (long)ret_var.inner;
16279 if (ret_var.is_owned) {
16285 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
16286 LDKTxCreationKeys obj_conv;
16287 obj_conv.inner = (void*)(obj & (~1));
16288 obj_conv.is_owned = false;
16289 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
16290 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16291 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16292 CVec_u8Z_free(ret_var);
16296 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
16297 LDKu8slice ser_ref;
16298 ser_ref.datalen = *((uint32_t*)ser);
16299 ser_ref.data = (int8_t*)(ser + 4);
16300 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
16301 *ret_conv = TxCreationKeys_read(ser_ref);
16302 return (long)ret_conv;
16305 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
16306 LDKChannelPublicKeys this_obj_conv;
16307 this_obj_conv.inner = (void*)(this_obj & (~1));
16308 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16309 ChannelPublicKeys_free(this_obj_conv);
16312 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
16313 LDKChannelPublicKeys this_ptr_conv;
16314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16315 this_ptr_conv.is_owned = false;
16316 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16317 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
16321 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
16322 LDKChannelPublicKeys this_ptr_conv;
16323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16324 this_ptr_conv.is_owned = false;
16325 LDKPublicKey val_ref;
16326 CHECK(*((uint32_t*)val) == 33);
16327 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16328 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
16331 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
16332 LDKChannelPublicKeys this_ptr_conv;
16333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16334 this_ptr_conv.is_owned = false;
16335 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16336 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
16340 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
16341 LDKChannelPublicKeys this_ptr_conv;
16342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16343 this_ptr_conv.is_owned = false;
16344 LDKPublicKey val_ref;
16345 CHECK(*((uint32_t*)val) == 33);
16346 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16347 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
16350 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
16351 LDKChannelPublicKeys this_ptr_conv;
16352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16353 this_ptr_conv.is_owned = false;
16354 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16355 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
16359 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
16360 LDKChannelPublicKeys this_ptr_conv;
16361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16362 this_ptr_conv.is_owned = false;
16363 LDKPublicKey val_ref;
16364 CHECK(*((uint32_t*)val) == 33);
16365 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16366 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
16369 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
16370 LDKChannelPublicKeys this_ptr_conv;
16371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16372 this_ptr_conv.is_owned = false;
16373 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16374 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
16378 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
16379 LDKChannelPublicKeys this_ptr_conv;
16380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16381 this_ptr_conv.is_owned = false;
16382 LDKPublicKey val_ref;
16383 CHECK(*((uint32_t*)val) == 33);
16384 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16385 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16388 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
16389 LDKChannelPublicKeys this_ptr_conv;
16390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16391 this_ptr_conv.is_owned = false;
16392 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16393 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
16397 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
16398 LDKChannelPublicKeys this_ptr_conv;
16399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16400 this_ptr_conv.is_owned = false;
16401 LDKPublicKey val_ref;
16402 CHECK(*((uint32_t*)val) == 33);
16403 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16404 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
16407 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) {
16408 LDKPublicKey funding_pubkey_arg_ref;
16409 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
16410 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
16411 LDKPublicKey revocation_basepoint_arg_ref;
16412 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
16413 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
16414 LDKPublicKey payment_point_arg_ref;
16415 CHECK(*((uint32_t*)payment_point_arg) == 33);
16416 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
16417 LDKPublicKey delayed_payment_basepoint_arg_ref;
16418 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
16419 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
16420 LDKPublicKey htlc_basepoint_arg_ref;
16421 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
16422 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
16423 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);
16424 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16425 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16426 long ret_ref = (long)ret_var.inner;
16427 if (ret_var.is_owned) {
16433 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
16434 LDKChannelPublicKeys orig_conv;
16435 orig_conv.inner = (void*)(orig & (~1));
16436 orig_conv.is_owned = false;
16437 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
16438 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16439 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16440 long ret_ref = (long)ret_var.inner;
16441 if (ret_var.is_owned) {
16447 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
16448 LDKChannelPublicKeys obj_conv;
16449 obj_conv.inner = (void*)(obj & (~1));
16450 obj_conv.is_owned = false;
16451 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
16452 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16453 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16454 CVec_u8Z_free(ret_var);
16458 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
16459 LDKu8slice ser_ref;
16460 ser_ref.datalen = *((uint32_t*)ser);
16461 ser_ref.data = (int8_t*)(ser + 4);
16462 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
16463 *ret_conv = ChannelPublicKeys_read(ser_ref);
16464 return (long)ret_conv;
16467 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) {
16468 LDKPublicKey per_commitment_point_ref;
16469 CHECK(*((uint32_t*)per_commitment_point) == 33);
16470 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16471 LDKPublicKey broadcaster_delayed_payment_base_ref;
16472 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
16473 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
16474 LDKPublicKey broadcaster_htlc_base_ref;
16475 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
16476 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
16477 LDKPublicKey countersignatory_revocation_base_ref;
16478 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
16479 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
16480 LDKPublicKey countersignatory_htlc_base_ref;
16481 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
16482 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
16483 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
16484 *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);
16485 return (long)ret_conv;
16488 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
16489 LDKPublicKey per_commitment_point_ref;
16490 CHECK(*((uint32_t*)per_commitment_point) == 33);
16491 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16492 LDKChannelPublicKeys broadcaster_keys_conv;
16493 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
16494 broadcaster_keys_conv.is_owned = false;
16495 LDKChannelPublicKeys countersignatory_keys_conv;
16496 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
16497 countersignatory_keys_conv.is_owned = false;
16498 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
16499 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
16500 return (long)ret_conv;
16503 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
16504 LDKPublicKey revocation_key_ref;
16505 CHECK(*((uint32_t*)revocation_key) == 33);
16506 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
16507 LDKPublicKey broadcaster_delayed_payment_key_ref;
16508 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
16509 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
16510 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
16511 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16512 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16513 CVec_u8Z_free(ret_var);
16517 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
16518 LDKHTLCOutputInCommitment this_obj_conv;
16519 this_obj_conv.inner = (void*)(this_obj & (~1));
16520 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16521 HTLCOutputInCommitment_free(this_obj_conv);
16524 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
16525 LDKHTLCOutputInCommitment this_ptr_conv;
16526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16527 this_ptr_conv.is_owned = false;
16528 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
16532 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
16533 LDKHTLCOutputInCommitment this_ptr_conv;
16534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16535 this_ptr_conv.is_owned = false;
16536 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
16539 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
16540 LDKHTLCOutputInCommitment this_ptr_conv;
16541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16542 this_ptr_conv.is_owned = false;
16543 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
16547 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
16548 LDKHTLCOutputInCommitment this_ptr_conv;
16549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16550 this_ptr_conv.is_owned = false;
16551 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
16554 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
16555 LDKHTLCOutputInCommitment this_ptr_conv;
16556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16557 this_ptr_conv.is_owned = false;
16558 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
16562 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
16563 LDKHTLCOutputInCommitment this_ptr_conv;
16564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16565 this_ptr_conv.is_owned = false;
16566 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
16569 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
16570 LDKHTLCOutputInCommitment this_ptr_conv;
16571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16572 this_ptr_conv.is_owned = false;
16573 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16574 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
16578 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
16579 LDKHTLCOutputInCommitment this_ptr_conv;
16580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16581 this_ptr_conv.is_owned = false;
16582 LDKThirtyTwoBytes val_ref;
16583 CHECK(*((uint32_t*)val) == 32);
16584 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16585 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
16588 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
16589 LDKHTLCOutputInCommitment orig_conv;
16590 orig_conv.inner = (void*)(orig & (~1));
16591 orig_conv.is_owned = false;
16592 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
16593 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16594 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16595 long ret_ref = (long)ret_var.inner;
16596 if (ret_var.is_owned) {
16602 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
16603 LDKHTLCOutputInCommitment obj_conv;
16604 obj_conv.inner = (void*)(obj & (~1));
16605 obj_conv.is_owned = false;
16606 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
16607 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16608 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16609 CVec_u8Z_free(ret_var);
16613 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
16614 LDKu8slice ser_ref;
16615 ser_ref.datalen = *((uint32_t*)ser);
16616 ser_ref.data = (int8_t*)(ser + 4);
16617 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
16618 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
16619 return (long)ret_conv;
16622 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
16623 LDKHTLCOutputInCommitment htlc_conv;
16624 htlc_conv.inner = (void*)(htlc & (~1));
16625 htlc_conv.is_owned = false;
16626 LDKTxCreationKeys keys_conv;
16627 keys_conv.inner = (void*)(keys & (~1));
16628 keys_conv.is_owned = false;
16629 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
16630 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16631 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16632 CVec_u8Z_free(ret_var);
16636 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
16637 LDKPublicKey broadcaster_ref;
16638 CHECK(*((uint32_t*)broadcaster) == 33);
16639 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
16640 LDKPublicKey countersignatory_ref;
16641 CHECK(*((uint32_t*)countersignatory) == 33);
16642 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
16643 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
16644 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16645 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16646 CVec_u8Z_free(ret_var);
16650 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) {
16651 unsigned char prev_hash_arr[32];
16652 CHECK(*((uint32_t*)prev_hash) == 32);
16653 memcpy(prev_hash_arr, (uint8_t*)(prev_hash + 4), 32);
16654 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
16655 LDKHTLCOutputInCommitment htlc_conv;
16656 htlc_conv.inner = (void*)(htlc & (~1));
16657 htlc_conv.is_owned = false;
16658 LDKPublicKey broadcaster_delayed_payment_key_ref;
16659 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
16660 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
16661 LDKPublicKey revocation_key_ref;
16662 CHECK(*((uint32_t*)revocation_key) == 33);
16663 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
16664 LDKTransaction ret_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
16665 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16666 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16667 Transaction_free(ret_var);
16671 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
16672 LDKChannelTransactionParameters this_obj_conv;
16673 this_obj_conv.inner = (void*)(this_obj & (~1));
16674 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16675 ChannelTransactionParameters_free(this_obj_conv);
16678 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
16679 LDKChannelTransactionParameters this_ptr_conv;
16680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16681 this_ptr_conv.is_owned = false;
16682 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
16683 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16684 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16685 long ret_ref = (long)ret_var.inner;
16686 if (ret_var.is_owned) {
16692 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
16693 LDKChannelTransactionParameters this_ptr_conv;
16694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16695 this_ptr_conv.is_owned = false;
16696 LDKChannelPublicKeys val_conv;
16697 val_conv.inner = (void*)(val & (~1));
16698 val_conv.is_owned = (val & 1) || (val == 0);
16699 val_conv = ChannelPublicKeys_clone(&val_conv);
16700 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
16703 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
16704 LDKChannelTransactionParameters this_ptr_conv;
16705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16706 this_ptr_conv.is_owned = false;
16707 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
16711 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
16712 LDKChannelTransactionParameters this_ptr_conv;
16713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16714 this_ptr_conv.is_owned = false;
16715 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
16718 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
16719 LDKChannelTransactionParameters this_ptr_conv;
16720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16721 this_ptr_conv.is_owned = false;
16722 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
16726 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
16727 LDKChannelTransactionParameters this_ptr_conv;
16728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16729 this_ptr_conv.is_owned = false;
16730 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
16733 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
16734 LDKChannelTransactionParameters this_ptr_conv;
16735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16736 this_ptr_conv.is_owned = false;
16737 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
16738 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16739 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16740 long ret_ref = (long)ret_var.inner;
16741 if (ret_var.is_owned) {
16747 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
16748 LDKChannelTransactionParameters this_ptr_conv;
16749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16750 this_ptr_conv.is_owned = false;
16751 LDKCounterpartyChannelTransactionParameters val_conv;
16752 val_conv.inner = (void*)(val & (~1));
16753 val_conv.is_owned = (val & 1) || (val == 0);
16754 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
16755 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
16758 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
16759 LDKChannelTransactionParameters this_ptr_conv;
16760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16761 this_ptr_conv.is_owned = false;
16762 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
16763 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16764 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16765 long ret_ref = (long)ret_var.inner;
16766 if (ret_var.is_owned) {
16772 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
16773 LDKChannelTransactionParameters this_ptr_conv;
16774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16775 this_ptr_conv.is_owned = false;
16776 LDKOutPoint val_conv;
16777 val_conv.inner = (void*)(val & (~1));
16778 val_conv.is_owned = (val & 1) || (val == 0);
16779 val_conv = OutPoint_clone(&val_conv);
16780 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
16783 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) {
16784 LDKChannelPublicKeys holder_pubkeys_arg_conv;
16785 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
16786 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
16787 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
16788 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
16789 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
16790 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
16791 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
16792 LDKOutPoint funding_outpoint_arg_conv;
16793 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
16794 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
16795 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
16796 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);
16797 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16798 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16799 long ret_ref = (long)ret_var.inner;
16800 if (ret_var.is_owned) {
16806 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
16807 LDKChannelTransactionParameters orig_conv;
16808 orig_conv.inner = (void*)(orig & (~1));
16809 orig_conv.is_owned = false;
16810 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
16811 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16812 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16813 long ret_ref = (long)ret_var.inner;
16814 if (ret_var.is_owned) {
16820 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
16821 LDKCounterpartyChannelTransactionParameters this_obj_conv;
16822 this_obj_conv.inner = (void*)(this_obj & (~1));
16823 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16824 CounterpartyChannelTransactionParameters_free(this_obj_conv);
16827 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
16828 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16830 this_ptr_conv.is_owned = false;
16831 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
16832 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16833 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16834 long ret_ref = (long)ret_var.inner;
16835 if (ret_var.is_owned) {
16841 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
16842 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16844 this_ptr_conv.is_owned = false;
16845 LDKChannelPublicKeys val_conv;
16846 val_conv.inner = (void*)(val & (~1));
16847 val_conv.is_owned = (val & 1) || (val == 0);
16848 val_conv = ChannelPublicKeys_clone(&val_conv);
16849 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
16852 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
16853 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16855 this_ptr_conv.is_owned = false;
16856 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
16860 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
16861 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16863 this_ptr_conv.is_owned = false;
16864 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
16867 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
16868 LDKChannelPublicKeys pubkeys_arg_conv;
16869 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
16870 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
16871 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
16872 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
16873 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16874 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16875 long ret_ref = (long)ret_var.inner;
16876 if (ret_var.is_owned) {
16882 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
16883 LDKCounterpartyChannelTransactionParameters orig_conv;
16884 orig_conv.inner = (void*)(orig & (~1));
16885 orig_conv.is_owned = false;
16886 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
16887 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16888 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16889 long ret_ref = (long)ret_var.inner;
16890 if (ret_var.is_owned) {
16896 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
16897 LDKChannelTransactionParameters this_arg_conv;
16898 this_arg_conv.inner = (void*)(this_arg & (~1));
16899 this_arg_conv.is_owned = false;
16900 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
16904 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
16905 LDKChannelTransactionParameters this_arg_conv;
16906 this_arg_conv.inner = (void*)(this_arg & (~1));
16907 this_arg_conv.is_owned = false;
16908 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
16909 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16910 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16911 long ret_ref = (long)ret_var.inner;
16912 if (ret_var.is_owned) {
16918 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
16919 LDKChannelTransactionParameters this_arg_conv;
16920 this_arg_conv.inner = (void*)(this_arg & (~1));
16921 this_arg_conv.is_owned = false;
16922 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
16923 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16924 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16925 long ret_ref = (long)ret_var.inner;
16926 if (ret_var.is_owned) {
16932 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
16933 LDKCounterpartyChannelTransactionParameters obj_conv;
16934 obj_conv.inner = (void*)(obj & (~1));
16935 obj_conv.is_owned = false;
16936 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
16937 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16938 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16939 CVec_u8Z_free(ret_var);
16943 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
16944 LDKu8slice ser_ref;
16945 ser_ref.datalen = *((uint32_t*)ser);
16946 ser_ref.data = (int8_t*)(ser + 4);
16947 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
16948 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
16949 return (long)ret_conv;
16952 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
16953 LDKChannelTransactionParameters obj_conv;
16954 obj_conv.inner = (void*)(obj & (~1));
16955 obj_conv.is_owned = false;
16956 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
16957 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16958 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16959 CVec_u8Z_free(ret_var);
16963 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
16964 LDKu8slice ser_ref;
16965 ser_ref.datalen = *((uint32_t*)ser);
16966 ser_ref.data = (int8_t*)(ser + 4);
16967 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
16968 *ret_conv = ChannelTransactionParameters_read(ser_ref);
16969 return (long)ret_conv;
16972 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
16973 LDKDirectedChannelTransactionParameters this_obj_conv;
16974 this_obj_conv.inner = (void*)(this_obj & (~1));
16975 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16976 DirectedChannelTransactionParameters_free(this_obj_conv);
16979 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
16980 LDKDirectedChannelTransactionParameters this_arg_conv;
16981 this_arg_conv.inner = (void*)(this_arg & (~1));
16982 this_arg_conv.is_owned = false;
16983 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
16984 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16985 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16986 long ret_ref = (long)ret_var.inner;
16987 if (ret_var.is_owned) {
16993 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
16994 LDKDirectedChannelTransactionParameters this_arg_conv;
16995 this_arg_conv.inner = (void*)(this_arg & (~1));
16996 this_arg_conv.is_owned = false;
16997 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
16998 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16999 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17000 long ret_ref = (long)ret_var.inner;
17001 if (ret_var.is_owned) {
17007 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
17008 LDKDirectedChannelTransactionParameters this_arg_conv;
17009 this_arg_conv.inner = (void*)(this_arg & (~1));
17010 this_arg_conv.is_owned = false;
17011 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
17015 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
17016 LDKDirectedChannelTransactionParameters this_arg_conv;
17017 this_arg_conv.inner = (void*)(this_arg & (~1));
17018 this_arg_conv.is_owned = false;
17019 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
17023 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
17024 LDKDirectedChannelTransactionParameters this_arg_conv;
17025 this_arg_conv.inner = (void*)(this_arg & (~1));
17026 this_arg_conv.is_owned = false;
17027 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
17028 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17029 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17030 long ret_ref = (long)ret_var.inner;
17031 if (ret_var.is_owned) {
17037 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
17038 LDKHolderCommitmentTransaction this_obj_conv;
17039 this_obj_conv.inner = (void*)(this_obj & (~1));
17040 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17041 HolderCommitmentTransaction_free(this_obj_conv);
17044 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
17045 LDKHolderCommitmentTransaction this_ptr_conv;
17046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17047 this_ptr_conv.is_owned = false;
17048 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17049 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
17053 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
17054 LDKHolderCommitmentTransaction this_ptr_conv;
17055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17056 this_ptr_conv.is_owned = false;
17057 LDKSignature val_ref;
17058 CHECK(*((uint32_t*)val) == 64);
17059 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17060 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
17063 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
17064 LDKHolderCommitmentTransaction this_ptr_conv;
17065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17066 this_ptr_conv.is_owned = false;
17067 LDKCVec_SignatureZ val_constr;
17068 val_constr.datalen = *((uint32_t*)val);
17069 if (val_constr.datalen > 0)
17070 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17072 val_constr.data = NULL;
17073 int8_tArray* val_vals = (int8_tArray*)(val + 4);
17074 for (size_t m = 0; m < val_constr.datalen; m++) {
17075 int8_tArray val_conv_12 = val_vals[m];
17076 LDKSignature val_conv_12_ref;
17077 CHECK(*((uint32_t*)val_conv_12) == 64);
17078 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
17079 val_constr.data[m] = val_conv_12_ref;
17081 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
17084 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
17085 LDKHolderCommitmentTransaction orig_conv;
17086 orig_conv.inner = (void*)(orig & (~1));
17087 orig_conv.is_owned = false;
17088 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
17089 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17090 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17091 long ret_ref = (long)ret_var.inner;
17092 if (ret_var.is_owned) {
17098 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
17099 LDKHolderCommitmentTransaction obj_conv;
17100 obj_conv.inner = (void*)(obj & (~1));
17101 obj_conv.is_owned = false;
17102 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
17103 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17104 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17105 CVec_u8Z_free(ret_var);
17109 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
17110 LDKu8slice ser_ref;
17111 ser_ref.datalen = *((uint32_t*)ser);
17112 ser_ref.data = (int8_t*)(ser + 4);
17113 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
17114 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
17115 return (long)ret_conv;
17118 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) {
17119 LDKCommitmentTransaction commitment_tx_conv;
17120 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
17121 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
17122 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
17123 LDKSignature counterparty_sig_ref;
17124 CHECK(*((uint32_t*)counterparty_sig) == 64);
17125 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
17126 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
17127 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
17128 if (counterparty_htlc_sigs_constr.datalen > 0)
17129 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17131 counterparty_htlc_sigs_constr.data = NULL;
17132 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
17133 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
17134 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
17135 LDKSignature counterparty_htlc_sigs_conv_12_ref;
17136 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
17137 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
17138 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
17140 LDKPublicKey holder_funding_key_ref;
17141 CHECK(*((uint32_t*)holder_funding_key) == 33);
17142 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
17143 LDKPublicKey counterparty_funding_key_ref;
17144 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
17145 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
17146 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
17147 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17148 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17149 long ret_ref = (long)ret_var.inner;
17150 if (ret_var.is_owned) {
17156 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
17157 LDKBuiltCommitmentTransaction this_obj_conv;
17158 this_obj_conv.inner = (void*)(this_obj & (~1));
17159 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17160 BuiltCommitmentTransaction_free(this_obj_conv);
17163 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
17164 LDKBuiltCommitmentTransaction this_ptr_conv;
17165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17166 this_ptr_conv.is_owned = false;
17167 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
17168 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17169 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17170 Transaction_free(ret_var);
17174 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
17175 LDKBuiltCommitmentTransaction this_ptr_conv;
17176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17177 this_ptr_conv.is_owned = false;
17178 LDKTransaction val_ref;
17179 val_ref.datalen = *((uint32_t*)val);
17180 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
17181 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
17182 val_ref.data_is_owned = true;
17183 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
17186 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
17187 LDKBuiltCommitmentTransaction this_ptr_conv;
17188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17189 this_ptr_conv.is_owned = false;
17190 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17191 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
17195 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
17196 LDKBuiltCommitmentTransaction this_ptr_conv;
17197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17198 this_ptr_conv.is_owned = false;
17199 LDKThirtyTwoBytes val_ref;
17200 CHECK(*((uint32_t*)val) == 32);
17201 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17202 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
17205 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
17206 LDKTransaction transaction_arg_ref;
17207 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
17208 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
17209 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
17210 transaction_arg_ref.data_is_owned = true;
17211 LDKThirtyTwoBytes txid_arg_ref;
17212 CHECK(*((uint32_t*)txid_arg) == 32);
17213 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
17214 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
17215 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17216 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17217 long ret_ref = (long)ret_var.inner;
17218 if (ret_var.is_owned) {
17224 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
17225 LDKBuiltCommitmentTransaction orig_conv;
17226 orig_conv.inner = (void*)(orig & (~1));
17227 orig_conv.is_owned = false;
17228 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
17229 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17230 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17231 long ret_ref = (long)ret_var.inner;
17232 if (ret_var.is_owned) {
17238 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
17239 LDKBuiltCommitmentTransaction obj_conv;
17240 obj_conv.inner = (void*)(obj & (~1));
17241 obj_conv.is_owned = false;
17242 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
17243 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17244 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17245 CVec_u8Z_free(ret_var);
17249 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
17250 LDKu8slice ser_ref;
17251 ser_ref.datalen = *((uint32_t*)ser);
17252 ser_ref.data = (int8_t*)(ser + 4);
17253 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
17254 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
17255 return (long)ret_conv;
17258 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
17259 LDKBuiltCommitmentTransaction this_arg_conv;
17260 this_arg_conv.inner = (void*)(this_arg & (~1));
17261 this_arg_conv.is_owned = false;
17262 LDKu8slice funding_redeemscript_ref;
17263 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
17264 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
17265 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17266 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
17270 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) {
17271 LDKBuiltCommitmentTransaction this_arg_conv;
17272 this_arg_conv.inner = (void*)(this_arg & (~1));
17273 this_arg_conv.is_owned = false;
17274 unsigned char funding_key_arr[32];
17275 CHECK(*((uint32_t*)funding_key) == 32);
17276 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
17277 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
17278 LDKu8slice funding_redeemscript_ref;
17279 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
17280 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
17281 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17282 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
17286 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
17287 LDKCommitmentTransaction this_obj_conv;
17288 this_obj_conv.inner = (void*)(this_obj & (~1));
17289 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17290 CommitmentTransaction_free(this_obj_conv);
17293 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
17294 LDKCommitmentTransaction orig_conv;
17295 orig_conv.inner = (void*)(orig & (~1));
17296 orig_conv.is_owned = false;
17297 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
17298 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17299 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17300 long ret_ref = (long)ret_var.inner;
17301 if (ret_var.is_owned) {
17307 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
17308 LDKCommitmentTransaction obj_conv;
17309 obj_conv.inner = (void*)(obj & (~1));
17310 obj_conv.is_owned = false;
17311 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
17312 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17313 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17314 CVec_u8Z_free(ret_var);
17318 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
17319 LDKu8slice ser_ref;
17320 ser_ref.datalen = *((uint32_t*)ser);
17321 ser_ref.data = (int8_t*)(ser + 4);
17322 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
17323 *ret_conv = CommitmentTransaction_read(ser_ref);
17324 return (long)ret_conv;
17327 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
17328 LDKCommitmentTransaction this_arg_conv;
17329 this_arg_conv.inner = (void*)(this_arg & (~1));
17330 this_arg_conv.is_owned = false;
17331 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
17335 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
17336 LDKCommitmentTransaction this_arg_conv;
17337 this_arg_conv.inner = (void*)(this_arg & (~1));
17338 this_arg_conv.is_owned = false;
17339 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
17343 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
17344 LDKCommitmentTransaction this_arg_conv;
17345 this_arg_conv.inner = (void*)(this_arg & (~1));
17346 this_arg_conv.is_owned = false;
17347 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
17351 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
17352 LDKCommitmentTransaction this_arg_conv;
17353 this_arg_conv.inner = (void*)(this_arg & (~1));
17354 this_arg_conv.is_owned = false;
17355 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
17359 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
17360 LDKCommitmentTransaction this_arg_conv;
17361 this_arg_conv.inner = (void*)(this_arg & (~1));
17362 this_arg_conv.is_owned = false;
17363 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
17364 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17365 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17366 long ret_ref = (long)ret_var.inner;
17367 if (ret_var.is_owned) {
17373 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
17374 LDKCommitmentTransaction this_arg_conv;
17375 this_arg_conv.inner = (void*)(this_arg & (~1));
17376 this_arg_conv.is_owned = false;
17377 LDKDirectedChannelTransactionParameters channel_parameters_conv;
17378 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
17379 channel_parameters_conv.is_owned = false;
17380 LDKChannelPublicKeys broadcaster_keys_conv;
17381 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
17382 broadcaster_keys_conv.is_owned = false;
17383 LDKChannelPublicKeys countersignatory_keys_conv;
17384 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
17385 countersignatory_keys_conv.is_owned = false;
17386 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
17387 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
17388 return (long)ret_conv;
17391 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
17392 LDKTrustedCommitmentTransaction this_obj_conv;
17393 this_obj_conv.inner = (void*)(this_obj & (~1));
17394 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17395 TrustedCommitmentTransaction_free(this_obj_conv);
17398 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
17399 LDKTrustedCommitmentTransaction this_arg_conv;
17400 this_arg_conv.inner = (void*)(this_arg & (~1));
17401 this_arg_conv.is_owned = false;
17402 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17403 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
17407 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
17408 LDKTrustedCommitmentTransaction this_arg_conv;
17409 this_arg_conv.inner = (void*)(this_arg & (~1));
17410 this_arg_conv.is_owned = false;
17411 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
17412 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17413 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17414 long ret_ref = (long)ret_var.inner;
17415 if (ret_var.is_owned) {
17421 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
17422 LDKTrustedCommitmentTransaction this_arg_conv;
17423 this_arg_conv.inner = (void*)(this_arg & (~1));
17424 this_arg_conv.is_owned = false;
17425 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
17426 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17427 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17428 long ret_ref = (long)ret_var.inner;
17429 if (ret_var.is_owned) {
17435 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
17436 LDKTrustedCommitmentTransaction this_arg_conv;
17437 this_arg_conv.inner = (void*)(this_arg & (~1));
17438 this_arg_conv.is_owned = false;
17439 unsigned char htlc_base_key_arr[32];
17440 CHECK(*((uint32_t*)htlc_base_key) == 32);
17441 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
17442 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
17443 LDKDirectedChannelTransactionParameters channel_parameters_conv;
17444 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
17445 channel_parameters_conv.is_owned = false;
17446 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
17447 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
17448 return (long)ret_conv;
17451 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) {
17452 LDKPublicKey broadcaster_payment_basepoint_ref;
17453 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
17454 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
17455 LDKPublicKey countersignatory_payment_basepoint_ref;
17456 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
17457 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
17458 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
17462 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
17463 LDKInitFeatures orig_conv;
17464 orig_conv.inner = (void*)(orig & (~1));
17465 orig_conv.is_owned = false;
17466 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
17467 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17468 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17469 long ret_ref = (long)ret_var.inner;
17470 if (ret_var.is_owned) {
17476 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
17477 LDKNodeFeatures orig_conv;
17478 orig_conv.inner = (void*)(orig & (~1));
17479 orig_conv.is_owned = false;
17480 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
17481 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17482 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17483 long ret_ref = (long)ret_var.inner;
17484 if (ret_var.is_owned) {
17490 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
17491 LDKChannelFeatures orig_conv;
17492 orig_conv.inner = (void*)(orig & (~1));
17493 orig_conv.is_owned = false;
17494 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
17495 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17496 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17497 long ret_ref = (long)ret_var.inner;
17498 if (ret_var.is_owned) {
17504 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
17505 LDKInvoiceFeatures orig_conv;
17506 orig_conv.inner = (void*)(orig & (~1));
17507 orig_conv.is_owned = false;
17508 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
17509 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17510 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17511 long ret_ref = (long)ret_var.inner;
17512 if (ret_var.is_owned) {
17518 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
17519 LDKInitFeatures this_obj_conv;
17520 this_obj_conv.inner = (void*)(this_obj & (~1));
17521 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17522 InitFeatures_free(this_obj_conv);
17525 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
17526 LDKNodeFeatures this_obj_conv;
17527 this_obj_conv.inner = (void*)(this_obj & (~1));
17528 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17529 NodeFeatures_free(this_obj_conv);
17532 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
17533 LDKChannelFeatures this_obj_conv;
17534 this_obj_conv.inner = (void*)(this_obj & (~1));
17535 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17536 ChannelFeatures_free(this_obj_conv);
17539 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
17540 LDKInvoiceFeatures this_obj_conv;
17541 this_obj_conv.inner = (void*)(this_obj & (~1));
17542 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17543 InvoiceFeatures_free(this_obj_conv);
17546 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
17547 LDKInitFeatures ret_var = InitFeatures_empty();
17548 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17549 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17550 long ret_ref = (long)ret_var.inner;
17551 if (ret_var.is_owned) {
17557 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
17558 LDKInitFeatures ret_var = InitFeatures_known();
17559 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17560 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17561 long ret_ref = (long)ret_var.inner;
17562 if (ret_var.is_owned) {
17568 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
17569 LDKNodeFeatures ret_var = NodeFeatures_empty();
17570 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17571 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17572 long ret_ref = (long)ret_var.inner;
17573 if (ret_var.is_owned) {
17579 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
17580 LDKNodeFeatures ret_var = NodeFeatures_known();
17581 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17582 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17583 long ret_ref = (long)ret_var.inner;
17584 if (ret_var.is_owned) {
17590 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
17591 LDKChannelFeatures ret_var = ChannelFeatures_empty();
17592 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17593 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17594 long ret_ref = (long)ret_var.inner;
17595 if (ret_var.is_owned) {
17601 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
17602 LDKChannelFeatures ret_var = ChannelFeatures_known();
17603 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17604 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17605 long ret_ref = (long)ret_var.inner;
17606 if (ret_var.is_owned) {
17612 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
17613 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
17614 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17615 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17616 long ret_ref = (long)ret_var.inner;
17617 if (ret_var.is_owned) {
17623 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
17624 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
17625 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17626 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17627 long ret_ref = (long)ret_var.inner;
17628 if (ret_var.is_owned) {
17634 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
17635 LDKInitFeatures obj_conv;
17636 obj_conv.inner = (void*)(obj & (~1));
17637 obj_conv.is_owned = false;
17638 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
17639 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17640 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17641 CVec_u8Z_free(ret_var);
17645 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
17646 LDKNodeFeatures obj_conv;
17647 obj_conv.inner = (void*)(obj & (~1));
17648 obj_conv.is_owned = false;
17649 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
17650 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17651 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17652 CVec_u8Z_free(ret_var);
17656 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
17657 LDKChannelFeatures obj_conv;
17658 obj_conv.inner = (void*)(obj & (~1));
17659 obj_conv.is_owned = false;
17660 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
17661 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17662 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17663 CVec_u8Z_free(ret_var);
17667 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
17668 LDKInvoiceFeatures obj_conv;
17669 obj_conv.inner = (void*)(obj & (~1));
17670 obj_conv.is_owned = false;
17671 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
17672 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17673 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17674 CVec_u8Z_free(ret_var);
17678 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
17679 LDKu8slice ser_ref;
17680 ser_ref.datalen = *((uint32_t*)ser);
17681 ser_ref.data = (int8_t*)(ser + 4);
17682 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17683 *ret_conv = InitFeatures_read(ser_ref);
17684 return (long)ret_conv;
17687 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
17688 LDKu8slice ser_ref;
17689 ser_ref.datalen = *((uint32_t*)ser);
17690 ser_ref.data = (int8_t*)(ser + 4);
17691 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17692 *ret_conv = NodeFeatures_read(ser_ref);
17693 return (long)ret_conv;
17696 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
17697 LDKu8slice ser_ref;
17698 ser_ref.datalen = *((uint32_t*)ser);
17699 ser_ref.data = (int8_t*)(ser + 4);
17700 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17701 *ret_conv = ChannelFeatures_read(ser_ref);
17702 return (long)ret_conv;
17705 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
17706 LDKu8slice ser_ref;
17707 ser_ref.datalen = *((uint32_t*)ser);
17708 ser_ref.data = (int8_t*)(ser + 4);
17709 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17710 *ret_conv = InvoiceFeatures_read(ser_ref);
17711 return (long)ret_conv;
17714 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
17715 LDKRouteHop this_obj_conv;
17716 this_obj_conv.inner = (void*)(this_obj & (~1));
17717 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17718 RouteHop_free(this_obj_conv);
17721 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
17722 LDKRouteHop this_ptr_conv;
17723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17724 this_ptr_conv.is_owned = false;
17725 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17726 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
17730 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
17731 LDKRouteHop this_ptr_conv;
17732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17733 this_ptr_conv.is_owned = false;
17734 LDKPublicKey val_ref;
17735 CHECK(*((uint32_t*)val) == 33);
17736 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17737 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
17740 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
17741 LDKRouteHop this_ptr_conv;
17742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17743 this_ptr_conv.is_owned = false;
17744 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
17745 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17746 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17747 long ret_ref = (long)ret_var.inner;
17748 if (ret_var.is_owned) {
17754 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
17755 LDKRouteHop this_ptr_conv;
17756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17757 this_ptr_conv.is_owned = false;
17758 LDKNodeFeatures val_conv;
17759 val_conv.inner = (void*)(val & (~1));
17760 val_conv.is_owned = (val & 1) || (val == 0);
17761 val_conv = NodeFeatures_clone(&val_conv);
17762 RouteHop_set_node_features(&this_ptr_conv, val_conv);
17765 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
17766 LDKRouteHop this_ptr_conv;
17767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17768 this_ptr_conv.is_owned = false;
17769 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
17773 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
17774 LDKRouteHop this_ptr_conv;
17775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17776 this_ptr_conv.is_owned = false;
17777 RouteHop_set_short_channel_id(&this_ptr_conv, val);
17780 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
17781 LDKRouteHop this_ptr_conv;
17782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17783 this_ptr_conv.is_owned = false;
17784 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
17785 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17786 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17787 long ret_ref = (long)ret_var.inner;
17788 if (ret_var.is_owned) {
17794 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
17795 LDKRouteHop this_ptr_conv;
17796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17797 this_ptr_conv.is_owned = false;
17798 LDKChannelFeatures val_conv;
17799 val_conv.inner = (void*)(val & (~1));
17800 val_conv.is_owned = (val & 1) || (val == 0);
17801 val_conv = ChannelFeatures_clone(&val_conv);
17802 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
17805 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
17806 LDKRouteHop this_ptr_conv;
17807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17808 this_ptr_conv.is_owned = false;
17809 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
17813 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
17814 LDKRouteHop this_ptr_conv;
17815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17816 this_ptr_conv.is_owned = false;
17817 RouteHop_set_fee_msat(&this_ptr_conv, val);
17820 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
17821 LDKRouteHop this_ptr_conv;
17822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17823 this_ptr_conv.is_owned = false;
17824 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
17828 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
17829 LDKRouteHop this_ptr_conv;
17830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17831 this_ptr_conv.is_owned = false;
17832 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
17835 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) {
17836 LDKPublicKey pubkey_arg_ref;
17837 CHECK(*((uint32_t*)pubkey_arg) == 33);
17838 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
17839 LDKNodeFeatures node_features_arg_conv;
17840 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
17841 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
17842 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
17843 LDKChannelFeatures channel_features_arg_conv;
17844 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
17845 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
17846 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
17847 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);
17848 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17849 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17850 long ret_ref = (long)ret_var.inner;
17851 if (ret_var.is_owned) {
17857 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
17858 LDKRouteHop orig_conv;
17859 orig_conv.inner = (void*)(orig & (~1));
17860 orig_conv.is_owned = false;
17861 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
17862 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17863 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17864 long ret_ref = (long)ret_var.inner;
17865 if (ret_var.is_owned) {
17871 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
17872 LDKRoute this_obj_conv;
17873 this_obj_conv.inner = (void*)(this_obj & (~1));
17874 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17875 Route_free(this_obj_conv);
17878 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
17879 LDKRoute this_ptr_conv;
17880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17881 this_ptr_conv.is_owned = false;
17882 LDKCVec_CVec_RouteHopZZ val_constr;
17883 val_constr.datalen = *((uint32_t*)val);
17884 if (val_constr.datalen > 0)
17885 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
17887 val_constr.data = NULL;
17888 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
17889 for (size_t m = 0; m < val_constr.datalen; m++) {
17890 uint32_tArray val_conv_12 = val_vals[m];
17891 LDKCVec_RouteHopZ val_conv_12_constr;
17892 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
17893 if (val_conv_12_constr.datalen > 0)
17894 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17896 val_conv_12_constr.data = NULL;
17897 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
17898 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
17899 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
17900 LDKRouteHop val_conv_12_conv_10_conv;
17901 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
17902 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
17903 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
17904 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
17906 val_constr.data[m] = val_conv_12_constr;
17908 Route_set_paths(&this_ptr_conv, val_constr);
17911 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) {
17912 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
17913 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
17914 if (paths_arg_constr.datalen > 0)
17915 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
17917 paths_arg_constr.data = NULL;
17918 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
17919 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
17920 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
17921 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
17922 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
17923 if (paths_arg_conv_12_constr.datalen > 0)
17924 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17926 paths_arg_conv_12_constr.data = NULL;
17927 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
17928 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
17929 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
17930 LDKRouteHop paths_arg_conv_12_conv_10_conv;
17931 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
17932 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
17933 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
17934 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
17936 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
17938 LDKRoute ret_var = Route_new(paths_arg_constr);
17939 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17940 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17941 long ret_ref = (long)ret_var.inner;
17942 if (ret_var.is_owned) {
17948 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
17949 LDKRoute orig_conv;
17950 orig_conv.inner = (void*)(orig & (~1));
17951 orig_conv.is_owned = false;
17952 LDKRoute ret_var = Route_clone(&orig_conv);
17953 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17954 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17955 long ret_ref = (long)ret_var.inner;
17956 if (ret_var.is_owned) {
17962 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
17964 obj_conv.inner = (void*)(obj & (~1));
17965 obj_conv.is_owned = false;
17966 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
17967 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17968 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17969 CVec_u8Z_free(ret_var);
17973 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
17974 LDKu8slice ser_ref;
17975 ser_ref.datalen = *((uint32_t*)ser);
17976 ser_ref.data = (int8_t*)(ser + 4);
17977 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17978 *ret_conv = Route_read(ser_ref);
17979 return (long)ret_conv;
17982 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
17983 LDKRouteHint this_obj_conv;
17984 this_obj_conv.inner = (void*)(this_obj & (~1));
17985 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17986 RouteHint_free(this_obj_conv);
17989 int8_tArray __attribute__((visibility("default"))) TS_RouteHint_get_src_node_id(uint32_t this_ptr) {
17990 LDKRouteHint this_ptr_conv;
17991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17992 this_ptr_conv.is_owned = false;
17993 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17994 memcpy((uint8_t*)(ret_arr + 4), RouteHint_get_src_node_id(&this_ptr_conv).compressed_form, 33);
17998 void __attribute__((visibility("default"))) TS_RouteHint_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
17999 LDKRouteHint this_ptr_conv;
18000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18001 this_ptr_conv.is_owned = false;
18002 LDKPublicKey val_ref;
18003 CHECK(*((uint32_t*)val) == 33);
18004 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18005 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
18008 int64_t __attribute__((visibility("default"))) TS_RouteHint_get_short_channel_id(uint32_t this_ptr) {
18009 LDKRouteHint this_ptr_conv;
18010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18011 this_ptr_conv.is_owned = false;
18012 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
18016 void __attribute__((visibility("default"))) TS_RouteHint_set_short_channel_id(uint32_t this_ptr, int64_t val) {
18017 LDKRouteHint this_ptr_conv;
18018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18019 this_ptr_conv.is_owned = false;
18020 RouteHint_set_short_channel_id(&this_ptr_conv, val);
18023 uint32_t __attribute__((visibility("default"))) TS_RouteHint_get_fees(uint32_t this_ptr) {
18024 LDKRouteHint this_ptr_conv;
18025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18026 this_ptr_conv.is_owned = false;
18027 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
18028 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18029 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18030 long ret_ref = (long)ret_var.inner;
18031 if (ret_var.is_owned) {
18037 void __attribute__((visibility("default"))) TS_RouteHint_set_fees(uint32_t this_ptr, uint32_t val) {
18038 LDKRouteHint this_ptr_conv;
18039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18040 this_ptr_conv.is_owned = false;
18041 LDKRoutingFees val_conv;
18042 val_conv.inner = (void*)(val & (~1));
18043 val_conv.is_owned = (val & 1) || (val == 0);
18044 val_conv = RoutingFees_clone(&val_conv);
18045 RouteHint_set_fees(&this_ptr_conv, val_conv);
18048 int16_t __attribute__((visibility("default"))) TS_RouteHint_get_cltv_expiry_delta(uint32_t this_ptr) {
18049 LDKRouteHint this_ptr_conv;
18050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18051 this_ptr_conv.is_owned = false;
18052 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
18056 void __attribute__((visibility("default"))) TS_RouteHint_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
18057 LDKRouteHint this_ptr_conv;
18058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18059 this_ptr_conv.is_owned = false;
18060 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
18063 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
18064 LDKRouteHint orig_conv;
18065 orig_conv.inner = (void*)(orig & (~1));
18066 orig_conv.is_owned = false;
18067 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
18068 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18069 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18070 long ret_ref = (long)ret_var.inner;
18071 if (ret_var.is_owned) {
18077 uint32_t __attribute__((visibility("default"))) TS_get_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_t payee_features, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
18078 LDKPublicKey our_node_id_ref;
18079 CHECK(*((uint32_t*)our_node_id) == 33);
18080 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
18081 LDKNetworkGraph network_conv;
18082 network_conv.inner = (void*)(network & (~1));
18083 network_conv.is_owned = false;
18084 LDKPublicKey payee_ref;
18085 CHECK(*((uint32_t*)payee) == 33);
18086 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
18087 LDKInvoiceFeatures payee_features_conv;
18088 payee_features_conv.inner = (void*)(payee_features & (~1));
18089 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
18090 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
18091 LDKCVec_ChannelDetailsZ first_hops_constr;
18092 first_hops_constr.datalen = *((uint32_t*)first_hops);
18093 if (first_hops_constr.datalen > 0)
18094 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18096 first_hops_constr.data = NULL;
18097 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
18098 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
18099 uint32_t first_hops_conv_16 = first_hops_vals[q];
18100 LDKChannelDetails first_hops_conv_16_conv;
18101 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
18102 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
18103 first_hops_constr.data[q] = first_hops_conv_16_conv;
18105 LDKCVec_RouteHintZ last_hops_constr;
18106 last_hops_constr.datalen = *((uint32_t*)last_hops);
18107 if (last_hops_constr.datalen > 0)
18108 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
18110 last_hops_constr.data = NULL;
18111 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
18112 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
18113 uint32_t last_hops_conv_11 = last_hops_vals[l];
18114 LDKRouteHint last_hops_conv_11_conv;
18115 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
18116 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
18117 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
18118 last_hops_constr.data[l] = last_hops_conv_11_conv;
18120 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
18121 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18122 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
18123 FREE(first_hops_constr.data);
18124 return (long)ret_conv;
18127 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
18128 LDKNetworkGraph this_obj_conv;
18129 this_obj_conv.inner = (void*)(this_obj & (~1));
18130 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18131 NetworkGraph_free(this_obj_conv);
18134 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
18135 LDKNetworkGraph orig_conv;
18136 orig_conv.inner = (void*)(orig & (~1));
18137 orig_conv.is_owned = false;
18138 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
18139 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18140 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18141 long ret_ref = (long)ret_var.inner;
18142 if (ret_var.is_owned) {
18148 void __attribute__((visibility("default"))) TS_LockedNetworkGraph_free(uint32_t this_obj) {
18149 LDKLockedNetworkGraph this_obj_conv;
18150 this_obj_conv.inner = (void*)(this_obj & (~1));
18151 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18152 LockedNetworkGraph_free(this_obj_conv);
18155 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
18156 LDKNetGraphMsgHandler this_obj_conv;
18157 this_obj_conv.inner = (void*)(this_obj & (~1));
18158 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18159 NetGraphMsgHandler_free(this_obj_conv);
18162 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(int8_tArray genesis_hash, uint32_t chain_access, uint32_t logger) {
18163 LDKThirtyTwoBytes genesis_hash_ref;
18164 CHECK(*((uint32_t*)genesis_hash) == 32);
18165 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
18166 LDKAccess *chain_access_conv_ptr = NULL;
18167 if (chain_access != 0) {
18168 LDKAccess chain_access_conv;
18169 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
18170 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
18171 *chain_access_conv_ptr = chain_access_conv;
18173 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
18174 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
18175 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18176 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18177 long ret_ref = (long)ret_var.inner;
18178 if (ret_var.is_owned) {
18184 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_from_net_graph(uint32_t chain_access, uint32_t logger, uint32_t network_graph) {
18185 LDKAccess *chain_access_conv_ptr = NULL;
18186 if (chain_access != 0) {
18187 LDKAccess chain_access_conv;
18188 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
18189 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
18190 *chain_access_conv_ptr = chain_access_conv;
18192 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
18193 LDKNetworkGraph network_graph_conv;
18194 network_graph_conv.inner = (void*)(network_graph & (~1));
18195 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
18196 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
18197 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
18198 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18199 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18200 long ret_ref = (long)ret_var.inner;
18201 if (ret_var.is_owned) {
18207 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
18208 LDKNetGraphMsgHandler this_arg_conv;
18209 this_arg_conv.inner = (void*)(this_arg & (~1));
18210 this_arg_conv.is_owned = false;
18211 LDKAccess *chain_access_conv_ptr = NULL;
18212 if (chain_access != 0) {
18213 LDKAccess chain_access_conv;
18214 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
18215 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
18216 *chain_access_conv_ptr = chain_access_conv;
18218 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
18221 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_read_locked_graph(uint32_t this_arg) {
18222 LDKNetGraphMsgHandler this_arg_conv;
18223 this_arg_conv.inner = (void*)(this_arg & (~1));
18224 this_arg_conv.is_owned = false;
18225 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
18226 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18227 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18228 long ret_ref = (long)ret_var.inner;
18229 if (ret_var.is_owned) {
18235 uint32_t __attribute__((visibility("default"))) TS_LockedNetworkGraph_graph(uint32_t this_arg) {
18236 LDKLockedNetworkGraph this_arg_conv;
18237 this_arg_conv.inner = (void*)(this_arg & (~1));
18238 this_arg_conv.is_owned = false;
18239 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
18240 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18241 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18242 long ret_ref = (long)ret_var.inner;
18243 if (ret_var.is_owned) {
18249 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
18250 LDKNetGraphMsgHandler this_arg_conv;
18251 this_arg_conv.inner = (void*)(this_arg & (~1));
18252 this_arg_conv.is_owned = false;
18253 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
18254 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
18258 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
18259 LDKNetGraphMsgHandler this_arg_conv;
18260 this_arg_conv.inner = (void*)(this_arg & (~1));
18261 this_arg_conv.is_owned = false;
18262 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
18263 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
18267 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
18268 LDKDirectionalChannelInfo this_obj_conv;
18269 this_obj_conv.inner = (void*)(this_obj & (~1));
18270 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18271 DirectionalChannelInfo_free(this_obj_conv);
18274 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
18275 LDKDirectionalChannelInfo this_ptr_conv;
18276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18277 this_ptr_conv.is_owned = false;
18278 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
18282 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
18283 LDKDirectionalChannelInfo this_ptr_conv;
18284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18285 this_ptr_conv.is_owned = false;
18286 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
18289 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
18290 LDKDirectionalChannelInfo this_ptr_conv;
18291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18292 this_ptr_conv.is_owned = false;
18293 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
18297 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
18298 LDKDirectionalChannelInfo this_ptr_conv;
18299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18300 this_ptr_conv.is_owned = false;
18301 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
18304 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
18305 LDKDirectionalChannelInfo this_ptr_conv;
18306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18307 this_ptr_conv.is_owned = false;
18308 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
18312 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
18313 LDKDirectionalChannelInfo this_ptr_conv;
18314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18315 this_ptr_conv.is_owned = false;
18316 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
18319 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
18320 LDKDirectionalChannelInfo this_ptr_conv;
18321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18322 this_ptr_conv.is_owned = false;
18323 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
18327 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
18328 LDKDirectionalChannelInfo this_ptr_conv;
18329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18330 this_ptr_conv.is_owned = false;
18331 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
18334 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
18335 LDKDirectionalChannelInfo this_ptr_conv;
18336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18337 this_ptr_conv.is_owned = false;
18338 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
18339 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18340 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18341 long ret_ref = (long)ret_var.inner;
18342 if (ret_var.is_owned) {
18348 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
18349 LDKDirectionalChannelInfo this_ptr_conv;
18350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18351 this_ptr_conv.is_owned = false;
18352 LDKRoutingFees val_conv;
18353 val_conv.inner = (void*)(val & (~1));
18354 val_conv.is_owned = (val & 1) || (val == 0);
18355 val_conv = RoutingFees_clone(&val_conv);
18356 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
18359 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
18360 LDKDirectionalChannelInfo this_ptr_conv;
18361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18362 this_ptr_conv.is_owned = false;
18363 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
18364 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18365 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18366 long ret_ref = (long)ret_var.inner;
18367 if (ret_var.is_owned) {
18373 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
18374 LDKDirectionalChannelInfo this_ptr_conv;
18375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18376 this_ptr_conv.is_owned = false;
18377 LDKChannelUpdate val_conv;
18378 val_conv.inner = (void*)(val & (~1));
18379 val_conv.is_owned = (val & 1) || (val == 0);
18380 val_conv = ChannelUpdate_clone(&val_conv);
18381 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
18384 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
18385 LDKDirectionalChannelInfo orig_conv;
18386 orig_conv.inner = (void*)(orig & (~1));
18387 orig_conv.is_owned = false;
18388 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
18389 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18390 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18391 long ret_ref = (long)ret_var.inner;
18392 if (ret_var.is_owned) {
18398 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
18399 LDKDirectionalChannelInfo obj_conv;
18400 obj_conv.inner = (void*)(obj & (~1));
18401 obj_conv.is_owned = false;
18402 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
18403 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18404 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18405 CVec_u8Z_free(ret_var);
18409 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
18410 LDKu8slice ser_ref;
18411 ser_ref.datalen = *((uint32_t*)ser);
18412 ser_ref.data = (int8_t*)(ser + 4);
18413 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
18414 *ret_conv = DirectionalChannelInfo_read(ser_ref);
18415 return (long)ret_conv;
18418 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
18419 LDKChannelInfo this_obj_conv;
18420 this_obj_conv.inner = (void*)(this_obj & (~1));
18421 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18422 ChannelInfo_free(this_obj_conv);
18425 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
18426 LDKChannelInfo this_ptr_conv;
18427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18428 this_ptr_conv.is_owned = false;
18429 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
18430 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18431 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18432 long ret_ref = (long)ret_var.inner;
18433 if (ret_var.is_owned) {
18439 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
18440 LDKChannelInfo this_ptr_conv;
18441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18442 this_ptr_conv.is_owned = false;
18443 LDKChannelFeatures val_conv;
18444 val_conv.inner = (void*)(val & (~1));
18445 val_conv.is_owned = (val & 1) || (val == 0);
18446 val_conv = ChannelFeatures_clone(&val_conv);
18447 ChannelInfo_set_features(&this_ptr_conv, val_conv);
18450 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
18451 LDKChannelInfo this_ptr_conv;
18452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18453 this_ptr_conv.is_owned = false;
18454 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18455 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
18459 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, int8_tArray val) {
18460 LDKChannelInfo this_ptr_conv;
18461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18462 this_ptr_conv.is_owned = false;
18463 LDKPublicKey val_ref;
18464 CHECK(*((uint32_t*)val) == 33);
18465 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18466 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
18469 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
18470 LDKChannelInfo this_ptr_conv;
18471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18472 this_ptr_conv.is_owned = false;
18473 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
18474 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18475 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18476 long ret_ref = (long)ret_var.inner;
18477 if (ret_var.is_owned) {
18483 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
18484 LDKChannelInfo this_ptr_conv;
18485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18486 this_ptr_conv.is_owned = false;
18487 LDKDirectionalChannelInfo val_conv;
18488 val_conv.inner = (void*)(val & (~1));
18489 val_conv.is_owned = (val & 1) || (val == 0);
18490 val_conv = DirectionalChannelInfo_clone(&val_conv);
18491 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
18494 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
18495 LDKChannelInfo this_ptr_conv;
18496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18497 this_ptr_conv.is_owned = false;
18498 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18499 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
18503 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, int8_tArray val) {
18504 LDKChannelInfo this_ptr_conv;
18505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18506 this_ptr_conv.is_owned = false;
18507 LDKPublicKey val_ref;
18508 CHECK(*((uint32_t*)val) == 33);
18509 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18510 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
18513 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
18514 LDKChannelInfo this_ptr_conv;
18515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18516 this_ptr_conv.is_owned = false;
18517 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
18518 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18519 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18520 long ret_ref = (long)ret_var.inner;
18521 if (ret_var.is_owned) {
18527 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
18528 LDKChannelInfo this_ptr_conv;
18529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18530 this_ptr_conv.is_owned = false;
18531 LDKDirectionalChannelInfo val_conv;
18532 val_conv.inner = (void*)(val & (~1));
18533 val_conv.is_owned = (val & 1) || (val == 0);
18534 val_conv = DirectionalChannelInfo_clone(&val_conv);
18535 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
18538 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
18539 LDKChannelInfo this_ptr_conv;
18540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18541 this_ptr_conv.is_owned = false;
18542 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
18543 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18544 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18545 long ret_ref = (long)ret_var.inner;
18546 if (ret_var.is_owned) {
18552 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
18553 LDKChannelInfo this_ptr_conv;
18554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18555 this_ptr_conv.is_owned = false;
18556 LDKChannelAnnouncement val_conv;
18557 val_conv.inner = (void*)(val & (~1));
18558 val_conv.is_owned = (val & 1) || (val == 0);
18559 val_conv = ChannelAnnouncement_clone(&val_conv);
18560 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
18563 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
18564 LDKChannelInfo orig_conv;
18565 orig_conv.inner = (void*)(orig & (~1));
18566 orig_conv.is_owned = false;
18567 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
18568 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18569 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18570 long ret_ref = (long)ret_var.inner;
18571 if (ret_var.is_owned) {
18577 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
18578 LDKChannelInfo obj_conv;
18579 obj_conv.inner = (void*)(obj & (~1));
18580 obj_conv.is_owned = false;
18581 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
18582 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18583 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18584 CVec_u8Z_free(ret_var);
18588 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
18589 LDKu8slice ser_ref;
18590 ser_ref.datalen = *((uint32_t*)ser);
18591 ser_ref.data = (int8_t*)(ser + 4);
18592 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
18593 *ret_conv = ChannelInfo_read(ser_ref);
18594 return (long)ret_conv;
18597 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
18598 LDKRoutingFees this_obj_conv;
18599 this_obj_conv.inner = (void*)(this_obj & (~1));
18600 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18601 RoutingFees_free(this_obj_conv);
18604 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
18605 LDKRoutingFees this_ptr_conv;
18606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18607 this_ptr_conv.is_owned = false;
18608 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
18612 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
18613 LDKRoutingFees this_ptr_conv;
18614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18615 this_ptr_conv.is_owned = false;
18616 RoutingFees_set_base_msat(&this_ptr_conv, val);
18619 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
18620 LDKRoutingFees this_ptr_conv;
18621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18622 this_ptr_conv.is_owned = false;
18623 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
18627 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
18628 LDKRoutingFees this_ptr_conv;
18629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18630 this_ptr_conv.is_owned = false;
18631 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
18634 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
18635 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
18636 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18637 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18638 long ret_ref = (long)ret_var.inner;
18639 if (ret_var.is_owned) {
18645 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
18646 LDKRoutingFees orig_conv;
18647 orig_conv.inner = (void*)(orig & (~1));
18648 orig_conv.is_owned = false;
18649 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
18650 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18651 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18652 long ret_ref = (long)ret_var.inner;
18653 if (ret_var.is_owned) {
18659 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
18660 LDKu8slice ser_ref;
18661 ser_ref.datalen = *((uint32_t*)ser);
18662 ser_ref.data = (int8_t*)(ser + 4);
18663 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
18664 *ret_conv = RoutingFees_read(ser_ref);
18665 return (long)ret_conv;
18668 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
18669 LDKRoutingFees obj_conv;
18670 obj_conv.inner = (void*)(obj & (~1));
18671 obj_conv.is_owned = false;
18672 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
18673 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18674 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18675 CVec_u8Z_free(ret_var);
18679 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
18680 LDKNodeAnnouncementInfo this_obj_conv;
18681 this_obj_conv.inner = (void*)(this_obj & (~1));
18682 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18683 NodeAnnouncementInfo_free(this_obj_conv);
18686 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
18687 LDKNodeAnnouncementInfo this_ptr_conv;
18688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18689 this_ptr_conv.is_owned = false;
18690 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
18691 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18692 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18693 long ret_ref = (long)ret_var.inner;
18694 if (ret_var.is_owned) {
18700 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
18701 LDKNodeAnnouncementInfo this_ptr_conv;
18702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18703 this_ptr_conv.is_owned = false;
18704 LDKNodeFeatures val_conv;
18705 val_conv.inner = (void*)(val & (~1));
18706 val_conv.is_owned = (val & 1) || (val == 0);
18707 val_conv = NodeFeatures_clone(&val_conv);
18708 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
18711 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
18712 LDKNodeAnnouncementInfo this_ptr_conv;
18713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18714 this_ptr_conv.is_owned = false;
18715 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
18719 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
18720 LDKNodeAnnouncementInfo this_ptr_conv;
18721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18722 this_ptr_conv.is_owned = false;
18723 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
18726 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
18727 LDKNodeAnnouncementInfo this_ptr_conv;
18728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18729 this_ptr_conv.is_owned = false;
18730 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
18731 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
18735 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
18736 LDKNodeAnnouncementInfo this_ptr_conv;
18737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18738 this_ptr_conv.is_owned = false;
18739 LDKThreeBytes val_ref;
18740 CHECK(*((uint32_t*)val) == 3);
18741 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
18742 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
18745 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
18746 LDKNodeAnnouncementInfo this_ptr_conv;
18747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18748 this_ptr_conv.is_owned = false;
18749 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18750 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
18754 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
18755 LDKNodeAnnouncementInfo this_ptr_conv;
18756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18757 this_ptr_conv.is_owned = false;
18758 LDKThirtyTwoBytes val_ref;
18759 CHECK(*((uint32_t*)val) == 32);
18760 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18761 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
18764 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
18765 LDKNodeAnnouncementInfo this_ptr_conv;
18766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18767 this_ptr_conv.is_owned = false;
18768 LDKCVec_NetAddressZ val_constr;
18769 val_constr.datalen = *((uint32_t*)val);
18770 if (val_constr.datalen > 0)
18771 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18773 val_constr.data = NULL;
18774 uint32_t* val_vals = (uint32_t*)(val + 4);
18775 for (size_t m = 0; m < val_constr.datalen; m++) {
18776 uint32_t val_conv_12 = val_vals[m];
18777 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
18778 FREE((void*)val_conv_12);
18779 val_constr.data[m] = val_conv_12_conv;
18781 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
18784 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
18785 LDKNodeAnnouncementInfo this_ptr_conv;
18786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18787 this_ptr_conv.is_owned = false;
18788 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
18789 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18790 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18791 long ret_ref = (long)ret_var.inner;
18792 if (ret_var.is_owned) {
18798 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
18799 LDKNodeAnnouncementInfo this_ptr_conv;
18800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18801 this_ptr_conv.is_owned = false;
18802 LDKNodeAnnouncement val_conv;
18803 val_conv.inner = (void*)(val & (~1));
18804 val_conv.is_owned = (val & 1) || (val == 0);
18805 val_conv = NodeAnnouncement_clone(&val_conv);
18806 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
18809 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) {
18810 LDKNodeFeatures features_arg_conv;
18811 features_arg_conv.inner = (void*)(features_arg & (~1));
18812 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
18813 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
18814 LDKThreeBytes rgb_arg_ref;
18815 CHECK(*((uint32_t*)rgb_arg) == 3);
18816 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
18817 LDKThirtyTwoBytes alias_arg_ref;
18818 CHECK(*((uint32_t*)alias_arg) == 32);
18819 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
18820 LDKCVec_NetAddressZ addresses_arg_constr;
18821 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
18822 if (addresses_arg_constr.datalen > 0)
18823 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18825 addresses_arg_constr.data = NULL;
18826 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
18827 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
18828 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
18829 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
18830 FREE((void*)addresses_arg_conv_12);
18831 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
18833 LDKNodeAnnouncement announcement_message_arg_conv;
18834 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
18835 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
18836 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
18837 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
18838 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18839 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18840 long ret_ref = (long)ret_var.inner;
18841 if (ret_var.is_owned) {
18847 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
18848 LDKNodeAnnouncementInfo orig_conv;
18849 orig_conv.inner = (void*)(orig & (~1));
18850 orig_conv.is_owned = false;
18851 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
18852 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18853 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18854 long ret_ref = (long)ret_var.inner;
18855 if (ret_var.is_owned) {
18861 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
18862 LDKNodeAnnouncementInfo obj_conv;
18863 obj_conv.inner = (void*)(obj & (~1));
18864 obj_conv.is_owned = false;
18865 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
18866 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18867 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18868 CVec_u8Z_free(ret_var);
18872 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
18873 LDKu8slice ser_ref;
18874 ser_ref.datalen = *((uint32_t*)ser);
18875 ser_ref.data = (int8_t*)(ser + 4);
18876 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
18877 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
18878 return (long)ret_conv;
18881 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
18882 LDKNodeInfo this_obj_conv;
18883 this_obj_conv.inner = (void*)(this_obj & (~1));
18884 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18885 NodeInfo_free(this_obj_conv);
18888 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
18889 LDKNodeInfo this_ptr_conv;
18890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18891 this_ptr_conv.is_owned = false;
18892 LDKCVec_u64Z val_constr;
18893 val_constr.datalen = *((uint32_t*)val);
18894 if (val_constr.datalen > 0)
18895 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
18897 val_constr.data = NULL;
18898 int64_t* val_vals = (int64_t*)(val + 4);
18899 for (size_t i = 0; i < val_constr.datalen; i++) {
18900 int64_t val_conv_8 = val_vals[i];
18901 val_constr.data[i] = val_conv_8;
18903 NodeInfo_set_channels(&this_ptr_conv, val_constr);
18906 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
18907 LDKNodeInfo this_ptr_conv;
18908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18909 this_ptr_conv.is_owned = false;
18910 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
18911 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18912 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18913 long ret_ref = (long)ret_var.inner;
18914 if (ret_var.is_owned) {
18920 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
18921 LDKNodeInfo this_ptr_conv;
18922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18923 this_ptr_conv.is_owned = false;
18924 LDKRoutingFees val_conv;
18925 val_conv.inner = (void*)(val & (~1));
18926 val_conv.is_owned = (val & 1) || (val == 0);
18927 val_conv = RoutingFees_clone(&val_conv);
18928 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
18931 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
18932 LDKNodeInfo this_ptr_conv;
18933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18934 this_ptr_conv.is_owned = false;
18935 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
18936 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18937 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18938 long ret_ref = (long)ret_var.inner;
18939 if (ret_var.is_owned) {
18945 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
18946 LDKNodeInfo this_ptr_conv;
18947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18948 this_ptr_conv.is_owned = false;
18949 LDKNodeAnnouncementInfo val_conv;
18950 val_conv.inner = (void*)(val & (~1));
18951 val_conv.is_owned = (val & 1) || (val == 0);
18952 val_conv = NodeAnnouncementInfo_clone(&val_conv);
18953 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
18956 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
18957 LDKCVec_u64Z channels_arg_constr;
18958 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
18959 if (channels_arg_constr.datalen > 0)
18960 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
18962 channels_arg_constr.data = NULL;
18963 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
18964 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
18965 int64_t channels_arg_conv_8 = channels_arg_vals[i];
18966 channels_arg_constr.data[i] = channels_arg_conv_8;
18968 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
18969 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
18970 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
18971 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
18972 LDKNodeAnnouncementInfo announcement_info_arg_conv;
18973 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
18974 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
18975 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
18976 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
18977 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18978 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18979 long ret_ref = (long)ret_var.inner;
18980 if (ret_var.is_owned) {
18986 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
18987 LDKNodeInfo orig_conv;
18988 orig_conv.inner = (void*)(orig & (~1));
18989 orig_conv.is_owned = false;
18990 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
18991 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18992 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18993 long ret_ref = (long)ret_var.inner;
18994 if (ret_var.is_owned) {
19000 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
19001 LDKNodeInfo obj_conv;
19002 obj_conv.inner = (void*)(obj & (~1));
19003 obj_conv.is_owned = false;
19004 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
19005 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19006 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19007 CVec_u8Z_free(ret_var);
19011 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
19012 LDKu8slice ser_ref;
19013 ser_ref.datalen = *((uint32_t*)ser);
19014 ser_ref.data = (int8_t*)(ser + 4);
19015 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19016 *ret_conv = NodeInfo_read(ser_ref);
19017 return (long)ret_conv;
19020 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
19021 LDKNetworkGraph obj_conv;
19022 obj_conv.inner = (void*)(obj & (~1));
19023 obj_conv.is_owned = false;
19024 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
19025 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19026 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19027 CVec_u8Z_free(ret_var);
19031 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
19032 LDKu8slice ser_ref;
19033 ser_ref.datalen = *((uint32_t*)ser);
19034 ser_ref.data = (int8_t*)(ser + 4);
19035 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19036 *ret_conv = NetworkGraph_read(ser_ref);
19037 return (long)ret_conv;
19040 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
19041 LDKThirtyTwoBytes genesis_hash_ref;
19042 CHECK(*((uint32_t*)genesis_hash) == 32);
19043 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
19044 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
19045 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19046 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19047 long ret_ref = (long)ret_var.inner;
19048 if (ret_var.is_owned) {
19054 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
19055 LDKNetworkGraph this_arg_conv;
19056 this_arg_conv.inner = (void*)(this_arg & (~1));
19057 this_arg_conv.is_owned = false;
19058 LDKNodeAnnouncement msg_conv;
19059 msg_conv.inner = (void*)(msg & (~1));
19060 msg_conv.is_owned = false;
19061 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19062 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
19063 return (long)ret_conv;
19066 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
19067 LDKNetworkGraph this_arg_conv;
19068 this_arg_conv.inner = (void*)(this_arg & (~1));
19069 this_arg_conv.is_owned = false;
19070 LDKUnsignedNodeAnnouncement msg_conv;
19071 msg_conv.inner = (void*)(msg & (~1));
19072 msg_conv.is_owned = false;
19073 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19074 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
19075 return (long)ret_conv;
19078 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
19079 LDKNetworkGraph this_arg_conv;
19080 this_arg_conv.inner = (void*)(this_arg & (~1));
19081 this_arg_conv.is_owned = false;
19082 LDKChannelAnnouncement msg_conv;
19083 msg_conv.inner = (void*)(msg & (~1));
19084 msg_conv.is_owned = false;
19085 LDKAccess *chain_access_conv_ptr = NULL;
19086 if (chain_access != 0) {
19087 LDKAccess chain_access_conv;
19088 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19089 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19090 *chain_access_conv_ptr = chain_access_conv;
19092 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19093 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
19094 return (long)ret_conv;
19097 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
19098 LDKNetworkGraph this_arg_conv;
19099 this_arg_conv.inner = (void*)(this_arg & (~1));
19100 this_arg_conv.is_owned = false;
19101 LDKUnsignedChannelAnnouncement msg_conv;
19102 msg_conv.inner = (void*)(msg & (~1));
19103 msg_conv.is_owned = false;
19104 LDKAccess *chain_access_conv_ptr = NULL;
19105 if (chain_access != 0) {
19106 LDKAccess chain_access_conv;
19107 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19108 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19109 *chain_access_conv_ptr = chain_access_conv;
19111 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19112 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
19113 return (long)ret_conv;
19116 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
19117 LDKNetworkGraph this_arg_conv;
19118 this_arg_conv.inner = (void*)(this_arg & (~1));
19119 this_arg_conv.is_owned = false;
19120 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
19123 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
19124 LDKNetworkGraph this_arg_conv;
19125 this_arg_conv.inner = (void*)(this_arg & (~1));
19126 this_arg_conv.is_owned = false;
19127 LDKChannelUpdate msg_conv;
19128 msg_conv.inner = (void*)(msg & (~1));
19129 msg_conv.is_owned = false;
19130 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19131 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
19132 return (long)ret_conv;
19135 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
19136 LDKNetworkGraph this_arg_conv;
19137 this_arg_conv.inner = (void*)(this_arg & (~1));
19138 this_arg_conv.is_owned = false;
19139 LDKUnsignedChannelUpdate msg_conv;
19140 msg_conv.inner = (void*)(msg & (~1));
19141 msg_conv.is_owned = false;
19142 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19143 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
19144 return (long)ret_conv;