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;
648 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MessageSendEventZ_new(uint32_tArray elems) {
649 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
650 ret->datalen = *((uint32_t*)elems);
651 if (ret->datalen == 0) {
654 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
655 uint32_t *java_elems = (uint32_t*)(elems + 4);
656 for (size_t i = 0; i < ret->datalen; i++) {
657 uint32_t arr_elem = java_elems[i];
658 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
659 FREE((void*)arr_elem);
660 ret->data[i] = arr_elem_conv;
665 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
666 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
667 for (size_t i = 0; i < ret.datalen; i++) {
668 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
672 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
673 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
675 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
676 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
677 CHECK(val->result_ok);
678 return *val->contents.result;
680 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
681 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
682 CHECK(!val->result_ok);
683 LDKLightningError err_var = (*val->contents.err);
684 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
685 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
686 long err_ref = (long)err_var.inner & ~1;
689 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
690 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
691 LDKChannelAnnouncement a_conv;
692 a_conv.inner = (void*)(a & (~1));
693 a_conv.is_owned = (a & 1) || (a == 0);
694 a_conv = ChannelAnnouncement_clone(&a_conv);
696 LDKChannelUpdate b_conv;
697 b_conv.inner = (void*)(b & (~1));
698 b_conv.is_owned = (b & 1) || (b == 0);
699 b_conv = ChannelUpdate_clone(&b_conv);
701 LDKChannelUpdate c_conv;
702 c_conv.inner = (void*)(c & (~1));
703 c_conv.is_owned = (c & 1) || (c == 0);
704 c_conv = ChannelUpdate_clone(&c_conv);
708 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t ptr) {
709 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
710 LDKChannelAnnouncement a_var = tuple->a;
711 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
712 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
713 long a_ref = (long)a_var.inner & ~1;
716 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t ptr) {
717 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
718 LDKChannelUpdate b_var = tuple->b;
719 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
720 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
721 long b_ref = (long)b_var.inner & ~1;
724 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t ptr) {
725 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
726 LDKChannelUpdate c_var = tuple->c;
727 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
728 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
729 long c_ref = (long)c_var.inner & ~1;
732 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
733 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
734 ret->datalen = *((uint32_t*)elems);
735 if (ret->datalen == 0) {
738 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
739 uint32_t *java_elems = (uint32_t*)(elems + 4);
740 for (size_t i = 0; i < ret->datalen; i++) {
741 uint32_t arr_elem = java_elems[i];
742 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
743 FREE((void*)arr_elem);
744 ret->data[i] = arr_elem_conv;
749 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
750 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
751 for (size_t i = 0; i < ret.datalen; i++) {
752 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
756 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
757 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
758 ret->datalen = *((uint32_t*)elems);
759 if (ret->datalen == 0) {
762 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
763 uint32_t *java_elems = (uint32_t*)(elems + 4);
764 for (size_t i = 0; i < ret->datalen; i++) {
765 uint32_t arr_elem = java_elems[i];
766 LDKNodeAnnouncement arr_elem_conv;
767 arr_elem_conv.inner = (void*)(arr_elem & (~1));
768 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
769 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
770 ret->data[i] = arr_elem_conv;
775 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
776 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
777 for (size_t i = 0; i < ret.datalen; i++) {
778 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
782 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
783 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
785 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
786 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
787 CHECK(val->result_ok);
788 return *val->contents.result;
790 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
791 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
792 CHECK(!val->result_ok);
793 LDKLightningError err_var = (*val->contents.err);
794 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
795 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
796 long err_ref = (long)err_var.inner & ~1;
799 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
800 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
802 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
803 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
804 CHECK(val->result_ok);
805 LDKCVec_u8Z res_var = (*val->contents.result);
806 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
807 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
810 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
811 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
812 CHECK(!val->result_ok);
813 LDKPeerHandleError err_var = (*val->contents.err);
814 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
815 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
816 long err_ref = (long)err_var.inner & ~1;
819 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
820 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
822 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
823 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
824 CHECK(val->result_ok);
825 return *val->contents.result;
827 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
828 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
829 CHECK(!val->result_ok);
830 LDKPeerHandleError err_var = (*val->contents.err);
831 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
832 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
833 long err_ref = (long)err_var.inner & ~1;
836 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
837 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
839 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
840 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
841 CHECK(val->result_ok);
842 return *val->contents.result;
844 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
845 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
846 CHECK(!val->result_ok);
847 LDKPeerHandleError err_var = (*val->contents.err);
848 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
849 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
850 long err_ref = (long)err_var.inner & ~1;
853 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
854 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
856 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
857 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
858 CHECK(val->result_ok);
859 LDKInitFeatures res_var = (*val->contents.result);
860 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
861 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
862 long res_ref = (long)res_var.inner & ~1;
865 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
866 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
867 CHECK(!val->result_ok);
868 LDKDecodeError err_var = (*val->contents.err);
869 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
870 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
871 long err_ref = (long)err_var.inner & ~1;
874 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
875 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
877 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
878 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
879 CHECK(val->result_ok);
880 LDKNodeFeatures res_var = (*val->contents.result);
881 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
882 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
883 long res_ref = (long)res_var.inner & ~1;
886 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
887 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
888 CHECK(!val->result_ok);
889 LDKDecodeError err_var = (*val->contents.err);
890 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
891 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
892 long err_ref = (long)err_var.inner & ~1;
895 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
896 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
898 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
899 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
900 CHECK(val->result_ok);
901 LDKChannelFeatures res_var = (*val->contents.result);
902 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
903 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
904 long res_ref = (long)res_var.inner & ~1;
907 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
908 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
909 CHECK(!val->result_ok);
910 LDKDecodeError err_var = (*val->contents.err);
911 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
912 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
913 long err_ref = (long)err_var.inner & ~1;
916 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
917 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
919 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
920 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
921 CHECK(val->result_ok);
922 LDKChannelConfig res_var = (*val->contents.result);
923 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
924 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
925 long res_ref = (long)res_var.inner & ~1;
928 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
929 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
930 CHECK(!val->result_ok);
931 LDKDecodeError err_var = (*val->contents.err);
932 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
933 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
934 long err_ref = (long)err_var.inner & ~1;
937 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
938 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
940 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
941 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
942 CHECK(val->result_ok);
943 LDKDirectionalChannelInfo res_var = (*val->contents.result);
944 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
945 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
946 long res_ref = (long)res_var.inner & ~1;
949 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
950 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
951 CHECK(!val->result_ok);
952 LDKDecodeError err_var = (*val->contents.err);
953 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
954 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
955 long err_ref = (long)err_var.inner & ~1;
958 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
959 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
961 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
962 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
963 CHECK(val->result_ok);
964 LDKChannelInfo res_var = (*val->contents.result);
965 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
966 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
967 long res_ref = (long)res_var.inner & ~1;
970 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
971 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
972 CHECK(!val->result_ok);
973 LDKDecodeError err_var = (*val->contents.err);
974 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
975 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
976 long err_ref = (long)err_var.inner & ~1;
979 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
980 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
982 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
983 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
984 CHECK(val->result_ok);
985 LDKRoutingFees res_var = (*val->contents.result);
986 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
987 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
988 long res_ref = (long)res_var.inner & ~1;
991 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
992 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
993 CHECK(!val->result_ok);
994 LDKDecodeError err_var = (*val->contents.err);
995 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
996 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
997 long err_ref = (long)err_var.inner & ~1;
1000 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
1001 LDKNetAddress *obj = (LDKNetAddress*)ptr;
1003 case LDKNetAddress_IPv4: {
1004 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
1005 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
1006 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
1008 case LDKNetAddress_IPv6: {
1009 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
1010 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
1011 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
1013 case LDKNetAddress_OnionV2: {
1014 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
1015 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
1016 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
1018 case LDKNetAddress_OnionV3: {
1019 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1020 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
1021 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
1026 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
1027 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
1028 ret->datalen = *((uint32_t*)elems);
1029 if (ret->datalen == 0) {
1032 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
1033 uint32_t *java_elems = (uint32_t*)(elems + 4);
1034 for (size_t i = 0; i < ret->datalen; i++) {
1035 uint32_t arr_elem = java_elems[i];
1036 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
1037 FREE((void*)arr_elem);
1038 ret->data[i] = arr_elem_conv;
1043 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
1044 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
1045 for (size_t i = 0; i < ret.datalen; i++) {
1046 ret.data[i] = NetAddress_clone(&orig->data[i]);
1050 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
1051 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
1053 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
1054 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1055 CHECK(val->result_ok);
1056 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
1057 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1058 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1059 long res_ref = (long)res_var.inner & ~1;
1062 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
1063 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1064 CHECK(!val->result_ok);
1065 LDKDecodeError err_var = (*val->contents.err);
1066 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1067 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1068 long err_ref = (long)err_var.inner & ~1;
1071 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
1072 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
1073 ret->datalen = *((uint32_t*)elems);
1074 if (ret->datalen == 0) {
1077 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
1078 int64_t *java_elems = (int64_t*)(elems + 4);
1079 for (size_t i = 0; i < ret->datalen; i++) {
1080 ret->data[i] = java_elems[i];
1085 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1086 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1087 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1090 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
1091 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
1093 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
1094 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1095 CHECK(val->result_ok);
1096 LDKNodeInfo res_var = (*val->contents.result);
1097 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1098 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1099 long res_ref = (long)res_var.inner & ~1;
1102 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
1103 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1104 CHECK(!val->result_ok);
1105 LDKDecodeError err_var = (*val->contents.err);
1106 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1107 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1108 long err_ref = (long)err_var.inner & ~1;
1111 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
1112 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
1114 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
1115 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1116 CHECK(val->result_ok);
1117 LDKNetworkGraph res_var = (*val->contents.result);
1118 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1119 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1120 long res_ref = (long)res_var.inner & ~1;
1123 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
1124 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1125 CHECK(!val->result_ok);
1126 LDKDecodeError err_var = (*val->contents.err);
1127 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1128 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1129 long err_ref = (long)err_var.inner & ~1;
1132 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
1133 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1135 LDKTransaction b_ref;
1136 b_ref.datalen = *((uint32_t*)b);
1137 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1138 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
1139 b_ref.data_is_owned = false;
1143 int64_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_a(uint32_t ptr) {
1144 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1147 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_b(uint32_t ptr) {
1148 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1149 LDKTransaction b_var = tuple->b;
1150 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1151 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
1154 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_usizeTransactionZZ_new(uint32_tArray elems) {
1155 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1156 ret->datalen = *((uint32_t*)elems);
1157 if (ret->datalen == 0) {
1160 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1161 uint32_t *java_elems = (uint32_t*)(elems + 4);
1162 for (size_t i = 0; i < ret->datalen; i++) {
1163 uint32_t arr_elem = java_elems[i];
1164 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1165 FREE((void*)arr_elem);
1166 ret->data[i] = arr_elem_conv;
1171 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(uint32_t arg) {
1172 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1174 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
1175 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1176 CHECK(val->result_ok);
1177 return *val->contents.result;
1179 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
1180 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1181 CHECK(!val->result_ok);
1182 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
1185 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
1186 LDKMonitorEvent *obj = (LDKMonitorEvent*)ptr;
1188 case LDKMonitorEvent_HTLCEvent: {
1189 return 0 /* LDKMonitorEvent - HTLCEvent */;
1191 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1192 return 0 /* LDKMonitorEvent - CommitmentTxBroadcasted */;
1197 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) {
1198 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1199 ret->datalen = *((uint32_t*)elems);
1200 if (ret->datalen == 0) {
1203 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1204 uint32_t *java_elems = (uint32_t*)(elems + 4);
1205 for (size_t i = 0; i < ret->datalen; i++) {
1206 uint32_t arr_elem = java_elems[i];
1207 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1208 FREE((void*)arr_elem);
1209 ret->data[i] = arr_elem_conv;
1214 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1215 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1216 for (size_t i = 0; i < ret.datalen; i++) {
1217 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1221 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
1222 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
1224 case LDKSpendableOutputDescriptor_StaticOutput: {
1225 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1226 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1227 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1228 long outpoint_ref = (long)outpoint_var.inner & ~1;
1229 long output_ref = ((long)&obj->static_output.output) | 1;
1230 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (long)output_ref;
1232 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1233 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */;
1235 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1236 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */;
1241 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_SpendableOutputDescriptorZ_new(uint32_tArray elems) {
1242 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1243 ret->datalen = *((uint32_t*)elems);
1244 if (ret->datalen == 0) {
1247 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1248 uint32_t *java_elems = (uint32_t*)(elems + 4);
1249 for (size_t i = 0; i < ret->datalen; i++) {
1250 uint32_t arr_elem = java_elems[i];
1251 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1252 FREE((void*)arr_elem);
1253 ret->data[i] = arr_elem_conv;
1258 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1259 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1260 for (size_t i = 0; i < ret.datalen; i++) {
1261 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1265 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
1266 LDKEvent *obj = (LDKEvent*)ptr;
1268 case LDKEvent_FundingGenerationReady: {
1269 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1270 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
1271 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1272 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1273 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
1274 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;
1276 case LDKEvent_FundingBroadcastSafe: {
1277 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1278 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1279 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1280 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1281 return 0 /* LDKEvent - FundingBroadcastSafe */; (void) funding_txo_ref; (void) obj->funding_broadcast_safe.user_channel_id;
1283 case LDKEvent_PaymentReceived: {
1284 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1285 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
1286 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1287 memcpy((uint8_t*)(payment_secret_arr + 4), obj->payment_received.payment_secret.data, 32);
1288 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) payment_secret_arr; (void) obj->payment_received.amt;
1290 case LDKEvent_PaymentSent: {
1291 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1292 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
1293 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
1295 case LDKEvent_PaymentFailed: {
1296 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1297 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_failed.payment_hash.data, 32);
1298 return 0 /* LDKEvent - PaymentFailed */; (void) payment_hash_arr; (void) obj->payment_failed.rejected_by_dest;
1300 case LDKEvent_PendingHTLCsForwardable: {
1301 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
1303 case LDKEvent_SpendableOutputs: {
1304 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1305 uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1306 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
1307 for (size_t b = 0; b < outputs_var.datalen; b++) {
1308 long outputs_conv_27_ref = ((long)&outputs_var.data[b]) | 1;
1309 outputs_arr_ptr[b] = outputs_conv_27_ref;
1311 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
1316 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
1317 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1318 ret->datalen = *((uint32_t*)elems);
1319 if (ret->datalen == 0) {
1322 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
1323 uint32_t *java_elems = (uint32_t*)(elems + 4);
1324 for (size_t i = 0; i < ret->datalen; i++) {
1325 uint32_t arr_elem = java_elems[i];
1326 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
1327 FREE((void*)arr_elem);
1328 ret->data[i] = arr_elem_conv;
1333 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1334 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1335 for (size_t i = 0; i < ret.datalen; i++) {
1336 ret.data[i] = Event_clone(&orig->data[i]);
1340 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
1341 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
1343 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
1344 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1345 CHECK(val->result_ok);
1346 LDKOutPoint res_var = (*val->contents.result);
1347 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1348 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1349 long res_ref = (long)res_var.inner & ~1;
1352 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
1353 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1354 CHECK(!val->result_ok);
1355 LDKDecodeError err_var = (*val->contents.err);
1356 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1357 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1358 long err_ref = (long)err_var.inner & ~1;
1361 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
1362 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
1364 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
1365 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1366 CHECK(val->result_ok);
1367 LDKChannelMonitorUpdate res_var = (*val->contents.result);
1368 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1369 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1370 long res_ref = (long)res_var.inner & ~1;
1373 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
1374 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1375 CHECK(!val->result_ok);
1376 LDKDecodeError err_var = (*val->contents.err);
1377 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1378 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1379 long err_ref = (long)err_var.inner & ~1;
1382 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
1383 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
1385 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
1386 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1387 CHECK(val->result_ok);
1388 LDKHTLCUpdate res_var = (*val->contents.result);
1389 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1390 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1391 long res_ref = (long)res_var.inner & ~1;
1394 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
1395 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1396 CHECK(!val->result_ok);
1397 LDKDecodeError err_var = (*val->contents.err);
1398 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1399 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1400 long err_ref = (long)err_var.inner & ~1;
1403 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
1404 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
1406 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
1407 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1408 CHECK(val->result_ok);
1409 return *val->contents.result;
1411 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
1412 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1413 CHECK(!val->result_ok);
1414 LDKMonitorUpdateError err_var = (*val->contents.err);
1415 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1416 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1417 long err_ref = (long)err_var.inner & ~1;
1420 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
1421 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
1423 a_conv.inner = (void*)(a & (~1));
1424 a_conv.is_owned = (a & 1) || (a == 0);
1425 a_conv = OutPoint_clone(&a_conv);
1428 b_ref.datalen = *((uint32_t*)b);
1429 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
1430 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
1434 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_a(uint32_t ptr) {
1435 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1436 LDKOutPoint a_var = tuple->a;
1437 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1438 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1439 long a_ref = (long)a_var.inner & ~1;
1442 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_b(uint32_t ptr) {
1443 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1444 LDKCVec_u8Z b_var = tuple->b;
1445 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1446 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
1449 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
1450 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
1452 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
1457 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_a(uint32_t ptr) {
1458 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1461 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_b(uint32_t ptr) {
1462 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1463 long b_ref = ((long)&tuple->b) | 1;
1466 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
1467 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
1468 ret->datalen = *((uint32_t*)elems);
1469 if (ret->datalen == 0) {
1472 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
1473 uint32_t *java_elems = (uint32_t*)(elems + 4);
1474 for (size_t i = 0; i < ret->datalen; i++) {
1475 uint32_t arr_elem = java_elems[i];
1476 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
1477 FREE((void*)arr_elem);
1478 ret->data[i] = arr_elem_conv;
1483 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
1484 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
1485 for (size_t i = 0; i < ret.datalen; i++) {
1486 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
1490 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
1491 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
1492 LDKThirtyTwoBytes a_ref;
1493 CHECK(*((uint32_t*)a) == 32);
1494 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
1496 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
1497 b_constr.datalen = *((uint32_t*)b);
1498 if (b_constr.datalen > 0)
1499 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
1501 b_constr.data = NULL;
1502 uint32_t* b_vals = (uint32_t*)(b + 4);
1503 for (size_t z = 0; z < b_constr.datalen; z++) {
1504 uint32_t b_conv_25 = b_vals[z];
1505 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
1506 FREE((void*)b_conv_25);
1507 b_constr.data[z] = b_conv_25_conv;
1512 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t ptr) {
1513 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
1514 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1515 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
1518 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t ptr) {
1519 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
1520 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
1521 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1522 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
1523 for (size_t z = 0; z < b_var.datalen; z++) {
1524 long b_conv_25_ref = (long)(&b_var.data[z]) | 1;
1525 b_arr_ptr[z] = b_conv_25_ref;
1529 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
1530 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
1531 ret->datalen = *((uint32_t*)elems);
1532 if (ret->datalen == 0) {
1535 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
1536 uint32_t *java_elems = (uint32_t*)(elems + 4);
1537 for (size_t i = 0; i < ret->datalen; i++) {
1538 uint32_t arr_elem = java_elems[i];
1539 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
1540 FREE((void*)arr_elem);
1541 ret->data[i] = arr_elem_conv;
1546 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
1547 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1549 CHECK(*((uint32_t*)a) == 64);
1550 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
1552 LDKCVec_SignatureZ b_constr;
1553 b_constr.datalen = *((uint32_t*)b);
1554 if (b_constr.datalen > 0)
1555 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1557 b_constr.data = NULL;
1558 int8_tArray* b_vals = (int8_tArray*)(b + 4);
1559 for (size_t m = 0; m < b_constr.datalen; m++) {
1560 int8_tArray b_conv_12 = b_vals[m];
1561 LDKSignature b_conv_12_ref;
1562 CHECK(*((uint32_t*)b_conv_12) == 64);
1563 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
1564 b_constr.data[m] = b_conv_12_ref;
1569 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t ptr) {
1570 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1571 int8_tArray a_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1572 memcpy((uint8_t*)(a_arr + 4), tuple->a.compact_form, 64);
1575 ptrArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t ptr) {
1576 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1577 LDKCVec_SignatureZ b_var = tuple->b;
1578 ptrArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1579 int8_tArray *b_arr_ptr = (int8_tArray*)(b_arr + 4);
1580 for (size_t m = 0; m < b_var.datalen; m++) {
1581 int8_tArray b_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1582 memcpy((uint8_t*)(b_conv_12_arr + 4), b_var.data[m].compact_form, 64);
1583 b_arr_ptr[m] = b_conv_12_arr;
1587 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(uint32_t arg) {
1588 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1590 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1591 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1592 CHECK(val->result_ok);
1593 long res_ref = (long)(&(*val->contents.result)) | 1;
1596 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1597 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1598 CHECK(!val->result_ok);
1599 return *val->contents.err;
1601 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_result_ok(uint32_t arg) {
1602 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1604 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1605 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1606 CHECK(val->result_ok);
1607 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1608 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1611 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1612 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1613 CHECK(!val->result_ok);
1614 return *val->contents.err;
1616 typedef struct LDKSign_JCalls {
1617 atomic_size_t refcnt;
1618 uint32_t get_per_commitment_point_meth;
1619 uint32_t release_commitment_secret_meth;
1620 uint32_t channel_keys_id_meth;
1621 uint32_t sign_counterparty_commitment_meth;
1622 uint32_t sign_holder_commitment_and_htlcs_meth;
1623 uint32_t sign_justice_transaction_meth;
1624 uint32_t sign_counterparty_htlc_transaction_meth;
1625 uint32_t sign_closing_transaction_meth;
1626 uint32_t sign_channel_announcement_meth;
1627 uint32_t ready_channel_meth;
1628 uint32_t write_meth;
1630 static void LDKSign_JCalls_free(void* this_arg) {
1631 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1632 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1633 js_free(j_calls->get_per_commitment_point_meth);
1634 js_free(j_calls->release_commitment_secret_meth);
1635 js_free(j_calls->channel_keys_id_meth);
1636 js_free(j_calls->sign_counterparty_commitment_meth);
1637 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1638 js_free(j_calls->sign_justice_transaction_meth);
1639 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1640 js_free(j_calls->sign_closing_transaction_meth);
1641 js_free(j_calls->sign_channel_announcement_meth);
1642 js_free(j_calls->ready_channel_meth);
1643 js_free(j_calls->write_meth);
1647 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1648 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1649 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1650 LDKPublicKey ret_ref;
1651 CHECK(*((uint32_t*)ret) == 33);
1652 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1655 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1656 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1657 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1658 LDKThirtyTwoBytes ret_ref;
1659 CHECK(*((uint32_t*)ret) == 32);
1660 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1663 LDKThirtyTwoBytes channel_keys_id_jcall(const void* this_arg) {
1664 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1665 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1666 LDKThirtyTwoBytes ret_ref;
1667 CHECK(*((uint32_t*)ret) == 32);
1668 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1671 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1672 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1673 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1674 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1675 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1676 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1677 long commitment_tx_ref = (long)commitment_tx_var.inner;
1678 if (commitment_tx_var.is_owned) {
1679 commitment_tx_ref |= 1;
1681 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1682 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1683 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
1686 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1687 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1688 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1689 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1690 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1691 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1692 long commitment_tx_ref = (long)commitment_tx_var.inner;
1693 if (commitment_tx_var.is_owned) {
1694 commitment_tx_ref |= 1;
1696 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1697 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1698 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
1701 LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
1702 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1703 LDKTransaction justice_tx_var = justice_tx;
1704 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1705 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1706 Transaction_free(justice_tx_var);
1707 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1708 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1709 LDKHTLCOutputInCommitment htlc_var = *htlc;
1710 htlc_var = HTLCOutputInCommitment_clone(htlc);
1711 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1712 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1713 long htlc_ref = (long)htlc_var.inner;
1714 if (htlc_var.is_owned) {
1717 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);
1718 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1719 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1722 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
1723 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1724 LDKTransaction htlc_tx_var = htlc_tx;
1725 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1726 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1727 Transaction_free(htlc_tx_var);
1728 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1729 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1730 LDKHTLCOutputInCommitment htlc_var = *htlc;
1731 htlc_var = HTLCOutputInCommitment_clone(htlc);
1732 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1733 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1734 long htlc_ref = (long)htlc_var.inner;
1735 if (htlc_var.is_owned) {
1738 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);
1739 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1740 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1743 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1744 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1745 LDKTransaction closing_tx_var = closing_tx;
1746 int8_tArray closing_tx_arr = init_arr(closing_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1747 memcpy((uint8_t*)(closing_tx_arr + 4), closing_tx_var.data, closing_tx_var.datalen);
1748 Transaction_free(closing_tx_var);
1749 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_arr);
1750 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1751 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1754 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1755 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1756 LDKUnsignedChannelAnnouncement msg_var = *msg;
1757 msg_var = UnsignedChannelAnnouncement_clone(msg);
1758 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1759 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1760 long msg_ref = (long)msg_var.inner;
1761 if (msg_var.is_owned) {
1764 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
1765 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1766 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1769 void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1770 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1771 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1772 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1773 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1774 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1775 long channel_parameters_ref = (long)channel_parameters_var.inner;
1776 if (channel_parameters_var.is_owned) {
1777 channel_parameters_ref |= 1;
1779 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
1781 LDKCVec_u8Z write_jcall(const void* this_arg) {
1782 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1783 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
1784 LDKCVec_u8Z ret_ref;
1785 ret_ref.datalen = *((uint32_t*)ret);
1786 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
1787 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
1790 static void* LDKSign_JCalls_clone(const void* this_arg) {
1791 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1792 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1793 return (void*) this_arg;
1795 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1796 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
1797 atomic_init(&calls->refcnt, 1);
1798 //TODO: Assign calls->o from o
1800 LDKChannelPublicKeys pubkeys_conv;
1801 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1802 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1803 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1806 .this_arg = (void*) calls,
1807 .get_per_commitment_point = get_per_commitment_point_jcall,
1808 .release_commitment_secret = release_commitment_secret_jcall,
1809 .channel_keys_id = channel_keys_id_jcall,
1810 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1811 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_jcall,
1812 .sign_justice_transaction = sign_justice_transaction_jcall,
1813 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1814 .sign_closing_transaction = sign_closing_transaction_jcall,
1815 .sign_channel_announcement = sign_channel_announcement_jcall,
1816 .ready_channel = ready_channel_jcall,
1817 .clone = LDKSign_JCalls_clone,
1818 .write = write_jcall,
1819 .free = LDKSign_JCalls_free,
1820 .pubkeys = pubkeys_conv,
1821 .set_pubkeys = NULL,
1825 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1826 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
1827 *res_ptr = LDKSign_init(o, pubkeys);
1828 return (long)res_ptr;
1830 int8_tArray __attribute__((visibility("default"))) TS_Sign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
1831 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1832 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1833 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1837 int8_tArray __attribute__((visibility("default"))) TS_Sign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
1838 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1839 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1840 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1844 int8_tArray __attribute__((visibility("default"))) TS_Sign_channel_keys_id(uint32_t this_arg) {
1845 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1846 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1847 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1851 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
1852 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1853 LDKCommitmentTransaction commitment_tx_conv;
1854 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1855 commitment_tx_conv.is_owned = false;
1856 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1857 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1858 return (long)ret_conv;
1861 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
1862 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1863 LDKHolderCommitmentTransaction commitment_tx_conv;
1864 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1865 commitment_tx_conv.is_owned = false;
1866 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1867 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1868 return (long)ret_conv;
1871 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) {
1872 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1873 LDKTransaction justice_tx_ref;
1874 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1875 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1876 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1877 justice_tx_ref.data_is_owned = true;
1878 unsigned char per_commitment_key_arr[32];
1879 CHECK(*((uint32_t*)per_commitment_key) == 32);
1880 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1881 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1882 LDKHTLCOutputInCommitment htlc_conv;
1883 htlc_conv.inner = (void*)(htlc & (~1));
1884 htlc_conv.is_owned = false;
1885 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1886 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
1887 return (long)ret_conv;
1890 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) {
1891 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1892 LDKTransaction htlc_tx_ref;
1893 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
1894 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1895 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
1896 htlc_tx_ref.data_is_owned = true;
1897 LDKPublicKey per_commitment_point_ref;
1898 CHECK(*((uint32_t*)per_commitment_point) == 33);
1899 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
1900 LDKHTLCOutputInCommitment htlc_conv;
1901 htlc_conv.inner = (void*)(htlc & (~1));
1902 htlc_conv.is_owned = false;
1903 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1904 *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);
1905 return (long)ret_conv;
1908 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_closing_transaction(uint32_t this_arg, int8_tArray closing_tx) {
1909 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1910 LDKTransaction closing_tx_ref;
1911 closing_tx_ref.datalen = *((uint32_t*)closing_tx);
1912 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
1913 memcpy(closing_tx_ref.data, (uint8_t*)(closing_tx + 4), closing_tx_ref.datalen);
1914 closing_tx_ref.data_is_owned = true;
1915 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1916 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
1917 return (long)ret_conv;
1920 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
1921 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1922 LDKUnsignedChannelAnnouncement msg_conv;
1923 msg_conv.inner = (void*)(msg & (~1));
1924 msg_conv.is_owned = false;
1925 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1926 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1927 return (long)ret_conv;
1930 void __attribute__((visibility("default"))) TS_Sign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
1931 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1932 LDKChannelTransactionParameters channel_parameters_conv;
1933 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1934 channel_parameters_conv.is_owned = false;
1935 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1938 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
1939 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1940 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1941 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1942 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
1943 CVec_u8Z_free(ret_var);
1947 LDKChannelPublicKeys LDKSign_set_get_pubkeys(LDKSign* this_arg) {
1948 if (this_arg->set_pubkeys != NULL)
1949 this_arg->set_pubkeys(this_arg);
1950 return this_arg->pubkeys;
1952 uint32_t __attribute__((visibility("default"))) TS_Sign_get_pubkeys(uint32_t this_arg) {
1953 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1954 LDKChannelPublicKeys ret_var = LDKSign_set_get_pubkeys(this_arg_conv);
1955 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1956 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1957 long ret_ref = (long)ret_var.inner;
1958 if (ret_var.is_owned) {
1964 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
1965 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
1966 LDKThirtyTwoBytes a_ref;
1967 CHECK(*((uint32_t*)a) == 32);
1968 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
1970 LDKChannelMonitor b_conv;
1971 b_conv.inner = (void*)(b & (~1));
1972 b_conv.is_owned = (b & 1) || (b == 0);
1973 b_conv = ChannelMonitor_clone(&b_conv);
1977 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t ptr) {
1978 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
1979 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1980 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
1983 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t ptr) {
1984 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
1985 LDKChannelMonitor b_var = tuple->b;
1986 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1987 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1988 long b_ref = (long)b_var.inner & ~1;
1991 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
1992 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
1994 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
1995 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
1996 CHECK(val->result_ok);
1997 long res_ref = (long)(&(*val->contents.result)) | 1;
2000 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
2001 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2002 CHECK(!val->result_ok);
2003 LDKDecodeError err_var = (*val->contents.err);
2004 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2005 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2006 long err_ref = (long)err_var.inner & ~1;
2009 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_result_ok(uint32_t arg) {
2010 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
2012 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
2013 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2014 CHECK(val->result_ok);
2015 long res_ref = ((long)&(*val->contents.result)) | 1;
2016 return (long)res_ref;
2018 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
2019 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2020 CHECK(!val->result_ok);
2021 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
2024 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2025 LDKAPIError *obj = (LDKAPIError*)ptr;
2027 case LDKAPIError_APIMisuseError: {
2028 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
2029 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2030 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
2031 return 0 /* LDKAPIError - APIMisuseError */; (void) err_arr;
2033 case LDKAPIError_FeeRateTooHigh: {
2034 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
2035 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2036 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
2037 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_arr; (void) obj->fee_rate_too_high.feerate;
2039 case LDKAPIError_RouteError: {
2040 LDKStr err_str = obj->route_error.err;
2041 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2042 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2044 case LDKAPIError_ChannelUnavailable: {
2045 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
2046 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2047 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
2048 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_arr;
2050 case LDKAPIError_MonitorUpdateFailed: {
2051 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2056 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
2057 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2059 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2060 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2061 CHECK(val->result_ok);
2062 return *val->contents.result;
2064 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2065 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2066 CHECK(!val->result_ok);
2067 long err_ref = ((long)&(*val->contents.err)) | 1;
2070 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) {
2071 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2072 ret->datalen = *((uint32_t*)elems);
2073 if (ret->datalen == 0) {
2076 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2077 uint32_t *java_elems = (uint32_t*)(elems + 4);
2078 for (size_t i = 0; i < ret->datalen; i++) {
2079 uint32_t arr_elem = java_elems[i];
2080 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2081 FREE((void*)arr_elem);
2082 ret->data[i] = arr_elem_conv;
2087 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2088 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2089 for (size_t i = 0; i < ret.datalen; i++) {
2090 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2094 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) {
2095 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2096 ret->datalen = *((uint32_t*)elems);
2097 if (ret->datalen == 0) {
2100 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2101 uint32_t *java_elems = (uint32_t*)(elems + 4);
2102 for (size_t i = 0; i < ret->datalen; i++) {
2103 uint32_t arr_elem = java_elems[i];
2104 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
2105 FREE((void*)arr_elem);
2106 ret->data[i] = arr_elem_conv;
2111 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2112 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2113 for (size_t i = 0; i < ret.datalen; i++) {
2114 ret.data[i] = APIError_clone(&orig->data[i]);
2118 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) {
2119 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
2120 ret->datalen = *((uint32_t*)elems);
2121 if (ret->datalen == 0) {
2124 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
2125 uint32_t *java_elems = (uint32_t*)(elems + 4);
2126 for (size_t i = 0; i < ret->datalen; i++) {
2127 uint32_t arr_elem = java_elems[i];
2128 LDKChannelDetails arr_elem_conv;
2129 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2130 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2131 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2132 ret->data[i] = arr_elem_conv;
2137 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2138 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2139 for (size_t i = 0; i < ret.datalen; i++) {
2140 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2144 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2145 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)ptr;
2147 case LDKPaymentSendFailure_ParameterError: {
2148 return 0 /* LDKPaymentSendFailure - ParameterError */;
2150 case LDKPaymentSendFailure_PathParameterError: {
2151 return 0 /* LDKPaymentSendFailure - PathParameterError */;
2153 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2154 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */;
2156 case LDKPaymentSendFailure_PartialFailure: {
2157 return 0 /* LDKPaymentSendFailure - PartialFailure */;
2162 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
2163 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2165 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2166 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2167 CHECK(val->result_ok);
2168 return *val->contents.result;
2170 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2171 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2172 CHECK(!val->result_ok);
2173 long err_ref = ((long)&(*val->contents.err)) | 1;
2176 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
2177 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2178 ret->datalen = *((uint32_t*)elems);
2179 if (ret->datalen == 0) {
2182 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2183 uint32_t *java_elems = (uint32_t*)(elems + 4);
2184 for (size_t i = 0; i < ret->datalen; i++) {
2185 uint32_t arr_elem = java_elems[i];
2186 LDKChannelMonitor arr_elem_conv;
2187 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2188 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2189 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2190 ret->data[i] = arr_elem_conv;
2195 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2196 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2197 for (size_t i = 0; i < ret.datalen; i++) {
2198 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2202 typedef struct LDKWatch_JCalls {
2203 atomic_size_t refcnt;
2204 uint32_t watch_channel_meth;
2205 uint32_t update_channel_meth;
2206 uint32_t release_pending_monitor_events_meth;
2208 static void LDKWatch_JCalls_free(void* this_arg) {
2209 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2210 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2211 js_free(j_calls->watch_channel_meth);
2212 js_free(j_calls->update_channel_meth);
2213 js_free(j_calls->release_pending_monitor_events_meth);
2217 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2218 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2219 LDKOutPoint funding_txo_var = funding_txo;
2220 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2221 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2222 long funding_txo_ref = (long)funding_txo_var.inner;
2223 if (funding_txo_var.is_owned) {
2224 funding_txo_ref |= 1;
2226 LDKChannelMonitor monitor_var = monitor;
2227 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2228 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2229 long monitor_ref = (long)monitor_var.inner;
2230 if (monitor_var.is_owned) {
2233 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2234 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2235 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2238 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2239 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2240 LDKOutPoint funding_txo_var = funding_txo;
2241 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2242 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2243 long funding_txo_ref = (long)funding_txo_var.inner;
2244 if (funding_txo_var.is_owned) {
2245 funding_txo_ref |= 1;
2247 LDKChannelMonitorUpdate update_var = update;
2248 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2249 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2250 long update_ref = (long)update_var.inner;
2251 if (update_var.is_owned) {
2254 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2255 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2256 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2259 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2260 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2261 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2262 LDKCVec_MonitorEventZ ret_constr;
2263 ret_constr.datalen = *((uint32_t*)ret);
2264 if (ret_constr.datalen > 0)
2265 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2267 ret_constr.data = NULL;
2268 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2269 for (size_t o = 0; o < ret_constr.datalen; o++) {
2270 uint32_t ret_conv_14 = ret_vals[o];
2271 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
2272 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)ret_conv_14);
2273 ret_constr.data[o] = ret_conv_14_conv;
2277 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2278 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2279 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2280 return (void*) this_arg;
2282 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2283 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2284 atomic_init(&calls->refcnt, 1);
2285 //TODO: Assign calls->o from o
2288 .this_arg = (void*) calls,
2289 .watch_channel = watch_channel_jcall,
2290 .update_channel = update_channel_jcall,
2291 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2292 .free = LDKWatch_JCalls_free,
2296 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2297 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2298 *res_ptr = LDKWatch_init(o);
2299 return (long)res_ptr;
2301 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2302 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2303 LDKOutPoint funding_txo_conv;
2304 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2305 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2306 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2307 LDKChannelMonitor monitor_conv;
2308 monitor_conv.inner = (void*)(monitor & (~1));
2309 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2310 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2311 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2312 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2313 return (long)ret_conv;
2316 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
2317 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2318 LDKOutPoint funding_txo_conv;
2319 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2320 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2321 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2322 LDKChannelMonitorUpdate update_conv;
2323 update_conv.inner = (void*)(update & (~1));
2324 update_conv.is_owned = (update & 1) || (update == 0);
2325 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2326 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2327 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2328 return (long)ret_conv;
2331 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
2332 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2333 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2334 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2335 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
2336 for (size_t o = 0; o < ret_var.datalen; o++) {
2337 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2338 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
2339 long ret_conv_14_ref = (long)ret_conv_14_copy;
2340 ret_arr_ptr[o] = ret_conv_14_ref;
2346 typedef struct LDKBroadcasterInterface_JCalls {
2347 atomic_size_t refcnt;
2348 uint32_t broadcast_transaction_meth;
2349 } LDKBroadcasterInterface_JCalls;
2350 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2351 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2352 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2353 js_free(j_calls->broadcast_transaction_meth);
2357 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2358 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2359 LDKTransaction tx_var = tx;
2360 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2361 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
2362 Transaction_free(tx_var);
2363 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
2365 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2366 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2367 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2368 return (void*) this_arg;
2370 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
2371 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2372 atomic_init(&calls->refcnt, 1);
2373 //TODO: Assign calls->o from o
2375 LDKBroadcasterInterface ret = {
2376 .this_arg = (void*) calls,
2377 .broadcast_transaction = broadcast_transaction_jcall,
2378 .free = LDKBroadcasterInterface_JCalls_free,
2382 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
2383 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2384 *res_ptr = LDKBroadcasterInterface_init(o);
2385 return (long)res_ptr;
2387 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
2388 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2389 LDKTransaction tx_ref;
2390 tx_ref.datalen = *((uint32_t*)tx);
2391 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2392 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
2393 tx_ref.data_is_owned = true;
2394 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2397 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_result_ok(uint32_t arg) {
2398 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2400 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
2401 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2402 CHECK(val->result_ok);
2403 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2404 *ret = Sign_clone(&(*val->contents.result));
2407 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
2408 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2409 CHECK(!val->result_ok);
2410 LDKDecodeError err_var = (*val->contents.err);
2411 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2412 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2413 long err_ref = (long)err_var.inner & ~1;
2416 typedef struct LDKKeysInterface_JCalls {
2417 atomic_size_t refcnt;
2418 uint32_t get_node_secret_meth;
2419 uint32_t get_destination_script_meth;
2420 uint32_t get_shutdown_pubkey_meth;
2421 uint32_t get_channel_signer_meth;
2422 uint32_t get_secure_random_bytes_meth;
2423 uint32_t read_chan_signer_meth;
2424 } LDKKeysInterface_JCalls;
2425 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2426 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2427 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2428 js_free(j_calls->get_node_secret_meth);
2429 js_free(j_calls->get_destination_script_meth);
2430 js_free(j_calls->get_shutdown_pubkey_meth);
2431 js_free(j_calls->get_channel_signer_meth);
2432 js_free(j_calls->get_secure_random_bytes_meth);
2433 js_free(j_calls->read_chan_signer_meth);
2437 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2438 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2439 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
2440 LDKSecretKey ret_ref;
2441 CHECK(*((uint32_t*)ret) == 32);
2442 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
2445 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2446 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2447 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
2448 LDKCVec_u8Z ret_ref;
2449 ret_ref.datalen = *((uint32_t*)ret);
2450 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2451 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2454 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2455 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2456 int8_tArray ret = js_invoke_function_0(j_calls->get_shutdown_pubkey_meth);
2457 LDKPublicKey ret_ref;
2458 CHECK(*((uint32_t*)ret) == 33);
2459 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
2462 LDKSign get_channel_signer_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2463 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2464 LDKSign* ret = (LDKSign*)js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
2465 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
2466 ret_conv = Sign_clone(ret);
2469 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2470 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2471 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
2472 LDKThirtyTwoBytes ret_ref;
2473 CHECK(*((uint32_t*)ret) == 32);
2474 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
2477 LDKCResult_SignDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) {
2478 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2479 LDKu8slice reader_var = reader;
2480 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2481 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
2482 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
2483 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
2484 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)ret);
2487 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2488 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2489 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2490 return (void*) this_arg;
2492 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
2493 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2494 atomic_init(&calls->refcnt, 1);
2495 //TODO: Assign calls->o from o
2497 LDKKeysInterface ret = {
2498 .this_arg = (void*) calls,
2499 .get_node_secret = get_node_secret_jcall,
2500 .get_destination_script = get_destination_script_jcall,
2501 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2502 .get_channel_signer = get_channel_signer_jcall,
2503 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2504 .read_chan_signer = read_chan_signer_jcall,
2505 .free = LDKKeysInterface_JCalls_free,
2509 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
2510 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2511 *res_ptr = LDKKeysInterface_init(o);
2512 return (long)res_ptr;
2514 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
2515 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2516 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2517 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
2521 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
2522 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2523 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2524 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2525 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2526 CVec_u8Z_free(ret_var);
2530 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_pubkey(uint32_t this_arg) {
2531 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2532 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
2533 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form, 33);
2537 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2538 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2539 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2540 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2544 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
2545 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2546 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2547 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
2551 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
2552 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2553 LDKu8slice reader_ref;
2554 reader_ref.datalen = *((uint32_t*)reader);
2555 reader_ref.data = (int8_t*)(reader + 4);
2556 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
2557 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2558 return (long)ret_conv;
2561 typedef struct LDKFeeEstimator_JCalls {
2562 atomic_size_t refcnt;
2563 uint32_t get_est_sat_per_1000_weight_meth;
2564 } LDKFeeEstimator_JCalls;
2565 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2566 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2567 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2568 js_free(j_calls->get_est_sat_per_1000_weight_meth);
2572 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2573 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2574 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
2575 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2577 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2578 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2579 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2580 return (void*) this_arg;
2582 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
2583 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2584 atomic_init(&calls->refcnt, 1);
2585 //TODO: Assign calls->o from o
2587 LDKFeeEstimator ret = {
2588 .this_arg = (void*) calls,
2589 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2590 .free = LDKFeeEstimator_JCalls_free,
2594 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
2595 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2596 *res_ptr = LDKFeeEstimator_init(o);
2597 return (long)res_ptr;
2599 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
2600 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2601 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
2602 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2606 typedef struct LDKLogger_JCalls {
2607 atomic_size_t refcnt;
2610 static void LDKLogger_JCalls_free(void* this_arg) {
2611 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2612 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2613 js_free(j_calls->log_meth);
2617 void log_jcall(const void* this_arg, const char* record) {
2618 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2619 const char* record_str = record;
2620 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
2621 js_invoke_function_1(j_calls->log_meth, record_conv);
2623 static void* LDKLogger_JCalls_clone(const void* this_arg) {
2624 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2625 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2626 return (void*) this_arg;
2628 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
2629 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2630 atomic_init(&calls->refcnt, 1);
2631 //TODO: Assign calls->o from o
2634 .this_arg = (void*) calls,
2636 .free = LDKLogger_JCalls_free,
2640 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
2641 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2642 *res_ptr = LDKLogger_init(o);
2643 return (long)res_ptr;
2645 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
2646 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2647 LDKThirtyTwoBytes a_ref;
2648 CHECK(*((uint32_t*)a) == 32);
2649 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2651 LDKChannelManager b_conv;
2652 b_conv.inner = (void*)(b & (~1));
2653 b_conv.is_owned = (b & 1) || (b == 0);
2654 // Warning: we need a move here but no clone is available for LDKChannelManager
2658 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_a(uint32_t ptr) {
2659 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2660 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2661 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2664 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_b(uint32_t ptr) {
2665 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2666 LDKChannelManager b_var = tuple->b;
2667 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2668 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2669 long b_ref = (long)b_var.inner & ~1;
2672 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
2673 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2675 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
2676 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2677 CHECK(val->result_ok);
2678 long res_ref = (long)(&(*val->contents.result)) | 1;
2681 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
2682 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2683 CHECK(!val->result_ok);
2684 LDKDecodeError err_var = (*val->contents.err);
2685 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2686 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2687 long err_ref = (long)err_var.inner & ~1;
2690 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
2691 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2693 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
2694 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2695 CHECK(val->result_ok);
2696 long res_ref = ((long)&(*val->contents.result)) | 1;
2699 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
2700 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2701 CHECK(!val->result_ok);
2702 LDKDecodeError err_var = (*val->contents.err);
2703 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2704 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2705 long err_ref = (long)err_var.inner & ~1;
2708 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2709 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2710 for (size_t i = 0; i < ret.datalen; i++) {
2711 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2715 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(uint32_t arg) {
2716 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2718 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
2719 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2720 CHECK(val->result_ok);
2721 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2722 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
2723 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
2724 for (size_t m = 0; m < res_var.datalen; m++) {
2725 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
2726 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2727 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
2728 res_arr_ptr[m] = res_conv_12_arr;
2732 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
2733 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2734 CHECK(!val->result_ok);
2735 return *val->contents.err;
2737 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_result_ok(uint32_t arg) {
2738 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2740 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
2741 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2742 CHECK(val->result_ok);
2743 LDKInMemorySigner res_var = (*val->contents.result);
2744 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2745 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2746 long res_ref = (long)res_var.inner & ~1;
2749 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
2750 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2751 CHECK(!val->result_ok);
2752 LDKDecodeError err_var = (*val->contents.err);
2753 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2754 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2755 long err_ref = (long)err_var.inner & ~1;
2758 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_TxOutZ_new(uint32_tArray elems) {
2759 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2760 ret->datalen = *((uint32_t*)elems);
2761 if (ret->datalen == 0) {
2764 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2765 uint32_t *java_elems = (uint32_t*)(elems + 4);
2766 for (size_t i = 0; i < ret->datalen; i++) {
2767 uint32_t arr_elem = java_elems[i];
2768 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
2769 FREE((void*)arr_elem);
2770 ret->data[i] = arr_elem_conv;
2775 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2776 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2777 for (size_t i = 0; i < ret.datalen; i++) {
2778 ret.data[i] = TxOut_clone(&orig->data[i]);
2782 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_result_ok(uint32_t arg) {
2783 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2785 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
2786 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2787 CHECK(val->result_ok);
2788 LDKTransaction res_var = (*val->contents.result);
2789 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2790 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
2793 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
2794 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2795 CHECK(!val->result_ok);
2796 return *val->contents.err;
2798 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) {
2799 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
2800 ret->datalen = *((uint32_t*)elems);
2801 if (ret->datalen == 0) {
2804 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
2805 uint32_t *java_elems = (uint32_t*)(elems + 4);
2806 for (size_t i = 0; i < ret->datalen; i++) {
2807 uint32_t arr_elem = java_elems[i];
2808 LDKRouteHop arr_elem_conv;
2809 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2810 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2811 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
2812 ret->data[i] = arr_elem_conv;
2817 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2818 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2819 for (size_t i = 0; i < ret.datalen; i++) {
2820 ret.data[i] = RouteHop_clone(&orig->data[i]);
2824 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
2825 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
2826 for (size_t i = 0; i < ret.datalen; i++) {
2827 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
2831 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_result_ok(uint32_t arg) {
2832 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
2834 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
2835 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
2836 CHECK(val->result_ok);
2837 LDKRoute res_var = (*val->contents.result);
2838 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2839 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2840 long res_ref = (long)res_var.inner & ~1;
2843 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
2844 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
2845 CHECK(!val->result_ok);
2846 LDKDecodeError err_var = (*val->contents.err);
2847 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2848 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2849 long err_ref = (long)err_var.inner & ~1;
2852 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintZ_new(uint32_tArray elems) {
2853 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
2854 ret->datalen = *((uint32_t*)elems);
2855 if (ret->datalen == 0) {
2858 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
2859 uint32_t *java_elems = (uint32_t*)(elems + 4);
2860 for (size_t i = 0; i < ret->datalen; i++) {
2861 uint32_t arr_elem = java_elems[i];
2862 LDKRouteHint arr_elem_conv;
2863 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2864 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2865 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
2866 ret->data[i] = arr_elem_conv;
2871 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2872 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2873 for (size_t i = 0; i < ret.datalen; i++) {
2874 ret.data[i] = RouteHint_clone(&orig->data[i]);
2878 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_result_ok(uint32_t arg) {
2879 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
2881 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
2882 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
2883 CHECK(val->result_ok);
2884 LDKRoute res_var = (*val->contents.result);
2885 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2886 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2887 long res_ref = (long)res_var.inner & ~1;
2890 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
2891 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
2892 CHECK(!val->result_ok);
2893 LDKLightningError err_var = (*val->contents.err);
2894 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2895 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2896 long err_ref = (long)err_var.inner & ~1;
2899 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) {
2900 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
2902 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_ok(uint32_t arg) {
2903 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
2904 CHECK(val->result_ok);
2905 long res_ref = ((long)&(*val->contents.result)) | 1;
2908 int8_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_err(uint32_t arg) {
2909 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
2910 CHECK(!val->result_ok);
2911 return *val->contents.err;
2913 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_result_ok(uint32_t arg) {
2914 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
2916 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_ok(uint32_t arg) {
2917 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
2918 CHECK(val->result_ok);
2919 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
2920 *res_conv = (*val->contents.result);
2921 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
2922 return (long)res_conv;
2924 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_err(uint32_t arg) {
2925 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
2926 CHECK(!val->result_ok);
2927 LDKDecodeError err_var = (*val->contents.err);
2928 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2929 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2930 long err_ref = (long)err_var.inner & ~1;
2933 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
2934 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
2935 ret->datalen = *((uint32_t*)elems);
2936 if (ret->datalen == 0) {
2939 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
2940 uint32_t *java_elems = (uint32_t*)(elems + 4);
2941 for (size_t i = 0; i < ret->datalen; i++) {
2942 uint32_t arr_elem = java_elems[i];
2943 LDKUpdateAddHTLC arr_elem_conv;
2944 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2945 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2946 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
2947 ret->data[i] = arr_elem_conv;
2952 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
2953 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
2954 for (size_t i = 0; i < ret.datalen; i++) {
2955 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
2959 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
2960 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
2961 ret->datalen = *((uint32_t*)elems);
2962 if (ret->datalen == 0) {
2965 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
2966 uint32_t *java_elems = (uint32_t*)(elems + 4);
2967 for (size_t i = 0; i < ret->datalen; i++) {
2968 uint32_t arr_elem = java_elems[i];
2969 LDKUpdateFulfillHTLC arr_elem_conv;
2970 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2971 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2972 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
2973 ret->data[i] = arr_elem_conv;
2978 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
2979 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
2980 for (size_t i = 0; i < ret.datalen; i++) {
2981 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
2985 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
2986 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
2987 ret->datalen = *((uint32_t*)elems);
2988 if (ret->datalen == 0) {
2991 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
2992 uint32_t *java_elems = (uint32_t*)(elems + 4);
2993 for (size_t i = 0; i < ret->datalen; i++) {
2994 uint32_t arr_elem = java_elems[i];
2995 LDKUpdateFailHTLC arr_elem_conv;
2996 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2997 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2998 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
2999 ret->data[i] = arr_elem_conv;
3004 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
3005 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
3006 for (size_t i = 0; i < ret.datalen; i++) {
3007 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
3011 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
3012 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
3013 ret->datalen = *((uint32_t*)elems);
3014 if (ret->datalen == 0) {
3017 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
3018 uint32_t *java_elems = (uint32_t*)(elems + 4);
3019 for (size_t i = 0; i < ret->datalen; i++) {
3020 uint32_t arr_elem = java_elems[i];
3021 LDKUpdateFailMalformedHTLC arr_elem_conv;
3022 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3023 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3024 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3025 ret->data[i] = arr_elem_conv;
3030 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
3031 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
3032 for (size_t i = 0; i < ret.datalen; i++) {
3033 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
3037 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
3038 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
3040 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
3041 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3042 CHECK(val->result_ok);
3043 LDKAcceptChannel res_var = (*val->contents.result);
3044 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3045 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3046 long res_ref = (long)res_var.inner & ~1;
3049 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
3050 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3051 CHECK(!val->result_ok);
3052 LDKDecodeError err_var = (*val->contents.err);
3053 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3054 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3055 long err_ref = (long)err_var.inner & ~1;
3058 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
3059 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
3061 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
3062 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
3063 CHECK(val->result_ok);
3064 LDKAnnouncementSignatures res_var = (*val->contents.result);
3065 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3066 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3067 long res_ref = (long)res_var.inner & ~1;
3070 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
3071 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
3072 CHECK(!val->result_ok);
3073 LDKDecodeError err_var = (*val->contents.err);
3074 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3075 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3076 long err_ref = (long)err_var.inner & ~1;
3079 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
3080 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
3082 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
3083 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3084 CHECK(val->result_ok);
3085 LDKChannelReestablish res_var = (*val->contents.result);
3086 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3087 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3088 long res_ref = (long)res_var.inner & ~1;
3091 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
3092 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3093 CHECK(!val->result_ok);
3094 LDKDecodeError err_var = (*val->contents.err);
3095 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3096 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3097 long err_ref = (long)err_var.inner & ~1;
3100 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
3101 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
3103 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
3104 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
3105 CHECK(val->result_ok);
3106 LDKClosingSigned res_var = (*val->contents.result);
3107 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3108 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3109 long res_ref = (long)res_var.inner & ~1;
3112 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
3113 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
3114 CHECK(!val->result_ok);
3115 LDKDecodeError err_var = (*val->contents.err);
3116 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3117 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3118 long err_ref = (long)err_var.inner & ~1;
3121 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
3122 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
3124 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
3125 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
3126 CHECK(val->result_ok);
3127 LDKCommitmentSigned res_var = (*val->contents.result);
3128 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3129 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3130 long res_ref = (long)res_var.inner & ~1;
3133 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
3134 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
3135 CHECK(!val->result_ok);
3136 LDKDecodeError err_var = (*val->contents.err);
3137 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3138 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3139 long err_ref = (long)err_var.inner & ~1;
3142 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
3143 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
3145 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
3146 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
3147 CHECK(val->result_ok);
3148 LDKFundingCreated res_var = (*val->contents.result);
3149 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3150 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3151 long res_ref = (long)res_var.inner & ~1;
3154 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
3155 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
3156 CHECK(!val->result_ok);
3157 LDKDecodeError err_var = (*val->contents.err);
3158 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3159 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3160 long err_ref = (long)err_var.inner & ~1;
3163 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
3164 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
3166 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
3167 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
3168 CHECK(val->result_ok);
3169 LDKFundingSigned res_var = (*val->contents.result);
3170 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3171 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3172 long res_ref = (long)res_var.inner & ~1;
3175 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
3176 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
3177 CHECK(!val->result_ok);
3178 LDKDecodeError err_var = (*val->contents.err);
3179 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3180 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3181 long err_ref = (long)err_var.inner & ~1;
3184 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
3185 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
3187 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
3188 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
3189 CHECK(val->result_ok);
3190 LDKFundingLocked res_var = (*val->contents.result);
3191 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3192 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3193 long res_ref = (long)res_var.inner & ~1;
3196 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
3197 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
3198 CHECK(!val->result_ok);
3199 LDKDecodeError err_var = (*val->contents.err);
3200 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3201 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3202 long err_ref = (long)err_var.inner & ~1;
3205 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_result_ok(uint32_t arg) {
3206 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
3208 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
3209 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
3210 CHECK(val->result_ok);
3211 LDKInit res_var = (*val->contents.result);
3212 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3213 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3214 long res_ref = (long)res_var.inner & ~1;
3217 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
3218 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
3219 CHECK(!val->result_ok);
3220 LDKDecodeError err_var = (*val->contents.err);
3221 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3222 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3223 long err_ref = (long)err_var.inner & ~1;
3226 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
3227 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
3229 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
3230 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
3231 CHECK(val->result_ok);
3232 LDKOpenChannel res_var = (*val->contents.result);
3233 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3234 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3235 long res_ref = (long)res_var.inner & ~1;
3238 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
3239 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
3240 CHECK(!val->result_ok);
3241 LDKDecodeError err_var = (*val->contents.err);
3242 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3243 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3244 long err_ref = (long)err_var.inner & ~1;
3247 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
3248 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
3250 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
3251 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
3252 CHECK(val->result_ok);
3253 LDKRevokeAndACK res_var = (*val->contents.result);
3254 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3255 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3256 long res_ref = (long)res_var.inner & ~1;
3259 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
3260 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
3261 CHECK(!val->result_ok);
3262 LDKDecodeError err_var = (*val->contents.err);
3263 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3264 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3265 long err_ref = (long)err_var.inner & ~1;
3268 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
3269 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
3271 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
3272 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
3273 CHECK(val->result_ok);
3274 LDKShutdown res_var = (*val->contents.result);
3275 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3276 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3277 long res_ref = (long)res_var.inner & ~1;
3280 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
3281 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
3282 CHECK(!val->result_ok);
3283 LDKDecodeError err_var = (*val->contents.err);
3284 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3285 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3286 long err_ref = (long)err_var.inner & ~1;
3289 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3290 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
3292 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3293 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
3294 CHECK(val->result_ok);
3295 LDKUpdateFailHTLC res_var = (*val->contents.result);
3296 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3297 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3298 long res_ref = (long)res_var.inner & ~1;
3301 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
3302 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
3303 CHECK(!val->result_ok);
3304 LDKDecodeError err_var = (*val->contents.err);
3305 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3306 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3307 long err_ref = (long)err_var.inner & ~1;
3310 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3311 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
3313 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3314 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
3315 CHECK(val->result_ok);
3316 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
3317 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3318 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3319 long res_ref = (long)res_var.inner & ~1;
3322 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
3323 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
3324 CHECK(!val->result_ok);
3325 LDKDecodeError err_var = (*val->contents.err);
3326 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3327 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3328 long err_ref = (long)err_var.inner & ~1;
3331 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
3332 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
3334 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
3335 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
3336 CHECK(val->result_ok);
3337 LDKUpdateFee res_var = (*val->contents.result);
3338 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3339 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3340 long res_ref = (long)res_var.inner & ~1;
3343 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
3344 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
3345 CHECK(!val->result_ok);
3346 LDKDecodeError err_var = (*val->contents.err);
3347 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3348 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3349 long err_ref = (long)err_var.inner & ~1;
3352 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3353 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
3355 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3356 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
3357 CHECK(val->result_ok);
3358 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
3359 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3360 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3361 long res_ref = (long)res_var.inner & ~1;
3364 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
3365 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
3366 CHECK(!val->result_ok);
3367 LDKDecodeError err_var = (*val->contents.err);
3368 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3369 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3370 long err_ref = (long)err_var.inner & ~1;
3373 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3374 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
3376 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3377 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
3378 CHECK(val->result_ok);
3379 LDKUpdateAddHTLC res_var = (*val->contents.result);
3380 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3381 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3382 long res_ref = (long)res_var.inner & ~1;
3385 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
3386 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
3387 CHECK(!val->result_ok);
3388 LDKDecodeError err_var = (*val->contents.err);
3389 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3390 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3391 long err_ref = (long)err_var.inner & ~1;
3394 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_result_ok(uint32_t arg) {
3395 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
3397 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
3398 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
3399 CHECK(val->result_ok);
3400 LDKPing res_var = (*val->contents.result);
3401 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3402 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3403 long res_ref = (long)res_var.inner & ~1;
3406 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
3407 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
3408 CHECK(!val->result_ok);
3409 LDKDecodeError err_var = (*val->contents.err);
3410 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3411 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3412 long err_ref = (long)err_var.inner & ~1;
3415 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_result_ok(uint32_t arg) {
3416 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
3418 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
3419 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
3420 CHECK(val->result_ok);
3421 LDKPong res_var = (*val->contents.result);
3422 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3423 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3424 long res_ref = (long)res_var.inner & ~1;
3427 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
3428 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
3429 CHECK(!val->result_ok);
3430 LDKDecodeError err_var = (*val->contents.err);
3431 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3432 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3433 long err_ref = (long)err_var.inner & ~1;
3436 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3437 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
3439 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3440 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3441 CHECK(val->result_ok);
3442 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
3443 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3444 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3445 long res_ref = (long)res_var.inner & ~1;
3448 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3449 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3450 CHECK(!val->result_ok);
3451 LDKDecodeError err_var = (*val->contents.err);
3452 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3453 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3454 long err_ref = (long)err_var.inner & ~1;
3457 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3458 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
3460 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3461 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3462 CHECK(val->result_ok);
3463 LDKChannelAnnouncement res_var = (*val->contents.result);
3464 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3465 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3466 long res_ref = (long)res_var.inner & ~1;
3469 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3470 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3471 CHECK(!val->result_ok);
3472 LDKDecodeError err_var = (*val->contents.err);
3473 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3474 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3475 long err_ref = (long)err_var.inner & ~1;
3478 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3479 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
3481 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3482 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
3483 CHECK(val->result_ok);
3484 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
3485 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3486 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3487 long res_ref = (long)res_var.inner & ~1;
3490 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
3491 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
3492 CHECK(!val->result_ok);
3493 LDKDecodeError err_var = (*val->contents.err);
3494 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3495 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3496 long err_ref = (long)err_var.inner & ~1;
3499 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3500 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
3502 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3503 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
3504 CHECK(val->result_ok);
3505 LDKChannelUpdate res_var = (*val->contents.result);
3506 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3507 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3508 long res_ref = (long)res_var.inner & ~1;
3511 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
3512 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
3513 CHECK(!val->result_ok);
3514 LDKDecodeError err_var = (*val->contents.err);
3515 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3516 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3517 long err_ref = (long)err_var.inner & ~1;
3520 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
3521 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
3523 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
3524 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3525 CHECK(val->result_ok);
3526 LDKErrorMessage res_var = (*val->contents.result);
3527 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3528 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3529 long res_ref = (long)res_var.inner & ~1;
3532 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
3533 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3534 CHECK(!val->result_ok);
3535 LDKDecodeError err_var = (*val->contents.err);
3536 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3537 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3538 long err_ref = (long)err_var.inner & ~1;
3541 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3542 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3544 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3545 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3546 CHECK(val->result_ok);
3547 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
3548 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3549 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3550 long res_ref = (long)res_var.inner & ~1;
3553 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3554 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3555 CHECK(!val->result_ok);
3556 LDKDecodeError err_var = (*val->contents.err);
3557 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3558 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3559 long err_ref = (long)err_var.inner & ~1;
3562 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3563 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3565 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3566 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
3567 CHECK(val->result_ok);
3568 LDKNodeAnnouncement res_var = (*val->contents.result);
3569 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3570 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3571 long res_ref = (long)res_var.inner & ~1;
3574 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3575 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
3576 CHECK(!val->result_ok);
3577 LDKDecodeError err_var = (*val->contents.err);
3578 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3579 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3580 long err_ref = (long)err_var.inner & ~1;
3583 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
3584 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
3586 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
3587 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3588 CHECK(val->result_ok);
3589 LDKQueryShortChannelIds res_var = (*val->contents.result);
3590 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3591 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3592 long res_ref = (long)res_var.inner & ~1;
3595 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
3596 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3597 CHECK(!val->result_ok);
3598 LDKDecodeError err_var = (*val->contents.err);
3599 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3600 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3601 long err_ref = (long)err_var.inner & ~1;
3604 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
3605 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
3607 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
3608 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3609 CHECK(val->result_ok);
3610 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
3611 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3612 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3613 long res_ref = (long)res_var.inner & ~1;
3616 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
3617 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3618 CHECK(!val->result_ok);
3619 LDKDecodeError err_var = (*val->contents.err);
3620 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3621 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3622 long err_ref = (long)err_var.inner & ~1;
3625 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
3626 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
3628 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
3629 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3630 CHECK(val->result_ok);
3631 LDKQueryChannelRange res_var = (*val->contents.result);
3632 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3633 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3634 long res_ref = (long)res_var.inner & ~1;
3637 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
3638 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3639 CHECK(!val->result_ok);
3640 LDKDecodeError err_var = (*val->contents.err);
3641 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3642 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3643 long err_ref = (long)err_var.inner & ~1;
3646 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
3647 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
3649 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
3650 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3651 CHECK(val->result_ok);
3652 LDKReplyChannelRange res_var = (*val->contents.result);
3653 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3654 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3655 long res_ref = (long)res_var.inner & ~1;
3658 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
3659 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3660 CHECK(!val->result_ok);
3661 LDKDecodeError err_var = (*val->contents.err);
3662 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3663 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3664 long err_ref = (long)err_var.inner & ~1;
3667 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
3668 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
3670 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
3671 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3672 CHECK(val->result_ok);
3673 LDKGossipTimestampFilter res_var = (*val->contents.result);
3674 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3675 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3676 long res_ref = (long)res_var.inner & ~1;
3679 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
3680 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3681 CHECK(!val->result_ok);
3682 LDKDecodeError err_var = (*val->contents.err);
3683 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3684 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3685 long err_ref = (long)err_var.inner & ~1;
3688 typedef struct LDKMessageSendEventsProvider_JCalls {
3689 atomic_size_t refcnt;
3690 uint32_t get_and_clear_pending_msg_events_meth;
3691 } LDKMessageSendEventsProvider_JCalls;
3692 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
3693 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3694 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3695 js_free(j_calls->get_and_clear_pending_msg_events_meth);
3699 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
3700 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3701 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
3702 LDKCVec_MessageSendEventZ ret_constr;
3703 ret_constr.datalen = *((uint32_t*)ret);
3704 if (ret_constr.datalen > 0)
3705 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
3707 ret_constr.data = NULL;
3708 uint32_t* ret_vals = (uint32_t*)(ret + 4);
3709 for (size_t s = 0; s < ret_constr.datalen; s++) {
3710 uint32_t ret_conv_18 = ret_vals[s];
3711 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
3712 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)ret_conv_18);
3713 ret_constr.data[s] = ret_conv_18_conv;
3717 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
3718 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3719 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3720 return (void*) this_arg;
3722 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
3723 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
3724 atomic_init(&calls->refcnt, 1);
3725 //TODO: Assign calls->o from o
3727 LDKMessageSendEventsProvider ret = {
3728 .this_arg = (void*) calls,
3729 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
3730 .free = LDKMessageSendEventsProvider_JCalls_free,
3734 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
3735 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
3736 *res_ptr = LDKMessageSendEventsProvider_init(o);
3737 return (long)res_ptr;
3739 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
3740 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
3741 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
3742 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3743 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3744 for (size_t s = 0; s < ret_var.datalen; s++) {
3745 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
3746 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
3747 long ret_conv_18_ref = (long)ret_conv_18_copy;
3748 ret_arr_ptr[s] = ret_conv_18_ref;
3754 typedef struct LDKEventsProvider_JCalls {
3755 atomic_size_t refcnt;
3756 uint32_t get_and_clear_pending_events_meth;
3757 } LDKEventsProvider_JCalls;
3758 static void LDKEventsProvider_JCalls_free(void* this_arg) {
3759 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3760 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3761 js_free(j_calls->get_and_clear_pending_events_meth);
3765 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
3766 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3767 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_events_meth);
3768 LDKCVec_EventZ ret_constr;
3769 ret_constr.datalen = *((uint32_t*)ret);
3770 if (ret_constr.datalen > 0)
3771 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
3773 ret_constr.data = NULL;
3774 uint32_t* ret_vals = (uint32_t*)(ret + 4);
3775 for (size_t h = 0; h < ret_constr.datalen; h++) {
3776 uint32_t ret_conv_7 = ret_vals[h];
3777 LDKEvent ret_conv_7_conv = *(LDKEvent*)(((uint64_t)ret_conv_7) & ~1);
3778 ret_conv_7_conv = Event_clone((LDKEvent*)ret_conv_7);
3779 ret_constr.data[h] = ret_conv_7_conv;
3783 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
3784 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3785 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3786 return (void*) this_arg;
3788 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
3789 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
3790 atomic_init(&calls->refcnt, 1);
3791 //TODO: Assign calls->o from o
3793 LDKEventsProvider ret = {
3794 .this_arg = (void*) calls,
3795 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
3796 .free = LDKEventsProvider_JCalls_free,
3800 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
3801 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
3802 *res_ptr = LDKEventsProvider_init(o);
3803 return (long)res_ptr;
3805 uint32_tArray __attribute__((visibility("default"))) TS_EventsProvider_get_and_clear_pending_events(uint32_t this_arg) {
3806 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
3807 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
3808 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3809 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3810 for (size_t h = 0; h < ret_var.datalen; h++) {
3811 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
3812 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
3813 long ret_conv_7_ref = (long)ret_conv_7_copy;
3814 ret_arr_ptr[h] = ret_conv_7_ref;
3820 typedef struct LDKAccess_JCalls {
3821 atomic_size_t refcnt;
3822 uint32_t get_utxo_meth;
3824 static void LDKAccess_JCalls_free(void* this_arg) {
3825 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3826 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3827 js_free(j_calls->get_utxo_meth);
3831 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3832 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3833 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3834 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
3835 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
3836 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
3837 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)ret);
3840 static void* LDKAccess_JCalls_clone(const void* this_arg) {
3841 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3842 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3843 return (void*) this_arg;
3845 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
3846 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3847 atomic_init(&calls->refcnt, 1);
3848 //TODO: Assign calls->o from o
3851 .this_arg = (void*) calls,
3852 .get_utxo = get_utxo_jcall,
3853 .free = LDKAccess_JCalls_free,
3857 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
3858 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3859 *res_ptr = LDKAccess_init(o);
3860 return (long)res_ptr;
3862 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
3863 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
3864 unsigned char genesis_hash_arr[32];
3865 CHECK(*((uint32_t*)genesis_hash) == 32);
3866 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
3867 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3868 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3869 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3870 return (long)ret_conv;
3873 typedef struct LDKListen_JCalls {
3874 atomic_size_t refcnt;
3875 uint32_t block_connected_meth;
3876 uint32_t block_disconnected_meth;
3878 static void LDKListen_JCalls_free(void* this_arg) {
3879 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
3880 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3881 js_free(j_calls->block_connected_meth);
3882 js_free(j_calls->block_disconnected_meth);
3886 void block_connected_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
3887 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
3888 LDKu8slice block_var = block;
3889 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3890 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
3891 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
3893 void block_disconnected_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
3894 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
3895 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
3896 memcpy((uint8_t*)(header_arr + 4), *header, 80);
3897 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
3899 static void* LDKListen_JCalls_clone(const void* this_arg) {
3900 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
3901 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3902 return (void*) this_arg;
3904 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
3905 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
3906 atomic_init(&calls->refcnt, 1);
3907 //TODO: Assign calls->o from o
3910 .this_arg = (void*) calls,
3911 .block_connected = block_connected_jcall,
3912 .block_disconnected = block_disconnected_jcall,
3913 .free = LDKListen_JCalls_free,
3917 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
3918 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
3919 *res_ptr = LDKListen_init(o);
3920 return (long)res_ptr;
3922 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
3923 LDKListen* this_arg_conv = (LDKListen*)this_arg;
3924 LDKu8slice block_ref;
3925 block_ref.datalen = *((uint32_t*)block);
3926 block_ref.data = (int8_t*)(block + 4);
3927 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
3930 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
3931 LDKListen* this_arg_conv = (LDKListen*)this_arg;
3932 unsigned char header_arr[80];
3933 CHECK(*((uint32_t*)header) == 80);
3934 memcpy(header_arr, (uint8_t*)(header + 4), 80);
3935 unsigned char (*header_ref)[80] = &header_arr;
3936 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
3939 typedef struct LDKFilter_JCalls {
3940 atomic_size_t refcnt;
3941 uint32_t register_tx_meth;
3942 uint32_t register_output_meth;
3944 static void LDKFilter_JCalls_free(void* this_arg) {
3945 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3946 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3947 js_free(j_calls->register_tx_meth);
3948 js_free(j_calls->register_output_meth);
3952 void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
3953 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3954 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3955 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
3956 LDKu8slice script_pubkey_var = script_pubkey;
3957 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3958 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
3959 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
3961 void register_output_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) {
3962 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3963 LDKOutPoint outpoint_var = *outpoint;
3964 outpoint_var = OutPoint_clone(outpoint);
3965 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3966 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3967 long outpoint_ref = (long)outpoint_var.inner;
3968 if (outpoint_var.is_owned) {
3971 LDKu8slice script_pubkey_var = script_pubkey;
3972 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3973 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
3974 js_invoke_function_2(j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
3976 static void* LDKFilter_JCalls_clone(const void* this_arg) {
3977 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3978 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3979 return (void*) this_arg;
3981 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
3982 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
3983 atomic_init(&calls->refcnt, 1);
3984 //TODO: Assign calls->o from o
3987 .this_arg = (void*) calls,
3988 .register_tx = register_tx_jcall,
3989 .register_output = register_output_jcall,
3990 .free = LDKFilter_JCalls_free,
3994 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
3995 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
3996 *res_ptr = LDKFilter_init(o);
3997 return (long)res_ptr;
3999 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
4000 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
4001 unsigned char txid_arr[32];
4002 CHECK(*((uint32_t*)txid) == 32);
4003 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
4004 unsigned char (*txid_ref)[32] = &txid_arr;
4005 LDKu8slice script_pubkey_ref;
4006 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
4007 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
4008 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
4011 void __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t outpoint, int8_tArray script_pubkey) {
4012 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
4013 LDKOutPoint outpoint_conv;
4014 outpoint_conv.inner = (void*)(outpoint & (~1));
4015 outpoint_conv.is_owned = false;
4016 LDKu8slice script_pubkey_ref;
4017 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
4018 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
4019 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
4022 typedef struct LDKPersist_JCalls {
4023 atomic_size_t refcnt;
4024 uint32_t persist_new_channel_meth;
4025 uint32_t update_persisted_channel_meth;
4026 } LDKPersist_JCalls;
4027 static void LDKPersist_JCalls_free(void* this_arg) {
4028 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4029 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4030 js_free(j_calls->persist_new_channel_meth);
4031 js_free(j_calls->update_persisted_channel_meth);
4035 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
4036 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4037 LDKOutPoint id_var = id;
4038 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4039 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4040 long id_ref = (long)id_var.inner;
4041 if (id_var.is_owned) {
4044 LDKChannelMonitor data_var = *data;
4045 data_var = ChannelMonitor_clone(data);
4046 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4047 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4048 long data_ref = (long)data_var.inner;
4049 if (data_var.is_owned) {
4052 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
4053 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4054 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
4057 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
4058 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4059 LDKOutPoint id_var = id;
4060 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4061 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4062 long id_ref = (long)id_var.inner;
4063 if (id_var.is_owned) {
4066 LDKChannelMonitorUpdate update_var = *update;
4067 update_var = ChannelMonitorUpdate_clone(update);
4068 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4069 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4070 long update_ref = (long)update_var.inner;
4071 if (update_var.is_owned) {
4074 LDKChannelMonitor data_var = *data;
4075 data_var = ChannelMonitor_clone(data);
4076 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4077 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4078 long data_ref = (long)data_var.inner;
4079 if (data_var.is_owned) {
4082 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
4083 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4084 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
4087 static void* LDKPersist_JCalls_clone(const void* this_arg) {
4088 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4089 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4090 return (void*) this_arg;
4092 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
4093 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
4094 atomic_init(&calls->refcnt, 1);
4095 //TODO: Assign calls->o from o
4098 .this_arg = (void*) calls,
4099 .persist_new_channel = persist_new_channel_jcall,
4100 .update_persisted_channel = update_persisted_channel_jcall,
4101 .free = LDKPersist_JCalls_free,
4105 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
4106 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
4107 *res_ptr = LDKPersist_init(o);
4108 return (long)res_ptr;
4110 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t id, uint32_t data) {
4111 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4112 LDKOutPoint id_conv;
4113 id_conv.inner = (void*)(id & (~1));
4114 id_conv.is_owned = (id & 1) || (id == 0);
4115 id_conv = OutPoint_clone(&id_conv);
4116 LDKChannelMonitor data_conv;
4117 data_conv.inner = (void*)(data & (~1));
4118 data_conv.is_owned = false;
4119 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4120 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
4121 return (long)ret_conv;
4124 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
4125 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4126 LDKOutPoint id_conv;
4127 id_conv.inner = (void*)(id & (~1));
4128 id_conv.is_owned = (id & 1) || (id == 0);
4129 id_conv = OutPoint_clone(&id_conv);
4130 LDKChannelMonitorUpdate update_conv;
4131 update_conv.inner = (void*)(update & (~1));
4132 update_conv.is_owned = false;
4133 LDKChannelMonitor data_conv;
4134 data_conv.inner = (void*)(data & (~1));
4135 data_conv.is_owned = false;
4136 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4137 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
4138 return (long)ret_conv;
4141 typedef struct LDKChannelMessageHandler_JCalls {
4142 atomic_size_t refcnt;
4143 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4144 uint32_t handle_open_channel_meth;
4145 uint32_t handle_accept_channel_meth;
4146 uint32_t handle_funding_created_meth;
4147 uint32_t handle_funding_signed_meth;
4148 uint32_t handle_funding_locked_meth;
4149 uint32_t handle_shutdown_meth;
4150 uint32_t handle_closing_signed_meth;
4151 uint32_t handle_update_add_htlc_meth;
4152 uint32_t handle_update_fulfill_htlc_meth;
4153 uint32_t handle_update_fail_htlc_meth;
4154 uint32_t handle_update_fail_malformed_htlc_meth;
4155 uint32_t handle_commitment_signed_meth;
4156 uint32_t handle_revoke_and_ack_meth;
4157 uint32_t handle_update_fee_meth;
4158 uint32_t handle_announcement_signatures_meth;
4159 uint32_t peer_disconnected_meth;
4160 uint32_t peer_connected_meth;
4161 uint32_t handle_channel_reestablish_meth;
4162 uint32_t handle_error_meth;
4163 } LDKChannelMessageHandler_JCalls;
4164 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
4165 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4166 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4167 js_free(j_calls->handle_open_channel_meth);
4168 js_free(j_calls->handle_accept_channel_meth);
4169 js_free(j_calls->handle_funding_created_meth);
4170 js_free(j_calls->handle_funding_signed_meth);
4171 js_free(j_calls->handle_funding_locked_meth);
4172 js_free(j_calls->handle_shutdown_meth);
4173 js_free(j_calls->handle_closing_signed_meth);
4174 js_free(j_calls->handle_update_add_htlc_meth);
4175 js_free(j_calls->handle_update_fulfill_htlc_meth);
4176 js_free(j_calls->handle_update_fail_htlc_meth);
4177 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
4178 js_free(j_calls->handle_commitment_signed_meth);
4179 js_free(j_calls->handle_revoke_and_ack_meth);
4180 js_free(j_calls->handle_update_fee_meth);
4181 js_free(j_calls->handle_announcement_signatures_meth);
4182 js_free(j_calls->peer_disconnected_meth);
4183 js_free(j_calls->peer_connected_meth);
4184 js_free(j_calls->handle_channel_reestablish_meth);
4185 js_free(j_calls->handle_error_meth);
4189 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
4190 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4191 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4192 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4193 LDKInitFeatures their_features_var = their_features;
4194 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4195 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4196 long their_features_ref = (long)their_features_var.inner;
4197 if (their_features_var.is_owned) {
4198 their_features_ref |= 1;
4200 LDKOpenChannel msg_var = *msg;
4201 msg_var = OpenChannel_clone(msg);
4202 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4203 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4204 long msg_ref = (long)msg_var.inner;
4205 if (msg_var.is_owned) {
4208 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4210 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
4211 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4212 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4213 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4214 LDKInitFeatures their_features_var = their_features;
4215 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4216 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4217 long their_features_ref = (long)their_features_var.inner;
4218 if (their_features_var.is_owned) {
4219 their_features_ref |= 1;
4221 LDKAcceptChannel msg_var = *msg;
4222 msg_var = AcceptChannel_clone(msg);
4223 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4224 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4225 long msg_ref = (long)msg_var.inner;
4226 if (msg_var.is_owned) {
4229 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4231 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
4232 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4233 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4234 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4235 LDKFundingCreated msg_var = *msg;
4236 msg_var = FundingCreated_clone(msg);
4237 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4238 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4239 long msg_ref = (long)msg_var.inner;
4240 if (msg_var.is_owned) {
4243 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
4245 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
4246 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4247 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4248 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4249 LDKFundingSigned msg_var = *msg;
4250 msg_var = FundingSigned_clone(msg);
4251 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4252 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4253 long msg_ref = (long)msg_var.inner;
4254 if (msg_var.is_owned) {
4257 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
4259 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
4260 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4261 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4262 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4263 LDKFundingLocked msg_var = *msg;
4264 msg_var = FundingLocked_clone(msg);
4265 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4266 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4267 long msg_ref = (long)msg_var.inner;
4268 if (msg_var.is_owned) {
4271 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
4273 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
4274 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4275 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4276 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4277 LDKInitFeatures their_features_var = *their_features;
4278 their_features_var = InitFeatures_clone(their_features);
4279 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4280 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4281 long their_features_ref = (long)their_features_var.inner;
4282 if (their_features_var.is_owned) {
4283 their_features_ref |= 1;
4285 LDKShutdown msg_var = *msg;
4286 msg_var = Shutdown_clone(msg);
4287 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4288 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4289 long msg_ref = (long)msg_var.inner;
4290 if (msg_var.is_owned) {
4293 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
4295 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
4296 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4297 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4298 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4299 LDKClosingSigned msg_var = *msg;
4300 msg_var = ClosingSigned_clone(msg);
4301 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4302 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4303 long msg_ref = (long)msg_var.inner;
4304 if (msg_var.is_owned) {
4307 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
4309 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
4310 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4311 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4312 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4313 LDKUpdateAddHTLC msg_var = *msg;
4314 msg_var = UpdateAddHTLC_clone(msg);
4315 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4316 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4317 long msg_ref = (long)msg_var.inner;
4318 if (msg_var.is_owned) {
4321 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
4323 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
4324 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4325 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4326 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4327 LDKUpdateFulfillHTLC msg_var = *msg;
4328 msg_var = UpdateFulfillHTLC_clone(msg);
4329 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4330 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4331 long msg_ref = (long)msg_var.inner;
4332 if (msg_var.is_owned) {
4335 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
4337 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
4338 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4339 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4340 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4341 LDKUpdateFailHTLC msg_var = *msg;
4342 msg_var = UpdateFailHTLC_clone(msg);
4343 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4344 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4345 long msg_ref = (long)msg_var.inner;
4346 if (msg_var.is_owned) {
4349 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
4351 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
4352 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4353 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4354 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4355 LDKUpdateFailMalformedHTLC msg_var = *msg;
4356 msg_var = UpdateFailMalformedHTLC_clone(msg);
4357 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4358 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4359 long msg_ref = (long)msg_var.inner;
4360 if (msg_var.is_owned) {
4363 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
4365 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
4366 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4367 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4368 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4369 LDKCommitmentSigned msg_var = *msg;
4370 msg_var = CommitmentSigned_clone(msg);
4371 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4372 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4373 long msg_ref = (long)msg_var.inner;
4374 if (msg_var.is_owned) {
4377 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
4379 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
4380 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4381 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4382 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4383 LDKRevokeAndACK msg_var = *msg;
4384 msg_var = RevokeAndACK_clone(msg);
4385 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4386 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4387 long msg_ref = (long)msg_var.inner;
4388 if (msg_var.is_owned) {
4391 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
4393 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
4394 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4395 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4396 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4397 LDKUpdateFee msg_var = *msg;
4398 msg_var = UpdateFee_clone(msg);
4399 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4400 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4401 long msg_ref = (long)msg_var.inner;
4402 if (msg_var.is_owned) {
4405 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
4407 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
4408 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4409 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4410 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4411 LDKAnnouncementSignatures msg_var = *msg;
4412 msg_var = AnnouncementSignatures_clone(msg);
4413 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4414 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4415 long msg_ref = (long)msg_var.inner;
4416 if (msg_var.is_owned) {
4419 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
4421 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
4422 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4423 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4424 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4425 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
4427 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
4428 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4429 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4430 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4431 LDKInit msg_var = *msg;
4432 msg_var = Init_clone(msg);
4433 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4434 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4435 long msg_ref = (long)msg_var.inner;
4436 if (msg_var.is_owned) {
4439 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
4441 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
4442 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4443 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4444 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4445 LDKChannelReestablish msg_var = *msg;
4446 msg_var = ChannelReestablish_clone(msg);
4447 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4448 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4449 long msg_ref = (long)msg_var.inner;
4450 if (msg_var.is_owned) {
4453 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
4455 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
4456 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4457 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4458 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4459 LDKErrorMessage msg_var = *msg;
4460 msg_var = ErrorMessage_clone(msg);
4461 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4462 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4463 long msg_ref = (long)msg_var.inner;
4464 if (msg_var.is_owned) {
4467 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
4469 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
4470 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4471 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4472 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4473 return (void*) this_arg;
4475 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
4476 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
4477 atomic_init(&calls->refcnt, 1);
4478 //TODO: Assign calls->o from o
4480 LDKChannelMessageHandler ret = {
4481 .this_arg = (void*) calls,
4482 .handle_open_channel = handle_open_channel_jcall,
4483 .handle_accept_channel = handle_accept_channel_jcall,
4484 .handle_funding_created = handle_funding_created_jcall,
4485 .handle_funding_signed = handle_funding_signed_jcall,
4486 .handle_funding_locked = handle_funding_locked_jcall,
4487 .handle_shutdown = handle_shutdown_jcall,
4488 .handle_closing_signed = handle_closing_signed_jcall,
4489 .handle_update_add_htlc = handle_update_add_htlc_jcall,
4490 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
4491 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
4492 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
4493 .handle_commitment_signed = handle_commitment_signed_jcall,
4494 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
4495 .handle_update_fee = handle_update_fee_jcall,
4496 .handle_announcement_signatures = handle_announcement_signatures_jcall,
4497 .peer_disconnected = peer_disconnected_jcall,
4498 .peer_connected = peer_connected_jcall,
4499 .handle_channel_reestablish = handle_channel_reestablish_jcall,
4500 .handle_error = handle_error_jcall,
4501 .free = LDKChannelMessageHandler_JCalls_free,
4502 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
4504 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
4507 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
4508 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
4509 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
4510 return (long)res_ptr;
4512 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) {
4513 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4514 LDKPublicKey their_node_id_ref;
4515 CHECK(*((uint32_t*)their_node_id) == 33);
4516 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4517 LDKInitFeatures their_features_conv;
4518 their_features_conv.inner = (void*)(their_features & (~1));
4519 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4520 their_features_conv = InitFeatures_clone(&their_features_conv);
4521 LDKOpenChannel msg_conv;
4522 msg_conv.inner = (void*)(msg & (~1));
4523 msg_conv.is_owned = false;
4524 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4527 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) {
4528 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4529 LDKPublicKey their_node_id_ref;
4530 CHECK(*((uint32_t*)their_node_id) == 33);
4531 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4532 LDKInitFeatures their_features_conv;
4533 their_features_conv.inner = (void*)(their_features & (~1));
4534 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4535 their_features_conv = InitFeatures_clone(&their_features_conv);
4536 LDKAcceptChannel msg_conv;
4537 msg_conv.inner = (void*)(msg & (~1));
4538 msg_conv.is_owned = false;
4539 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4542 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4543 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4544 LDKPublicKey their_node_id_ref;
4545 CHECK(*((uint32_t*)their_node_id) == 33);
4546 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4547 LDKFundingCreated msg_conv;
4548 msg_conv.inner = (void*)(msg & (~1));
4549 msg_conv.is_owned = false;
4550 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4553 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4554 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4555 LDKPublicKey their_node_id_ref;
4556 CHECK(*((uint32_t*)their_node_id) == 33);
4557 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4558 LDKFundingSigned msg_conv;
4559 msg_conv.inner = (void*)(msg & (~1));
4560 msg_conv.is_owned = false;
4561 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4564 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4565 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4566 LDKPublicKey their_node_id_ref;
4567 CHECK(*((uint32_t*)their_node_id) == 33);
4568 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4569 LDKFundingLocked msg_conv;
4570 msg_conv.inner = (void*)(msg & (~1));
4571 msg_conv.is_owned = false;
4572 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4575 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
4576 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4577 LDKPublicKey their_node_id_ref;
4578 CHECK(*((uint32_t*)their_node_id) == 33);
4579 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4580 LDKInitFeatures their_features_conv;
4581 their_features_conv.inner = (void*)(their_features & (~1));
4582 their_features_conv.is_owned = false;
4583 LDKShutdown msg_conv;
4584 msg_conv.inner = (void*)(msg & (~1));
4585 msg_conv.is_owned = false;
4586 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
4589 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4590 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4591 LDKPublicKey their_node_id_ref;
4592 CHECK(*((uint32_t*)their_node_id) == 33);
4593 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4594 LDKClosingSigned msg_conv;
4595 msg_conv.inner = (void*)(msg & (~1));
4596 msg_conv.is_owned = false;
4597 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4600 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4601 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4602 LDKPublicKey their_node_id_ref;
4603 CHECK(*((uint32_t*)their_node_id) == 33);
4604 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4605 LDKUpdateAddHTLC msg_conv;
4606 msg_conv.inner = (void*)(msg & (~1));
4607 msg_conv.is_owned = false;
4608 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4611 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4612 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4613 LDKPublicKey their_node_id_ref;
4614 CHECK(*((uint32_t*)their_node_id) == 33);
4615 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4616 LDKUpdateFulfillHTLC msg_conv;
4617 msg_conv.inner = (void*)(msg & (~1));
4618 msg_conv.is_owned = false;
4619 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4622 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4623 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4624 LDKPublicKey their_node_id_ref;
4625 CHECK(*((uint32_t*)their_node_id) == 33);
4626 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4627 LDKUpdateFailHTLC msg_conv;
4628 msg_conv.inner = (void*)(msg & (~1));
4629 msg_conv.is_owned = false;
4630 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4633 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4634 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4635 LDKPublicKey their_node_id_ref;
4636 CHECK(*((uint32_t*)their_node_id) == 33);
4637 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4638 LDKUpdateFailMalformedHTLC msg_conv;
4639 msg_conv.inner = (void*)(msg & (~1));
4640 msg_conv.is_owned = false;
4641 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4644 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4645 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4646 LDKPublicKey their_node_id_ref;
4647 CHECK(*((uint32_t*)their_node_id) == 33);
4648 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4649 LDKCommitmentSigned msg_conv;
4650 msg_conv.inner = (void*)(msg & (~1));
4651 msg_conv.is_owned = false;
4652 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4655 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4656 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4657 LDKPublicKey their_node_id_ref;
4658 CHECK(*((uint32_t*)their_node_id) == 33);
4659 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4660 LDKRevokeAndACK msg_conv;
4661 msg_conv.inner = (void*)(msg & (~1));
4662 msg_conv.is_owned = false;
4663 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4666 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4667 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4668 LDKPublicKey their_node_id_ref;
4669 CHECK(*((uint32_t*)their_node_id) == 33);
4670 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4671 LDKUpdateFee msg_conv;
4672 msg_conv.inner = (void*)(msg & (~1));
4673 msg_conv.is_owned = false;
4674 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4677 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4678 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4679 LDKPublicKey their_node_id_ref;
4680 CHECK(*((uint32_t*)their_node_id) == 33);
4681 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4682 LDKAnnouncementSignatures msg_conv;
4683 msg_conv.inner = (void*)(msg & (~1));
4684 msg_conv.is_owned = false;
4685 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4688 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
4689 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4690 LDKPublicKey their_node_id_ref;
4691 CHECK(*((uint32_t*)their_node_id) == 33);
4692 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4693 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
4696 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4697 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4698 LDKPublicKey their_node_id_ref;
4699 CHECK(*((uint32_t*)their_node_id) == 33);
4700 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4702 msg_conv.inner = (void*)(msg & (~1));
4703 msg_conv.is_owned = false;
4704 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4707 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4708 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4709 LDKPublicKey their_node_id_ref;
4710 CHECK(*((uint32_t*)their_node_id) == 33);
4711 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4712 LDKChannelReestablish msg_conv;
4713 msg_conv.inner = (void*)(msg & (~1));
4714 msg_conv.is_owned = false;
4715 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4718 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4719 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4720 LDKPublicKey their_node_id_ref;
4721 CHECK(*((uint32_t*)their_node_id) == 33);
4722 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4723 LDKErrorMessage msg_conv;
4724 msg_conv.inner = (void*)(msg & (~1));
4725 msg_conv.is_owned = false;
4726 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4729 typedef struct LDKRoutingMessageHandler_JCalls {
4730 atomic_size_t refcnt;
4731 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4732 uint32_t handle_node_announcement_meth;
4733 uint32_t handle_channel_announcement_meth;
4734 uint32_t handle_channel_update_meth;
4735 uint32_t handle_htlc_fail_channel_update_meth;
4736 uint32_t get_next_channel_announcements_meth;
4737 uint32_t get_next_node_announcements_meth;
4738 uint32_t sync_routing_table_meth;
4739 uint32_t handle_reply_channel_range_meth;
4740 uint32_t handle_reply_short_channel_ids_end_meth;
4741 uint32_t handle_query_channel_range_meth;
4742 uint32_t handle_query_short_channel_ids_meth;
4743 } LDKRoutingMessageHandler_JCalls;
4744 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
4745 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4746 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4747 js_free(j_calls->handle_node_announcement_meth);
4748 js_free(j_calls->handle_channel_announcement_meth);
4749 js_free(j_calls->handle_channel_update_meth);
4750 js_free(j_calls->handle_htlc_fail_channel_update_meth);
4751 js_free(j_calls->get_next_channel_announcements_meth);
4752 js_free(j_calls->get_next_node_announcements_meth);
4753 js_free(j_calls->sync_routing_table_meth);
4754 js_free(j_calls->handle_reply_channel_range_meth);
4755 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
4756 js_free(j_calls->handle_query_channel_range_meth);
4757 js_free(j_calls->handle_query_short_channel_ids_meth);
4761 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
4762 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4763 LDKNodeAnnouncement msg_var = *msg;
4764 msg_var = NodeAnnouncement_clone(msg);
4765 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4766 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4767 long msg_ref = (long)msg_var.inner;
4768 if (msg_var.is_owned) {
4771 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
4772 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4773 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4776 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
4777 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4778 LDKChannelAnnouncement msg_var = *msg;
4779 msg_var = ChannelAnnouncement_clone(msg);
4780 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4781 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4782 long msg_ref = (long)msg_var.inner;
4783 if (msg_var.is_owned) {
4786 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
4787 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4788 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4791 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
4792 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4793 LDKChannelUpdate msg_var = *msg;
4794 msg_var = ChannelUpdate_clone(msg);
4795 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4796 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4797 long msg_ref = (long)msg_var.inner;
4798 if (msg_var.is_owned) {
4801 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
4802 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4803 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4806 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
4807 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4808 long ret_update = (long)update;
4809 js_invoke_function_1(j_calls->handle_htlc_fail_channel_update_meth, ret_update);
4811 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
4812 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4813 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
4814 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
4815 ret_constr.datalen = *((uint32_t*)ret);
4816 if (ret_constr.datalen > 0)
4817 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4819 ret_constr.data = NULL;
4820 uint32_t* ret_vals = (uint32_t*)(ret + 4);
4821 for (size_t l = 0; l < ret_constr.datalen; l++) {
4822 uint32_t ret_conv_63 = ret_vals[l];
4823 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
4824 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ret_conv_63);
4825 ret_constr.data[l] = ret_conv_63_conv;
4829 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
4830 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4831 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4832 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
4833 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
4834 LDKCVec_NodeAnnouncementZ ret_constr;
4835 ret_constr.datalen = *((uint32_t*)ret);
4836 if (ret_constr.datalen > 0)
4837 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4839 ret_constr.data = NULL;
4840 uint32_t* ret_vals = (uint32_t*)(ret + 4);
4841 for (size_t s = 0; s < ret_constr.datalen; s++) {
4842 uint32_t ret_conv_18 = ret_vals[s];
4843 LDKNodeAnnouncement ret_conv_18_conv;
4844 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
4845 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
4846 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
4847 ret_constr.data[s] = ret_conv_18_conv;
4851 void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
4852 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4853 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4854 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4855 LDKInit init_var = *init;
4856 init_var = Init_clone(init);
4857 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4858 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4859 long init_ref = (long)init_var.inner;
4860 if (init_var.is_owned) {
4863 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
4865 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
4866 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4867 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4868 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4869 LDKReplyChannelRange msg_var = msg;
4870 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4871 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4872 long msg_ref = (long)msg_var.inner;
4873 if (msg_var.is_owned) {
4876 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
4877 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
4878 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
4881 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
4882 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4883 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4884 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4885 LDKReplyShortChannelIdsEnd msg_var = msg;
4886 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4887 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4888 long msg_ref = (long)msg_var.inner;
4889 if (msg_var.is_owned) {
4892 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
4893 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
4894 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
4897 LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
4898 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4899 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4900 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4901 LDKQueryChannelRange msg_var = msg;
4902 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4903 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4904 long msg_ref = (long)msg_var.inner;
4905 if (msg_var.is_owned) {
4908 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
4909 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
4910 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
4913 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
4914 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4915 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4916 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4917 LDKQueryShortChannelIds msg_var = msg;
4918 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4919 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4920 long msg_ref = (long)msg_var.inner;
4921 if (msg_var.is_owned) {
4924 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
4925 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
4926 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
4929 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
4930 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4931 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4932 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4933 return (void*) this_arg;
4935 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
4936 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
4937 atomic_init(&calls->refcnt, 1);
4938 //TODO: Assign calls->o from o
4940 LDKRoutingMessageHandler ret = {
4941 .this_arg = (void*) calls,
4942 .handle_node_announcement = handle_node_announcement_jcall,
4943 .handle_channel_announcement = handle_channel_announcement_jcall,
4944 .handle_channel_update = handle_channel_update_jcall,
4945 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
4946 .get_next_channel_announcements = get_next_channel_announcements_jcall,
4947 .get_next_node_announcements = get_next_node_announcements_jcall,
4948 .sync_routing_table = sync_routing_table_jcall,
4949 .handle_reply_channel_range = handle_reply_channel_range_jcall,
4950 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_jcall,
4951 .handle_query_channel_range = handle_query_channel_range_jcall,
4952 .handle_query_short_channel_ids = handle_query_short_channel_ids_jcall,
4953 .free = LDKRoutingMessageHandler_JCalls_free,
4954 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
4956 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
4959 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
4960 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
4961 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
4962 return (long)res_ptr;
4964 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
4965 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4966 LDKNodeAnnouncement msg_conv;
4967 msg_conv.inner = (void*)(msg & (~1));
4968 msg_conv.is_owned = false;
4969 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4970 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
4971 return (long)ret_conv;
4974 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
4975 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4976 LDKChannelAnnouncement msg_conv;
4977 msg_conv.inner = (void*)(msg & (~1));
4978 msg_conv.is_owned = false;
4979 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4980 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4981 return (long)ret_conv;
4984 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
4985 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4986 LDKChannelUpdate msg_conv;
4987 msg_conv.inner = (void*)(msg & (~1));
4988 msg_conv.is_owned = false;
4989 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4990 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
4991 return (long)ret_conv;
4994 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_htlc_fail_channel_update(uint32_t this_arg, uint32_t update) {
4995 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4996 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
4997 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
5000 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
5001 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5002 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
5003 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5004 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5005 for (size_t l = 0; l < ret_var.datalen; l++) {
5006 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5007 *ret_conv_63_ref = ret_var.data[l];
5008 ret_arr_ptr[l] = (long)ret_conv_63_ref;
5014 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
5015 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5016 LDKPublicKey starting_point_ref;
5017 CHECK(*((uint32_t*)starting_point) == 33);
5018 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
5019 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
5020 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5021 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5022 for (size_t s = 0; s < ret_var.datalen; s++) {
5023 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
5024 CHECK((((long)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5025 CHECK((((long)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5026 long ret_conv_18_ref = (long)ret_conv_18_var.inner;
5027 if (ret_conv_18_var.is_owned) {
5028 ret_conv_18_ref |= 1;
5030 ret_arr_ptr[s] = ret_conv_18_ref;
5036 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
5037 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5038 LDKPublicKey their_node_id_ref;
5039 CHECK(*((uint32_t*)their_node_id) == 33);
5040 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5042 init_conv.inner = (void*)(init & (~1));
5043 init_conv.is_owned = false;
5044 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
5047 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5048 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5049 LDKPublicKey their_node_id_ref;
5050 CHECK(*((uint32_t*)their_node_id) == 33);
5051 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5052 LDKReplyChannelRange msg_conv;
5053 msg_conv.inner = (void*)(msg & (~1));
5054 msg_conv.is_owned = (msg & 1) || (msg == 0);
5055 msg_conv = ReplyChannelRange_clone(&msg_conv);
5056 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5057 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5058 return (long)ret_conv;
5061 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) {
5062 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5063 LDKPublicKey their_node_id_ref;
5064 CHECK(*((uint32_t*)their_node_id) == 33);
5065 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5066 LDKReplyShortChannelIdsEnd msg_conv;
5067 msg_conv.inner = (void*)(msg & (~1));
5068 msg_conv.is_owned = (msg & 1) || (msg == 0);
5069 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
5070 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5071 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5072 return (long)ret_conv;
5075 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5076 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5077 LDKPublicKey their_node_id_ref;
5078 CHECK(*((uint32_t*)their_node_id) == 33);
5079 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5080 LDKQueryChannelRange msg_conv;
5081 msg_conv.inner = (void*)(msg & (~1));
5082 msg_conv.is_owned = (msg & 1) || (msg == 0);
5083 msg_conv = QueryChannelRange_clone(&msg_conv);
5084 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5085 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5086 return (long)ret_conv;
5089 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5090 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5091 LDKPublicKey their_node_id_ref;
5092 CHECK(*((uint32_t*)their_node_id) == 33);
5093 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5094 LDKQueryShortChannelIds msg_conv;
5095 msg_conv.inner = (void*)(msg & (~1));
5096 msg_conv.is_owned = (msg & 1) || (msg == 0);
5097 msg_conv = QueryShortChannelIds_clone(&msg_conv);
5098 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5099 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5100 return (long)ret_conv;
5103 typedef struct LDKSocketDescriptor_JCalls {
5104 atomic_size_t refcnt;
5105 uint32_t send_data_meth;
5106 uint32_t disconnect_socket_meth;
5109 } LDKSocketDescriptor_JCalls;
5110 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
5111 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5112 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5113 js_free(j_calls->send_data_meth);
5114 js_free(j_calls->disconnect_socket_meth);
5115 js_free(j_calls->eq_meth);
5116 js_free(j_calls->hash_meth);
5120 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
5121 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5122 LDKu8slice data_var = data;
5123 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5124 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
5125 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
5127 void disconnect_socket_jcall(void* this_arg) {
5128 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5129 js_invoke_function_0(j_calls->disconnect_socket_meth);
5131 bool eq_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
5132 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5133 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5134 *other_arg_clone = SocketDescriptor_clone(other_arg);
5135 return js_invoke_function_1(j_calls->eq_meth, (long)other_arg_clone);
5137 uint64_t hash_jcall(const void* this_arg) {
5138 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5139 return js_invoke_function_0(j_calls->hash_meth);
5141 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
5142 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5143 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5144 return (void*) this_arg;
5146 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
5147 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
5148 atomic_init(&calls->refcnt, 1);
5149 //TODO: Assign calls->o from o
5151 LDKSocketDescriptor ret = {
5152 .this_arg = (void*) calls,
5153 .send_data = send_data_jcall,
5154 .disconnect_socket = disconnect_socket_jcall,
5157 .clone = LDKSocketDescriptor_JCalls_clone,
5158 .free = LDKSocketDescriptor_JCalls_free,
5162 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
5163 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5164 *res_ptr = LDKSocketDescriptor_init(o);
5165 return (long)res_ptr;
5167 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
5168 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5169 LDKu8slice data_ref;
5170 data_ref.datalen = *((uint32_t*)data);
5171 data_ref.data = (int8_t*)(data + 4);
5172 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
5176 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
5177 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5178 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
5181 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
5182 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5183 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
5187 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
5188 LDKTransaction _res_ref;
5189 _res_ref.datalen = *((uint32_t*)_res);
5190 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5191 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
5192 _res_ref.data_is_owned = true;
5193 Transaction_free(_res_ref);
5196 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
5197 if ((_res & 1) != 0) return;
5198 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
5200 TxOut_free(_res_conv);
5203 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
5204 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
5205 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5206 *ret_ref = TxOut_clone(orig_conv);
5207 return (long)ret_ref;
5210 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
5212 CHECK(*((uint32_t*)o) == 32);
5213 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
5214 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
5215 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
5216 return (long)ret_conv;
5219 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
5220 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5221 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
5222 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
5223 return (long)ret_conv;
5226 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
5227 if ((_res & 1) != 0) return;
5228 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
5230 CResult_SecretKeyErrorZ_free(_res_conv);
5233 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
5235 CHECK(*((uint32_t*)o) == 33);
5236 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
5237 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
5238 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
5239 return (long)ret_conv;
5242 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
5243 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5244 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
5245 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
5246 return (long)ret_conv;
5249 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
5250 if ((_res & 1) != 0) return;
5251 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
5253 CResult_PublicKeyErrorZ_free(_res_conv);
5256 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
5257 LDKTxCreationKeys o_conv;
5258 o_conv.inner = (void*)(o & (~1));
5259 o_conv.is_owned = (o & 1) || (o == 0);
5260 o_conv = TxCreationKeys_clone(&o_conv);
5261 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5262 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
5263 return (long)ret_conv;
5266 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
5267 LDKDecodeError e_conv;
5268 e_conv.inner = (void*)(e & (~1));
5269 e_conv.is_owned = (e & 1) || (e == 0);
5270 e_conv = DecodeError_clone(&e_conv);
5271 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5272 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
5273 return (long)ret_conv;
5276 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
5277 if ((_res & 1) != 0) return;
5278 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
5280 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
5283 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
5284 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
5285 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5286 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
5287 return (long)ret_conv;
5290 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
5291 LDKChannelPublicKeys o_conv;
5292 o_conv.inner = (void*)(o & (~1));
5293 o_conv.is_owned = (o & 1) || (o == 0);
5294 o_conv = ChannelPublicKeys_clone(&o_conv);
5295 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5296 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
5297 return (long)ret_conv;
5300 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
5301 LDKDecodeError e_conv;
5302 e_conv.inner = (void*)(e & (~1));
5303 e_conv.is_owned = (e & 1) || (e == 0);
5304 e_conv = DecodeError_clone(&e_conv);
5305 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5306 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
5307 return (long)ret_conv;
5310 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
5311 if ((_res & 1) != 0) return;
5312 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
5314 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
5317 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
5318 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
5319 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5320 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
5321 return (long)ret_conv;
5324 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
5325 LDKTxCreationKeys o_conv;
5326 o_conv.inner = (void*)(o & (~1));
5327 o_conv.is_owned = (o & 1) || (o == 0);
5328 o_conv = TxCreationKeys_clone(&o_conv);
5329 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
5330 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
5331 return (long)ret_conv;
5334 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
5335 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5336 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
5337 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
5338 return (long)ret_conv;
5341 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
5342 if ((_res & 1) != 0) return;
5343 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
5345 CResult_TxCreationKeysErrorZ_free(_res_conv);
5348 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
5349 LDKHTLCOutputInCommitment o_conv;
5350 o_conv.inner = (void*)(o & (~1));
5351 o_conv.is_owned = (o & 1) || (o == 0);
5352 o_conv = HTLCOutputInCommitment_clone(&o_conv);
5353 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5354 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
5355 return (long)ret_conv;
5358 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
5359 LDKDecodeError e_conv;
5360 e_conv.inner = (void*)(e & (~1));
5361 e_conv.is_owned = (e & 1) || (e == 0);
5362 e_conv = DecodeError_clone(&e_conv);
5363 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5364 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
5365 return (long)ret_conv;
5368 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
5369 if ((_res & 1) != 0) return;
5370 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
5372 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
5375 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
5376 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
5377 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5378 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
5379 return (long)ret_conv;
5382 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
5383 LDKCounterpartyChannelTransactionParameters o_conv;
5384 o_conv.inner = (void*)(o & (~1));
5385 o_conv.is_owned = (o & 1) || (o == 0);
5386 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
5387 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5388 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
5389 return (long)ret_conv;
5392 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
5393 LDKDecodeError e_conv;
5394 e_conv.inner = (void*)(e & (~1));
5395 e_conv.is_owned = (e & 1) || (e == 0);
5396 e_conv = DecodeError_clone(&e_conv);
5397 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5398 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
5399 return (long)ret_conv;
5402 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
5403 if ((_res & 1) != 0) return;
5404 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
5406 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
5409 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
5410 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
5411 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5412 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
5413 return (long)ret_conv;
5416 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
5417 LDKChannelTransactionParameters o_conv;
5418 o_conv.inner = (void*)(o & (~1));
5419 o_conv.is_owned = (o & 1) || (o == 0);
5420 o_conv = ChannelTransactionParameters_clone(&o_conv);
5421 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5422 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
5423 return (long)ret_conv;
5426 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
5427 LDKDecodeError e_conv;
5428 e_conv.inner = (void*)(e & (~1));
5429 e_conv.is_owned = (e & 1) || (e == 0);
5430 e_conv = DecodeError_clone(&e_conv);
5431 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5432 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
5433 return (long)ret_conv;
5436 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
5437 if ((_res & 1) != 0) return;
5438 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
5440 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
5443 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
5444 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
5445 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5446 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
5447 return (long)ret_conv;
5450 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
5451 LDKCVec_SignatureZ _res_constr;
5452 _res_constr.datalen = *((uint32_t*)_res);
5453 if (_res_constr.datalen > 0)
5454 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5456 _res_constr.data = NULL;
5457 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
5458 for (size_t m = 0; m < _res_constr.datalen; m++) {
5459 int8_tArray _res_conv_12 = _res_vals[m];
5460 LDKSignature _res_conv_12_ref;
5461 CHECK(*((uint32_t*)_res_conv_12) == 64);
5462 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
5463 _res_constr.data[m] = _res_conv_12_ref;
5465 CVec_SignatureZ_free(_res_constr);
5468 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5469 LDKHolderCommitmentTransaction o_conv;
5470 o_conv.inner = (void*)(o & (~1));
5471 o_conv.is_owned = (o & 1) || (o == 0);
5472 o_conv = HolderCommitmentTransaction_clone(&o_conv);
5473 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5474 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
5475 return (long)ret_conv;
5478 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5479 LDKDecodeError e_conv;
5480 e_conv.inner = (void*)(e & (~1));
5481 e_conv.is_owned = (e & 1) || (e == 0);
5482 e_conv = DecodeError_clone(&e_conv);
5483 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5484 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
5485 return (long)ret_conv;
5488 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5489 if ((_res & 1) != 0) return;
5490 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5492 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
5495 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5496 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
5497 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5498 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
5499 return (long)ret_conv;
5502 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5503 LDKBuiltCommitmentTransaction o_conv;
5504 o_conv.inner = (void*)(o & (~1));
5505 o_conv.is_owned = (o & 1) || (o == 0);
5506 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
5507 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5508 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
5509 return (long)ret_conv;
5512 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5513 LDKDecodeError e_conv;
5514 e_conv.inner = (void*)(e & (~1));
5515 e_conv.is_owned = (e & 1) || (e == 0);
5516 e_conv = DecodeError_clone(&e_conv);
5517 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5518 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
5519 return (long)ret_conv;
5522 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5523 if ((_res & 1) != 0) return;
5524 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5526 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
5529 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5530 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
5531 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5532 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
5533 return (long)ret_conv;
5536 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5537 LDKCommitmentTransaction o_conv;
5538 o_conv.inner = (void*)(o & (~1));
5539 o_conv.is_owned = (o & 1) || (o == 0);
5540 o_conv = CommitmentTransaction_clone(&o_conv);
5541 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
5542 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
5543 return (long)ret_conv;
5546 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5547 LDKDecodeError e_conv;
5548 e_conv.inner = (void*)(e & (~1));
5549 e_conv.is_owned = (e & 1) || (e == 0);
5550 e_conv = DecodeError_clone(&e_conv);
5551 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
5552 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
5553 return (long)ret_conv;
5556 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5557 if ((_res & 1) != 0) return;
5558 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5560 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
5563 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5564 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
5565 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
5566 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
5567 return (long)ret_conv;
5570 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
5571 LDKTrustedCommitmentTransaction o_conv;
5572 o_conv.inner = (void*)(o & (~1));
5573 o_conv.is_owned = (o & 1) || (o == 0);
5574 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
5575 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
5576 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
5577 return (long)ret_conv;
5580 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
5581 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
5582 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
5583 return (long)ret_conv;
5586 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
5587 if ((_res & 1) != 0) return;
5588 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
5590 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
5593 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
5594 LDKCVec_SignatureZ o_constr;
5595 o_constr.datalen = *((uint32_t*)o);
5596 if (o_constr.datalen > 0)
5597 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5599 o_constr.data = NULL;
5600 int8_tArray* o_vals = (int8_tArray*)(o + 4);
5601 for (size_t m = 0; m < o_constr.datalen; m++) {
5602 int8_tArray o_conv_12 = o_vals[m];
5603 LDKSignature o_conv_12_ref;
5604 CHECK(*((uint32_t*)o_conv_12) == 64);
5605 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
5606 o_constr.data[m] = o_conv_12_ref;
5608 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5609 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
5610 return (long)ret_conv;
5613 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
5614 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5615 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
5616 return (long)ret_conv;
5619 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
5620 if ((_res & 1) != 0) return;
5621 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
5623 CResult_CVec_SignatureZNoneZ_free(_res_conv);
5626 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
5627 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
5628 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5629 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
5630 return (long)ret_conv;
5633 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
5634 LDKCVec_MessageSendEventZ _res_constr;
5635 _res_constr.datalen = *((uint32_t*)_res);
5636 if (_res_constr.datalen > 0)
5637 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5639 _res_constr.data = NULL;
5640 uint32_t* _res_vals = (uint32_t*)(_res + 4);
5641 for (size_t s = 0; s < _res_constr.datalen; s++) {
5642 uint32_t _res_conv_18 = _res_vals[s];
5643 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
5644 FREE((void*)_res_conv_18);
5645 _res_constr.data[s] = _res_conv_18_conv;
5647 CVec_MessageSendEventZ_free(_res_constr);
5650 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
5651 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5652 *ret_conv = CResult_boolLightningErrorZ_ok(o);
5653 return (long)ret_conv;
5656 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
5657 LDKLightningError e_conv;
5658 e_conv.inner = (void*)(e & (~1));
5659 e_conv.is_owned = (e & 1) || (e == 0);
5660 e_conv = LightningError_clone(&e_conv);
5661 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5662 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
5663 return (long)ret_conv;
5666 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
5667 if ((_res & 1) != 0) return;
5668 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
5670 CResult_boolLightningErrorZ_free(_res_conv);
5673 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
5674 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
5675 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5676 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
5677 return (long)ret_conv;
5680 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
5681 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
5682 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5683 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
5684 return (long)ret_ref;
5687 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
5688 LDKChannelAnnouncement a_conv;
5689 a_conv.inner = (void*)(a & (~1));
5690 a_conv.is_owned = (a & 1) || (a == 0);
5691 a_conv = ChannelAnnouncement_clone(&a_conv);
5692 LDKChannelUpdate b_conv;
5693 b_conv.inner = (void*)(b & (~1));
5694 b_conv.is_owned = (b & 1) || (b == 0);
5695 b_conv = ChannelUpdate_clone(&b_conv);
5696 LDKChannelUpdate c_conv;
5697 c_conv.inner = (void*)(c & (~1));
5698 c_conv.is_owned = (c & 1) || (c == 0);
5699 c_conv = ChannelUpdate_clone(&c_conv);
5700 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5701 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5702 return (long)ret_ref;
5705 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
5706 if ((_res & 1) != 0) return;
5707 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
5709 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
5712 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
5713 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
5714 _res_constr.datalen = *((uint32_t*)_res);
5715 if (_res_constr.datalen > 0)
5716 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5718 _res_constr.data = NULL;
5719 uint32_t* _res_vals = (uint32_t*)(_res + 4);
5720 for (size_t l = 0; l < _res_constr.datalen; l++) {
5721 uint32_t _res_conv_63 = _res_vals[l];
5722 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
5723 FREE((void*)_res_conv_63);
5724 _res_constr.data[l] = _res_conv_63_conv;
5726 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
5729 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
5730 LDKCVec_NodeAnnouncementZ _res_constr;
5731 _res_constr.datalen = *((uint32_t*)_res);
5732 if (_res_constr.datalen > 0)
5733 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5735 _res_constr.data = NULL;
5736 uint32_t* _res_vals = (uint32_t*)(_res + 4);
5737 for (size_t s = 0; s < _res_constr.datalen; s++) {
5738 uint32_t _res_conv_18 = _res_vals[s];
5739 LDKNodeAnnouncement _res_conv_18_conv;
5740 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
5741 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
5742 _res_constr.data[s] = _res_conv_18_conv;
5744 CVec_NodeAnnouncementZ_free(_res_constr);
5747 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
5748 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5749 *ret_conv = CResult_NoneLightningErrorZ_ok();
5750 return (long)ret_conv;
5753 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
5754 LDKLightningError e_conv;
5755 e_conv.inner = (void*)(e & (~1));
5756 e_conv.is_owned = (e & 1) || (e == 0);
5757 e_conv = LightningError_clone(&e_conv);
5758 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5759 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
5760 return (long)ret_conv;
5763 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
5764 if ((_res & 1) != 0) return;
5765 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
5767 CResult_NoneLightningErrorZ_free(_res_conv);
5770 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
5771 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
5772 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5773 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
5774 return (long)ret_conv;
5777 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
5778 LDKCVec_PublicKeyZ _res_constr;
5779 _res_constr.datalen = *((uint32_t*)_res);
5780 if (_res_constr.datalen > 0)
5781 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
5783 _res_constr.data = NULL;
5784 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
5785 for (size_t m = 0; m < _res_constr.datalen; m++) {
5786 int8_tArray _res_conv_12 = _res_vals[m];
5787 LDKPublicKey _res_conv_12_ref;
5788 CHECK(*((uint32_t*)_res_conv_12) == 33);
5789 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
5790 _res_constr.data[m] = _res_conv_12_ref;
5792 CVec_PublicKeyZ_free(_res_constr);
5795 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
5796 LDKCVec_u8Z _res_ref;
5797 _res_ref.datalen = *((uint32_t*)_res);
5798 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
5799 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
5800 CVec_u8Z_free(_res_ref);
5803 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
5805 o_ref.datalen = *((uint32_t*)o);
5806 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
5807 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
5808 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5809 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
5810 return (long)ret_conv;
5813 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
5814 LDKPeerHandleError e_conv;
5815 e_conv.inner = (void*)(e & (~1));
5816 e_conv.is_owned = (e & 1) || (e == 0);
5817 e_conv = PeerHandleError_clone(&e_conv);
5818 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5819 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
5820 return (long)ret_conv;
5823 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
5824 if ((_res & 1) != 0) return;
5825 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
5827 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
5830 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
5831 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
5832 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5833 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
5834 return (long)ret_conv;
5837 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
5838 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5839 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
5840 return (long)ret_conv;
5843 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
5844 LDKPeerHandleError e_conv;
5845 e_conv.inner = (void*)(e & (~1));
5846 e_conv.is_owned = (e & 1) || (e == 0);
5847 e_conv = PeerHandleError_clone(&e_conv);
5848 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5849 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
5850 return (long)ret_conv;
5853 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
5854 if ((_res & 1) != 0) return;
5855 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
5857 CResult_NonePeerHandleErrorZ_free(_res_conv);
5860 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
5861 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
5862 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5863 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
5864 return (long)ret_conv;
5867 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
5868 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
5869 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
5870 return (long)ret_conv;
5873 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
5874 LDKPeerHandleError e_conv;
5875 e_conv.inner = (void*)(e & (~1));
5876 e_conv.is_owned = (e & 1) || (e == 0);
5877 e_conv = PeerHandleError_clone(&e_conv);
5878 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
5879 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
5880 return (long)ret_conv;
5883 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
5884 if ((_res & 1) != 0) return;
5885 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
5887 CResult_boolPeerHandleErrorZ_free(_res_conv);
5890 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
5891 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
5892 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
5893 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
5894 return (long)ret_conv;
5897 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
5898 LDKInitFeatures o_conv;
5899 o_conv.inner = (void*)(o & (~1));
5900 o_conv.is_owned = (o & 1) || (o == 0);
5901 o_conv = InitFeatures_clone(&o_conv);
5902 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
5903 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
5904 return (long)ret_conv;
5907 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
5908 LDKDecodeError e_conv;
5909 e_conv.inner = (void*)(e & (~1));
5910 e_conv.is_owned = (e & 1) || (e == 0);
5911 e_conv = DecodeError_clone(&e_conv);
5912 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
5913 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
5914 return (long)ret_conv;
5917 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
5918 if ((_res & 1) != 0) return;
5919 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
5921 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
5924 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
5925 LDKNodeFeatures o_conv;
5926 o_conv.inner = (void*)(o & (~1));
5927 o_conv.is_owned = (o & 1) || (o == 0);
5928 o_conv = NodeFeatures_clone(&o_conv);
5929 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
5930 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
5931 return (long)ret_conv;
5934 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
5935 LDKDecodeError e_conv;
5936 e_conv.inner = (void*)(e & (~1));
5937 e_conv.is_owned = (e & 1) || (e == 0);
5938 e_conv = DecodeError_clone(&e_conv);
5939 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
5940 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
5941 return (long)ret_conv;
5944 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
5945 if ((_res & 1) != 0) return;
5946 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
5948 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
5951 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
5952 LDKChannelFeatures o_conv;
5953 o_conv.inner = (void*)(o & (~1));
5954 o_conv.is_owned = (o & 1) || (o == 0);
5955 o_conv = ChannelFeatures_clone(&o_conv);
5956 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
5957 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
5958 return (long)ret_conv;
5961 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
5962 LDKDecodeError e_conv;
5963 e_conv.inner = (void*)(e & (~1));
5964 e_conv.is_owned = (e & 1) || (e == 0);
5965 e_conv = DecodeError_clone(&e_conv);
5966 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
5967 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
5968 return (long)ret_conv;
5971 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
5972 if ((_res & 1) != 0) return;
5973 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
5975 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
5978 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
5979 LDKChannelConfig o_conv;
5980 o_conv.inner = (void*)(o & (~1));
5981 o_conv.is_owned = (o & 1) || (o == 0);
5982 o_conv = ChannelConfig_clone(&o_conv);
5983 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
5984 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
5985 return (long)ret_conv;
5988 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
5989 LDKDecodeError e_conv;
5990 e_conv.inner = (void*)(e & (~1));
5991 e_conv.is_owned = (e & 1) || (e == 0);
5992 e_conv = DecodeError_clone(&e_conv);
5993 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
5994 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
5995 return (long)ret_conv;
5998 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
5999 if ((_res & 1) != 0) return;
6000 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
6002 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
6005 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
6006 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
6007 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
6008 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
6009 return (long)ret_conv;
6012 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
6013 LDKDirectionalChannelInfo o_conv;
6014 o_conv.inner = (void*)(o & (~1));
6015 o_conv.is_owned = (o & 1) || (o == 0);
6016 o_conv = DirectionalChannelInfo_clone(&o_conv);
6017 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
6018 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
6019 return (long)ret_conv;
6022 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
6023 LDKDecodeError e_conv;
6024 e_conv.inner = (void*)(e & (~1));
6025 e_conv.is_owned = (e & 1) || (e == 0);
6026 e_conv = DecodeError_clone(&e_conv);
6027 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
6028 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
6029 return (long)ret_conv;
6032 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
6033 if ((_res & 1) != 0) return;
6034 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6036 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
6039 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
6040 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
6041 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
6042 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
6043 return (long)ret_conv;
6046 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
6047 LDKChannelInfo o_conv;
6048 o_conv.inner = (void*)(o & (~1));
6049 o_conv.is_owned = (o & 1) || (o == 0);
6050 o_conv = ChannelInfo_clone(&o_conv);
6051 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
6052 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
6053 return (long)ret_conv;
6056 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
6057 LDKDecodeError e_conv;
6058 e_conv.inner = (void*)(e & (~1));
6059 e_conv.is_owned = (e & 1) || (e == 0);
6060 e_conv = DecodeError_clone(&e_conv);
6061 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
6062 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
6063 return (long)ret_conv;
6066 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
6067 if ((_res & 1) != 0) return;
6068 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6070 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
6073 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
6074 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
6075 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
6076 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
6077 return (long)ret_conv;
6080 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
6081 LDKRoutingFees o_conv;
6082 o_conv.inner = (void*)(o & (~1));
6083 o_conv.is_owned = (o & 1) || (o == 0);
6084 o_conv = RoutingFees_clone(&o_conv);
6085 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6086 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
6087 return (long)ret_conv;
6090 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
6091 LDKDecodeError e_conv;
6092 e_conv.inner = (void*)(e & (~1));
6093 e_conv.is_owned = (e & 1) || (e == 0);
6094 e_conv = DecodeError_clone(&e_conv);
6095 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6096 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
6097 return (long)ret_conv;
6100 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
6101 if ((_res & 1) != 0) return;
6102 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6104 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
6107 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
6108 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
6109 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6110 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
6111 return (long)ret_conv;
6114 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
6115 LDKCVec_NetAddressZ _res_constr;
6116 _res_constr.datalen = *((uint32_t*)_res);
6117 if (_res_constr.datalen > 0)
6118 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
6120 _res_constr.data = NULL;
6121 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6122 for (size_t m = 0; m < _res_constr.datalen; m++) {
6123 uint32_t _res_conv_12 = _res_vals[m];
6124 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
6125 FREE((void*)_res_conv_12);
6126 _res_constr.data[m] = _res_conv_12_conv;
6128 CVec_NetAddressZ_free(_res_constr);
6131 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
6132 LDKNodeAnnouncementInfo o_conv;
6133 o_conv.inner = (void*)(o & (~1));
6134 o_conv.is_owned = (o & 1) || (o == 0);
6135 o_conv = NodeAnnouncementInfo_clone(&o_conv);
6136 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6137 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
6138 return (long)ret_conv;
6141 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
6142 LDKDecodeError e_conv;
6143 e_conv.inner = (void*)(e & (~1));
6144 e_conv.is_owned = (e & 1) || (e == 0);
6145 e_conv = DecodeError_clone(&e_conv);
6146 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6147 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
6148 return (long)ret_conv;
6151 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
6152 if ((_res & 1) != 0) return;
6153 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6155 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
6158 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
6159 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
6160 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6161 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
6162 return (long)ret_conv;
6165 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
6166 LDKCVec_u64Z _res_constr;
6167 _res_constr.datalen = *((uint32_t*)_res);
6168 if (_res_constr.datalen > 0)
6169 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
6171 _res_constr.data = NULL;
6172 int64_t* _res_vals = (int64_t*)(_res + 4);
6173 for (size_t i = 0; i < _res_constr.datalen; i++) {
6174 int64_t _res_conv_8 = _res_vals[i];
6175 _res_constr.data[i] = _res_conv_8;
6177 CVec_u64Z_free(_res_constr);
6180 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
6182 o_conv.inner = (void*)(o & (~1));
6183 o_conv.is_owned = (o & 1) || (o == 0);
6184 o_conv = NodeInfo_clone(&o_conv);
6185 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6186 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
6187 return (long)ret_conv;
6190 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
6191 LDKDecodeError e_conv;
6192 e_conv.inner = (void*)(e & (~1));
6193 e_conv.is_owned = (e & 1) || (e == 0);
6194 e_conv = DecodeError_clone(&e_conv);
6195 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6196 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
6197 return (long)ret_conv;
6200 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
6201 if ((_res & 1) != 0) return;
6202 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6204 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
6207 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
6208 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
6209 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6210 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
6211 return (long)ret_conv;
6214 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
6215 LDKNetworkGraph o_conv;
6216 o_conv.inner = (void*)(o & (~1));
6217 o_conv.is_owned = (o & 1) || (o == 0);
6218 o_conv = NetworkGraph_clone(&o_conv);
6219 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6220 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
6221 return (long)ret_conv;
6224 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
6225 LDKDecodeError e_conv;
6226 e_conv.inner = (void*)(e & (~1));
6227 e_conv.is_owned = (e & 1) || (e == 0);
6228 e_conv = DecodeError_clone(&e_conv);
6229 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6230 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
6231 return (long)ret_conv;
6234 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
6235 if ((_res & 1) != 0) return;
6236 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
6238 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
6241 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
6242 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
6243 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6244 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
6245 return (long)ret_conv;
6248 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
6249 LDKTransaction b_ref;
6250 b_ref.datalen = *((uint32_t*)b);
6251 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
6252 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6253 b_ref.data_is_owned = true;
6254 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6255 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
6256 return (long)ret_ref;
6259 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
6260 if ((_res & 1) != 0) return;
6261 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
6263 C2Tuple_usizeTransactionZ_free(_res_conv);
6266 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
6267 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
6268 _res_constr.datalen = *((uint32_t*)_res);
6269 if (_res_constr.datalen > 0)
6270 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6272 _res_constr.data = NULL;
6273 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6274 for (size_t e = 0; e < _res_constr.datalen; e++) {
6275 uint32_t _res_conv_30 = _res_vals[e];
6276 LDKC2Tuple_usizeTransactionZ _res_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_30) & ~1);
6277 FREE((void*)_res_conv_30);
6278 _res_constr.data[e] = _res_conv_30_conv;
6280 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
6283 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
6284 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6285 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
6286 return (long)ret_conv;
6289 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
6290 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
6291 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6292 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
6293 return (long)ret_conv;
6296 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
6297 if ((_res & 1) != 0) return;
6298 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
6300 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
6303 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
6304 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
6305 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6306 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
6307 return (long)ret_conv;
6310 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
6311 LDKCVec_MonitorEventZ _res_constr;
6312 _res_constr.datalen = *((uint32_t*)_res);
6313 if (_res_constr.datalen > 0)
6314 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
6316 _res_constr.data = NULL;
6317 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6318 for (size_t o = 0; o < _res_constr.datalen; o++) {
6319 uint32_t _res_conv_14 = _res_vals[o];
6320 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
6321 FREE((void*)_res_conv_14);
6322 _res_constr.data[o] = _res_conv_14_conv;
6324 CVec_MonitorEventZ_free(_res_constr);
6327 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
6328 LDKCVec_EventZ _res_constr;
6329 _res_constr.datalen = *((uint32_t*)_res);
6330 if (_res_constr.datalen > 0)
6331 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
6333 _res_constr.data = NULL;
6334 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6335 for (size_t h = 0; h < _res_constr.datalen; h++) {
6336 uint32_t _res_conv_7 = _res_vals[h];
6337 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
6338 FREE((void*)_res_conv_7);
6339 _res_constr.data[h] = _res_conv_7_conv;
6341 CVec_EventZ_free(_res_constr);
6344 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
6346 o_conv.inner = (void*)(o & (~1));
6347 o_conv.is_owned = (o & 1) || (o == 0);
6348 o_conv = OutPoint_clone(&o_conv);
6349 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
6350 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
6351 return (long)ret_conv;
6354 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
6355 LDKDecodeError e_conv;
6356 e_conv.inner = (void*)(e & (~1));
6357 e_conv.is_owned = (e & 1) || (e == 0);
6358 e_conv = DecodeError_clone(&e_conv);
6359 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
6360 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
6361 return (long)ret_conv;
6364 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
6365 if ((_res & 1) != 0) return;
6366 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
6368 CResult_OutPointDecodeErrorZ_free(_res_conv);
6371 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
6372 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
6373 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
6374 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
6375 return (long)ret_conv;
6378 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
6379 LDKChannelMonitorUpdate o_conv;
6380 o_conv.inner = (void*)(o & (~1));
6381 o_conv.is_owned = (o & 1) || (o == 0);
6382 o_conv = ChannelMonitorUpdate_clone(&o_conv);
6383 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6384 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
6385 return (long)ret_conv;
6388 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
6389 LDKDecodeError e_conv;
6390 e_conv.inner = (void*)(e & (~1));
6391 e_conv.is_owned = (e & 1) || (e == 0);
6392 e_conv = DecodeError_clone(&e_conv);
6393 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6394 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
6395 return (long)ret_conv;
6398 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
6399 if ((_res & 1) != 0) return;
6400 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
6402 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
6405 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
6406 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
6407 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6408 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
6409 return (long)ret_conv;
6412 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
6413 LDKHTLCUpdate o_conv;
6414 o_conv.inner = (void*)(o & (~1));
6415 o_conv.is_owned = (o & 1) || (o == 0);
6416 o_conv = HTLCUpdate_clone(&o_conv);
6417 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6418 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
6419 return (long)ret_conv;
6422 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
6423 LDKDecodeError e_conv;
6424 e_conv.inner = (void*)(e & (~1));
6425 e_conv.is_owned = (e & 1) || (e == 0);
6426 e_conv = DecodeError_clone(&e_conv);
6427 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6428 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
6429 return (long)ret_conv;
6432 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
6433 if ((_res & 1) != 0) return;
6434 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
6436 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
6439 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
6440 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
6441 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6442 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
6443 return (long)ret_conv;
6446 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
6447 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6448 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
6449 return (long)ret_conv;
6452 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
6453 LDKMonitorUpdateError e_conv;
6454 e_conv.inner = (void*)(e & (~1));
6455 e_conv.is_owned = (e & 1) || (e == 0);
6456 e_conv = MonitorUpdateError_clone(&e_conv);
6457 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6458 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
6459 return (long)ret_conv;
6462 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
6463 if ((_res & 1) != 0) return;
6464 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
6466 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
6469 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
6470 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
6471 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6472 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
6473 return (long)ret_conv;
6476 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
6477 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
6478 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6479 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
6480 return (long)ret_ref;
6483 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
6485 a_conv.inner = (void*)(a & (~1));
6486 a_conv.is_owned = (a & 1) || (a == 0);
6487 a_conv = OutPoint_clone(&a_conv);
6489 b_ref.datalen = *((uint32_t*)b);
6490 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
6491 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6492 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6493 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
6494 return (long)ret_ref;
6497 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
6498 if ((_res & 1) != 0) return;
6499 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
6501 C2Tuple_OutPointScriptZ_free(_res_conv);
6504 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
6505 LDKCVec_TransactionZ _res_constr;
6506 _res_constr.datalen = *((uint32_t*)_res);
6507 if (_res_constr.datalen > 0)
6508 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
6510 _res_constr.data = NULL;
6511 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
6512 for (size_t m = 0; m < _res_constr.datalen; m++) {
6513 int8_tArray _res_conv_12 = _res_vals[m];
6514 LDKTransaction _res_conv_12_ref;
6515 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
6516 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
6517 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
6518 _res_conv_12_ref.data_is_owned = true;
6519 _res_constr.data[m] = _res_conv_12_ref;
6521 CVec_TransactionZ_free(_res_constr);
6524 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
6525 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
6526 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6527 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
6528 return (long)ret_ref;
6531 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
6532 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
6534 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6535 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
6536 return (long)ret_ref;
6539 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
6540 if ((_res & 1) != 0) return;
6541 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
6543 C2Tuple_u32TxOutZ_free(_res_conv);
6546 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
6547 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
6548 _res_constr.datalen = *((uint32_t*)_res);
6549 if (_res_constr.datalen > 0)
6550 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
6552 _res_constr.data = NULL;
6553 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6554 for (size_t z = 0; z < _res_constr.datalen; z++) {
6555 uint32_t _res_conv_25 = _res_vals[z];
6556 LDKC2Tuple_u32TxOutZ _res_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_25) & ~1);
6557 FREE((void*)_res_conv_25);
6558 _res_constr.data[z] = _res_conv_25_conv;
6560 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
6563 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
6564 LDKThirtyTwoBytes a_ref;
6565 CHECK(*((uint32_t*)a) == 32);
6566 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6567 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
6568 b_constr.datalen = *((uint32_t*)b);
6569 if (b_constr.datalen > 0)
6570 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
6572 b_constr.data = NULL;
6573 uint32_t* b_vals = (uint32_t*)(b + 4);
6574 for (size_t z = 0; z < b_constr.datalen; z++) {
6575 uint32_t b_conv_25 = b_vals[z];
6576 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
6577 FREE((void*)b_conv_25);
6578 b_constr.data[z] = b_conv_25_conv;
6580 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
6581 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
6582 return (long)ret_ref;
6585 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
6586 if ((_res & 1) != 0) return;
6587 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
6589 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
6592 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
6593 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
6594 _res_constr.datalen = *((uint32_t*)_res);
6595 if (_res_constr.datalen > 0)
6596 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
6598 _res_constr.data = NULL;
6599 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6600 for (size_t x = 0; x < _res_constr.datalen; x++) {
6601 uint32_t _res_conv_49 = _res_vals[x];
6602 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_49) & ~1);
6603 FREE((void*)_res_conv_49);
6604 _res_constr.data[x] = _res_conv_49_conv;
6606 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
6609 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
6610 LDKThirtyTwoBytes a_ref;
6611 CHECK(*((uint32_t*)a) == 32);
6612 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6613 LDKChannelMonitor b_conv;
6614 b_conv.inner = (void*)(b & (~1));
6615 b_conv.is_owned = (b & 1) || (b == 0);
6616 b_conv = ChannelMonitor_clone(&b_conv);
6617 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6618 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
6619 return (long)ret_ref;
6622 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
6623 if ((_res & 1) != 0) return;
6624 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
6626 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
6629 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
6630 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
6632 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
6633 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
6634 return (long)ret_conv;
6637 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
6638 LDKDecodeError e_conv;
6639 e_conv.inner = (void*)(e & (~1));
6640 e_conv.is_owned = (e & 1) || (e == 0);
6641 e_conv = DecodeError_clone(&e_conv);
6642 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
6643 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
6644 return (long)ret_conv;
6647 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
6648 if ((_res & 1) != 0) return;
6649 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
6651 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
6654 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
6655 LDKCVec_SpendableOutputDescriptorZ _res_constr;
6656 _res_constr.datalen = *((uint32_t*)_res);
6657 if (_res_constr.datalen > 0)
6658 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
6660 _res_constr.data = NULL;
6661 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6662 for (size_t b = 0; b < _res_constr.datalen; b++) {
6663 uint32_t _res_conv_27 = _res_vals[b];
6664 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
6665 FREE((void*)_res_conv_27);
6666 _res_constr.data[b] = _res_conv_27_conv;
6668 CVec_SpendableOutputDescriptorZ_free(_res_constr);
6671 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
6672 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
6674 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6675 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
6676 return (long)ret_conv;
6679 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
6680 LDKAccessError e_conv = LDKAccessError_from_js(e);
6681 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6682 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
6683 return (long)ret_conv;
6686 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
6687 if ((_res & 1) != 0) return;
6688 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
6690 CResult_TxOutAccessErrorZ_free(_res_conv);
6693 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
6694 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
6695 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6696 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
6697 return (long)ret_conv;
6700 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
6701 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6702 *ret_conv = CResult_NoneAPIErrorZ_ok();
6703 return (long)ret_conv;
6706 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
6707 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
6709 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6710 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
6711 return (long)ret_conv;
6714 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
6715 if ((_res & 1) != 0) return;
6716 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
6718 CResult_NoneAPIErrorZ_free(_res_conv);
6721 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
6722 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
6723 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6724 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
6725 return (long)ret_conv;
6728 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
6729 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
6730 _res_constr.datalen = *((uint32_t*)_res);
6731 if (_res_constr.datalen > 0)
6732 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
6734 _res_constr.data = NULL;
6735 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6736 for (size_t w = 0; w < _res_constr.datalen; w++) {
6737 uint32_t _res_conv_22 = _res_vals[w];
6738 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
6739 FREE((void*)_res_conv_22);
6740 _res_constr.data[w] = _res_conv_22_conv;
6742 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
6745 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
6746 LDKCVec_APIErrorZ _res_constr;
6747 _res_constr.datalen = *((uint32_t*)_res);
6748 if (_res_constr.datalen > 0)
6749 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
6751 _res_constr.data = NULL;
6752 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6753 for (size_t k = 0; k < _res_constr.datalen; k++) {
6754 uint32_t _res_conv_10 = _res_vals[k];
6755 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
6756 FREE((void*)_res_conv_10);
6757 _res_constr.data[k] = _res_conv_10_conv;
6759 CVec_APIErrorZ_free(_res_constr);
6762 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
6763 LDKCVec_ChannelDetailsZ _res_constr;
6764 _res_constr.datalen = *((uint32_t*)_res);
6765 if (_res_constr.datalen > 0)
6766 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6768 _res_constr.data = NULL;
6769 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6770 for (size_t q = 0; q < _res_constr.datalen; q++) {
6771 uint32_t _res_conv_16 = _res_vals[q];
6772 LDKChannelDetails _res_conv_16_conv;
6773 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
6774 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
6775 _res_constr.data[q] = _res_conv_16_conv;
6777 CVec_ChannelDetailsZ_free(_res_constr);
6780 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
6781 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6782 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
6783 return (long)ret_conv;
6786 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
6787 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
6789 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6790 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
6791 return (long)ret_conv;
6794 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
6795 if ((_res & 1) != 0) return;
6796 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
6798 CResult_NonePaymentSendFailureZ_free(_res_conv);
6801 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
6802 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
6803 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6804 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
6805 return (long)ret_conv;
6808 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
6809 LDKCVec_ChannelMonitorZ _res_constr;
6810 _res_constr.datalen = *((uint32_t*)_res);
6811 if (_res_constr.datalen > 0)
6812 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
6814 _res_constr.data = NULL;
6815 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6816 for (size_t q = 0; q < _res_constr.datalen; q++) {
6817 uint32_t _res_conv_16 = _res_vals[q];
6818 LDKChannelMonitor _res_conv_16_conv;
6819 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
6820 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
6821 _res_constr.data[q] = _res_conv_16_conv;
6823 CVec_ChannelMonitorZ_free(_res_constr);
6826 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
6827 LDKThirtyTwoBytes a_ref;
6828 CHECK(*((uint32_t*)a) == 32);
6829 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6830 LDKChannelManager b_conv;
6831 b_conv.inner = (void*)(b & (~1));
6832 b_conv.is_owned = (b & 1) || (b == 0);
6833 // Warning: we need a move here but no clone is available for LDKChannelManager
6834 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
6835 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
6836 return (long)ret_ref;
6839 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
6840 if ((_res & 1) != 0) return;
6841 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
6843 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
6846 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
6847 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
6849 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6850 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
6851 return (long)ret_conv;
6854 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
6855 LDKDecodeError e_conv;
6856 e_conv.inner = (void*)(e & (~1));
6857 e_conv.is_owned = (e & 1) || (e == 0);
6858 e_conv = DecodeError_clone(&e_conv);
6859 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6860 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
6861 return (long)ret_conv;
6864 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
6865 if ((_res & 1) != 0) return;
6866 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
6868 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
6871 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
6872 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
6874 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
6875 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
6876 return (long)ret_conv;
6879 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
6880 LDKDecodeError e_conv;
6881 e_conv.inner = (void*)(e & (~1));
6882 e_conv.is_owned = (e & 1) || (e == 0);
6883 e_conv = DecodeError_clone(&e_conv);
6884 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
6885 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
6886 return (long)ret_conv;
6889 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
6890 if ((_res & 1) != 0) return;
6891 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
6893 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
6896 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
6897 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
6898 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
6899 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
6900 return (long)ret_conv;
6903 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
6904 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
6905 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
6906 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
6907 return (long)ret_ref;
6910 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
6912 CHECK(*((uint32_t*)a) == 64);
6913 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
6914 LDKCVec_SignatureZ b_constr;
6915 b_constr.datalen = *((uint32_t*)b);
6916 if (b_constr.datalen > 0)
6917 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6919 b_constr.data = NULL;
6920 int8_tArray* b_vals = (int8_tArray*)(b + 4);
6921 for (size_t m = 0; m < b_constr.datalen; m++) {
6922 int8_tArray b_conv_12 = b_vals[m];
6923 LDKSignature b_conv_12_ref;
6924 CHECK(*((uint32_t*)b_conv_12) == 64);
6925 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
6926 b_constr.data[m] = b_conv_12_ref;
6928 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
6929 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
6930 return (long)ret_ref;
6933 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
6934 if ((_res & 1) != 0) return;
6935 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
6937 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
6940 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
6941 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
6943 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
6944 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
6945 return (long)ret_conv;
6948 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
6949 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
6950 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
6951 return (long)ret_conv;
6954 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
6955 if ((_res & 1) != 0) return;
6956 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
6958 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
6961 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
6962 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
6963 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
6964 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
6965 return (long)ret_conv;
6968 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
6970 CHECK(*((uint32_t*)o) == 64);
6971 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
6972 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6973 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
6974 return (long)ret_conv;
6977 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
6978 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6979 *ret_conv = CResult_SignatureNoneZ_err();
6980 return (long)ret_conv;
6983 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
6984 if ((_res & 1) != 0) return;
6985 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
6987 CResult_SignatureNoneZ_free(_res_conv);
6990 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
6991 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
6992 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6993 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
6994 return (long)ret_conv;
6997 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
6998 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
6999 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7000 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
7001 return (long)ret_conv;
7004 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
7005 LDKDecodeError e_conv;
7006 e_conv.inner = (void*)(e & (~1));
7007 e_conv.is_owned = (e & 1) || (e == 0);
7008 e_conv = DecodeError_clone(&e_conv);
7009 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7010 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
7011 return (long)ret_conv;
7014 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
7015 if ((_res & 1) != 0) return;
7016 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
7018 CResult_SignDecodeErrorZ_free(_res_conv);
7021 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
7022 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
7023 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7024 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
7025 return (long)ret_conv;
7028 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
7029 LDKCVec_CVec_u8ZZ _res_constr;
7030 _res_constr.datalen = *((uint32_t*)_res);
7031 if (_res_constr.datalen > 0)
7032 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
7034 _res_constr.data = NULL;
7035 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7036 for (size_t m = 0; m < _res_constr.datalen; m++) {
7037 int8_tArray _res_conv_12 = _res_vals[m];
7038 LDKCVec_u8Z _res_conv_12_ref;
7039 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
7040 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
7041 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
7042 _res_constr.data[m] = _res_conv_12_ref;
7044 CVec_CVec_u8ZZ_free(_res_constr);
7047 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
7048 LDKCVec_CVec_u8ZZ o_constr;
7049 o_constr.datalen = *((uint32_t*)o);
7050 if (o_constr.datalen > 0)
7051 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
7053 o_constr.data = NULL;
7054 int8_tArray* o_vals = (int8_tArray*)(o + 4);
7055 for (size_t m = 0; m < o_constr.datalen; m++) {
7056 int8_tArray o_conv_12 = o_vals[m];
7057 LDKCVec_u8Z o_conv_12_ref;
7058 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
7059 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
7060 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
7061 o_constr.data[m] = o_conv_12_ref;
7063 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7064 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
7065 return (long)ret_conv;
7068 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
7069 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7070 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
7071 return (long)ret_conv;
7074 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
7075 if ((_res & 1) != 0) return;
7076 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
7078 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
7081 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
7082 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
7083 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7084 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
7085 return (long)ret_conv;
7088 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
7089 LDKInMemorySigner o_conv;
7090 o_conv.inner = (void*)(o & (~1));
7091 o_conv.is_owned = (o & 1) || (o == 0);
7092 o_conv = InMemorySigner_clone(&o_conv);
7093 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7094 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
7095 return (long)ret_conv;
7098 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
7099 LDKDecodeError e_conv;
7100 e_conv.inner = (void*)(e & (~1));
7101 e_conv.is_owned = (e & 1) || (e == 0);
7102 e_conv = DecodeError_clone(&e_conv);
7103 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7104 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
7105 return (long)ret_conv;
7108 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
7109 if ((_res & 1) != 0) return;
7110 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
7112 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
7115 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
7116 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
7117 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7118 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
7119 return (long)ret_conv;
7122 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
7123 LDKCVec_TxOutZ _res_constr;
7124 _res_constr.datalen = *((uint32_t*)_res);
7125 if (_res_constr.datalen > 0)
7126 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
7128 _res_constr.data = NULL;
7129 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7130 for (size_t h = 0; h < _res_constr.datalen; h++) {
7131 uint32_t _res_conv_7 = _res_vals[h];
7132 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
7133 FREE((void*)_res_conv_7);
7134 _res_constr.data[h] = _res_conv_7_conv;
7136 CVec_TxOutZ_free(_res_constr);
7139 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
7140 LDKTransaction o_ref;
7141 o_ref.datalen = *((uint32_t*)o);
7142 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
7143 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
7144 o_ref.data_is_owned = true;
7145 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
7146 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
7147 return (long)ret_conv;
7150 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
7151 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
7152 *ret_conv = CResult_TransactionNoneZ_err();
7153 return (long)ret_conv;
7156 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
7157 if ((_res & 1) != 0) return;
7158 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
7160 CResult_TransactionNoneZ_free(_res_conv);
7163 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
7164 LDKCVec_RouteHopZ _res_constr;
7165 _res_constr.datalen = *((uint32_t*)_res);
7166 if (_res_constr.datalen > 0)
7167 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7169 _res_constr.data = NULL;
7170 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7171 for (size_t k = 0; k < _res_constr.datalen; k++) {
7172 uint32_t _res_conv_10 = _res_vals[k];
7173 LDKRouteHop _res_conv_10_conv;
7174 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
7175 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
7176 _res_constr.data[k] = _res_conv_10_conv;
7178 CVec_RouteHopZ_free(_res_constr);
7181 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
7182 LDKCVec_CVec_RouteHopZZ _res_constr;
7183 _res_constr.datalen = *((uint32_t*)_res);
7184 if (_res_constr.datalen > 0)
7185 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
7187 _res_constr.data = NULL;
7188 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
7189 for (size_t m = 0; m < _res_constr.datalen; m++) {
7190 uint32_tArray _res_conv_12 = _res_vals[m];
7191 LDKCVec_RouteHopZ _res_conv_12_constr;
7192 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
7193 if (_res_conv_12_constr.datalen > 0)
7194 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7196 _res_conv_12_constr.data = NULL;
7197 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
7198 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
7199 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
7200 LDKRouteHop _res_conv_12_conv_10_conv;
7201 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
7202 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
7203 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
7205 _res_constr.data[m] = _res_conv_12_constr;
7207 CVec_CVec_RouteHopZZ_free(_res_constr);
7210 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
7212 o_conv.inner = (void*)(o & (~1));
7213 o_conv.is_owned = (o & 1) || (o == 0);
7214 o_conv = Route_clone(&o_conv);
7215 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7216 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
7217 return (long)ret_conv;
7220 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
7221 LDKDecodeError e_conv;
7222 e_conv.inner = (void*)(e & (~1));
7223 e_conv.is_owned = (e & 1) || (e == 0);
7224 e_conv = DecodeError_clone(&e_conv);
7225 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7226 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
7227 return (long)ret_conv;
7230 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
7231 if ((_res & 1) != 0) return;
7232 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
7234 CResult_RouteDecodeErrorZ_free(_res_conv);
7237 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
7238 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
7239 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7240 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
7241 return (long)ret_conv;
7244 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
7245 LDKCVec_RouteHintZ _res_constr;
7246 _res_constr.datalen = *((uint32_t*)_res);
7247 if (_res_constr.datalen > 0)
7248 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
7250 _res_constr.data = NULL;
7251 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7252 for (size_t l = 0; l < _res_constr.datalen; l++) {
7253 uint32_t _res_conv_11 = _res_vals[l];
7254 LDKRouteHint _res_conv_11_conv;
7255 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
7256 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
7257 _res_constr.data[l] = _res_conv_11_conv;
7259 CVec_RouteHintZ_free(_res_constr);
7262 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
7264 o_conv.inner = (void*)(o & (~1));
7265 o_conv.is_owned = (o & 1) || (o == 0);
7266 o_conv = Route_clone(&o_conv);
7267 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7268 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
7269 return (long)ret_conv;
7272 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
7273 LDKLightningError e_conv;
7274 e_conv.inner = (void*)(e & (~1));
7275 e_conv.is_owned = (e & 1) || (e == 0);
7276 e_conv = LightningError_clone(&e_conv);
7277 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7278 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
7279 return (long)ret_conv;
7282 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
7283 if ((_res & 1) != 0) return;
7284 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
7286 CResult_RouteLightningErrorZ_free(_res_conv);
7289 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
7290 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
7291 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7292 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
7293 return (long)ret_conv;
7296 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
7297 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
7299 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7300 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
7301 return (long)ret_conv;
7304 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_err(int8_t e) {
7305 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7306 *ret_conv = CResult_NetAddressu8Z_err(e);
7307 return (long)ret_conv;
7310 void __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_free(uint32_t _res) {
7311 if ((_res & 1) != 0) return;
7312 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
7314 CResult_NetAddressu8Z_free(_res_conv);
7317 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_clone(uint32_t orig) {
7318 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
7319 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7320 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
7321 return (long)ret_conv;
7324 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
7325 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
7327 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7328 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
7329 return (long)ret_conv;
7332 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_err(uint32_t e) {
7333 LDKDecodeError e_conv;
7334 e_conv.inner = (void*)(e & (~1));
7335 e_conv.is_owned = (e & 1) || (e == 0);
7336 e_conv = DecodeError_clone(&e_conv);
7337 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7338 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
7339 return (long)ret_conv;
7342 void __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_free(uint32_t _res) {
7343 if ((_res & 1) != 0) return;
7344 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
7346 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
7349 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(uint32_t orig) {
7350 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
7351 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7352 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
7353 return (long)ret_conv;
7356 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
7357 LDKCVec_UpdateAddHTLCZ _res_constr;
7358 _res_constr.datalen = *((uint32_t*)_res);
7359 if (_res_constr.datalen > 0)
7360 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
7362 _res_constr.data = NULL;
7363 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7364 for (size_t p = 0; p < _res_constr.datalen; p++) {
7365 uint32_t _res_conv_15 = _res_vals[p];
7366 LDKUpdateAddHTLC _res_conv_15_conv;
7367 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
7368 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
7369 _res_constr.data[p] = _res_conv_15_conv;
7371 CVec_UpdateAddHTLCZ_free(_res_constr);
7374 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
7375 LDKCVec_UpdateFulfillHTLCZ _res_constr;
7376 _res_constr.datalen = *((uint32_t*)_res);
7377 if (_res_constr.datalen > 0)
7378 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
7380 _res_constr.data = NULL;
7381 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7382 for (size_t t = 0; t < _res_constr.datalen; t++) {
7383 uint32_t _res_conv_19 = _res_vals[t];
7384 LDKUpdateFulfillHTLC _res_conv_19_conv;
7385 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
7386 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
7387 _res_constr.data[t] = _res_conv_19_conv;
7389 CVec_UpdateFulfillHTLCZ_free(_res_constr);
7392 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
7393 LDKCVec_UpdateFailHTLCZ _res_constr;
7394 _res_constr.datalen = *((uint32_t*)_res);
7395 if (_res_constr.datalen > 0)
7396 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
7398 _res_constr.data = NULL;
7399 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7400 for (size_t q = 0; q < _res_constr.datalen; q++) {
7401 uint32_t _res_conv_16 = _res_vals[q];
7402 LDKUpdateFailHTLC _res_conv_16_conv;
7403 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7404 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7405 _res_constr.data[q] = _res_conv_16_conv;
7407 CVec_UpdateFailHTLCZ_free(_res_constr);
7410 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
7411 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
7412 _res_constr.datalen = *((uint32_t*)_res);
7413 if (_res_constr.datalen > 0)
7414 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
7416 _res_constr.data = NULL;
7417 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7418 for (size_t z = 0; z < _res_constr.datalen; z++) {
7419 uint32_t _res_conv_25 = _res_vals[z];
7420 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
7421 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
7422 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
7423 _res_constr.data[z] = _res_conv_25_conv;
7425 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
7428 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
7429 LDKAcceptChannel o_conv;
7430 o_conv.inner = (void*)(o & (~1));
7431 o_conv.is_owned = (o & 1) || (o == 0);
7432 o_conv = AcceptChannel_clone(&o_conv);
7433 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7434 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
7435 return (long)ret_conv;
7438 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
7439 LDKDecodeError e_conv;
7440 e_conv.inner = (void*)(e & (~1));
7441 e_conv.is_owned = (e & 1) || (e == 0);
7442 e_conv = DecodeError_clone(&e_conv);
7443 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7444 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
7445 return (long)ret_conv;
7448 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
7449 if ((_res & 1) != 0) return;
7450 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
7452 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
7455 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
7456 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
7457 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7458 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
7459 return (long)ret_conv;
7462 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
7463 LDKAnnouncementSignatures o_conv;
7464 o_conv.inner = (void*)(o & (~1));
7465 o_conv.is_owned = (o & 1) || (o == 0);
7466 o_conv = AnnouncementSignatures_clone(&o_conv);
7467 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7468 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
7469 return (long)ret_conv;
7472 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
7473 LDKDecodeError e_conv;
7474 e_conv.inner = (void*)(e & (~1));
7475 e_conv.is_owned = (e & 1) || (e == 0);
7476 e_conv = DecodeError_clone(&e_conv);
7477 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7478 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
7479 return (long)ret_conv;
7482 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
7483 if ((_res & 1) != 0) return;
7484 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7486 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
7489 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
7490 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
7491 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7492 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
7493 return (long)ret_conv;
7496 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
7497 LDKChannelReestablish o_conv;
7498 o_conv.inner = (void*)(o & (~1));
7499 o_conv.is_owned = (o & 1) || (o == 0);
7500 o_conv = ChannelReestablish_clone(&o_conv);
7501 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7502 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
7503 return (long)ret_conv;
7506 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
7507 LDKDecodeError e_conv;
7508 e_conv.inner = (void*)(e & (~1));
7509 e_conv.is_owned = (e & 1) || (e == 0);
7510 e_conv = DecodeError_clone(&e_conv);
7511 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7512 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
7513 return (long)ret_conv;
7516 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
7517 if ((_res & 1) != 0) return;
7518 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
7520 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
7523 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
7524 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
7525 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7526 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
7527 return (long)ret_conv;
7530 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
7531 LDKClosingSigned o_conv;
7532 o_conv.inner = (void*)(o & (~1));
7533 o_conv.is_owned = (o & 1) || (o == 0);
7534 o_conv = ClosingSigned_clone(&o_conv);
7535 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7536 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
7537 return (long)ret_conv;
7540 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
7541 LDKDecodeError e_conv;
7542 e_conv.inner = (void*)(e & (~1));
7543 e_conv.is_owned = (e & 1) || (e == 0);
7544 e_conv = DecodeError_clone(&e_conv);
7545 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7546 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
7547 return (long)ret_conv;
7550 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
7551 if ((_res & 1) != 0) return;
7552 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7554 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
7557 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
7558 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
7559 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7560 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
7561 return (long)ret_conv;
7564 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
7565 LDKCommitmentSigned o_conv;
7566 o_conv.inner = (void*)(o & (~1));
7567 o_conv.is_owned = (o & 1) || (o == 0);
7568 o_conv = CommitmentSigned_clone(&o_conv);
7569 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7570 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
7571 return (long)ret_conv;
7574 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
7575 LDKDecodeError e_conv;
7576 e_conv.inner = (void*)(e & (~1));
7577 e_conv.is_owned = (e & 1) || (e == 0);
7578 e_conv = DecodeError_clone(&e_conv);
7579 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7580 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
7581 return (long)ret_conv;
7584 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
7585 if ((_res & 1) != 0) return;
7586 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7588 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
7591 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
7592 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
7593 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7594 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
7595 return (long)ret_conv;
7598 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
7599 LDKFundingCreated o_conv;
7600 o_conv.inner = (void*)(o & (~1));
7601 o_conv.is_owned = (o & 1) || (o == 0);
7602 o_conv = FundingCreated_clone(&o_conv);
7603 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7604 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
7605 return (long)ret_conv;
7608 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
7609 LDKDecodeError e_conv;
7610 e_conv.inner = (void*)(e & (~1));
7611 e_conv.is_owned = (e & 1) || (e == 0);
7612 e_conv = DecodeError_clone(&e_conv);
7613 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7614 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
7615 return (long)ret_conv;
7618 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
7619 if ((_res & 1) != 0) return;
7620 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7622 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
7625 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
7626 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
7627 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7628 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
7629 return (long)ret_conv;
7632 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
7633 LDKFundingSigned o_conv;
7634 o_conv.inner = (void*)(o & (~1));
7635 o_conv.is_owned = (o & 1) || (o == 0);
7636 o_conv = FundingSigned_clone(&o_conv);
7637 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7638 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
7639 return (long)ret_conv;
7642 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
7643 LDKDecodeError e_conv;
7644 e_conv.inner = (void*)(e & (~1));
7645 e_conv.is_owned = (e & 1) || (e == 0);
7646 e_conv = DecodeError_clone(&e_conv);
7647 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7648 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
7649 return (long)ret_conv;
7652 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
7653 if ((_res & 1) != 0) return;
7654 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7656 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
7659 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
7660 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
7661 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7662 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
7663 return (long)ret_conv;
7666 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
7667 LDKFundingLocked o_conv;
7668 o_conv.inner = (void*)(o & (~1));
7669 o_conv.is_owned = (o & 1) || (o == 0);
7670 o_conv = FundingLocked_clone(&o_conv);
7671 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7672 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
7673 return (long)ret_conv;
7676 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
7677 LDKDecodeError e_conv;
7678 e_conv.inner = (void*)(e & (~1));
7679 e_conv.is_owned = (e & 1) || (e == 0);
7680 e_conv = DecodeError_clone(&e_conv);
7681 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7682 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
7683 return (long)ret_conv;
7686 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
7687 if ((_res & 1) != 0) return;
7688 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7690 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
7693 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
7694 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
7695 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7696 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
7697 return (long)ret_conv;
7700 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
7702 o_conv.inner = (void*)(o & (~1));
7703 o_conv.is_owned = (o & 1) || (o == 0);
7704 o_conv = Init_clone(&o_conv);
7705 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7706 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
7707 return (long)ret_conv;
7710 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
7711 LDKDecodeError e_conv;
7712 e_conv.inner = (void*)(e & (~1));
7713 e_conv.is_owned = (e & 1) || (e == 0);
7714 e_conv = DecodeError_clone(&e_conv);
7715 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7716 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
7717 return (long)ret_conv;
7720 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
7721 if ((_res & 1) != 0) return;
7722 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
7724 CResult_InitDecodeErrorZ_free(_res_conv);
7727 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
7728 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
7729 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7730 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
7731 return (long)ret_conv;
7734 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
7735 LDKOpenChannel o_conv;
7736 o_conv.inner = (void*)(o & (~1));
7737 o_conv.is_owned = (o & 1) || (o == 0);
7738 o_conv = OpenChannel_clone(&o_conv);
7739 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
7740 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
7741 return (long)ret_conv;
7744 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
7745 LDKDecodeError e_conv;
7746 e_conv.inner = (void*)(e & (~1));
7747 e_conv.is_owned = (e & 1) || (e == 0);
7748 e_conv = DecodeError_clone(&e_conv);
7749 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
7750 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
7751 return (long)ret_conv;
7754 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
7755 if ((_res & 1) != 0) return;
7756 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
7758 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
7761 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
7762 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
7763 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
7764 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
7765 return (long)ret_conv;
7768 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
7769 LDKRevokeAndACK o_conv;
7770 o_conv.inner = (void*)(o & (~1));
7771 o_conv.is_owned = (o & 1) || (o == 0);
7772 o_conv = RevokeAndACK_clone(&o_conv);
7773 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
7774 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
7775 return (long)ret_conv;
7778 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
7779 LDKDecodeError e_conv;
7780 e_conv.inner = (void*)(e & (~1));
7781 e_conv.is_owned = (e & 1) || (e == 0);
7782 e_conv = DecodeError_clone(&e_conv);
7783 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
7784 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
7785 return (long)ret_conv;
7788 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
7789 if ((_res & 1) != 0) return;
7790 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
7792 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
7795 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
7796 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
7797 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
7798 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
7799 return (long)ret_conv;
7802 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
7804 o_conv.inner = (void*)(o & (~1));
7805 o_conv.is_owned = (o & 1) || (o == 0);
7806 o_conv = Shutdown_clone(&o_conv);
7807 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
7808 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
7809 return (long)ret_conv;
7812 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
7813 LDKDecodeError e_conv;
7814 e_conv.inner = (void*)(e & (~1));
7815 e_conv.is_owned = (e & 1) || (e == 0);
7816 e_conv = DecodeError_clone(&e_conv);
7817 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
7818 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
7819 return (long)ret_conv;
7822 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
7823 if ((_res & 1) != 0) return;
7824 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
7826 CResult_ShutdownDecodeErrorZ_free(_res_conv);
7829 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
7830 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
7831 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
7832 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
7833 return (long)ret_conv;
7836 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
7837 LDKUpdateFailHTLC o_conv;
7838 o_conv.inner = (void*)(o & (~1));
7839 o_conv.is_owned = (o & 1) || (o == 0);
7840 o_conv = UpdateFailHTLC_clone(&o_conv);
7841 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
7842 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
7843 return (long)ret_conv;
7846 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
7847 LDKDecodeError e_conv;
7848 e_conv.inner = (void*)(e & (~1));
7849 e_conv.is_owned = (e & 1) || (e == 0);
7850 e_conv = DecodeError_clone(&e_conv);
7851 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
7852 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
7853 return (long)ret_conv;
7856 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
7857 if ((_res & 1) != 0) return;
7858 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
7860 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
7863 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
7864 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
7865 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
7866 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
7867 return (long)ret_conv;
7870 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
7871 LDKUpdateFailMalformedHTLC o_conv;
7872 o_conv.inner = (void*)(o & (~1));
7873 o_conv.is_owned = (o & 1) || (o == 0);
7874 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
7875 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
7876 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
7877 return (long)ret_conv;
7880 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
7881 LDKDecodeError e_conv;
7882 e_conv.inner = (void*)(e & (~1));
7883 e_conv.is_owned = (e & 1) || (e == 0);
7884 e_conv = DecodeError_clone(&e_conv);
7885 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
7886 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
7887 return (long)ret_conv;
7890 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
7891 if ((_res & 1) != 0) return;
7892 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
7894 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
7897 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
7898 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
7899 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
7900 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
7901 return (long)ret_conv;
7904 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
7905 LDKUpdateFee o_conv;
7906 o_conv.inner = (void*)(o & (~1));
7907 o_conv.is_owned = (o & 1) || (o == 0);
7908 o_conv = UpdateFee_clone(&o_conv);
7909 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
7910 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
7911 return (long)ret_conv;
7914 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
7915 LDKDecodeError e_conv;
7916 e_conv.inner = (void*)(e & (~1));
7917 e_conv.is_owned = (e & 1) || (e == 0);
7918 e_conv = DecodeError_clone(&e_conv);
7919 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
7920 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
7921 return (long)ret_conv;
7924 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
7925 if ((_res & 1) != 0) return;
7926 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
7928 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
7931 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
7932 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
7933 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
7934 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
7935 return (long)ret_conv;
7938 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
7939 LDKUpdateFulfillHTLC o_conv;
7940 o_conv.inner = (void*)(o & (~1));
7941 o_conv.is_owned = (o & 1) || (o == 0);
7942 o_conv = UpdateFulfillHTLC_clone(&o_conv);
7943 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
7944 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
7945 return (long)ret_conv;
7948 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
7949 LDKDecodeError e_conv;
7950 e_conv.inner = (void*)(e & (~1));
7951 e_conv.is_owned = (e & 1) || (e == 0);
7952 e_conv = DecodeError_clone(&e_conv);
7953 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
7954 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
7955 return (long)ret_conv;
7958 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
7959 if ((_res & 1) != 0) return;
7960 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
7962 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
7965 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
7966 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
7967 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
7968 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
7969 return (long)ret_conv;
7972 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
7973 LDKUpdateAddHTLC o_conv;
7974 o_conv.inner = (void*)(o & (~1));
7975 o_conv.is_owned = (o & 1) || (o == 0);
7976 o_conv = UpdateAddHTLC_clone(&o_conv);
7977 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
7978 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
7979 return (long)ret_conv;
7982 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
7983 LDKDecodeError e_conv;
7984 e_conv.inner = (void*)(e & (~1));
7985 e_conv.is_owned = (e & 1) || (e == 0);
7986 e_conv = DecodeError_clone(&e_conv);
7987 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
7988 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
7989 return (long)ret_conv;
7992 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
7993 if ((_res & 1) != 0) return;
7994 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
7996 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
7999 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
8000 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
8001 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8002 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
8003 return (long)ret_conv;
8006 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
8008 o_conv.inner = (void*)(o & (~1));
8009 o_conv.is_owned = (o & 1) || (o == 0);
8010 o_conv = Ping_clone(&o_conv);
8011 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8012 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
8013 return (long)ret_conv;
8016 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
8017 LDKDecodeError e_conv;
8018 e_conv.inner = (void*)(e & (~1));
8019 e_conv.is_owned = (e & 1) || (e == 0);
8020 e_conv = DecodeError_clone(&e_conv);
8021 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8022 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
8023 return (long)ret_conv;
8026 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
8027 if ((_res & 1) != 0) return;
8028 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
8030 CResult_PingDecodeErrorZ_free(_res_conv);
8033 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
8034 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
8035 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8036 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
8037 return (long)ret_conv;
8040 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
8042 o_conv.inner = (void*)(o & (~1));
8043 o_conv.is_owned = (o & 1) || (o == 0);
8044 o_conv = Pong_clone(&o_conv);
8045 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8046 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
8047 return (long)ret_conv;
8050 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
8051 LDKDecodeError e_conv;
8052 e_conv.inner = (void*)(e & (~1));
8053 e_conv.is_owned = (e & 1) || (e == 0);
8054 e_conv = DecodeError_clone(&e_conv);
8055 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8056 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
8057 return (long)ret_conv;
8060 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
8061 if ((_res & 1) != 0) return;
8062 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
8064 CResult_PongDecodeErrorZ_free(_res_conv);
8067 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
8068 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
8069 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8070 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
8071 return (long)ret_conv;
8074 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
8075 LDKUnsignedChannelAnnouncement o_conv;
8076 o_conv.inner = (void*)(o & (~1));
8077 o_conv.is_owned = (o & 1) || (o == 0);
8078 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
8079 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8080 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
8081 return (long)ret_conv;
8084 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
8085 LDKDecodeError e_conv;
8086 e_conv.inner = (void*)(e & (~1));
8087 e_conv.is_owned = (e & 1) || (e == 0);
8088 e_conv = DecodeError_clone(&e_conv);
8089 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8090 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
8091 return (long)ret_conv;
8094 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
8095 if ((_res & 1) != 0) return;
8096 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8098 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
8101 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8102 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
8103 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8104 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
8105 return (long)ret_conv;
8108 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
8109 LDKChannelAnnouncement o_conv;
8110 o_conv.inner = (void*)(o & (~1));
8111 o_conv.is_owned = (o & 1) || (o == 0);
8112 o_conv = ChannelAnnouncement_clone(&o_conv);
8113 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8114 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
8115 return (long)ret_conv;
8118 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
8119 LDKDecodeError e_conv;
8120 e_conv.inner = (void*)(e & (~1));
8121 e_conv.is_owned = (e & 1) || (e == 0);
8122 e_conv = DecodeError_clone(&e_conv);
8123 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8124 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
8125 return (long)ret_conv;
8128 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
8129 if ((_res & 1) != 0) return;
8130 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8132 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
8135 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8136 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
8137 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8138 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
8139 return (long)ret_conv;
8142 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
8143 LDKUnsignedChannelUpdate o_conv;
8144 o_conv.inner = (void*)(o & (~1));
8145 o_conv.is_owned = (o & 1) || (o == 0);
8146 o_conv = UnsignedChannelUpdate_clone(&o_conv);
8147 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8148 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
8149 return (long)ret_conv;
8152 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
8153 LDKDecodeError e_conv;
8154 e_conv.inner = (void*)(e & (~1));
8155 e_conv.is_owned = (e & 1) || (e == 0);
8156 e_conv = DecodeError_clone(&e_conv);
8157 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8158 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
8159 return (long)ret_conv;
8162 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
8163 if ((_res & 1) != 0) return;
8164 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8166 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
8169 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
8170 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
8171 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8172 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
8173 return (long)ret_conv;
8176 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
8177 LDKChannelUpdate o_conv;
8178 o_conv.inner = (void*)(o & (~1));
8179 o_conv.is_owned = (o & 1) || (o == 0);
8180 o_conv = ChannelUpdate_clone(&o_conv);
8181 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8182 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
8183 return (long)ret_conv;
8186 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
8187 LDKDecodeError e_conv;
8188 e_conv.inner = (void*)(e & (~1));
8189 e_conv.is_owned = (e & 1) || (e == 0);
8190 e_conv = DecodeError_clone(&e_conv);
8191 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8192 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
8193 return (long)ret_conv;
8196 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
8197 if ((_res & 1) != 0) return;
8198 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8200 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
8203 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
8204 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
8205 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8206 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
8207 return (long)ret_conv;
8210 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
8211 LDKErrorMessage o_conv;
8212 o_conv.inner = (void*)(o & (~1));
8213 o_conv.is_owned = (o & 1) || (o == 0);
8214 o_conv = ErrorMessage_clone(&o_conv);
8215 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8216 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
8217 return (long)ret_conv;
8220 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
8221 LDKDecodeError e_conv;
8222 e_conv.inner = (void*)(e & (~1));
8223 e_conv.is_owned = (e & 1) || (e == 0);
8224 e_conv = DecodeError_clone(&e_conv);
8225 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8226 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
8227 return (long)ret_conv;
8230 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
8231 if ((_res & 1) != 0) return;
8232 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
8234 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
8237 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
8238 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
8239 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8240 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
8241 return (long)ret_conv;
8244 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
8245 LDKUnsignedNodeAnnouncement o_conv;
8246 o_conv.inner = (void*)(o & (~1));
8247 o_conv.is_owned = (o & 1) || (o == 0);
8248 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
8249 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8250 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
8251 return (long)ret_conv;
8254 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
8255 LDKDecodeError e_conv;
8256 e_conv.inner = (void*)(e & (~1));
8257 e_conv.is_owned = (e & 1) || (e == 0);
8258 e_conv = DecodeError_clone(&e_conv);
8259 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8260 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
8261 return (long)ret_conv;
8264 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
8265 if ((_res & 1) != 0) return;
8266 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8268 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
8271 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8272 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
8273 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8274 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
8275 return (long)ret_conv;
8278 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
8279 LDKNodeAnnouncement o_conv;
8280 o_conv.inner = (void*)(o & (~1));
8281 o_conv.is_owned = (o & 1) || (o == 0);
8282 o_conv = NodeAnnouncement_clone(&o_conv);
8283 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8284 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
8285 return (long)ret_conv;
8288 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
8289 LDKDecodeError e_conv;
8290 e_conv.inner = (void*)(e & (~1));
8291 e_conv.is_owned = (e & 1) || (e == 0);
8292 e_conv = DecodeError_clone(&e_conv);
8293 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8294 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
8295 return (long)ret_conv;
8298 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
8299 if ((_res & 1) != 0) return;
8300 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8302 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
8305 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8306 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
8307 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8308 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
8309 return (long)ret_conv;
8312 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
8313 LDKQueryShortChannelIds o_conv;
8314 o_conv.inner = (void*)(o & (~1));
8315 o_conv.is_owned = (o & 1) || (o == 0);
8316 o_conv = QueryShortChannelIds_clone(&o_conv);
8317 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8318 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
8319 return (long)ret_conv;
8322 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
8323 LDKDecodeError e_conv;
8324 e_conv.inner = (void*)(e & (~1));
8325 e_conv.is_owned = (e & 1) || (e == 0);
8326 e_conv = DecodeError_clone(&e_conv);
8327 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8328 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
8329 return (long)ret_conv;
8332 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
8333 if ((_res & 1) != 0) return;
8334 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
8336 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
8339 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
8340 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
8341 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8342 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
8343 return (long)ret_conv;
8346 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
8347 LDKReplyShortChannelIdsEnd o_conv;
8348 o_conv.inner = (void*)(o & (~1));
8349 o_conv.is_owned = (o & 1) || (o == 0);
8350 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
8351 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8352 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
8353 return (long)ret_conv;
8356 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
8357 LDKDecodeError e_conv;
8358 e_conv.inner = (void*)(e & (~1));
8359 e_conv.is_owned = (e & 1) || (e == 0);
8360 e_conv = DecodeError_clone(&e_conv);
8361 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8362 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
8363 return (long)ret_conv;
8366 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
8367 if ((_res & 1) != 0) return;
8368 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
8370 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
8373 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
8374 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
8375 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8376 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
8377 return (long)ret_conv;
8380 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
8381 LDKQueryChannelRange o_conv;
8382 o_conv.inner = (void*)(o & (~1));
8383 o_conv.is_owned = (o & 1) || (o == 0);
8384 o_conv = QueryChannelRange_clone(&o_conv);
8385 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8386 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
8387 return (long)ret_conv;
8390 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
8391 LDKDecodeError e_conv;
8392 e_conv.inner = (void*)(e & (~1));
8393 e_conv.is_owned = (e & 1) || (e == 0);
8394 e_conv = DecodeError_clone(&e_conv);
8395 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8396 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
8397 return (long)ret_conv;
8400 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
8401 if ((_res & 1) != 0) return;
8402 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8404 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
8407 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
8408 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
8409 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8410 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
8411 return (long)ret_conv;
8414 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
8415 LDKReplyChannelRange o_conv;
8416 o_conv.inner = (void*)(o & (~1));
8417 o_conv.is_owned = (o & 1) || (o == 0);
8418 o_conv = ReplyChannelRange_clone(&o_conv);
8419 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8420 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
8421 return (long)ret_conv;
8424 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
8425 LDKDecodeError e_conv;
8426 e_conv.inner = (void*)(e & (~1));
8427 e_conv.is_owned = (e & 1) || (e == 0);
8428 e_conv = DecodeError_clone(&e_conv);
8429 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8430 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
8431 return (long)ret_conv;
8434 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
8435 if ((_res & 1) != 0) return;
8436 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8438 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
8441 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
8442 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
8443 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8444 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
8445 return (long)ret_conv;
8448 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
8449 LDKGossipTimestampFilter o_conv;
8450 o_conv.inner = (void*)(o & (~1));
8451 o_conv.is_owned = (o & 1) || (o == 0);
8452 o_conv = GossipTimestampFilter_clone(&o_conv);
8453 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8454 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
8455 return (long)ret_conv;
8458 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
8459 LDKDecodeError e_conv;
8460 e_conv.inner = (void*)(e & (~1));
8461 e_conv.is_owned = (e & 1) || (e == 0);
8462 e_conv = DecodeError_clone(&e_conv);
8463 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8464 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
8465 return (long)ret_conv;
8468 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
8469 if ((_res & 1) != 0) return;
8470 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
8472 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
8475 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
8476 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
8477 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8478 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
8479 return (long)ret_conv;
8482 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
8483 if ((this_ptr & 1) != 0) return;
8484 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
8485 FREE((void*)this_ptr);
8486 Event_free(this_ptr_conv);
8489 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
8490 LDKEvent* orig_conv = (LDKEvent*)orig;
8491 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
8492 *ret_copy = Event_clone(orig_conv);
8493 long ret_ref = (long)ret_copy;
8497 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
8498 LDKEvent* obj_conv = (LDKEvent*)obj;
8499 LDKCVec_u8Z ret_var = Event_write(obj_conv);
8500 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
8501 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
8502 CVec_u8Z_free(ret_var);
8506 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
8507 if ((this_ptr & 1) != 0) return;
8508 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
8509 FREE((void*)this_ptr);
8510 MessageSendEvent_free(this_ptr_conv);
8513 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
8514 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
8515 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
8516 *ret_copy = MessageSendEvent_clone(orig_conv);
8517 long ret_ref = (long)ret_copy;
8521 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
8522 if ((this_ptr & 1) != 0) return;
8523 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
8524 FREE((void*)this_ptr);
8525 MessageSendEventsProvider_free(this_ptr_conv);
8528 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
8529 if ((this_ptr & 1) != 0) return;
8530 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
8531 FREE((void*)this_ptr);
8532 EventsProvider_free(this_ptr_conv);
8535 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
8536 if ((this_ptr & 1) != 0) return;
8537 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
8538 FREE((void*)this_ptr);
8539 APIError_free(this_ptr_conv);
8542 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
8543 LDKAPIError* orig_conv = (LDKAPIError*)orig;
8544 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
8545 *ret_copy = APIError_clone(orig_conv);
8546 long ret_ref = (long)ret_copy;
8550 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
8551 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
8552 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
8556 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
8557 uint32_t ret_conv = LDKLevel_to_js(Level_max());
8561 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
8562 if ((this_ptr & 1) != 0) return;
8563 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
8564 FREE((void*)this_ptr);
8565 Logger_free(this_ptr_conv);
8568 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_ptr) {
8569 LDKChannelHandshakeConfig this_ptr_conv;
8570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8571 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8572 ChannelHandshakeConfig_free(this_ptr_conv);
8575 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
8576 LDKChannelHandshakeConfig this_ptr_conv;
8577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8578 this_ptr_conv.is_owned = false;
8579 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
8583 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
8584 LDKChannelHandshakeConfig this_ptr_conv;
8585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8586 this_ptr_conv.is_owned = false;
8587 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
8590 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
8591 LDKChannelHandshakeConfig this_ptr_conv;
8592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8593 this_ptr_conv.is_owned = false;
8594 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
8598 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
8599 LDKChannelHandshakeConfig this_ptr_conv;
8600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8601 this_ptr_conv.is_owned = false;
8602 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
8605 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
8606 LDKChannelHandshakeConfig this_ptr_conv;
8607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8608 this_ptr_conv.is_owned = false;
8609 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
8613 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
8614 LDKChannelHandshakeConfig this_ptr_conv;
8615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8616 this_ptr_conv.is_owned = false;
8617 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
8620 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) {
8621 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
8622 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8623 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8624 long ret_ref = (long)ret_var.inner;
8625 if (ret_var.is_owned) {
8631 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
8632 LDKChannelHandshakeConfig orig_conv;
8633 orig_conv.inner = (void*)(orig & (~1));
8634 orig_conv.is_owned = false;
8635 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
8636 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8637 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8638 long ret_ref = (long)ret_var.inner;
8639 if (ret_var.is_owned) {
8645 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
8646 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
8647 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8648 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8649 long ret_ref = (long)ret_var.inner;
8650 if (ret_var.is_owned) {
8656 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_ptr) {
8657 LDKChannelHandshakeLimits this_ptr_conv;
8658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8659 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8660 ChannelHandshakeLimits_free(this_ptr_conv);
8663 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
8664 LDKChannelHandshakeLimits this_ptr_conv;
8665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8666 this_ptr_conv.is_owned = false;
8667 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
8671 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
8672 LDKChannelHandshakeLimits this_ptr_conv;
8673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8674 this_ptr_conv.is_owned = false;
8675 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
8678 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
8679 LDKChannelHandshakeLimits this_ptr_conv;
8680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8681 this_ptr_conv.is_owned = false;
8682 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
8686 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
8687 LDKChannelHandshakeLimits this_ptr_conv;
8688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8689 this_ptr_conv.is_owned = false;
8690 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
8693 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
8694 LDKChannelHandshakeLimits this_ptr_conv;
8695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8696 this_ptr_conv.is_owned = false;
8697 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
8701 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
8702 LDKChannelHandshakeLimits this_ptr_conv;
8703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8704 this_ptr_conv.is_owned = false;
8705 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8708 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
8709 LDKChannelHandshakeLimits this_ptr_conv;
8710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8711 this_ptr_conv.is_owned = false;
8712 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
8716 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
8717 LDKChannelHandshakeLimits this_ptr_conv;
8718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8719 this_ptr_conv.is_owned = false;
8720 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
8723 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
8724 LDKChannelHandshakeLimits this_ptr_conv;
8725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8726 this_ptr_conv.is_owned = false;
8727 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
8731 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
8732 LDKChannelHandshakeLimits this_ptr_conv;
8733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8734 this_ptr_conv.is_owned = false;
8735 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
8738 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_dust_limit_satoshis(uint32_t this_ptr) {
8739 LDKChannelHandshakeLimits this_ptr_conv;
8740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8741 this_ptr_conv.is_owned = false;
8742 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
8746 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
8747 LDKChannelHandshakeLimits this_ptr_conv;
8748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8749 this_ptr_conv.is_owned = false;
8750 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
8753 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_dust_limit_satoshis(uint32_t this_ptr) {
8754 LDKChannelHandshakeLimits this_ptr_conv;
8755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8756 this_ptr_conv.is_owned = false;
8757 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
8761 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
8762 LDKChannelHandshakeLimits this_ptr_conv;
8763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8764 this_ptr_conv.is_owned = false;
8765 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
8768 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
8769 LDKChannelHandshakeLimits this_ptr_conv;
8770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8771 this_ptr_conv.is_owned = false;
8772 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
8776 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
8777 LDKChannelHandshakeLimits this_ptr_conv;
8778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8779 this_ptr_conv.is_owned = false;
8780 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
8783 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
8784 LDKChannelHandshakeLimits this_ptr_conv;
8785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8786 this_ptr_conv.is_owned = false;
8787 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
8791 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
8792 LDKChannelHandshakeLimits this_ptr_conv;
8793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8794 this_ptr_conv.is_owned = false;
8795 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
8798 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
8799 LDKChannelHandshakeLimits this_ptr_conv;
8800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8801 this_ptr_conv.is_owned = false;
8802 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
8806 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
8807 LDKChannelHandshakeLimits this_ptr_conv;
8808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8809 this_ptr_conv.is_owned = false;
8810 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
8813 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) {
8814 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);
8815 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8816 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8817 long ret_ref = (long)ret_var.inner;
8818 if (ret_var.is_owned) {
8824 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
8825 LDKChannelHandshakeLimits orig_conv;
8826 orig_conv.inner = (void*)(orig & (~1));
8827 orig_conv.is_owned = false;
8828 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
8829 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8830 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8831 long ret_ref = (long)ret_var.inner;
8832 if (ret_var.is_owned) {
8838 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
8839 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
8840 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8841 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8842 long ret_ref = (long)ret_var.inner;
8843 if (ret_var.is_owned) {
8849 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_ptr) {
8850 LDKChannelConfig this_ptr_conv;
8851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8852 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8853 ChannelConfig_free(this_ptr_conv);
8856 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_fee_proportional_millionths(uint32_t this_ptr) {
8857 LDKChannelConfig this_ptr_conv;
8858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8859 this_ptr_conv.is_owned = false;
8860 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
8864 void __attribute__((visibility("default"))) TS_ChannelConfig_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
8865 LDKChannelConfig this_ptr_conv;
8866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8867 this_ptr_conv.is_owned = false;
8868 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
8871 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
8872 LDKChannelConfig this_ptr_conv;
8873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8874 this_ptr_conv.is_owned = false;
8875 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
8879 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
8880 LDKChannelConfig this_ptr_conv;
8881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8882 this_ptr_conv.is_owned = false;
8883 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
8886 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
8887 LDKChannelConfig this_ptr_conv;
8888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8889 this_ptr_conv.is_owned = false;
8890 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
8894 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
8895 LDKChannelConfig this_ptr_conv;
8896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8897 this_ptr_conv.is_owned = false;
8898 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
8901 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_new(int32_t fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
8902 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
8903 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8904 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8905 long ret_ref = (long)ret_var.inner;
8906 if (ret_var.is_owned) {
8912 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
8913 LDKChannelConfig orig_conv;
8914 orig_conv.inner = (void*)(orig & (~1));
8915 orig_conv.is_owned = false;
8916 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
8917 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8918 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8919 long ret_ref = (long)ret_var.inner;
8920 if (ret_var.is_owned) {
8926 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
8927 LDKChannelConfig ret_var = ChannelConfig_default();
8928 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8929 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8930 long ret_ref = (long)ret_var.inner;
8931 if (ret_var.is_owned) {
8937 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
8938 LDKChannelConfig obj_conv;
8939 obj_conv.inner = (void*)(obj & (~1));
8940 obj_conv.is_owned = false;
8941 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
8942 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
8943 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
8944 CVec_u8Z_free(ret_var);
8948 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
8950 ser_ref.datalen = *((uint32_t*)ser);
8951 ser_ref.data = (int8_t*)(ser + 4);
8952 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8953 *ret_conv = ChannelConfig_read(ser_ref);
8954 return (long)ret_conv;
8957 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_ptr) {
8958 LDKUserConfig this_ptr_conv;
8959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8960 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8961 UserConfig_free(this_ptr_conv);
8964 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
8965 LDKUserConfig this_ptr_conv;
8966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8967 this_ptr_conv.is_owned = false;
8968 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
8969 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8970 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8971 long ret_ref = (long)ret_var.inner;
8972 if (ret_var.is_owned) {
8978 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
8979 LDKUserConfig this_ptr_conv;
8980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8981 this_ptr_conv.is_owned = false;
8982 LDKChannelHandshakeConfig val_conv;
8983 val_conv.inner = (void*)(val & (~1));
8984 val_conv.is_owned = (val & 1) || (val == 0);
8985 val_conv = ChannelHandshakeConfig_clone(&val_conv);
8986 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
8989 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
8990 LDKUserConfig this_ptr_conv;
8991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8992 this_ptr_conv.is_owned = false;
8993 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
8994 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8995 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8996 long ret_ref = (long)ret_var.inner;
8997 if (ret_var.is_owned) {
9003 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
9004 LDKUserConfig this_ptr_conv;
9005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9006 this_ptr_conv.is_owned = false;
9007 LDKChannelHandshakeLimits val_conv;
9008 val_conv.inner = (void*)(val & (~1));
9009 val_conv.is_owned = (val & 1) || (val == 0);
9010 val_conv = ChannelHandshakeLimits_clone(&val_conv);
9011 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
9014 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
9015 LDKUserConfig this_ptr_conv;
9016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9017 this_ptr_conv.is_owned = false;
9018 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
9019 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9020 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9021 long ret_ref = (long)ret_var.inner;
9022 if (ret_var.is_owned) {
9028 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
9029 LDKUserConfig this_ptr_conv;
9030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9031 this_ptr_conv.is_owned = false;
9032 LDKChannelConfig val_conv;
9033 val_conv.inner = (void*)(val & (~1));
9034 val_conv.is_owned = (val & 1) || (val == 0);
9035 val_conv = ChannelConfig_clone(&val_conv);
9036 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
9039 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) {
9040 LDKChannelHandshakeConfig own_channel_config_arg_conv;
9041 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
9042 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
9043 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
9044 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
9045 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
9046 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
9047 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
9048 LDKChannelConfig channel_options_arg_conv;
9049 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
9050 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
9051 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
9052 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
9053 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9054 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9055 long ret_ref = (long)ret_var.inner;
9056 if (ret_var.is_owned) {
9062 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
9063 LDKUserConfig orig_conv;
9064 orig_conv.inner = (void*)(orig & (~1));
9065 orig_conv.is_owned = false;
9066 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
9067 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9068 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9069 long ret_ref = (long)ret_var.inner;
9070 if (ret_var.is_owned) {
9076 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
9077 LDKUserConfig ret_var = UserConfig_default();
9078 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9079 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9080 long ret_ref = (long)ret_var.inner;
9081 if (ret_var.is_owned) {
9087 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
9088 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
9089 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
9093 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
9094 if ((this_ptr & 1) != 0) return;
9095 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
9096 FREE((void*)this_ptr);
9097 Access_free(this_ptr_conv);
9100 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
9101 if ((this_ptr & 1) != 0) return;
9102 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
9103 FREE((void*)this_ptr);
9104 Listen_free(this_ptr_conv);
9107 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
9108 if ((this_ptr & 1) != 0) return;
9109 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
9110 FREE((void*)this_ptr);
9111 Watch_free(this_ptr_conv);
9114 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
9115 if ((this_ptr & 1) != 0) return;
9116 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
9117 FREE((void*)this_ptr);
9118 Filter_free(this_ptr_conv);
9121 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
9122 if ((this_ptr & 1) != 0) return;
9123 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
9124 FREE((void*)this_ptr);
9125 BroadcasterInterface_free(this_ptr_conv);
9128 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
9129 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
9130 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
9134 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
9135 if ((this_ptr & 1) != 0) return;
9136 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
9137 FREE((void*)this_ptr);
9138 FeeEstimator_free(this_ptr_conv);
9141 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_ptr) {
9142 LDKChainMonitor this_ptr_conv;
9143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9144 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9145 ChainMonitor_free(this_ptr_conv);
9148 void __attribute__((visibility("default"))) TS_ChainMonitor_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
9149 LDKChainMonitor this_arg_conv;
9150 this_arg_conv.inner = (void*)(this_arg & (~1));
9151 this_arg_conv.is_owned = false;
9152 unsigned char header_arr[80];
9153 CHECK(*((uint32_t*)header) == 80);
9154 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9155 unsigned char (*header_ref)[80] = &header_arr;
9156 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9157 txdata_constr.datalen = *((uint32_t*)txdata);
9158 if (txdata_constr.datalen > 0)
9159 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9161 txdata_constr.data = NULL;
9162 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
9163 for (size_t e = 0; e < txdata_constr.datalen; e++) {
9164 uint32_t txdata_conv_30 = txdata_vals[e];
9165 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
9166 FREE((void*)txdata_conv_30);
9167 txdata_constr.data[e] = txdata_conv_30_conv;
9169 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
9172 void __attribute__((visibility("default"))) TS_ChainMonitor_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t disconnected_height) {
9173 LDKChainMonitor this_arg_conv;
9174 this_arg_conv.inner = (void*)(this_arg & (~1));
9175 this_arg_conv.is_owned = false;
9176 unsigned char header_arr[80];
9177 CHECK(*((uint32_t*)header) == 80);
9178 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9179 unsigned char (*header_ref)[80] = &header_arr;
9180 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
9183 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
9184 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
9185 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
9186 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9187 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
9188 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
9189 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
9190 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9191 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9192 long ret_ref = (long)ret_var.inner;
9193 if (ret_var.is_owned) {
9199 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
9200 LDKChainMonitor this_arg_conv;
9201 this_arg_conv.inner = (void*)(this_arg & (~1));
9202 this_arg_conv.is_owned = false;
9203 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
9204 *ret = ChainMonitor_as_Watch(&this_arg_conv);
9208 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
9209 LDKChainMonitor this_arg_conv;
9210 this_arg_conv.inner = (void*)(this_arg & (~1));
9211 this_arg_conv.is_owned = false;
9212 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9213 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
9217 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_ptr) {
9218 LDKChannelMonitorUpdate this_ptr_conv;
9219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9220 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9221 ChannelMonitorUpdate_free(this_ptr_conv);
9224 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
9225 LDKChannelMonitorUpdate this_ptr_conv;
9226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9227 this_ptr_conv.is_owned = false;
9228 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
9232 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
9233 LDKChannelMonitorUpdate this_ptr_conv;
9234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9235 this_ptr_conv.is_owned = false;
9236 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
9239 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
9240 LDKChannelMonitorUpdate orig_conv;
9241 orig_conv.inner = (void*)(orig & (~1));
9242 orig_conv.is_owned = false;
9243 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
9244 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9245 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9246 long ret_ref = (long)ret_var.inner;
9247 if (ret_var.is_owned) {
9253 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
9254 LDKChannelMonitorUpdate obj_conv;
9255 obj_conv.inner = (void*)(obj & (~1));
9256 obj_conv.is_owned = false;
9257 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
9258 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9259 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9260 CVec_u8Z_free(ret_var);
9264 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
9266 ser_ref.datalen = *((uint32_t*)ser);
9267 ser_ref.data = (int8_t*)(ser + 4);
9268 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9269 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
9270 return (long)ret_conv;
9273 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
9274 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
9275 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
9279 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_ptr) {
9280 LDKMonitorUpdateError this_ptr_conv;
9281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9282 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9283 MonitorUpdateError_free(this_ptr_conv);
9286 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
9287 LDKMonitorUpdateError orig_conv;
9288 orig_conv.inner = (void*)(orig & (~1));
9289 orig_conv.is_owned = false;
9290 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
9291 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9292 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9293 long ret_ref = (long)ret_var.inner;
9294 if (ret_var.is_owned) {
9300 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
9301 if ((this_ptr & 1) != 0) return;
9302 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
9303 FREE((void*)this_ptr);
9304 MonitorEvent_free(this_ptr_conv);
9307 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
9308 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
9309 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
9310 *ret_copy = MonitorEvent_clone(orig_conv);
9311 long ret_ref = (long)ret_copy;
9315 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_ptr) {
9316 LDKHTLCUpdate this_ptr_conv;
9317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9318 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9319 HTLCUpdate_free(this_ptr_conv);
9322 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
9323 LDKHTLCUpdate orig_conv;
9324 orig_conv.inner = (void*)(orig & (~1));
9325 orig_conv.is_owned = false;
9326 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
9327 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9328 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9329 long ret_ref = (long)ret_var.inner;
9330 if (ret_var.is_owned) {
9336 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
9337 LDKHTLCUpdate obj_conv;
9338 obj_conv.inner = (void*)(obj & (~1));
9339 obj_conv.is_owned = false;
9340 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
9341 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9342 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9343 CVec_u8Z_free(ret_var);
9347 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
9349 ser_ref.datalen = *((uint32_t*)ser);
9350 ser_ref.data = (int8_t*)(ser + 4);
9351 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9352 *ret_conv = HTLCUpdate_read(ser_ref);
9353 return (long)ret_conv;
9356 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_ptr) {
9357 LDKChannelMonitor this_ptr_conv;
9358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9359 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9360 ChannelMonitor_free(this_ptr_conv);
9363 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
9364 LDKChannelMonitor orig_conv;
9365 orig_conv.inner = (void*)(orig & (~1));
9366 orig_conv.is_owned = false;
9367 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
9368 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9369 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9370 long ret_ref = (long)ret_var.inner;
9371 if (ret_var.is_owned) {
9377 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
9378 LDKChannelMonitor obj_conv;
9379 obj_conv.inner = (void*)(obj & (~1));
9380 obj_conv.is_owned = false;
9381 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
9382 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9383 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9384 CVec_u8Z_free(ret_var);
9388 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) {
9389 LDKChannelMonitor this_arg_conv;
9390 this_arg_conv.inner = (void*)(this_arg & (~1));
9391 this_arg_conv.is_owned = false;
9392 LDKChannelMonitorUpdate updates_conv;
9393 updates_conv.inner = (void*)(updates & (~1));
9394 updates_conv.is_owned = false;
9395 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
9396 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator;
9397 LDKLogger* logger_conv = (LDKLogger*)logger;
9398 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
9399 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
9400 return (long)ret_conv;
9403 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
9404 LDKChannelMonitor this_arg_conv;
9405 this_arg_conv.inner = (void*)(this_arg & (~1));
9406 this_arg_conv.is_owned = false;
9407 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
9411 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
9412 LDKChannelMonitor this_arg_conv;
9413 this_arg_conv.inner = (void*)(this_arg & (~1));
9414 this_arg_conv.is_owned = false;
9415 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
9416 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
9417 return (long)ret_ref;
9420 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
9421 LDKChannelMonitor this_arg_conv;
9422 this_arg_conv.inner = (void*)(this_arg & (~1));
9423 this_arg_conv.is_owned = false;
9424 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
9425 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9426 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9427 for (size_t o = 0; o < ret_var.datalen; o++) {
9428 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
9429 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
9430 long ret_conv_14_ref = (long)ret_conv_14_copy;
9431 ret_arr_ptr[o] = ret_conv_14_ref;
9437 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
9438 LDKChannelMonitor this_arg_conv;
9439 this_arg_conv.inner = (void*)(this_arg & (~1));
9440 this_arg_conv.is_owned = false;
9441 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
9442 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9443 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9444 for (size_t h = 0; h < ret_var.datalen; h++) {
9445 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
9446 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
9447 long ret_conv_7_ref = (long)ret_conv_7_copy;
9448 ret_arr_ptr[h] = ret_conv_7_ref;
9454 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
9455 LDKChannelMonitor this_arg_conv;
9456 this_arg_conv.inner = (void*)(this_arg & (~1));
9457 this_arg_conv.is_owned = false;
9458 LDKLogger* logger_conv = (LDKLogger*)logger;
9459 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
9460 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
9461 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
9462 for (size_t m = 0; m < ret_var.datalen; m++) {
9463 LDKTransaction ret_conv_12_var = ret_var.data[m];
9464 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9465 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
9466 Transaction_free(ret_conv_12_var);
9467 ret_arr_ptr[m] = ret_conv_12_arr;
9473 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) {
9474 LDKChannelMonitor this_arg_conv;
9475 this_arg_conv.inner = (void*)(this_arg & (~1));
9476 this_arg_conv.is_owned = false;
9477 unsigned char header_arr[80];
9478 CHECK(*((uint32_t*)header) == 80);
9479 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9480 unsigned char (*header_ref)[80] = &header_arr;
9481 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9482 txdata_constr.datalen = *((uint32_t*)txdata);
9483 if (txdata_constr.datalen > 0)
9484 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9486 txdata_constr.data = NULL;
9487 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
9488 for (size_t e = 0; e < txdata_constr.datalen; e++) {
9489 uint32_t txdata_conv_30 = txdata_vals[e];
9490 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
9491 FREE((void*)txdata_conv_30);
9492 txdata_constr.data[e] = txdata_conv_30_conv;
9494 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
9495 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
9496 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9497 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);
9498 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9499 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9500 for (size_t x = 0; x < ret_var.datalen; x++) {
9501 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
9502 *ret_conv_49_ref = ret_var.data[x];
9503 ret_arr_ptr[x] = (long)ret_conv_49_ref;
9509 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) {
9510 LDKChannelMonitor this_arg_conv;
9511 this_arg_conv.inner = (void*)(this_arg & (~1));
9512 this_arg_conv.is_owned = false;
9513 unsigned char header_arr[80];
9514 CHECK(*((uint32_t*)header) == 80);
9515 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9516 unsigned char (*header_ref)[80] = &header_arr;
9517 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
9518 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
9519 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9520 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
9523 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
9524 if ((this_ptr & 1) != 0) return;
9525 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
9526 FREE((void*)this_ptr);
9527 Persist_free(this_ptr_conv);
9530 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
9532 ser_ref.datalen = *((uint32_t*)ser);
9533 ser_ref.data = (int8_t*)(ser + 4);
9534 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
9535 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
9536 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
9537 return (long)ret_conv;
9540 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_ptr) {
9541 LDKOutPoint this_ptr_conv;
9542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9543 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9544 OutPoint_free(this_ptr_conv);
9547 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
9548 LDKOutPoint this_ptr_conv;
9549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9550 this_ptr_conv.is_owned = false;
9551 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9552 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
9556 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
9557 LDKOutPoint this_ptr_conv;
9558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9559 this_ptr_conv.is_owned = false;
9560 LDKThirtyTwoBytes val_ref;
9561 CHECK(*((uint32_t*)val) == 32);
9562 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
9563 OutPoint_set_txid(&this_ptr_conv, val_ref);
9566 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
9567 LDKOutPoint this_ptr_conv;
9568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9569 this_ptr_conv.is_owned = false;
9570 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
9574 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
9575 LDKOutPoint this_ptr_conv;
9576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9577 this_ptr_conv.is_owned = false;
9578 OutPoint_set_index(&this_ptr_conv, val);
9581 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
9582 LDKThirtyTwoBytes txid_arg_ref;
9583 CHECK(*((uint32_t*)txid_arg) == 32);
9584 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
9585 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
9586 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9587 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9588 long ret_ref = (long)ret_var.inner;
9589 if (ret_var.is_owned) {
9595 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
9596 LDKOutPoint orig_conv;
9597 orig_conv.inner = (void*)(orig & (~1));
9598 orig_conv.is_owned = false;
9599 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
9600 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9601 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9602 long ret_ref = (long)ret_var.inner;
9603 if (ret_var.is_owned) {
9609 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
9610 LDKOutPoint this_arg_conv;
9611 this_arg_conv.inner = (void*)(this_arg & (~1));
9612 this_arg_conv.is_owned = false;
9613 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9614 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
9618 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
9619 LDKOutPoint obj_conv;
9620 obj_conv.inner = (void*)(obj & (~1));
9621 obj_conv.is_owned = false;
9622 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
9623 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9624 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9625 CVec_u8Z_free(ret_var);
9629 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
9631 ser_ref.datalen = *((uint32_t*)ser);
9632 ser_ref.data = (int8_t*)(ser + 4);
9633 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9634 *ret_conv = OutPoint_read(ser_ref);
9635 return (long)ret_conv;
9638 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_ptr) {
9639 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9641 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9642 DelayedPaymentOutputDescriptor_free(this_ptr_conv);
9645 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
9646 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9648 this_ptr_conv.is_owned = false;
9649 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
9650 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9651 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9652 long ret_ref = (long)ret_var.inner;
9653 if (ret_var.is_owned) {
9659 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
9660 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9662 this_ptr_conv.is_owned = false;
9663 LDKOutPoint val_conv;
9664 val_conv.inner = (void*)(val & (~1));
9665 val_conv.is_owned = (val & 1) || (val == 0);
9666 val_conv = OutPoint_clone(&val_conv);
9667 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
9670 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
9671 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9673 this_ptr_conv.is_owned = false;
9674 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
9675 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
9679 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
9680 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9682 this_ptr_conv.is_owned = false;
9683 LDKPublicKey val_ref;
9684 CHECK(*((uint32_t*)val) == 33);
9685 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
9686 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
9689 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
9690 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9692 this_ptr_conv.is_owned = false;
9693 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
9697 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
9698 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9700 this_ptr_conv.is_owned = false;
9701 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
9704 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
9705 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9707 this_ptr_conv.is_owned = false;
9708 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
9710 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
9713 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
9714 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9716 this_ptr_conv.is_owned = false;
9717 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
9718 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
9722 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
9723 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9725 this_ptr_conv.is_owned = false;
9726 LDKPublicKey val_ref;
9727 CHECK(*((uint32_t*)val) == 33);
9728 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
9729 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
9732 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
9733 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9735 this_ptr_conv.is_owned = false;
9736 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9737 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
9741 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
9742 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9744 this_ptr_conv.is_owned = false;
9745 LDKThirtyTwoBytes val_ref;
9746 CHECK(*((uint32_t*)val) == 32);
9747 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
9748 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
9751 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
9752 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9754 this_ptr_conv.is_owned = false;
9755 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
9759 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
9760 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9762 this_ptr_conv.is_owned = false;
9763 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
9766 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) {
9767 LDKOutPoint outpoint_arg_conv;
9768 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
9769 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
9770 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
9771 LDKPublicKey per_commitment_point_arg_ref;
9772 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
9773 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
9774 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
9775 FREE((void*)output_arg);
9776 LDKPublicKey revocation_pubkey_arg_ref;
9777 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
9778 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
9779 LDKThirtyTwoBytes channel_keys_id_arg_ref;
9780 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
9781 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
9782 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);
9783 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9784 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9785 long ret_ref = (long)ret_var.inner;
9786 if (ret_var.is_owned) {
9792 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
9793 LDKDelayedPaymentOutputDescriptor orig_conv;
9794 orig_conv.inner = (void*)(orig & (~1));
9795 orig_conv.is_owned = false;
9796 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
9797 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9798 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9799 long ret_ref = (long)ret_var.inner;
9800 if (ret_var.is_owned) {
9806 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_ptr) {
9807 LDKStaticPaymentOutputDescriptor this_ptr_conv;
9808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9809 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9810 StaticPaymentOutputDescriptor_free(this_ptr_conv);
9813 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
9814 LDKStaticPaymentOutputDescriptor this_ptr_conv;
9815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9816 this_ptr_conv.is_owned = false;
9817 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
9818 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9819 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9820 long ret_ref = (long)ret_var.inner;
9821 if (ret_var.is_owned) {
9827 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
9828 LDKStaticPaymentOutputDescriptor this_ptr_conv;
9829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9830 this_ptr_conv.is_owned = false;
9831 LDKOutPoint val_conv;
9832 val_conv.inner = (void*)(val & (~1));
9833 val_conv.is_owned = (val & 1) || (val == 0);
9834 val_conv = OutPoint_clone(&val_conv);
9835 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
9838 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
9839 LDKStaticPaymentOutputDescriptor this_ptr_conv;
9840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9841 this_ptr_conv.is_owned = false;
9842 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
9844 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
9847 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
9848 LDKStaticPaymentOutputDescriptor this_ptr_conv;
9849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9850 this_ptr_conv.is_owned = false;
9851 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9852 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
9856 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
9857 LDKStaticPaymentOutputDescriptor this_ptr_conv;
9858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9859 this_ptr_conv.is_owned = false;
9860 LDKThirtyTwoBytes val_ref;
9861 CHECK(*((uint32_t*)val) == 32);
9862 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
9863 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
9866 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
9867 LDKStaticPaymentOutputDescriptor this_ptr_conv;
9868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9869 this_ptr_conv.is_owned = false;
9870 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
9874 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
9875 LDKStaticPaymentOutputDescriptor this_ptr_conv;
9876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9877 this_ptr_conv.is_owned = false;
9878 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
9881 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) {
9882 LDKOutPoint outpoint_arg_conv;
9883 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
9884 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
9885 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
9886 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
9887 FREE((void*)output_arg);
9888 LDKThirtyTwoBytes channel_keys_id_arg_ref;
9889 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
9890 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
9891 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
9892 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9893 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9894 long ret_ref = (long)ret_var.inner;
9895 if (ret_var.is_owned) {
9901 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
9902 LDKStaticPaymentOutputDescriptor orig_conv;
9903 orig_conv.inner = (void*)(orig & (~1));
9904 orig_conv.is_owned = false;
9905 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
9906 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9907 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9908 long ret_ref = (long)ret_var.inner;
9909 if (ret_var.is_owned) {
9915 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
9916 if ((this_ptr & 1) != 0) return;
9917 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
9918 FREE((void*)this_ptr);
9919 SpendableOutputDescriptor_free(this_ptr_conv);
9922 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
9923 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
9924 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
9925 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
9926 long ret_ref = (long)ret_copy;
9930 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
9931 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
9932 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
9933 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9934 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9935 CVec_u8Z_free(ret_var);
9939 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
9941 ser_ref.datalen = *((uint32_t*)ser);
9942 ser_ref.data = (int8_t*)(ser + 4);
9943 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9944 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
9945 return (long)ret_conv;
9948 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
9949 LDKSign* orig_conv = (LDKSign*)orig;
9950 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
9951 *ret = Sign_clone(orig_conv);
9955 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
9956 if ((this_ptr & 1) != 0) return;
9957 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
9958 FREE((void*)this_ptr);
9959 Sign_free(this_ptr_conv);
9962 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
9963 if ((this_ptr & 1) != 0) return;
9964 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
9965 FREE((void*)this_ptr);
9966 KeysInterface_free(this_ptr_conv);
9969 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_ptr) {
9970 LDKInMemorySigner this_ptr_conv;
9971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9972 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9973 InMemorySigner_free(this_ptr_conv);
9976 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
9977 LDKInMemorySigner this_ptr_conv;
9978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9979 this_ptr_conv.is_owned = false;
9980 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9981 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
9985 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
9986 LDKInMemorySigner this_ptr_conv;
9987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9988 this_ptr_conv.is_owned = false;
9989 LDKSecretKey val_ref;
9990 CHECK(*((uint32_t*)val) == 32);
9991 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
9992 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
9995 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
9996 LDKInMemorySigner this_ptr_conv;
9997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9998 this_ptr_conv.is_owned = false;
9999 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10000 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
10004 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
10005 LDKInMemorySigner this_ptr_conv;
10006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10007 this_ptr_conv.is_owned = false;
10008 LDKSecretKey val_ref;
10009 CHECK(*((uint32_t*)val) == 32);
10010 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10011 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
10014 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
10015 LDKInMemorySigner this_ptr_conv;
10016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10017 this_ptr_conv.is_owned = false;
10018 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10019 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
10023 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
10024 LDKInMemorySigner this_ptr_conv;
10025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10026 this_ptr_conv.is_owned = false;
10027 LDKSecretKey val_ref;
10028 CHECK(*((uint32_t*)val) == 32);
10029 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10030 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
10033 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
10034 LDKInMemorySigner this_ptr_conv;
10035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10036 this_ptr_conv.is_owned = false;
10037 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10038 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
10042 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
10043 LDKInMemorySigner this_ptr_conv;
10044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10045 this_ptr_conv.is_owned = false;
10046 LDKSecretKey val_ref;
10047 CHECK(*((uint32_t*)val) == 32);
10048 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10049 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
10052 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
10053 LDKInMemorySigner this_ptr_conv;
10054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10055 this_ptr_conv.is_owned = false;
10056 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10057 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
10061 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
10062 LDKInMemorySigner this_ptr_conv;
10063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10064 this_ptr_conv.is_owned = false;
10065 LDKSecretKey val_ref;
10066 CHECK(*((uint32_t*)val) == 32);
10067 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10068 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
10071 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
10072 LDKInMemorySigner this_ptr_conv;
10073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10074 this_ptr_conv.is_owned = false;
10075 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10076 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
10080 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
10081 LDKInMemorySigner this_ptr_conv;
10082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10083 this_ptr_conv.is_owned = false;
10084 LDKThirtyTwoBytes val_ref;
10085 CHECK(*((uint32_t*)val) == 32);
10086 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10087 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
10090 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
10091 LDKInMemorySigner orig_conv;
10092 orig_conv.inner = (void*)(orig & (~1));
10093 orig_conv.is_owned = false;
10094 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
10095 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10096 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10097 long ret_ref = (long)ret_var.inner;
10098 if (ret_var.is_owned) {
10104 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) {
10105 LDKSecretKey funding_key_ref;
10106 CHECK(*((uint32_t*)funding_key) == 32);
10107 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
10108 LDKSecretKey revocation_base_key_ref;
10109 CHECK(*((uint32_t*)revocation_base_key) == 32);
10110 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
10111 LDKSecretKey payment_key_ref;
10112 CHECK(*((uint32_t*)payment_key) == 32);
10113 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
10114 LDKSecretKey delayed_payment_base_key_ref;
10115 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
10116 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
10117 LDKSecretKey htlc_base_key_ref;
10118 CHECK(*((uint32_t*)htlc_base_key) == 32);
10119 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
10120 LDKThirtyTwoBytes commitment_seed_ref;
10121 CHECK(*((uint32_t*)commitment_seed) == 32);
10122 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
10123 LDKThirtyTwoBytes channel_keys_id_ref;
10124 CHECK(*((uint32_t*)channel_keys_id) == 32);
10125 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
10126 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);
10127 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10128 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10129 long ret_ref = (long)ret_var.inner;
10130 if (ret_var.is_owned) {
10136 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
10137 LDKInMemorySigner this_arg_conv;
10138 this_arg_conv.inner = (void*)(this_arg & (~1));
10139 this_arg_conv.is_owned = false;
10140 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
10141 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10142 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10143 long ret_ref = (long)ret_var.inner;
10144 if (ret_var.is_owned) {
10150 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
10151 LDKInMemorySigner this_arg_conv;
10152 this_arg_conv.inner = (void*)(this_arg & (~1));
10153 this_arg_conv.is_owned = false;
10154 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
10158 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
10159 LDKInMemorySigner this_arg_conv;
10160 this_arg_conv.inner = (void*)(this_arg & (~1));
10161 this_arg_conv.is_owned = false;
10162 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
10166 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
10167 LDKInMemorySigner this_arg_conv;
10168 this_arg_conv.inner = (void*)(this_arg & (~1));
10169 this_arg_conv.is_owned = false;
10170 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
10174 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
10175 LDKInMemorySigner this_arg_conv;
10176 this_arg_conv.inner = (void*)(this_arg & (~1));
10177 this_arg_conv.is_owned = false;
10178 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
10179 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10180 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10181 long ret_ref = (long)ret_var.inner;
10182 if (ret_var.is_owned) {
10188 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
10189 LDKInMemorySigner this_arg_conv;
10190 this_arg_conv.inner = (void*)(this_arg & (~1));
10191 this_arg_conv.is_owned = false;
10192 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
10193 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10194 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10195 long ret_ref = (long)ret_var.inner;
10196 if (ret_var.is_owned) {
10202 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) {
10203 LDKInMemorySigner this_arg_conv;
10204 this_arg_conv.inner = (void*)(this_arg & (~1));
10205 this_arg_conv.is_owned = false;
10206 LDKTransaction spend_tx_ref;
10207 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
10208 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
10209 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
10210 spend_tx_ref.data_is_owned = true;
10211 LDKStaticPaymentOutputDescriptor descriptor_conv;
10212 descriptor_conv.inner = (void*)(descriptor & (~1));
10213 descriptor_conv.is_owned = false;
10214 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10215 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
10216 return (long)ret_conv;
10219 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) {
10220 LDKInMemorySigner this_arg_conv;
10221 this_arg_conv.inner = (void*)(this_arg & (~1));
10222 this_arg_conv.is_owned = false;
10223 LDKTransaction spend_tx_ref;
10224 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
10225 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
10226 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
10227 spend_tx_ref.data_is_owned = true;
10228 LDKDelayedPaymentOutputDescriptor descriptor_conv;
10229 descriptor_conv.inner = (void*)(descriptor & (~1));
10230 descriptor_conv.is_owned = false;
10231 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10232 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
10233 return (long)ret_conv;
10236 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
10237 LDKInMemorySigner this_arg_conv;
10238 this_arg_conv.inner = (void*)(this_arg & (~1));
10239 this_arg_conv.is_owned = false;
10240 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
10241 *ret = InMemorySigner_as_Sign(&this_arg_conv);
10245 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
10246 LDKInMemorySigner obj_conv;
10247 obj_conv.inner = (void*)(obj & (~1));
10248 obj_conv.is_owned = false;
10249 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
10250 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10251 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10252 CVec_u8Z_free(ret_var);
10256 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
10257 LDKu8slice ser_ref;
10258 ser_ref.datalen = *((uint32_t*)ser);
10259 ser_ref.data = (int8_t*)(ser + 4);
10260 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10261 *ret_conv = InMemorySigner_read(ser_ref);
10262 return (long)ret_conv;
10265 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_ptr) {
10266 LDKKeysManager this_ptr_conv;
10267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10268 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10269 KeysManager_free(this_ptr_conv);
10272 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
10273 unsigned char seed_arr[32];
10274 CHECK(*((uint32_t*)seed) == 32);
10275 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
10276 unsigned char (*seed_ref)[32] = &seed_arr;
10277 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
10278 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10279 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10280 long ret_ref = (long)ret_var.inner;
10281 if (ret_var.is_owned) {
10287 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
10288 LDKKeysManager this_arg_conv;
10289 this_arg_conv.inner = (void*)(this_arg & (~1));
10290 this_arg_conv.is_owned = false;
10291 unsigned char params_arr[32];
10292 CHECK(*((uint32_t*)params) == 32);
10293 memcpy(params_arr, (uint8_t*)(params + 4), 32);
10294 unsigned char (*params_ref)[32] = ¶ms_arr;
10295 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
10296 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10297 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10298 long ret_ref = (long)ret_var.inner;
10299 if (ret_var.is_owned) {
10305 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) {
10306 LDKKeysManager this_arg_conv;
10307 this_arg_conv.inner = (void*)(this_arg & (~1));
10308 this_arg_conv.is_owned = false;
10309 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
10310 descriptors_constr.datalen = *((uint32_t*)descriptors);
10311 if (descriptors_constr.datalen > 0)
10312 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
10314 descriptors_constr.data = NULL;
10315 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
10316 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
10317 uint32_t descriptors_conv_27 = descriptors_vals[b];
10318 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
10319 FREE((void*)descriptors_conv_27);
10320 descriptors_constr.data[b] = descriptors_conv_27_conv;
10322 LDKCVec_TxOutZ outputs_constr;
10323 outputs_constr.datalen = *((uint32_t*)outputs);
10324 if (outputs_constr.datalen > 0)
10325 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
10327 outputs_constr.data = NULL;
10328 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
10329 for (size_t h = 0; h < outputs_constr.datalen; h++) {
10330 uint32_t outputs_conv_7 = outputs_vals[h];
10331 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
10332 FREE((void*)outputs_conv_7);
10333 outputs_constr.data[h] = outputs_conv_7_conv;
10335 LDKCVec_u8Z change_destination_script_ref;
10336 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
10337 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
10338 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
10339 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10340 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
10341 return (long)ret_conv;
10344 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
10345 LDKKeysManager this_arg_conv;
10346 this_arg_conv.inner = (void*)(this_arg & (~1));
10347 this_arg_conv.is_owned = false;
10348 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
10349 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
10353 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_ptr) {
10354 LDKChannelManager this_ptr_conv;
10355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10356 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10357 ChannelManager_free(this_ptr_conv);
10360 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_ptr) {
10361 LDKChainParameters this_ptr_conv;
10362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10363 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10364 ChainParameters_free(this_ptr_conv);
10367 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
10368 LDKChainParameters this_ptr_conv;
10369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10370 this_ptr_conv.is_owned = false;
10371 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
10375 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
10376 LDKChainParameters this_ptr_conv;
10377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10378 this_ptr_conv.is_owned = false;
10379 LDKNetwork val_conv = LDKNetwork_from_js(val);
10380 ChainParameters_set_network(&this_ptr_conv, val_conv);
10383 int8_tArray __attribute__((visibility("default"))) TS_ChainParameters_get_latest_hash(uint32_t this_ptr) {
10384 LDKChainParameters this_ptr_conv;
10385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10386 this_ptr_conv.is_owned = false;
10387 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10388 memcpy((uint8_t*)(ret_arr + 4), *ChainParameters_get_latest_hash(&this_ptr_conv), 32);
10392 void __attribute__((visibility("default"))) TS_ChainParameters_set_latest_hash(uint32_t this_ptr, int8_tArray val) {
10393 LDKChainParameters this_ptr_conv;
10394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10395 this_ptr_conv.is_owned = false;
10396 LDKThirtyTwoBytes val_ref;
10397 CHECK(*((uint32_t*)val) == 32);
10398 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10399 ChainParameters_set_latest_hash(&this_ptr_conv, val_ref);
10402 int64_t __attribute__((visibility("default"))) TS_ChainParameters_get_latest_height(uint32_t this_ptr) {
10403 LDKChainParameters this_ptr_conv;
10404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10405 this_ptr_conv.is_owned = false;
10406 int64_t ret_val = ChainParameters_get_latest_height(&this_ptr_conv);
10410 void __attribute__((visibility("default"))) TS_ChainParameters_set_latest_height(uint32_t this_ptr, int64_t val) {
10411 LDKChainParameters this_ptr_conv;
10412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10413 this_ptr_conv.is_owned = false;
10414 ChainParameters_set_latest_height(&this_ptr_conv, val);
10417 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, int8_tArray latest_hash_arg, int64_t latest_height_arg) {
10418 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
10419 LDKThirtyTwoBytes latest_hash_arg_ref;
10420 CHECK(*((uint32_t*)latest_hash_arg) == 32);
10421 memcpy(latest_hash_arg_ref.data, (uint8_t*)(latest_hash_arg + 4), 32);
10422 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, latest_hash_arg_ref, latest_height_arg);
10423 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10424 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10425 long ret_ref = (long)ret_var.inner;
10426 if (ret_var.is_owned) {
10432 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_ptr) {
10433 LDKChannelDetails this_ptr_conv;
10434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10435 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10436 ChannelDetails_free(this_ptr_conv);
10439 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
10440 LDKChannelDetails this_ptr_conv;
10441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10442 this_ptr_conv.is_owned = false;
10443 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10444 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
10448 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
10449 LDKChannelDetails this_ptr_conv;
10450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10451 this_ptr_conv.is_owned = false;
10452 LDKThirtyTwoBytes val_ref;
10453 CHECK(*((uint32_t*)val) == 32);
10454 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10455 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
10458 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_remote_network_id(uint32_t this_ptr) {
10459 LDKChannelDetails this_ptr_conv;
10460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10461 this_ptr_conv.is_owned = false;
10462 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10463 memcpy((uint8_t*)(ret_arr + 4), ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form, 33);
10467 void __attribute__((visibility("default"))) TS_ChannelDetails_set_remote_network_id(uint32_t this_ptr, int8_tArray val) {
10468 LDKChannelDetails this_ptr_conv;
10469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10470 this_ptr_conv.is_owned = false;
10471 LDKPublicKey val_ref;
10472 CHECK(*((uint32_t*)val) == 33);
10473 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10474 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
10477 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty_features(uint32_t this_ptr) {
10478 LDKChannelDetails this_ptr_conv;
10479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10480 this_ptr_conv.is_owned = false;
10481 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
10482 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10483 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10484 long ret_ref = (long)ret_var.inner;
10485 if (ret_var.is_owned) {
10491 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty_features(uint32_t this_ptr, uint32_t val) {
10492 LDKChannelDetails this_ptr_conv;
10493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10494 this_ptr_conv.is_owned = false;
10495 LDKInitFeatures val_conv;
10496 val_conv.inner = (void*)(val & (~1));
10497 val_conv.is_owned = (val & 1) || (val == 0);
10498 val_conv = InitFeatures_clone(&val_conv);
10499 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
10502 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
10503 LDKChannelDetails this_ptr_conv;
10504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10505 this_ptr_conv.is_owned = false;
10506 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
10510 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
10511 LDKChannelDetails this_ptr_conv;
10512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10513 this_ptr_conv.is_owned = false;
10514 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
10517 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_id(uint32_t this_ptr) {
10518 LDKChannelDetails this_ptr_conv;
10519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10520 this_ptr_conv.is_owned = false;
10521 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
10525 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_id(uint32_t this_ptr, int64_t val) {
10526 LDKChannelDetails this_ptr_conv;
10527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10528 this_ptr_conv.is_owned = false;
10529 ChannelDetails_set_user_id(&this_ptr_conv, val);
10532 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
10533 LDKChannelDetails this_ptr_conv;
10534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10535 this_ptr_conv.is_owned = false;
10536 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
10540 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
10541 LDKChannelDetails this_ptr_conv;
10542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10543 this_ptr_conv.is_owned = false;
10544 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
10547 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
10548 LDKChannelDetails this_ptr_conv;
10549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10550 this_ptr_conv.is_owned = false;
10551 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
10555 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
10556 LDKChannelDetails this_ptr_conv;
10557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10558 this_ptr_conv.is_owned = false;
10559 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
10562 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_live(uint32_t this_ptr) {
10563 LDKChannelDetails this_ptr_conv;
10564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10565 this_ptr_conv.is_owned = false;
10566 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
10570 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_live(uint32_t this_ptr, jboolean val) {
10571 LDKChannelDetails this_ptr_conv;
10572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10573 this_ptr_conv.is_owned = false;
10574 ChannelDetails_set_is_live(&this_ptr_conv, val);
10577 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
10578 LDKChannelDetails orig_conv;
10579 orig_conv.inner = (void*)(orig & (~1));
10580 orig_conv.is_owned = false;
10581 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
10582 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10583 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10584 long ret_ref = (long)ret_var.inner;
10585 if (ret_var.is_owned) {
10591 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
10592 if ((this_ptr & 1) != 0) return;
10593 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
10594 FREE((void*)this_ptr);
10595 PaymentSendFailure_free(this_ptr_conv);
10598 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
10599 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
10600 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
10601 *ret_copy = PaymentSendFailure_clone(orig_conv);
10602 long ret_ref = (long)ret_copy;
10606 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) {
10607 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
10608 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
10609 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
10610 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10611 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
10612 LDKUserConfig config_conv;
10613 config_conv.inner = (void*)(config & (~1));
10614 config_conv.is_owned = (config & 1) || (config == 0);
10615 config_conv = UserConfig_clone(&config_conv);
10616 LDKChainParameters params_conv;
10617 params_conv.inner = (void*)(params & (~1));
10618 params_conv.is_owned = (params & 1) || (params == 0);
10619 // Warning: we need a move here but no clone is available for LDKChainParameters
10620 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
10621 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10622 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10623 long ret_ref = (long)ret_var.inner;
10624 if (ret_var.is_owned) {
10630 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) {
10631 LDKChannelManager this_arg_conv;
10632 this_arg_conv.inner = (void*)(this_arg & (~1));
10633 this_arg_conv.is_owned = false;
10634 LDKPublicKey their_network_key_ref;
10635 CHECK(*((uint32_t*)their_network_key) == 33);
10636 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
10637 LDKUserConfig override_config_conv;
10638 override_config_conv.inner = (void*)(override_config & (~1));
10639 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
10640 override_config_conv = UserConfig_clone(&override_config_conv);
10641 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10642 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
10643 return (long)ret_conv;
10646 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
10647 LDKChannelManager this_arg_conv;
10648 this_arg_conv.inner = (void*)(this_arg & (~1));
10649 this_arg_conv.is_owned = false;
10650 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
10651 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10652 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10653 for (size_t q = 0; q < ret_var.datalen; q++) {
10654 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
10655 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10656 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10657 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
10658 if (ret_conv_16_var.is_owned) {
10659 ret_conv_16_ref |= 1;
10661 ret_arr_ptr[q] = ret_conv_16_ref;
10663 FREE(ret_var.data);
10667 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
10668 LDKChannelManager this_arg_conv;
10669 this_arg_conv.inner = (void*)(this_arg & (~1));
10670 this_arg_conv.is_owned = false;
10671 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
10672 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10673 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10674 for (size_t q = 0; q < ret_var.datalen; q++) {
10675 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
10676 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10677 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10678 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
10679 if (ret_conv_16_var.is_owned) {
10680 ret_conv_16_ref |= 1;
10682 ret_arr_ptr[q] = ret_conv_16_ref;
10684 FREE(ret_var.data);
10688 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
10689 LDKChannelManager this_arg_conv;
10690 this_arg_conv.inner = (void*)(this_arg & (~1));
10691 this_arg_conv.is_owned = false;
10692 unsigned char channel_id_arr[32];
10693 CHECK(*((uint32_t*)channel_id) == 32);
10694 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
10695 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
10696 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10697 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
10698 return (long)ret_conv;
10701 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
10702 LDKChannelManager this_arg_conv;
10703 this_arg_conv.inner = (void*)(this_arg & (~1));
10704 this_arg_conv.is_owned = false;
10705 unsigned char channel_id_arr[32];
10706 CHECK(*((uint32_t*)channel_id) == 32);
10707 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
10708 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
10709 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10710 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
10711 return (long)ret_conv;
10714 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
10715 LDKChannelManager this_arg_conv;
10716 this_arg_conv.inner = (void*)(this_arg & (~1));
10717 this_arg_conv.is_owned = false;
10718 ChannelManager_force_close_all_channels(&this_arg_conv);
10721 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
10722 LDKChannelManager this_arg_conv;
10723 this_arg_conv.inner = (void*)(this_arg & (~1));
10724 this_arg_conv.is_owned = false;
10725 LDKRoute route_conv;
10726 route_conv.inner = (void*)(route & (~1));
10727 route_conv.is_owned = false;
10728 LDKThirtyTwoBytes payment_hash_ref;
10729 CHECK(*((uint32_t*)payment_hash) == 32);
10730 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
10731 LDKThirtyTwoBytes payment_secret_ref;
10732 CHECK(*((uint32_t*)payment_secret) == 32);
10733 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
10734 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10735 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
10736 return (long)ret_conv;
10739 void __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, uint32_t funding_txo) {
10740 LDKChannelManager this_arg_conv;
10741 this_arg_conv.inner = (void*)(this_arg & (~1));
10742 this_arg_conv.is_owned = false;
10743 unsigned char temporary_channel_id_arr[32];
10744 CHECK(*((uint32_t*)temporary_channel_id) == 32);
10745 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
10746 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
10747 LDKOutPoint funding_txo_conv;
10748 funding_txo_conv.inner = (void*)(funding_txo & (~1));
10749 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
10750 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
10751 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
10754 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
10755 LDKChannelManager this_arg_conv;
10756 this_arg_conv.inner = (void*)(this_arg & (~1));
10757 this_arg_conv.is_owned = false;
10758 LDKThreeBytes rgb_ref;
10759 CHECK(*((uint32_t*)rgb) == 3);
10760 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
10761 LDKThirtyTwoBytes alias_ref;
10762 CHECK(*((uint32_t*)alias) == 32);
10763 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
10764 LDKCVec_NetAddressZ addresses_constr;
10765 addresses_constr.datalen = *((uint32_t*)addresses);
10766 if (addresses_constr.datalen > 0)
10767 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10769 addresses_constr.data = NULL;
10770 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
10771 for (size_t m = 0; m < addresses_constr.datalen; m++) {
10772 uint32_t addresses_conv_12 = addresses_vals[m];
10773 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
10774 FREE((void*)addresses_conv_12);
10775 addresses_constr.data[m] = addresses_conv_12_conv;
10777 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
10780 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
10781 LDKChannelManager this_arg_conv;
10782 this_arg_conv.inner = (void*)(this_arg & (~1));
10783 this_arg_conv.is_owned = false;
10784 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
10787 void __attribute__((visibility("default"))) TS_ChannelManager_timer_chan_freshness_every_min(uint32_t this_arg) {
10788 LDKChannelManager this_arg_conv;
10789 this_arg_conv.inner = (void*)(this_arg & (~1));
10790 this_arg_conv.is_owned = false;
10791 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
10794 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
10795 LDKChannelManager this_arg_conv;
10796 this_arg_conv.inner = (void*)(this_arg & (~1));
10797 this_arg_conv.is_owned = false;
10798 unsigned char payment_hash_arr[32];
10799 CHECK(*((uint32_t*)payment_hash) == 32);
10800 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
10801 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
10802 LDKThirtyTwoBytes payment_secret_ref;
10803 CHECK(*((uint32_t*)payment_secret) == 32);
10804 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
10805 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
10809 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t expected_amount) {
10810 LDKChannelManager this_arg_conv;
10811 this_arg_conv.inner = (void*)(this_arg & (~1));
10812 this_arg_conv.is_owned = false;
10813 LDKThirtyTwoBytes payment_preimage_ref;
10814 CHECK(*((uint32_t*)payment_preimage) == 32);
10815 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
10816 LDKThirtyTwoBytes payment_secret_ref;
10817 CHECK(*((uint32_t*)payment_secret) == 32);
10818 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
10819 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
10823 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
10824 LDKChannelManager this_arg_conv;
10825 this_arg_conv.inner = (void*)(this_arg & (~1));
10826 this_arg_conv.is_owned = false;
10827 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10828 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
10832 void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
10833 LDKChannelManager this_arg_conv;
10834 this_arg_conv.inner = (void*)(this_arg & (~1));
10835 this_arg_conv.is_owned = false;
10836 LDKOutPoint funding_txo_conv;
10837 funding_txo_conv.inner = (void*)(funding_txo & (~1));
10838 funding_txo_conv.is_owned = false;
10839 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
10842 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
10843 LDKChannelManager this_arg_conv;
10844 this_arg_conv.inner = (void*)(this_arg & (~1));
10845 this_arg_conv.is_owned = false;
10846 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
10847 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
10851 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
10852 LDKChannelManager this_arg_conv;
10853 this_arg_conv.inner = (void*)(this_arg & (~1));
10854 this_arg_conv.is_owned = false;
10855 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
10856 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
10860 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
10861 LDKChannelManager this_arg_conv;
10862 this_arg_conv.inner = (void*)(this_arg & (~1));
10863 this_arg_conv.is_owned = false;
10864 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
10865 *ret = ChannelManager_as_Listen(&this_arg_conv);
10869 void __attribute__((visibility("default"))) TS_ChannelManager_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
10870 LDKChannelManager this_arg_conv;
10871 this_arg_conv.inner = (void*)(this_arg & (~1));
10872 this_arg_conv.is_owned = false;
10873 unsigned char header_arr[80];
10874 CHECK(*((uint32_t*)header) == 80);
10875 memcpy(header_arr, (uint8_t*)(header + 4), 80);
10876 unsigned char (*header_ref)[80] = &header_arr;
10877 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10878 txdata_constr.datalen = *((uint32_t*)txdata);
10879 if (txdata_constr.datalen > 0)
10880 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10882 txdata_constr.data = NULL;
10883 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
10884 for (size_t e = 0; e < txdata_constr.datalen; e++) {
10885 uint32_t txdata_conv_30 = txdata_vals[e];
10886 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
10887 FREE((void*)txdata_conv_30);
10888 txdata_constr.data[e] = txdata_conv_30_conv;
10890 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
10893 void __attribute__((visibility("default"))) TS_ChannelManager_block_disconnected(uint32_t this_arg, int8_tArray header) {
10894 LDKChannelManager this_arg_conv;
10895 this_arg_conv.inner = (void*)(this_arg & (~1));
10896 this_arg_conv.is_owned = false;
10897 unsigned char header_arr[80];
10898 CHECK(*((uint32_t*)header) == 80);
10899 memcpy(header_arr, (uint8_t*)(header + 4), 80);
10900 unsigned char (*header_ref)[80] = &header_arr;
10901 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
10904 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
10905 LDKChannelManager this_arg_conv;
10906 this_arg_conv.inner = (void*)(this_arg & (~1));
10907 this_arg_conv.is_owned = false;
10908 ChannelManager_await_persistable_update(&this_arg_conv);
10911 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
10912 LDKChannelManager this_arg_conv;
10913 this_arg_conv.inner = (void*)(this_arg & (~1));
10914 this_arg_conv.is_owned = false;
10915 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
10916 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
10920 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
10921 LDKChannelManager obj_conv;
10922 obj_conv.inner = (void*)(obj & (~1));
10923 obj_conv.is_owned = false;
10924 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
10925 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10926 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10927 CVec_u8Z_free(ret_var);
10931 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_ptr) {
10932 LDKChannelManagerReadArgs this_ptr_conv;
10933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10934 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10935 ChannelManagerReadArgs_free(this_ptr_conv);
10938 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
10939 LDKChannelManagerReadArgs this_ptr_conv;
10940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10941 this_ptr_conv.is_owned = false;
10942 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
10946 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
10947 LDKChannelManagerReadArgs this_ptr_conv;
10948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10949 this_ptr_conv.is_owned = false;
10950 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
10951 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
10954 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
10955 LDKChannelManagerReadArgs this_ptr_conv;
10956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10957 this_ptr_conv.is_owned = false;
10958 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
10962 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
10963 LDKChannelManagerReadArgs this_ptr_conv;
10964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10965 this_ptr_conv.is_owned = false;
10966 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
10967 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
10970 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
10971 LDKChannelManagerReadArgs this_ptr_conv;
10972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10973 this_ptr_conv.is_owned = false;
10974 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
10978 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
10979 LDKChannelManagerReadArgs this_ptr_conv;
10980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10981 this_ptr_conv.is_owned = false;
10982 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
10983 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
10986 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
10987 LDKChannelManagerReadArgs this_ptr_conv;
10988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10989 this_ptr_conv.is_owned = false;
10990 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
10994 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
10995 LDKChannelManagerReadArgs this_ptr_conv;
10996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10997 this_ptr_conv.is_owned = false;
10998 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
10999 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
11002 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
11003 LDKChannelManagerReadArgs this_ptr_conv;
11004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11005 this_ptr_conv.is_owned = false;
11006 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
11010 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
11011 LDKChannelManagerReadArgs this_ptr_conv;
11012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11013 this_ptr_conv.is_owned = false;
11014 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
11015 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
11018 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
11019 LDKChannelManagerReadArgs this_ptr_conv;
11020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11021 this_ptr_conv.is_owned = false;
11022 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
11023 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11024 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11025 long ret_ref = (long)ret_var.inner;
11026 if (ret_var.is_owned) {
11032 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
11033 LDKChannelManagerReadArgs this_ptr_conv;
11034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11035 this_ptr_conv.is_owned = false;
11036 LDKUserConfig val_conv;
11037 val_conv.inner = (void*)(val & (~1));
11038 val_conv.is_owned = (val & 1) || (val == 0);
11039 val_conv = UserConfig_clone(&val_conv);
11040 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
11043 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) {
11044 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
11045 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
11046 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
11047 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
11048 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
11049 LDKUserConfig default_config_conv;
11050 default_config_conv.inner = (void*)(default_config & (~1));
11051 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
11052 default_config_conv = UserConfig_clone(&default_config_conv);
11053 LDKCVec_ChannelMonitorZ channel_monitors_constr;
11054 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
11055 if (channel_monitors_constr.datalen > 0)
11056 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
11058 channel_monitors_constr.data = NULL;
11059 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
11060 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
11061 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
11062 LDKChannelMonitor channel_monitors_conv_16_conv;
11063 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
11064 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
11065 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
11067 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);
11068 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11069 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11070 long ret_ref = (long)ret_var.inner;
11071 if (ret_var.is_owned) {
11077 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
11078 LDKu8slice ser_ref;
11079 ser_ref.datalen = *((uint32_t*)ser);
11080 ser_ref.data = (int8_t*)(ser + 4);
11081 LDKChannelManagerReadArgs arg_conv;
11082 arg_conv.inner = (void*)(arg & (~1));
11083 arg_conv.is_owned = (arg & 1) || (arg == 0);
11084 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
11085 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
11086 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
11087 return (long)ret_conv;
11090 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_ptr) {
11091 LDKDecodeError this_ptr_conv;
11092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11093 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11094 DecodeError_free(this_ptr_conv);
11097 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
11098 LDKDecodeError orig_conv;
11099 orig_conv.inner = (void*)(orig & (~1));
11100 orig_conv.is_owned = false;
11101 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
11102 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11103 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11104 long ret_ref = (long)ret_var.inner;
11105 if (ret_var.is_owned) {
11111 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_ptr) {
11112 LDKInit this_ptr_conv;
11113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11114 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11115 Init_free(this_ptr_conv);
11118 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
11119 LDKInit this_ptr_conv;
11120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11121 this_ptr_conv.is_owned = false;
11122 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
11123 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11124 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11125 long ret_ref = (long)ret_var.inner;
11126 if (ret_var.is_owned) {
11132 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
11133 LDKInit this_ptr_conv;
11134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11135 this_ptr_conv.is_owned = false;
11136 LDKInitFeatures val_conv;
11137 val_conv.inner = (void*)(val & (~1));
11138 val_conv.is_owned = (val & 1) || (val == 0);
11139 val_conv = InitFeatures_clone(&val_conv);
11140 Init_set_features(&this_ptr_conv, val_conv);
11143 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
11144 LDKInitFeatures features_arg_conv;
11145 features_arg_conv.inner = (void*)(features_arg & (~1));
11146 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
11147 features_arg_conv = InitFeatures_clone(&features_arg_conv);
11148 LDKInit ret_var = Init_new(features_arg_conv);
11149 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11150 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11151 long ret_ref = (long)ret_var.inner;
11152 if (ret_var.is_owned) {
11158 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
11160 orig_conv.inner = (void*)(orig & (~1));
11161 orig_conv.is_owned = false;
11162 LDKInit ret_var = Init_clone(&orig_conv);
11163 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11164 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11165 long ret_ref = (long)ret_var.inner;
11166 if (ret_var.is_owned) {
11172 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_ptr) {
11173 LDKErrorMessage this_ptr_conv;
11174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11175 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11176 ErrorMessage_free(this_ptr_conv);
11179 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
11180 LDKErrorMessage this_ptr_conv;
11181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11182 this_ptr_conv.is_owned = false;
11183 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11184 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
11188 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
11189 LDKErrorMessage this_ptr_conv;
11190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11191 this_ptr_conv.is_owned = false;
11192 LDKThirtyTwoBytes val_ref;
11193 CHECK(*((uint32_t*)val) == 32);
11194 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11195 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
11198 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
11199 LDKErrorMessage this_ptr_conv;
11200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11201 this_ptr_conv.is_owned = false;
11202 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
11203 jstring _conv = str_ref_to_ts(_str.chars, _str.len);
11207 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, int8_tArray val) {
11208 LDKErrorMessage this_ptr_conv;
11209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11210 this_ptr_conv.is_owned = false;
11211 LDKCVec_u8Z val_ref;
11212 val_ref.datalen = *((uint32_t*)val);
11213 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
11214 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
11215 ErrorMessage_set_data(&this_ptr_conv, val_ref);
11218 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
11219 LDKThirtyTwoBytes channel_id_arg_ref;
11220 CHECK(*((uint32_t*)channel_id_arg) == 32);
11221 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
11222 LDKCVec_u8Z data_arg_ref;
11223 data_arg_ref.datalen = *((uint32_t*)data_arg);
11224 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
11225 memcpy(data_arg_ref.data, (uint8_t*)(data_arg + 4), data_arg_ref.datalen);
11226 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
11227 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11228 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11229 long ret_ref = (long)ret_var.inner;
11230 if (ret_var.is_owned) {
11236 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
11237 LDKErrorMessage orig_conv;
11238 orig_conv.inner = (void*)(orig & (~1));
11239 orig_conv.is_owned = false;
11240 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
11241 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11242 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11243 long ret_ref = (long)ret_var.inner;
11244 if (ret_var.is_owned) {
11250 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_ptr) {
11251 LDKPing this_ptr_conv;
11252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11253 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11254 Ping_free(this_ptr_conv);
11257 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
11258 LDKPing this_ptr_conv;
11259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11260 this_ptr_conv.is_owned = false;
11261 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
11265 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
11266 LDKPing this_ptr_conv;
11267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11268 this_ptr_conv.is_owned = false;
11269 Ping_set_ponglen(&this_ptr_conv, val);
11272 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
11273 LDKPing this_ptr_conv;
11274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11275 this_ptr_conv.is_owned = false;
11276 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
11280 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
11281 LDKPing this_ptr_conv;
11282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11283 this_ptr_conv.is_owned = false;
11284 Ping_set_byteslen(&this_ptr_conv, val);
11287 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
11288 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
11289 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11290 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11291 long ret_ref = (long)ret_var.inner;
11292 if (ret_var.is_owned) {
11298 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
11300 orig_conv.inner = (void*)(orig & (~1));
11301 orig_conv.is_owned = false;
11302 LDKPing ret_var = Ping_clone(&orig_conv);
11303 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11304 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11305 long ret_ref = (long)ret_var.inner;
11306 if (ret_var.is_owned) {
11312 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_ptr) {
11313 LDKPong this_ptr_conv;
11314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11315 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11316 Pong_free(this_ptr_conv);
11319 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
11320 LDKPong this_ptr_conv;
11321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11322 this_ptr_conv.is_owned = false;
11323 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
11327 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
11328 LDKPong this_ptr_conv;
11329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11330 this_ptr_conv.is_owned = false;
11331 Pong_set_byteslen(&this_ptr_conv, val);
11334 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
11335 LDKPong ret_var = Pong_new(byteslen_arg);
11336 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11337 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11338 long ret_ref = (long)ret_var.inner;
11339 if (ret_var.is_owned) {
11345 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
11347 orig_conv.inner = (void*)(orig & (~1));
11348 orig_conv.is_owned = false;
11349 LDKPong ret_var = Pong_clone(&orig_conv);
11350 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11351 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11352 long ret_ref = (long)ret_var.inner;
11353 if (ret_var.is_owned) {
11359 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_ptr) {
11360 LDKOpenChannel this_ptr_conv;
11361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11362 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11363 OpenChannel_free(this_ptr_conv);
11366 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
11367 LDKOpenChannel this_ptr_conv;
11368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11369 this_ptr_conv.is_owned = false;
11370 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11371 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
11375 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
11376 LDKOpenChannel this_ptr_conv;
11377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11378 this_ptr_conv.is_owned = false;
11379 LDKThirtyTwoBytes val_ref;
11380 CHECK(*((uint32_t*)val) == 32);
11381 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11382 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
11385 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
11386 LDKOpenChannel this_ptr_conv;
11387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11388 this_ptr_conv.is_owned = false;
11389 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11390 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
11394 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
11395 LDKOpenChannel this_ptr_conv;
11396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11397 this_ptr_conv.is_owned = false;
11398 LDKThirtyTwoBytes val_ref;
11399 CHECK(*((uint32_t*)val) == 32);
11400 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11401 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
11404 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
11405 LDKOpenChannel this_ptr_conv;
11406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11407 this_ptr_conv.is_owned = false;
11408 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
11412 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
11413 LDKOpenChannel this_ptr_conv;
11414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11415 this_ptr_conv.is_owned = false;
11416 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
11419 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
11420 LDKOpenChannel this_ptr_conv;
11421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11422 this_ptr_conv.is_owned = false;
11423 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
11427 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
11428 LDKOpenChannel this_ptr_conv;
11429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11430 this_ptr_conv.is_owned = false;
11431 OpenChannel_set_push_msat(&this_ptr_conv, val);
11434 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
11435 LDKOpenChannel this_ptr_conv;
11436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11437 this_ptr_conv.is_owned = false;
11438 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
11442 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
11443 LDKOpenChannel this_ptr_conv;
11444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11445 this_ptr_conv.is_owned = false;
11446 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
11449 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
11450 LDKOpenChannel this_ptr_conv;
11451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11452 this_ptr_conv.is_owned = false;
11453 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
11457 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
11458 LDKOpenChannel this_ptr_conv;
11459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11460 this_ptr_conv.is_owned = false;
11461 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
11464 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
11465 LDKOpenChannel this_ptr_conv;
11466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11467 this_ptr_conv.is_owned = false;
11468 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
11472 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
11473 LDKOpenChannel this_ptr_conv;
11474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11475 this_ptr_conv.is_owned = false;
11476 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
11479 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
11480 LDKOpenChannel this_ptr_conv;
11481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11482 this_ptr_conv.is_owned = false;
11483 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
11487 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
11488 LDKOpenChannel this_ptr_conv;
11489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11490 this_ptr_conv.is_owned = false;
11491 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
11494 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
11495 LDKOpenChannel this_ptr_conv;
11496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11497 this_ptr_conv.is_owned = false;
11498 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
11502 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
11503 LDKOpenChannel this_ptr_conv;
11504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11505 this_ptr_conv.is_owned = false;
11506 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
11509 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
11510 LDKOpenChannel this_ptr_conv;
11511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11512 this_ptr_conv.is_owned = false;
11513 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
11517 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
11518 LDKOpenChannel this_ptr_conv;
11519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11520 this_ptr_conv.is_owned = false;
11521 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
11524 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
11525 LDKOpenChannel this_ptr_conv;
11526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11527 this_ptr_conv.is_owned = false;
11528 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
11532 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
11533 LDKOpenChannel this_ptr_conv;
11534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11535 this_ptr_conv.is_owned = false;
11536 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
11539 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
11540 LDKOpenChannel this_ptr_conv;
11541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11542 this_ptr_conv.is_owned = false;
11543 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11544 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
11548 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
11549 LDKOpenChannel this_ptr_conv;
11550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11551 this_ptr_conv.is_owned = false;
11552 LDKPublicKey val_ref;
11553 CHECK(*((uint32_t*)val) == 33);
11554 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11555 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
11558 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
11559 LDKOpenChannel this_ptr_conv;
11560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11561 this_ptr_conv.is_owned = false;
11562 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11563 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
11567 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
11568 LDKOpenChannel this_ptr_conv;
11569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11570 this_ptr_conv.is_owned = false;
11571 LDKPublicKey val_ref;
11572 CHECK(*((uint32_t*)val) == 33);
11573 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11574 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
11577 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
11578 LDKOpenChannel this_ptr_conv;
11579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11580 this_ptr_conv.is_owned = false;
11581 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11582 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
11586 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
11587 LDKOpenChannel this_ptr_conv;
11588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11589 this_ptr_conv.is_owned = false;
11590 LDKPublicKey val_ref;
11591 CHECK(*((uint32_t*)val) == 33);
11592 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11593 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
11596 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
11597 LDKOpenChannel this_ptr_conv;
11598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11599 this_ptr_conv.is_owned = false;
11600 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11601 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
11605 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
11606 LDKOpenChannel this_ptr_conv;
11607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11608 this_ptr_conv.is_owned = false;
11609 LDKPublicKey val_ref;
11610 CHECK(*((uint32_t*)val) == 33);
11611 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11612 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
11615 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
11616 LDKOpenChannel this_ptr_conv;
11617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11618 this_ptr_conv.is_owned = false;
11619 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11620 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
11624 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
11625 LDKOpenChannel this_ptr_conv;
11626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11627 this_ptr_conv.is_owned = false;
11628 LDKPublicKey val_ref;
11629 CHECK(*((uint32_t*)val) == 33);
11630 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11631 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
11634 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
11635 LDKOpenChannel this_ptr_conv;
11636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11637 this_ptr_conv.is_owned = false;
11638 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11639 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
11643 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
11644 LDKOpenChannel this_ptr_conv;
11645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11646 this_ptr_conv.is_owned = false;
11647 LDKPublicKey val_ref;
11648 CHECK(*((uint32_t*)val) == 33);
11649 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11650 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
11653 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
11654 LDKOpenChannel this_ptr_conv;
11655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11656 this_ptr_conv.is_owned = false;
11657 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
11661 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
11662 LDKOpenChannel this_ptr_conv;
11663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11664 this_ptr_conv.is_owned = false;
11665 OpenChannel_set_channel_flags(&this_ptr_conv, val);
11668 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
11669 LDKOpenChannel orig_conv;
11670 orig_conv.inner = (void*)(orig & (~1));
11671 orig_conv.is_owned = false;
11672 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
11673 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11674 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11675 long ret_ref = (long)ret_var.inner;
11676 if (ret_var.is_owned) {
11682 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_ptr) {
11683 LDKAcceptChannel this_ptr_conv;
11684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11685 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11686 AcceptChannel_free(this_ptr_conv);
11689 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
11690 LDKAcceptChannel this_ptr_conv;
11691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11692 this_ptr_conv.is_owned = false;
11693 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11694 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
11698 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
11699 LDKAcceptChannel this_ptr_conv;
11700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11701 this_ptr_conv.is_owned = false;
11702 LDKThirtyTwoBytes val_ref;
11703 CHECK(*((uint32_t*)val) == 32);
11704 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11705 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
11708 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
11709 LDKAcceptChannel this_ptr_conv;
11710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11711 this_ptr_conv.is_owned = false;
11712 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
11716 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
11717 LDKAcceptChannel this_ptr_conv;
11718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11719 this_ptr_conv.is_owned = false;
11720 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
11723 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
11724 LDKAcceptChannel this_ptr_conv;
11725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11726 this_ptr_conv.is_owned = false;
11727 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
11731 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
11732 LDKAcceptChannel this_ptr_conv;
11733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11734 this_ptr_conv.is_owned = false;
11735 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
11738 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
11739 LDKAcceptChannel this_ptr_conv;
11740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11741 this_ptr_conv.is_owned = false;
11742 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
11746 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
11747 LDKAcceptChannel this_ptr_conv;
11748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11749 this_ptr_conv.is_owned = false;
11750 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
11753 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
11754 LDKAcceptChannel this_ptr_conv;
11755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11756 this_ptr_conv.is_owned = false;
11757 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
11761 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
11762 LDKAcceptChannel this_ptr_conv;
11763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11764 this_ptr_conv.is_owned = false;
11765 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
11768 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
11769 LDKAcceptChannel this_ptr_conv;
11770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11771 this_ptr_conv.is_owned = false;
11772 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
11776 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
11777 LDKAcceptChannel this_ptr_conv;
11778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11779 this_ptr_conv.is_owned = false;
11780 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
11783 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
11784 LDKAcceptChannel this_ptr_conv;
11785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11786 this_ptr_conv.is_owned = false;
11787 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
11791 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
11792 LDKAcceptChannel this_ptr_conv;
11793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11794 this_ptr_conv.is_owned = false;
11795 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
11798 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
11799 LDKAcceptChannel this_ptr_conv;
11800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11801 this_ptr_conv.is_owned = false;
11802 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
11806 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
11807 LDKAcceptChannel this_ptr_conv;
11808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11809 this_ptr_conv.is_owned = false;
11810 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
11813 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
11814 LDKAcceptChannel this_ptr_conv;
11815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11816 this_ptr_conv.is_owned = false;
11817 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11818 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
11822 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
11823 LDKAcceptChannel this_ptr_conv;
11824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11825 this_ptr_conv.is_owned = false;
11826 LDKPublicKey val_ref;
11827 CHECK(*((uint32_t*)val) == 33);
11828 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11829 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
11832 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
11833 LDKAcceptChannel this_ptr_conv;
11834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11835 this_ptr_conv.is_owned = false;
11836 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11837 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
11841 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
11842 LDKAcceptChannel this_ptr_conv;
11843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11844 this_ptr_conv.is_owned = false;
11845 LDKPublicKey val_ref;
11846 CHECK(*((uint32_t*)val) == 33);
11847 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11848 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
11851 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
11852 LDKAcceptChannel this_ptr_conv;
11853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11854 this_ptr_conv.is_owned = false;
11855 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11856 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
11860 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
11861 LDKAcceptChannel this_ptr_conv;
11862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11863 this_ptr_conv.is_owned = false;
11864 LDKPublicKey val_ref;
11865 CHECK(*((uint32_t*)val) == 33);
11866 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11867 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
11870 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
11871 LDKAcceptChannel this_ptr_conv;
11872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11873 this_ptr_conv.is_owned = false;
11874 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11875 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
11879 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
11880 LDKAcceptChannel this_ptr_conv;
11881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11882 this_ptr_conv.is_owned = false;
11883 LDKPublicKey val_ref;
11884 CHECK(*((uint32_t*)val) == 33);
11885 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11886 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
11889 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
11890 LDKAcceptChannel this_ptr_conv;
11891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11892 this_ptr_conv.is_owned = false;
11893 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11894 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
11898 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
11899 LDKAcceptChannel this_ptr_conv;
11900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11901 this_ptr_conv.is_owned = false;
11902 LDKPublicKey val_ref;
11903 CHECK(*((uint32_t*)val) == 33);
11904 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11905 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
11908 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
11909 LDKAcceptChannel this_ptr_conv;
11910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11911 this_ptr_conv.is_owned = false;
11912 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11913 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
11917 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
11918 LDKAcceptChannel this_ptr_conv;
11919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11920 this_ptr_conv.is_owned = false;
11921 LDKPublicKey val_ref;
11922 CHECK(*((uint32_t*)val) == 33);
11923 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11924 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
11927 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
11928 LDKAcceptChannel orig_conv;
11929 orig_conv.inner = (void*)(orig & (~1));
11930 orig_conv.is_owned = false;
11931 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
11932 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11933 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11934 long ret_ref = (long)ret_var.inner;
11935 if (ret_var.is_owned) {
11941 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_ptr) {
11942 LDKFundingCreated this_ptr_conv;
11943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11944 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11945 FundingCreated_free(this_ptr_conv);
11948 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
11949 LDKFundingCreated this_ptr_conv;
11950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11951 this_ptr_conv.is_owned = false;
11952 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11953 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
11957 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
11958 LDKFundingCreated this_ptr_conv;
11959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11960 this_ptr_conv.is_owned = false;
11961 LDKThirtyTwoBytes val_ref;
11962 CHECK(*((uint32_t*)val) == 32);
11963 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11964 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
11967 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
11968 LDKFundingCreated this_ptr_conv;
11969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11970 this_ptr_conv.is_owned = false;
11971 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11972 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
11976 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
11977 LDKFundingCreated this_ptr_conv;
11978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11979 this_ptr_conv.is_owned = false;
11980 LDKThirtyTwoBytes val_ref;
11981 CHECK(*((uint32_t*)val) == 32);
11982 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11983 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
11986 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
11987 LDKFundingCreated this_ptr_conv;
11988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11989 this_ptr_conv.is_owned = false;
11990 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
11994 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
11995 LDKFundingCreated this_ptr_conv;
11996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11997 this_ptr_conv.is_owned = false;
11998 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
12001 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
12002 LDKFundingCreated this_ptr_conv;
12003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12004 this_ptr_conv.is_owned = false;
12005 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12006 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
12010 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
12011 LDKFundingCreated this_ptr_conv;
12012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12013 this_ptr_conv.is_owned = false;
12014 LDKSignature val_ref;
12015 CHECK(*((uint32_t*)val) == 64);
12016 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12017 FundingCreated_set_signature(&this_ptr_conv, val_ref);
12020 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) {
12021 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
12022 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
12023 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
12024 LDKThirtyTwoBytes funding_txid_arg_ref;
12025 CHECK(*((uint32_t*)funding_txid_arg) == 32);
12026 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
12027 LDKSignature signature_arg_ref;
12028 CHECK(*((uint32_t*)signature_arg) == 64);
12029 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
12030 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
12031 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12032 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12033 long ret_ref = (long)ret_var.inner;
12034 if (ret_var.is_owned) {
12040 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
12041 LDKFundingCreated orig_conv;
12042 orig_conv.inner = (void*)(orig & (~1));
12043 orig_conv.is_owned = false;
12044 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
12045 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12046 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12047 long ret_ref = (long)ret_var.inner;
12048 if (ret_var.is_owned) {
12054 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_ptr) {
12055 LDKFundingSigned this_ptr_conv;
12056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12057 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12058 FundingSigned_free(this_ptr_conv);
12061 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
12062 LDKFundingSigned this_ptr_conv;
12063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12064 this_ptr_conv.is_owned = false;
12065 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12066 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
12070 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12071 LDKFundingSigned this_ptr_conv;
12072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12073 this_ptr_conv.is_owned = false;
12074 LDKThirtyTwoBytes val_ref;
12075 CHECK(*((uint32_t*)val) == 32);
12076 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12077 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
12080 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
12081 LDKFundingSigned this_ptr_conv;
12082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12083 this_ptr_conv.is_owned = false;
12084 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12085 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
12089 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
12090 LDKFundingSigned this_ptr_conv;
12091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12092 this_ptr_conv.is_owned = false;
12093 LDKSignature val_ref;
12094 CHECK(*((uint32_t*)val) == 64);
12095 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12096 FundingSigned_set_signature(&this_ptr_conv, val_ref);
12099 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
12100 LDKThirtyTwoBytes channel_id_arg_ref;
12101 CHECK(*((uint32_t*)channel_id_arg) == 32);
12102 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12103 LDKSignature signature_arg_ref;
12104 CHECK(*((uint32_t*)signature_arg) == 64);
12105 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
12106 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
12107 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12108 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12109 long ret_ref = (long)ret_var.inner;
12110 if (ret_var.is_owned) {
12116 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
12117 LDKFundingSigned orig_conv;
12118 orig_conv.inner = (void*)(orig & (~1));
12119 orig_conv.is_owned = false;
12120 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
12121 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12122 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12123 long ret_ref = (long)ret_var.inner;
12124 if (ret_var.is_owned) {
12130 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_ptr) {
12131 LDKFundingLocked this_ptr_conv;
12132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12133 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12134 FundingLocked_free(this_ptr_conv);
12137 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
12138 LDKFundingLocked this_ptr_conv;
12139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12140 this_ptr_conv.is_owned = false;
12141 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12142 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
12146 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12147 LDKFundingLocked this_ptr_conv;
12148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12149 this_ptr_conv.is_owned = false;
12150 LDKThirtyTwoBytes val_ref;
12151 CHECK(*((uint32_t*)val) == 32);
12152 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12153 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
12156 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
12157 LDKFundingLocked this_ptr_conv;
12158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12159 this_ptr_conv.is_owned = false;
12160 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12161 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12165 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12166 LDKFundingLocked this_ptr_conv;
12167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12168 this_ptr_conv.is_owned = false;
12169 LDKPublicKey val_ref;
12170 CHECK(*((uint32_t*)val) == 33);
12171 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12172 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
12175 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
12176 LDKThirtyTwoBytes channel_id_arg_ref;
12177 CHECK(*((uint32_t*)channel_id_arg) == 32);
12178 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12179 LDKPublicKey next_per_commitment_point_arg_ref;
12180 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
12181 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
12182 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
12183 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12184 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12185 long ret_ref = (long)ret_var.inner;
12186 if (ret_var.is_owned) {
12192 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
12193 LDKFundingLocked orig_conv;
12194 orig_conv.inner = (void*)(orig & (~1));
12195 orig_conv.is_owned = false;
12196 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
12197 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12198 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12199 long ret_ref = (long)ret_var.inner;
12200 if (ret_var.is_owned) {
12206 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_ptr) {
12207 LDKShutdown this_ptr_conv;
12208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12209 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12210 Shutdown_free(this_ptr_conv);
12213 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
12214 LDKShutdown this_ptr_conv;
12215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12216 this_ptr_conv.is_owned = false;
12217 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12218 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
12222 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12223 LDKShutdown this_ptr_conv;
12224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12225 this_ptr_conv.is_owned = false;
12226 LDKThirtyTwoBytes val_ref;
12227 CHECK(*((uint32_t*)val) == 32);
12228 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12229 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
12232 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
12233 LDKShutdown this_ptr_conv;
12234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12235 this_ptr_conv.is_owned = false;
12236 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
12237 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12238 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12242 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
12243 LDKShutdown this_ptr_conv;
12244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12245 this_ptr_conv.is_owned = false;
12246 LDKCVec_u8Z val_ref;
12247 val_ref.datalen = *((uint32_t*)val);
12248 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
12249 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
12250 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
12253 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
12254 LDKThirtyTwoBytes channel_id_arg_ref;
12255 CHECK(*((uint32_t*)channel_id_arg) == 32);
12256 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12257 LDKCVec_u8Z scriptpubkey_arg_ref;
12258 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
12259 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
12260 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
12261 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
12262 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12263 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12264 long ret_ref = (long)ret_var.inner;
12265 if (ret_var.is_owned) {
12271 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
12272 LDKShutdown orig_conv;
12273 orig_conv.inner = (void*)(orig & (~1));
12274 orig_conv.is_owned = false;
12275 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
12276 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12277 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12278 long ret_ref = (long)ret_var.inner;
12279 if (ret_var.is_owned) {
12285 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_ptr) {
12286 LDKClosingSigned this_ptr_conv;
12287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12288 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12289 ClosingSigned_free(this_ptr_conv);
12292 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
12293 LDKClosingSigned this_ptr_conv;
12294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12295 this_ptr_conv.is_owned = false;
12296 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12297 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
12301 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12302 LDKClosingSigned this_ptr_conv;
12303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12304 this_ptr_conv.is_owned = false;
12305 LDKThirtyTwoBytes val_ref;
12306 CHECK(*((uint32_t*)val) == 32);
12307 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12308 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
12311 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
12312 LDKClosingSigned this_ptr_conv;
12313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12314 this_ptr_conv.is_owned = false;
12315 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
12319 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
12320 LDKClosingSigned this_ptr_conv;
12321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12322 this_ptr_conv.is_owned = false;
12323 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
12326 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
12327 LDKClosingSigned this_ptr_conv;
12328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12329 this_ptr_conv.is_owned = false;
12330 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12331 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
12335 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
12336 LDKClosingSigned this_ptr_conv;
12337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12338 this_ptr_conv.is_owned = false;
12339 LDKSignature val_ref;
12340 CHECK(*((uint32_t*)val) == 64);
12341 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12342 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
12345 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
12346 LDKThirtyTwoBytes channel_id_arg_ref;
12347 CHECK(*((uint32_t*)channel_id_arg) == 32);
12348 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12349 LDKSignature signature_arg_ref;
12350 CHECK(*((uint32_t*)signature_arg) == 64);
12351 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
12352 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
12353 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12354 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12355 long ret_ref = (long)ret_var.inner;
12356 if (ret_var.is_owned) {
12362 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
12363 LDKClosingSigned orig_conv;
12364 orig_conv.inner = (void*)(orig & (~1));
12365 orig_conv.is_owned = false;
12366 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
12367 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12368 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12369 long ret_ref = (long)ret_var.inner;
12370 if (ret_var.is_owned) {
12376 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_ptr) {
12377 LDKUpdateAddHTLC this_ptr_conv;
12378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12379 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12380 UpdateAddHTLC_free(this_ptr_conv);
12383 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
12384 LDKUpdateAddHTLC this_ptr_conv;
12385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12386 this_ptr_conv.is_owned = false;
12387 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12388 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
12392 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12393 LDKUpdateAddHTLC this_ptr_conv;
12394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12395 this_ptr_conv.is_owned = false;
12396 LDKThirtyTwoBytes val_ref;
12397 CHECK(*((uint32_t*)val) == 32);
12398 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12399 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
12402 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
12403 LDKUpdateAddHTLC this_ptr_conv;
12404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12405 this_ptr_conv.is_owned = false;
12406 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
12410 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
12411 LDKUpdateAddHTLC this_ptr_conv;
12412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12413 this_ptr_conv.is_owned = false;
12414 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
12417 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
12418 LDKUpdateAddHTLC this_ptr_conv;
12419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12420 this_ptr_conv.is_owned = false;
12421 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
12425 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
12426 LDKUpdateAddHTLC this_ptr_conv;
12427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12428 this_ptr_conv.is_owned = false;
12429 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
12432 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
12433 LDKUpdateAddHTLC this_ptr_conv;
12434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12435 this_ptr_conv.is_owned = false;
12436 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12437 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
12441 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
12442 LDKUpdateAddHTLC this_ptr_conv;
12443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12444 this_ptr_conv.is_owned = false;
12445 LDKThirtyTwoBytes val_ref;
12446 CHECK(*((uint32_t*)val) == 32);
12447 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12448 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
12451 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
12452 LDKUpdateAddHTLC this_ptr_conv;
12453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12454 this_ptr_conv.is_owned = false;
12455 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
12459 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
12460 LDKUpdateAddHTLC this_ptr_conv;
12461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12462 this_ptr_conv.is_owned = false;
12463 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
12466 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
12467 LDKUpdateAddHTLC orig_conv;
12468 orig_conv.inner = (void*)(orig & (~1));
12469 orig_conv.is_owned = false;
12470 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
12471 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12472 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12473 long ret_ref = (long)ret_var.inner;
12474 if (ret_var.is_owned) {
12480 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_ptr) {
12481 LDKUpdateFulfillHTLC this_ptr_conv;
12482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12483 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12484 UpdateFulfillHTLC_free(this_ptr_conv);
12487 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
12488 LDKUpdateFulfillHTLC this_ptr_conv;
12489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12490 this_ptr_conv.is_owned = false;
12491 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12492 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
12496 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12497 LDKUpdateFulfillHTLC this_ptr_conv;
12498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12499 this_ptr_conv.is_owned = false;
12500 LDKThirtyTwoBytes val_ref;
12501 CHECK(*((uint32_t*)val) == 32);
12502 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12503 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
12506 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
12507 LDKUpdateFulfillHTLC this_ptr_conv;
12508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12509 this_ptr_conv.is_owned = false;
12510 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
12514 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
12515 LDKUpdateFulfillHTLC this_ptr_conv;
12516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12517 this_ptr_conv.is_owned = false;
12518 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
12521 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
12522 LDKUpdateFulfillHTLC this_ptr_conv;
12523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12524 this_ptr_conv.is_owned = false;
12525 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12526 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
12530 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
12531 LDKUpdateFulfillHTLC this_ptr_conv;
12532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12533 this_ptr_conv.is_owned = false;
12534 LDKThirtyTwoBytes val_ref;
12535 CHECK(*((uint32_t*)val) == 32);
12536 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12537 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
12540 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
12541 LDKThirtyTwoBytes channel_id_arg_ref;
12542 CHECK(*((uint32_t*)channel_id_arg) == 32);
12543 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12544 LDKThirtyTwoBytes payment_preimage_arg_ref;
12545 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
12546 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
12547 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
12548 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12549 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12550 long ret_ref = (long)ret_var.inner;
12551 if (ret_var.is_owned) {
12557 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
12558 LDKUpdateFulfillHTLC orig_conv;
12559 orig_conv.inner = (void*)(orig & (~1));
12560 orig_conv.is_owned = false;
12561 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
12562 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12563 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12564 long ret_ref = (long)ret_var.inner;
12565 if (ret_var.is_owned) {
12571 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_ptr) {
12572 LDKUpdateFailHTLC this_ptr_conv;
12573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12574 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12575 UpdateFailHTLC_free(this_ptr_conv);
12578 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
12579 LDKUpdateFailHTLC this_ptr_conv;
12580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12581 this_ptr_conv.is_owned = false;
12582 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12583 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
12587 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12588 LDKUpdateFailHTLC this_ptr_conv;
12589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12590 this_ptr_conv.is_owned = false;
12591 LDKThirtyTwoBytes val_ref;
12592 CHECK(*((uint32_t*)val) == 32);
12593 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12594 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
12597 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
12598 LDKUpdateFailHTLC this_ptr_conv;
12599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12600 this_ptr_conv.is_owned = false;
12601 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
12605 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
12606 LDKUpdateFailHTLC this_ptr_conv;
12607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12608 this_ptr_conv.is_owned = false;
12609 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
12612 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
12613 LDKUpdateFailHTLC orig_conv;
12614 orig_conv.inner = (void*)(orig & (~1));
12615 orig_conv.is_owned = false;
12616 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
12617 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12618 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12619 long ret_ref = (long)ret_var.inner;
12620 if (ret_var.is_owned) {
12626 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_ptr) {
12627 LDKUpdateFailMalformedHTLC this_ptr_conv;
12628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12629 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12630 UpdateFailMalformedHTLC_free(this_ptr_conv);
12633 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
12634 LDKUpdateFailMalformedHTLC this_ptr_conv;
12635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12636 this_ptr_conv.is_owned = false;
12637 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12638 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
12642 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12643 LDKUpdateFailMalformedHTLC this_ptr_conv;
12644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12645 this_ptr_conv.is_owned = false;
12646 LDKThirtyTwoBytes val_ref;
12647 CHECK(*((uint32_t*)val) == 32);
12648 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12649 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
12652 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
12653 LDKUpdateFailMalformedHTLC this_ptr_conv;
12654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12655 this_ptr_conv.is_owned = false;
12656 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
12660 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
12661 LDKUpdateFailMalformedHTLC this_ptr_conv;
12662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12663 this_ptr_conv.is_owned = false;
12664 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
12667 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
12668 LDKUpdateFailMalformedHTLC this_ptr_conv;
12669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12670 this_ptr_conv.is_owned = false;
12671 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
12675 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
12676 LDKUpdateFailMalformedHTLC this_ptr_conv;
12677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12678 this_ptr_conv.is_owned = false;
12679 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
12682 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
12683 LDKUpdateFailMalformedHTLC orig_conv;
12684 orig_conv.inner = (void*)(orig & (~1));
12685 orig_conv.is_owned = false;
12686 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
12687 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12688 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12689 long ret_ref = (long)ret_var.inner;
12690 if (ret_var.is_owned) {
12696 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_ptr) {
12697 LDKCommitmentSigned this_ptr_conv;
12698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12699 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12700 CommitmentSigned_free(this_ptr_conv);
12703 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
12704 LDKCommitmentSigned this_ptr_conv;
12705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12706 this_ptr_conv.is_owned = false;
12707 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12708 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
12712 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12713 LDKCommitmentSigned this_ptr_conv;
12714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12715 this_ptr_conv.is_owned = false;
12716 LDKThirtyTwoBytes val_ref;
12717 CHECK(*((uint32_t*)val) == 32);
12718 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12719 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
12722 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
12723 LDKCommitmentSigned this_ptr_conv;
12724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12725 this_ptr_conv.is_owned = false;
12726 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12727 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
12731 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
12732 LDKCommitmentSigned this_ptr_conv;
12733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12734 this_ptr_conv.is_owned = false;
12735 LDKSignature val_ref;
12736 CHECK(*((uint32_t*)val) == 64);
12737 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12738 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
12741 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
12742 LDKCommitmentSigned this_ptr_conv;
12743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12744 this_ptr_conv.is_owned = false;
12745 LDKCVec_SignatureZ val_constr;
12746 val_constr.datalen = *((uint32_t*)val);
12747 if (val_constr.datalen > 0)
12748 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12750 val_constr.data = NULL;
12751 int8_tArray* val_vals = (int8_tArray*)(val + 4);
12752 for (size_t m = 0; m < val_constr.datalen; m++) {
12753 int8_tArray val_conv_12 = val_vals[m];
12754 LDKSignature val_conv_12_ref;
12755 CHECK(*((uint32_t*)val_conv_12) == 64);
12756 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
12757 val_constr.data[m] = val_conv_12_ref;
12759 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
12762 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
12763 LDKThirtyTwoBytes channel_id_arg_ref;
12764 CHECK(*((uint32_t*)channel_id_arg) == 32);
12765 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12766 LDKSignature signature_arg_ref;
12767 CHECK(*((uint32_t*)signature_arg) == 64);
12768 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
12769 LDKCVec_SignatureZ htlc_signatures_arg_constr;
12770 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
12771 if (htlc_signatures_arg_constr.datalen > 0)
12772 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12774 htlc_signatures_arg_constr.data = NULL;
12775 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
12776 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
12777 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
12778 LDKSignature htlc_signatures_arg_conv_12_ref;
12779 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
12780 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
12781 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
12783 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
12784 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12785 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12786 long ret_ref = (long)ret_var.inner;
12787 if (ret_var.is_owned) {
12793 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
12794 LDKCommitmentSigned orig_conv;
12795 orig_conv.inner = (void*)(orig & (~1));
12796 orig_conv.is_owned = false;
12797 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
12798 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12799 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12800 long ret_ref = (long)ret_var.inner;
12801 if (ret_var.is_owned) {
12807 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_ptr) {
12808 LDKRevokeAndACK this_ptr_conv;
12809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12810 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12811 RevokeAndACK_free(this_ptr_conv);
12814 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
12815 LDKRevokeAndACK this_ptr_conv;
12816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12817 this_ptr_conv.is_owned = false;
12818 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12819 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
12823 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12824 LDKRevokeAndACK this_ptr_conv;
12825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12826 this_ptr_conv.is_owned = false;
12827 LDKThirtyTwoBytes val_ref;
12828 CHECK(*((uint32_t*)val) == 32);
12829 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12830 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
12833 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
12834 LDKRevokeAndACK this_ptr_conv;
12835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12836 this_ptr_conv.is_owned = false;
12837 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12838 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
12842 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
12843 LDKRevokeAndACK this_ptr_conv;
12844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12845 this_ptr_conv.is_owned = false;
12846 LDKThirtyTwoBytes val_ref;
12847 CHECK(*((uint32_t*)val) == 32);
12848 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12849 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
12852 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
12853 LDKRevokeAndACK this_ptr_conv;
12854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12855 this_ptr_conv.is_owned = false;
12856 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12857 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12861 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12862 LDKRevokeAndACK this_ptr_conv;
12863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12864 this_ptr_conv.is_owned = false;
12865 LDKPublicKey val_ref;
12866 CHECK(*((uint32_t*)val) == 33);
12867 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12868 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
12871 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) {
12872 LDKThirtyTwoBytes channel_id_arg_ref;
12873 CHECK(*((uint32_t*)channel_id_arg) == 32);
12874 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12875 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
12876 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
12877 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
12878 LDKPublicKey next_per_commitment_point_arg_ref;
12879 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
12880 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
12881 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
12882 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12883 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12884 long ret_ref = (long)ret_var.inner;
12885 if (ret_var.is_owned) {
12891 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
12892 LDKRevokeAndACK orig_conv;
12893 orig_conv.inner = (void*)(orig & (~1));
12894 orig_conv.is_owned = false;
12895 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
12896 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12897 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12898 long ret_ref = (long)ret_var.inner;
12899 if (ret_var.is_owned) {
12905 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_ptr) {
12906 LDKUpdateFee this_ptr_conv;
12907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12908 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12909 UpdateFee_free(this_ptr_conv);
12912 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
12913 LDKUpdateFee this_ptr_conv;
12914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12915 this_ptr_conv.is_owned = false;
12916 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12917 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
12921 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12922 LDKUpdateFee this_ptr_conv;
12923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12924 this_ptr_conv.is_owned = false;
12925 LDKThirtyTwoBytes val_ref;
12926 CHECK(*((uint32_t*)val) == 32);
12927 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12928 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
12931 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
12932 LDKUpdateFee this_ptr_conv;
12933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12934 this_ptr_conv.is_owned = false;
12935 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
12939 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
12940 LDKUpdateFee this_ptr_conv;
12941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12942 this_ptr_conv.is_owned = false;
12943 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
12946 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
12947 LDKThirtyTwoBytes channel_id_arg_ref;
12948 CHECK(*((uint32_t*)channel_id_arg) == 32);
12949 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12950 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
12951 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12952 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12953 long ret_ref = (long)ret_var.inner;
12954 if (ret_var.is_owned) {
12960 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
12961 LDKUpdateFee orig_conv;
12962 orig_conv.inner = (void*)(orig & (~1));
12963 orig_conv.is_owned = false;
12964 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
12965 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12966 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12967 long ret_ref = (long)ret_var.inner;
12968 if (ret_var.is_owned) {
12974 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_ptr) {
12975 LDKDataLossProtect this_ptr_conv;
12976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12977 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12978 DataLossProtect_free(this_ptr_conv);
12981 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
12982 LDKDataLossProtect this_ptr_conv;
12983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12984 this_ptr_conv.is_owned = false;
12985 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12986 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
12990 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
12991 LDKDataLossProtect this_ptr_conv;
12992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12993 this_ptr_conv.is_owned = false;
12994 LDKThirtyTwoBytes val_ref;
12995 CHECK(*((uint32_t*)val) == 32);
12996 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12997 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
13000 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
13001 LDKDataLossProtect this_ptr_conv;
13002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13003 this_ptr_conv.is_owned = false;
13004 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13005 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
13009 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
13010 LDKDataLossProtect this_ptr_conv;
13011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13012 this_ptr_conv.is_owned = false;
13013 LDKPublicKey val_ref;
13014 CHECK(*((uint32_t*)val) == 33);
13015 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13016 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
13019 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
13020 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
13021 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
13022 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
13023 LDKPublicKey my_current_per_commitment_point_arg_ref;
13024 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
13025 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
13026 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
13027 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13028 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13029 long ret_ref = (long)ret_var.inner;
13030 if (ret_var.is_owned) {
13036 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
13037 LDKDataLossProtect orig_conv;
13038 orig_conv.inner = (void*)(orig & (~1));
13039 orig_conv.is_owned = false;
13040 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
13041 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13042 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13043 long ret_ref = (long)ret_var.inner;
13044 if (ret_var.is_owned) {
13050 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_ptr) {
13051 LDKChannelReestablish this_ptr_conv;
13052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13053 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13054 ChannelReestablish_free(this_ptr_conv);
13057 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
13058 LDKChannelReestablish this_ptr_conv;
13059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13060 this_ptr_conv.is_owned = false;
13061 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13062 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
13066 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13067 LDKChannelReestablish this_ptr_conv;
13068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13069 this_ptr_conv.is_owned = false;
13070 LDKThirtyTwoBytes val_ref;
13071 CHECK(*((uint32_t*)val) == 32);
13072 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13073 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
13076 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
13077 LDKChannelReestablish this_ptr_conv;
13078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13079 this_ptr_conv.is_owned = false;
13080 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
13084 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
13085 LDKChannelReestablish this_ptr_conv;
13086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13087 this_ptr_conv.is_owned = false;
13088 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
13091 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
13092 LDKChannelReestablish this_ptr_conv;
13093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13094 this_ptr_conv.is_owned = false;
13095 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
13099 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
13100 LDKChannelReestablish this_ptr_conv;
13101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13102 this_ptr_conv.is_owned = false;
13103 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
13106 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
13107 LDKChannelReestablish orig_conv;
13108 orig_conv.inner = (void*)(orig & (~1));
13109 orig_conv.is_owned = false;
13110 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
13111 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13112 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13113 long ret_ref = (long)ret_var.inner;
13114 if (ret_var.is_owned) {
13120 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_ptr) {
13121 LDKAnnouncementSignatures this_ptr_conv;
13122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13123 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13124 AnnouncementSignatures_free(this_ptr_conv);
13127 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
13128 LDKAnnouncementSignatures this_ptr_conv;
13129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13130 this_ptr_conv.is_owned = false;
13131 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13132 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
13136 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13137 LDKAnnouncementSignatures this_ptr_conv;
13138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13139 this_ptr_conv.is_owned = false;
13140 LDKThirtyTwoBytes val_ref;
13141 CHECK(*((uint32_t*)val) == 32);
13142 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13143 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
13146 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
13147 LDKAnnouncementSignatures this_ptr_conv;
13148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13149 this_ptr_conv.is_owned = false;
13150 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
13154 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
13155 LDKAnnouncementSignatures this_ptr_conv;
13156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13157 this_ptr_conv.is_owned = false;
13158 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
13161 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
13162 LDKAnnouncementSignatures this_ptr_conv;
13163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13164 this_ptr_conv.is_owned = false;
13165 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13166 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
13170 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
13171 LDKAnnouncementSignatures this_ptr_conv;
13172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13173 this_ptr_conv.is_owned = false;
13174 LDKSignature val_ref;
13175 CHECK(*((uint32_t*)val) == 64);
13176 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13177 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
13180 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
13181 LDKAnnouncementSignatures this_ptr_conv;
13182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13183 this_ptr_conv.is_owned = false;
13184 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13185 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
13189 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
13190 LDKAnnouncementSignatures this_ptr_conv;
13191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13192 this_ptr_conv.is_owned = false;
13193 LDKSignature val_ref;
13194 CHECK(*((uint32_t*)val) == 64);
13195 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13196 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
13199 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) {
13200 LDKThirtyTwoBytes channel_id_arg_ref;
13201 CHECK(*((uint32_t*)channel_id_arg) == 32);
13202 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13203 LDKSignature node_signature_arg_ref;
13204 CHECK(*((uint32_t*)node_signature_arg) == 64);
13205 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
13206 LDKSignature bitcoin_signature_arg_ref;
13207 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
13208 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
13209 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
13210 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13211 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13212 long ret_ref = (long)ret_var.inner;
13213 if (ret_var.is_owned) {
13219 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
13220 LDKAnnouncementSignatures orig_conv;
13221 orig_conv.inner = (void*)(orig & (~1));
13222 orig_conv.is_owned = false;
13223 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
13224 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13225 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13226 long ret_ref = (long)ret_var.inner;
13227 if (ret_var.is_owned) {
13233 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
13234 if ((this_ptr & 1) != 0) return;
13235 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
13236 FREE((void*)this_ptr);
13237 NetAddress_free(this_ptr_conv);
13240 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
13241 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
13242 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
13243 *ret_copy = NetAddress_clone(orig_conv);
13244 long ret_ref = (long)ret_copy;
13248 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
13249 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
13250 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
13251 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13252 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13253 CVec_u8Z_free(ret_var);
13257 uint32_t __attribute__((visibility("default"))) TS_Result_read(int8_tArray ser) {
13258 LDKu8slice ser_ref;
13259 ser_ref.datalen = *((uint32_t*)ser);
13260 ser_ref.data = (int8_t*)(ser + 4);
13261 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
13262 *ret_conv = Result_read(ser_ref);
13263 return (long)ret_conv;
13266 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_ptr) {
13267 LDKUnsignedNodeAnnouncement this_ptr_conv;
13268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13269 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13270 UnsignedNodeAnnouncement_free(this_ptr_conv);
13273 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
13274 LDKUnsignedNodeAnnouncement this_ptr_conv;
13275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13276 this_ptr_conv.is_owned = false;
13277 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
13278 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13279 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13280 long ret_ref = (long)ret_var.inner;
13281 if (ret_var.is_owned) {
13287 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
13288 LDKUnsignedNodeAnnouncement this_ptr_conv;
13289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13290 this_ptr_conv.is_owned = false;
13291 LDKNodeFeatures val_conv;
13292 val_conv.inner = (void*)(val & (~1));
13293 val_conv.is_owned = (val & 1) || (val == 0);
13294 val_conv = NodeFeatures_clone(&val_conv);
13295 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
13298 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
13299 LDKUnsignedNodeAnnouncement this_ptr_conv;
13300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13301 this_ptr_conv.is_owned = false;
13302 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
13306 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
13307 LDKUnsignedNodeAnnouncement this_ptr_conv;
13308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13309 this_ptr_conv.is_owned = false;
13310 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
13313 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
13314 LDKUnsignedNodeAnnouncement this_ptr_conv;
13315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13316 this_ptr_conv.is_owned = false;
13317 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13318 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
13322 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
13323 LDKUnsignedNodeAnnouncement this_ptr_conv;
13324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13325 this_ptr_conv.is_owned = false;
13326 LDKPublicKey val_ref;
13327 CHECK(*((uint32_t*)val) == 33);
13328 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13329 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
13332 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
13333 LDKUnsignedNodeAnnouncement this_ptr_conv;
13334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13335 this_ptr_conv.is_owned = false;
13336 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
13337 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
13341 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
13342 LDKUnsignedNodeAnnouncement this_ptr_conv;
13343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13344 this_ptr_conv.is_owned = false;
13345 LDKThreeBytes val_ref;
13346 CHECK(*((uint32_t*)val) == 3);
13347 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
13348 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
13351 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
13352 LDKUnsignedNodeAnnouncement this_ptr_conv;
13353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13354 this_ptr_conv.is_owned = false;
13355 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13356 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
13360 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
13361 LDKUnsignedNodeAnnouncement this_ptr_conv;
13362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13363 this_ptr_conv.is_owned = false;
13364 LDKThirtyTwoBytes val_ref;
13365 CHECK(*((uint32_t*)val) == 32);
13366 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13367 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
13370 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
13371 LDKUnsignedNodeAnnouncement this_ptr_conv;
13372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13373 this_ptr_conv.is_owned = false;
13374 LDKCVec_NetAddressZ val_constr;
13375 val_constr.datalen = *((uint32_t*)val);
13376 if (val_constr.datalen > 0)
13377 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
13379 val_constr.data = NULL;
13380 uint32_t* val_vals = (uint32_t*)(val + 4);
13381 for (size_t m = 0; m < val_constr.datalen; m++) {
13382 uint32_t val_conv_12 = val_vals[m];
13383 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
13384 FREE((void*)val_conv_12);
13385 val_constr.data[m] = val_conv_12_conv;
13387 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
13390 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
13391 LDKUnsignedNodeAnnouncement orig_conv;
13392 orig_conv.inner = (void*)(orig & (~1));
13393 orig_conv.is_owned = false;
13394 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
13395 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13396 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13397 long ret_ref = (long)ret_var.inner;
13398 if (ret_var.is_owned) {
13404 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_ptr) {
13405 LDKNodeAnnouncement this_ptr_conv;
13406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13407 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13408 NodeAnnouncement_free(this_ptr_conv);
13411 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
13412 LDKNodeAnnouncement this_ptr_conv;
13413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13414 this_ptr_conv.is_owned = false;
13415 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13416 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
13420 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
13421 LDKNodeAnnouncement this_ptr_conv;
13422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13423 this_ptr_conv.is_owned = false;
13424 LDKSignature val_ref;
13425 CHECK(*((uint32_t*)val) == 64);
13426 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13427 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
13430 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
13431 LDKNodeAnnouncement this_ptr_conv;
13432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13433 this_ptr_conv.is_owned = false;
13434 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
13435 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13436 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13437 long ret_ref = (long)ret_var.inner;
13438 if (ret_var.is_owned) {
13444 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
13445 LDKNodeAnnouncement this_ptr_conv;
13446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13447 this_ptr_conv.is_owned = false;
13448 LDKUnsignedNodeAnnouncement val_conv;
13449 val_conv.inner = (void*)(val & (~1));
13450 val_conv.is_owned = (val & 1) || (val == 0);
13451 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
13452 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
13455 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
13456 LDKSignature signature_arg_ref;
13457 CHECK(*((uint32_t*)signature_arg) == 64);
13458 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
13459 LDKUnsignedNodeAnnouncement contents_arg_conv;
13460 contents_arg_conv.inner = (void*)(contents_arg & (~1));
13461 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
13462 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
13463 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
13464 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13465 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13466 long ret_ref = (long)ret_var.inner;
13467 if (ret_var.is_owned) {
13473 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
13474 LDKNodeAnnouncement orig_conv;
13475 orig_conv.inner = (void*)(orig & (~1));
13476 orig_conv.is_owned = false;
13477 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
13478 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13479 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13480 long ret_ref = (long)ret_var.inner;
13481 if (ret_var.is_owned) {
13487 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_ptr) {
13488 LDKUnsignedChannelAnnouncement this_ptr_conv;
13489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13490 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13491 UnsignedChannelAnnouncement_free(this_ptr_conv);
13494 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
13495 LDKUnsignedChannelAnnouncement this_ptr_conv;
13496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13497 this_ptr_conv.is_owned = false;
13498 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
13499 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13500 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13501 long ret_ref = (long)ret_var.inner;
13502 if (ret_var.is_owned) {
13508 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
13509 LDKUnsignedChannelAnnouncement this_ptr_conv;
13510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13511 this_ptr_conv.is_owned = false;
13512 LDKChannelFeatures val_conv;
13513 val_conv.inner = (void*)(val & (~1));
13514 val_conv.is_owned = (val & 1) || (val == 0);
13515 val_conv = ChannelFeatures_clone(&val_conv);
13516 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
13519 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
13520 LDKUnsignedChannelAnnouncement this_ptr_conv;
13521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13522 this_ptr_conv.is_owned = false;
13523 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13524 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
13528 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
13529 LDKUnsignedChannelAnnouncement this_ptr_conv;
13530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13531 this_ptr_conv.is_owned = false;
13532 LDKThirtyTwoBytes val_ref;
13533 CHECK(*((uint32_t*)val) == 32);
13534 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13535 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
13538 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
13539 LDKUnsignedChannelAnnouncement this_ptr_conv;
13540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13541 this_ptr_conv.is_owned = false;
13542 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
13546 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
13547 LDKUnsignedChannelAnnouncement this_ptr_conv;
13548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13549 this_ptr_conv.is_owned = false;
13550 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
13553 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
13554 LDKUnsignedChannelAnnouncement this_ptr_conv;
13555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13556 this_ptr_conv.is_owned = false;
13557 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13558 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
13562 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
13563 LDKUnsignedChannelAnnouncement this_ptr_conv;
13564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13565 this_ptr_conv.is_owned = false;
13566 LDKPublicKey val_ref;
13567 CHECK(*((uint32_t*)val) == 33);
13568 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13569 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
13572 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
13573 LDKUnsignedChannelAnnouncement this_ptr_conv;
13574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13575 this_ptr_conv.is_owned = false;
13576 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13577 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
13581 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
13582 LDKUnsignedChannelAnnouncement this_ptr_conv;
13583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13584 this_ptr_conv.is_owned = false;
13585 LDKPublicKey val_ref;
13586 CHECK(*((uint32_t*)val) == 33);
13587 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13588 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
13591 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
13592 LDKUnsignedChannelAnnouncement this_ptr_conv;
13593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13594 this_ptr_conv.is_owned = false;
13595 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13596 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
13600 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
13601 LDKUnsignedChannelAnnouncement this_ptr_conv;
13602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13603 this_ptr_conv.is_owned = false;
13604 LDKPublicKey val_ref;
13605 CHECK(*((uint32_t*)val) == 33);
13606 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13607 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
13610 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
13611 LDKUnsignedChannelAnnouncement this_ptr_conv;
13612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13613 this_ptr_conv.is_owned = false;
13614 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13615 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
13619 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
13620 LDKUnsignedChannelAnnouncement this_ptr_conv;
13621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13622 this_ptr_conv.is_owned = false;
13623 LDKPublicKey val_ref;
13624 CHECK(*((uint32_t*)val) == 33);
13625 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13626 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
13629 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
13630 LDKUnsignedChannelAnnouncement orig_conv;
13631 orig_conv.inner = (void*)(orig & (~1));
13632 orig_conv.is_owned = false;
13633 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
13634 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13635 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13636 long ret_ref = (long)ret_var.inner;
13637 if (ret_var.is_owned) {
13643 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_ptr) {
13644 LDKChannelAnnouncement this_ptr_conv;
13645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13646 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13647 ChannelAnnouncement_free(this_ptr_conv);
13650 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
13651 LDKChannelAnnouncement 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(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13655 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
13659 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
13660 LDKChannelAnnouncement this_ptr_conv;
13661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13662 this_ptr_conv.is_owned = false;
13663 LDKSignature val_ref;
13664 CHECK(*((uint32_t*)val) == 64);
13665 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13666 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
13669 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
13670 LDKChannelAnnouncement 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(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13674 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
13678 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
13679 LDKChannelAnnouncement this_ptr_conv;
13680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13681 this_ptr_conv.is_owned = false;
13682 LDKSignature val_ref;
13683 CHECK(*((uint32_t*)val) == 64);
13684 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13685 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
13688 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
13689 LDKChannelAnnouncement this_ptr_conv;
13690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13691 this_ptr_conv.is_owned = false;
13692 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13693 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
13697 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
13698 LDKChannelAnnouncement this_ptr_conv;
13699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13700 this_ptr_conv.is_owned = false;
13701 LDKSignature val_ref;
13702 CHECK(*((uint32_t*)val) == 64);
13703 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13704 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
13707 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
13708 LDKChannelAnnouncement this_ptr_conv;
13709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13710 this_ptr_conv.is_owned = false;
13711 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13712 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
13716 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
13717 LDKChannelAnnouncement this_ptr_conv;
13718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13719 this_ptr_conv.is_owned = false;
13720 LDKSignature val_ref;
13721 CHECK(*((uint32_t*)val) == 64);
13722 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13723 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
13726 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
13727 LDKChannelAnnouncement this_ptr_conv;
13728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13729 this_ptr_conv.is_owned = false;
13730 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
13731 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13732 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13733 long ret_ref = (long)ret_var.inner;
13734 if (ret_var.is_owned) {
13740 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
13741 LDKChannelAnnouncement this_ptr_conv;
13742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13743 this_ptr_conv.is_owned = false;
13744 LDKUnsignedChannelAnnouncement val_conv;
13745 val_conv.inner = (void*)(val & (~1));
13746 val_conv.is_owned = (val & 1) || (val == 0);
13747 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
13748 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
13751 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) {
13752 LDKSignature node_signature_1_arg_ref;
13753 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
13754 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
13755 LDKSignature node_signature_2_arg_ref;
13756 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
13757 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
13758 LDKSignature bitcoin_signature_1_arg_ref;
13759 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
13760 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
13761 LDKSignature bitcoin_signature_2_arg_ref;
13762 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
13763 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
13764 LDKUnsignedChannelAnnouncement contents_arg_conv;
13765 contents_arg_conv.inner = (void*)(contents_arg & (~1));
13766 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
13767 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
13768 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);
13769 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13770 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13771 long ret_ref = (long)ret_var.inner;
13772 if (ret_var.is_owned) {
13778 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
13779 LDKChannelAnnouncement orig_conv;
13780 orig_conv.inner = (void*)(orig & (~1));
13781 orig_conv.is_owned = false;
13782 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
13783 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13784 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13785 long ret_ref = (long)ret_var.inner;
13786 if (ret_var.is_owned) {
13792 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_ptr) {
13793 LDKUnsignedChannelUpdate this_ptr_conv;
13794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13795 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13796 UnsignedChannelUpdate_free(this_ptr_conv);
13799 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
13800 LDKUnsignedChannelUpdate this_ptr_conv;
13801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13802 this_ptr_conv.is_owned = false;
13803 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13804 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
13808 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
13809 LDKUnsignedChannelUpdate this_ptr_conv;
13810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13811 this_ptr_conv.is_owned = false;
13812 LDKThirtyTwoBytes val_ref;
13813 CHECK(*((uint32_t*)val) == 32);
13814 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13815 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
13818 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
13819 LDKUnsignedChannelUpdate this_ptr_conv;
13820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13821 this_ptr_conv.is_owned = false;
13822 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
13826 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
13827 LDKUnsignedChannelUpdate this_ptr_conv;
13828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13829 this_ptr_conv.is_owned = false;
13830 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
13833 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
13834 LDKUnsignedChannelUpdate this_ptr_conv;
13835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13836 this_ptr_conv.is_owned = false;
13837 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
13841 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
13842 LDKUnsignedChannelUpdate this_ptr_conv;
13843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13844 this_ptr_conv.is_owned = false;
13845 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
13848 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
13849 LDKUnsignedChannelUpdate this_ptr_conv;
13850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13851 this_ptr_conv.is_owned = false;
13852 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
13856 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
13857 LDKUnsignedChannelUpdate this_ptr_conv;
13858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13859 this_ptr_conv.is_owned = false;
13860 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
13863 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
13864 LDKUnsignedChannelUpdate this_ptr_conv;
13865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13866 this_ptr_conv.is_owned = false;
13867 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
13871 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
13872 LDKUnsignedChannelUpdate this_ptr_conv;
13873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13874 this_ptr_conv.is_owned = false;
13875 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
13878 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
13879 LDKUnsignedChannelUpdate this_ptr_conv;
13880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13881 this_ptr_conv.is_owned = false;
13882 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
13886 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
13887 LDKUnsignedChannelUpdate this_ptr_conv;
13888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13889 this_ptr_conv.is_owned = false;
13890 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
13893 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
13894 LDKUnsignedChannelUpdate this_ptr_conv;
13895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13896 this_ptr_conv.is_owned = false;
13897 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
13901 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
13902 LDKUnsignedChannelUpdate this_ptr_conv;
13903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13904 this_ptr_conv.is_owned = false;
13905 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
13908 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
13909 LDKUnsignedChannelUpdate this_ptr_conv;
13910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13911 this_ptr_conv.is_owned = false;
13912 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
13916 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
13917 LDKUnsignedChannelUpdate this_ptr_conv;
13918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13919 this_ptr_conv.is_owned = false;
13920 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
13923 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
13924 LDKUnsignedChannelUpdate orig_conv;
13925 orig_conv.inner = (void*)(orig & (~1));
13926 orig_conv.is_owned = false;
13927 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
13928 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13929 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13930 long ret_ref = (long)ret_var.inner;
13931 if (ret_var.is_owned) {
13937 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_ptr) {
13938 LDKChannelUpdate this_ptr_conv;
13939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13940 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13941 ChannelUpdate_free(this_ptr_conv);
13944 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
13945 LDKChannelUpdate this_ptr_conv;
13946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13947 this_ptr_conv.is_owned = false;
13948 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13949 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
13953 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
13954 LDKChannelUpdate this_ptr_conv;
13955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13956 this_ptr_conv.is_owned = false;
13957 LDKSignature val_ref;
13958 CHECK(*((uint32_t*)val) == 64);
13959 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13960 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
13963 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
13964 LDKChannelUpdate this_ptr_conv;
13965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13966 this_ptr_conv.is_owned = false;
13967 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
13968 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13969 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13970 long ret_ref = (long)ret_var.inner;
13971 if (ret_var.is_owned) {
13977 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
13978 LDKChannelUpdate this_ptr_conv;
13979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13980 this_ptr_conv.is_owned = false;
13981 LDKUnsignedChannelUpdate val_conv;
13982 val_conv.inner = (void*)(val & (~1));
13983 val_conv.is_owned = (val & 1) || (val == 0);
13984 val_conv = UnsignedChannelUpdate_clone(&val_conv);
13985 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
13988 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
13989 LDKSignature signature_arg_ref;
13990 CHECK(*((uint32_t*)signature_arg) == 64);
13991 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
13992 LDKUnsignedChannelUpdate contents_arg_conv;
13993 contents_arg_conv.inner = (void*)(contents_arg & (~1));
13994 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
13995 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
13996 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
13997 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13998 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13999 long ret_ref = (long)ret_var.inner;
14000 if (ret_var.is_owned) {
14006 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
14007 LDKChannelUpdate orig_conv;
14008 orig_conv.inner = (void*)(orig & (~1));
14009 orig_conv.is_owned = false;
14010 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
14011 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14012 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14013 long ret_ref = (long)ret_var.inner;
14014 if (ret_var.is_owned) {
14020 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_ptr) {
14021 LDKQueryChannelRange this_ptr_conv;
14022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14023 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14024 QueryChannelRange_free(this_ptr_conv);
14027 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
14028 LDKQueryChannelRange this_ptr_conv;
14029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14030 this_ptr_conv.is_owned = false;
14031 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14032 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
14036 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14037 LDKQueryChannelRange this_ptr_conv;
14038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14039 this_ptr_conv.is_owned = false;
14040 LDKThirtyTwoBytes val_ref;
14041 CHECK(*((uint32_t*)val) == 32);
14042 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14043 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
14046 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
14047 LDKQueryChannelRange this_ptr_conv;
14048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14049 this_ptr_conv.is_owned = false;
14050 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
14054 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
14055 LDKQueryChannelRange this_ptr_conv;
14056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14057 this_ptr_conv.is_owned = false;
14058 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
14061 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
14062 LDKQueryChannelRange this_ptr_conv;
14063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14064 this_ptr_conv.is_owned = false;
14065 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
14069 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
14070 LDKQueryChannelRange this_ptr_conv;
14071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14072 this_ptr_conv.is_owned = false;
14073 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
14076 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
14077 LDKThirtyTwoBytes chain_hash_arg_ref;
14078 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14079 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14080 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
14081 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14082 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14083 long ret_ref = (long)ret_var.inner;
14084 if (ret_var.is_owned) {
14090 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
14091 LDKQueryChannelRange orig_conv;
14092 orig_conv.inner = (void*)(orig & (~1));
14093 orig_conv.is_owned = false;
14094 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
14095 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14096 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14097 long ret_ref = (long)ret_var.inner;
14098 if (ret_var.is_owned) {
14104 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_ptr) {
14105 LDKReplyChannelRange this_ptr_conv;
14106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14107 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14108 ReplyChannelRange_free(this_ptr_conv);
14111 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
14112 LDKReplyChannelRange this_ptr_conv;
14113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14114 this_ptr_conv.is_owned = false;
14115 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14116 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
14120 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14121 LDKReplyChannelRange this_ptr_conv;
14122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14123 this_ptr_conv.is_owned = false;
14124 LDKThirtyTwoBytes val_ref;
14125 CHECK(*((uint32_t*)val) == 32);
14126 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14127 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
14130 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
14131 LDKReplyChannelRange this_ptr_conv;
14132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14133 this_ptr_conv.is_owned = false;
14134 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
14138 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
14139 LDKReplyChannelRange this_ptr_conv;
14140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14141 this_ptr_conv.is_owned = false;
14142 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
14145 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
14146 LDKReplyChannelRange this_ptr_conv;
14147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14148 this_ptr_conv.is_owned = false;
14149 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
14153 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
14154 LDKReplyChannelRange this_ptr_conv;
14155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14156 this_ptr_conv.is_owned = false;
14157 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
14160 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
14161 LDKReplyChannelRange this_ptr_conv;
14162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14163 this_ptr_conv.is_owned = false;
14164 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
14168 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
14169 LDKReplyChannelRange this_ptr_conv;
14170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14171 this_ptr_conv.is_owned = false;
14172 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
14175 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
14176 LDKReplyChannelRange this_ptr_conv;
14177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14178 this_ptr_conv.is_owned = false;
14179 LDKCVec_u64Z val_constr;
14180 val_constr.datalen = *((uint32_t*)val);
14181 if (val_constr.datalen > 0)
14182 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14184 val_constr.data = NULL;
14185 int64_t* val_vals = (int64_t*)(val + 4);
14186 for (size_t i = 0; i < val_constr.datalen; i++) {
14187 int64_t val_conv_8 = val_vals[i];
14188 val_constr.data[i] = val_conv_8;
14190 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
14193 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) {
14194 LDKThirtyTwoBytes chain_hash_arg_ref;
14195 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14196 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14197 LDKCVec_u64Z short_channel_ids_arg_constr;
14198 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
14199 if (short_channel_ids_arg_constr.datalen > 0)
14200 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14202 short_channel_ids_arg_constr.data = NULL;
14203 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
14204 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
14205 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
14206 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
14208 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
14209 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14210 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14211 long ret_ref = (long)ret_var.inner;
14212 if (ret_var.is_owned) {
14218 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
14219 LDKReplyChannelRange orig_conv;
14220 orig_conv.inner = (void*)(orig & (~1));
14221 orig_conv.is_owned = false;
14222 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
14223 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14224 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14225 long ret_ref = (long)ret_var.inner;
14226 if (ret_var.is_owned) {
14232 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_ptr) {
14233 LDKQueryShortChannelIds this_ptr_conv;
14234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14235 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14236 QueryShortChannelIds_free(this_ptr_conv);
14239 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
14240 LDKQueryShortChannelIds this_ptr_conv;
14241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14242 this_ptr_conv.is_owned = false;
14243 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14244 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
14248 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14249 LDKQueryShortChannelIds this_ptr_conv;
14250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14251 this_ptr_conv.is_owned = false;
14252 LDKThirtyTwoBytes val_ref;
14253 CHECK(*((uint32_t*)val) == 32);
14254 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14255 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
14258 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
14259 LDKQueryShortChannelIds this_ptr_conv;
14260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14261 this_ptr_conv.is_owned = false;
14262 LDKCVec_u64Z val_constr;
14263 val_constr.datalen = *((uint32_t*)val);
14264 if (val_constr.datalen > 0)
14265 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14267 val_constr.data = NULL;
14268 int64_t* val_vals = (int64_t*)(val + 4);
14269 for (size_t i = 0; i < val_constr.datalen; i++) {
14270 int64_t val_conv_8 = val_vals[i];
14271 val_constr.data[i] = val_conv_8;
14273 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
14276 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
14277 LDKThirtyTwoBytes chain_hash_arg_ref;
14278 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14279 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14280 LDKCVec_u64Z short_channel_ids_arg_constr;
14281 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
14282 if (short_channel_ids_arg_constr.datalen > 0)
14283 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14285 short_channel_ids_arg_constr.data = NULL;
14286 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
14287 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
14288 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
14289 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
14291 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
14292 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14293 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14294 long ret_ref = (long)ret_var.inner;
14295 if (ret_var.is_owned) {
14301 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
14302 LDKQueryShortChannelIds orig_conv;
14303 orig_conv.inner = (void*)(orig & (~1));
14304 orig_conv.is_owned = false;
14305 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
14306 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14307 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14308 long ret_ref = (long)ret_var.inner;
14309 if (ret_var.is_owned) {
14315 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_ptr) {
14316 LDKReplyShortChannelIdsEnd this_ptr_conv;
14317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14318 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14319 ReplyShortChannelIdsEnd_free(this_ptr_conv);
14322 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
14323 LDKReplyShortChannelIdsEnd this_ptr_conv;
14324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14325 this_ptr_conv.is_owned = false;
14326 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14327 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
14331 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14332 LDKReplyShortChannelIdsEnd this_ptr_conv;
14333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14334 this_ptr_conv.is_owned = false;
14335 LDKThirtyTwoBytes val_ref;
14336 CHECK(*((uint32_t*)val) == 32);
14337 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14338 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
14341 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
14342 LDKReplyShortChannelIdsEnd this_ptr_conv;
14343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14344 this_ptr_conv.is_owned = false;
14345 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
14349 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
14350 LDKReplyShortChannelIdsEnd this_ptr_conv;
14351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14352 this_ptr_conv.is_owned = false;
14353 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
14356 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
14357 LDKThirtyTwoBytes chain_hash_arg_ref;
14358 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14359 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14360 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
14361 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14362 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14363 long ret_ref = (long)ret_var.inner;
14364 if (ret_var.is_owned) {
14370 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
14371 LDKReplyShortChannelIdsEnd orig_conv;
14372 orig_conv.inner = (void*)(orig & (~1));
14373 orig_conv.is_owned = false;
14374 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
14375 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14376 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14377 long ret_ref = (long)ret_var.inner;
14378 if (ret_var.is_owned) {
14384 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_ptr) {
14385 LDKGossipTimestampFilter this_ptr_conv;
14386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14388 GossipTimestampFilter_free(this_ptr_conv);
14391 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
14392 LDKGossipTimestampFilter this_ptr_conv;
14393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14394 this_ptr_conv.is_owned = false;
14395 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14396 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
14400 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14401 LDKGossipTimestampFilter this_ptr_conv;
14402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14403 this_ptr_conv.is_owned = false;
14404 LDKThirtyTwoBytes val_ref;
14405 CHECK(*((uint32_t*)val) == 32);
14406 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14407 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
14410 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
14411 LDKGossipTimestampFilter this_ptr_conv;
14412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14413 this_ptr_conv.is_owned = false;
14414 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
14418 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
14419 LDKGossipTimestampFilter this_ptr_conv;
14420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14421 this_ptr_conv.is_owned = false;
14422 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
14425 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
14426 LDKGossipTimestampFilter this_ptr_conv;
14427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14428 this_ptr_conv.is_owned = false;
14429 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
14433 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
14434 LDKGossipTimestampFilter this_ptr_conv;
14435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14436 this_ptr_conv.is_owned = false;
14437 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
14440 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
14441 LDKThirtyTwoBytes chain_hash_arg_ref;
14442 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14443 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14444 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
14445 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14446 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14447 long ret_ref = (long)ret_var.inner;
14448 if (ret_var.is_owned) {
14454 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
14455 LDKGossipTimestampFilter orig_conv;
14456 orig_conv.inner = (void*)(orig & (~1));
14457 orig_conv.is_owned = false;
14458 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
14459 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14460 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14461 long ret_ref = (long)ret_var.inner;
14462 if (ret_var.is_owned) {
14468 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
14469 if ((this_ptr & 1) != 0) return;
14470 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
14471 FREE((void*)this_ptr);
14472 ErrorAction_free(this_ptr_conv);
14475 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
14476 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
14477 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
14478 *ret_copy = ErrorAction_clone(orig_conv);
14479 long ret_ref = (long)ret_copy;
14483 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_ptr) {
14484 LDKLightningError this_ptr_conv;
14485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14487 LightningError_free(this_ptr_conv);
14490 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
14491 LDKLightningError this_ptr_conv;
14492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14493 this_ptr_conv.is_owned = false;
14494 LDKStr _str = LightningError_get_err(&this_ptr_conv);
14495 jstring _conv = str_ref_to_ts(_str.chars, _str.len);
14499 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, int8_tArray val) {
14500 LDKLightningError this_ptr_conv;
14501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14502 this_ptr_conv.is_owned = false;
14503 LDKCVec_u8Z val_ref;
14504 val_ref.datalen = *((uint32_t*)val);
14505 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
14506 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
14507 LightningError_set_err(&this_ptr_conv, val_ref);
14510 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
14511 LDKLightningError this_ptr_conv;
14512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14513 this_ptr_conv.is_owned = false;
14514 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
14515 *ret_copy = LightningError_get_action(&this_ptr_conv);
14516 long ret_ref = (long)ret_copy;
14520 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
14521 LDKLightningError this_ptr_conv;
14522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14523 this_ptr_conv.is_owned = false;
14524 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
14526 LightningError_set_action(&this_ptr_conv, val_conv);
14529 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(int8_tArray err_arg, uint32_t action_arg) {
14530 LDKCVec_u8Z err_arg_ref;
14531 err_arg_ref.datalen = *((uint32_t*)err_arg);
14532 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
14533 memcpy(err_arg_ref.data, (uint8_t*)(err_arg + 4), err_arg_ref.datalen);
14534 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
14535 FREE((void*)action_arg);
14536 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
14537 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14538 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14539 long ret_ref = (long)ret_var.inner;
14540 if (ret_var.is_owned) {
14546 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
14547 LDKLightningError orig_conv;
14548 orig_conv.inner = (void*)(orig & (~1));
14549 orig_conv.is_owned = false;
14550 LDKLightningError ret_var = LightningError_clone(&orig_conv);
14551 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14552 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14553 long ret_ref = (long)ret_var.inner;
14554 if (ret_var.is_owned) {
14560 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_ptr) {
14561 LDKCommitmentUpdate this_ptr_conv;
14562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14563 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14564 CommitmentUpdate_free(this_ptr_conv);
14567 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
14568 LDKCommitmentUpdate this_ptr_conv;
14569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14570 this_ptr_conv.is_owned = false;
14571 LDKCVec_UpdateAddHTLCZ val_constr;
14572 val_constr.datalen = *((uint32_t*)val);
14573 if (val_constr.datalen > 0)
14574 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
14576 val_constr.data = NULL;
14577 uint32_t* val_vals = (uint32_t*)(val + 4);
14578 for (size_t p = 0; p < val_constr.datalen; p++) {
14579 uint32_t val_conv_15 = val_vals[p];
14580 LDKUpdateAddHTLC val_conv_15_conv;
14581 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
14582 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
14583 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
14584 val_constr.data[p] = val_conv_15_conv;
14586 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
14589 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
14590 LDKCommitmentUpdate this_ptr_conv;
14591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14592 this_ptr_conv.is_owned = false;
14593 LDKCVec_UpdateFulfillHTLCZ val_constr;
14594 val_constr.datalen = *((uint32_t*)val);
14595 if (val_constr.datalen > 0)
14596 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
14598 val_constr.data = NULL;
14599 uint32_t* val_vals = (uint32_t*)(val + 4);
14600 for (size_t t = 0; t < val_constr.datalen; t++) {
14601 uint32_t val_conv_19 = val_vals[t];
14602 LDKUpdateFulfillHTLC val_conv_19_conv;
14603 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
14604 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
14605 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
14606 val_constr.data[t] = val_conv_19_conv;
14608 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
14611 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
14612 LDKCommitmentUpdate this_ptr_conv;
14613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14614 this_ptr_conv.is_owned = false;
14615 LDKCVec_UpdateFailHTLCZ val_constr;
14616 val_constr.datalen = *((uint32_t*)val);
14617 if (val_constr.datalen > 0)
14618 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
14620 val_constr.data = NULL;
14621 uint32_t* val_vals = (uint32_t*)(val + 4);
14622 for (size_t q = 0; q < val_constr.datalen; q++) {
14623 uint32_t val_conv_16 = val_vals[q];
14624 LDKUpdateFailHTLC val_conv_16_conv;
14625 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
14626 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
14627 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
14628 val_constr.data[q] = val_conv_16_conv;
14630 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
14633 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
14634 LDKCommitmentUpdate this_ptr_conv;
14635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14636 this_ptr_conv.is_owned = false;
14637 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
14638 val_constr.datalen = *((uint32_t*)val);
14639 if (val_constr.datalen > 0)
14640 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
14642 val_constr.data = NULL;
14643 uint32_t* val_vals = (uint32_t*)(val + 4);
14644 for (size_t z = 0; z < val_constr.datalen; z++) {
14645 uint32_t val_conv_25 = val_vals[z];
14646 LDKUpdateFailMalformedHTLC val_conv_25_conv;
14647 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
14648 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
14649 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
14650 val_constr.data[z] = val_conv_25_conv;
14652 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
14655 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
14656 LDKCommitmentUpdate this_ptr_conv;
14657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14658 this_ptr_conv.is_owned = false;
14659 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
14660 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14661 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14662 long ret_ref = (long)ret_var.inner;
14663 if (ret_var.is_owned) {
14669 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
14670 LDKCommitmentUpdate this_ptr_conv;
14671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14672 this_ptr_conv.is_owned = false;
14673 LDKUpdateFee val_conv;
14674 val_conv.inner = (void*)(val & (~1));
14675 val_conv.is_owned = (val & 1) || (val == 0);
14676 val_conv = UpdateFee_clone(&val_conv);
14677 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
14680 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
14681 LDKCommitmentUpdate this_ptr_conv;
14682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14683 this_ptr_conv.is_owned = false;
14684 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
14685 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14686 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14687 long ret_ref = (long)ret_var.inner;
14688 if (ret_var.is_owned) {
14694 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
14695 LDKCommitmentUpdate this_ptr_conv;
14696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14697 this_ptr_conv.is_owned = false;
14698 LDKCommitmentSigned val_conv;
14699 val_conv.inner = (void*)(val & (~1));
14700 val_conv.is_owned = (val & 1) || (val == 0);
14701 val_conv = CommitmentSigned_clone(&val_conv);
14702 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
14705 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) {
14706 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
14707 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
14708 if (update_add_htlcs_arg_constr.datalen > 0)
14709 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
14711 update_add_htlcs_arg_constr.data = NULL;
14712 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
14713 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
14714 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
14715 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
14716 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
14717 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
14718 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
14719 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
14721 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
14722 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
14723 if (update_fulfill_htlcs_arg_constr.datalen > 0)
14724 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
14726 update_fulfill_htlcs_arg_constr.data = NULL;
14727 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
14728 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
14729 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
14730 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
14731 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
14732 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
14733 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
14734 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
14736 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
14737 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
14738 if (update_fail_htlcs_arg_constr.datalen > 0)
14739 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
14741 update_fail_htlcs_arg_constr.data = NULL;
14742 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
14743 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
14744 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
14745 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
14746 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
14747 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
14748 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
14749 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
14751 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
14752 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
14753 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
14754 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
14756 update_fail_malformed_htlcs_arg_constr.data = NULL;
14757 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
14758 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
14759 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
14760 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
14761 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
14762 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);
14763 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
14764 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
14766 LDKUpdateFee update_fee_arg_conv;
14767 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
14768 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
14769 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
14770 LDKCommitmentSigned commitment_signed_arg_conv;
14771 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
14772 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
14773 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
14774 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);
14775 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14776 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14777 long ret_ref = (long)ret_var.inner;
14778 if (ret_var.is_owned) {
14784 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
14785 LDKCommitmentUpdate orig_conv;
14786 orig_conv.inner = (void*)(orig & (~1));
14787 orig_conv.is_owned = false;
14788 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
14789 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14790 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14791 long ret_ref = (long)ret_var.inner;
14792 if (ret_var.is_owned) {
14798 void __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_free(uint32_t this_ptr) {
14799 if ((this_ptr & 1) != 0) return;
14800 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
14801 FREE((void*)this_ptr);
14802 HTLCFailChannelUpdate_free(this_ptr_conv);
14805 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_clone(uint32_t orig) {
14806 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
14807 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
14808 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
14809 long ret_ref = (long)ret_copy;
14813 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
14814 if ((this_ptr & 1) != 0) return;
14815 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
14816 FREE((void*)this_ptr);
14817 ChannelMessageHandler_free(this_ptr_conv);
14820 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
14821 if ((this_ptr & 1) != 0) return;
14822 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
14823 FREE((void*)this_ptr);
14824 RoutingMessageHandler_free(this_ptr_conv);
14827 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
14828 LDKAcceptChannel obj_conv;
14829 obj_conv.inner = (void*)(obj & (~1));
14830 obj_conv.is_owned = false;
14831 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
14832 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14833 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14834 CVec_u8Z_free(ret_var);
14838 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
14839 LDKu8slice ser_ref;
14840 ser_ref.datalen = *((uint32_t*)ser);
14841 ser_ref.data = (int8_t*)(ser + 4);
14842 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14843 *ret_conv = AcceptChannel_read(ser_ref);
14844 return (long)ret_conv;
14847 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
14848 LDKAnnouncementSignatures obj_conv;
14849 obj_conv.inner = (void*)(obj & (~1));
14850 obj_conv.is_owned = false;
14851 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
14852 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14853 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14854 CVec_u8Z_free(ret_var);
14858 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
14859 LDKu8slice ser_ref;
14860 ser_ref.datalen = *((uint32_t*)ser);
14861 ser_ref.data = (int8_t*)(ser + 4);
14862 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14863 *ret_conv = AnnouncementSignatures_read(ser_ref);
14864 return (long)ret_conv;
14867 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
14868 LDKChannelReestablish obj_conv;
14869 obj_conv.inner = (void*)(obj & (~1));
14870 obj_conv.is_owned = false;
14871 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
14872 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14873 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14874 CVec_u8Z_free(ret_var);
14878 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
14879 LDKu8slice ser_ref;
14880 ser_ref.datalen = *((uint32_t*)ser);
14881 ser_ref.data = (int8_t*)(ser + 4);
14882 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14883 *ret_conv = ChannelReestablish_read(ser_ref);
14884 return (long)ret_conv;
14887 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
14888 LDKClosingSigned obj_conv;
14889 obj_conv.inner = (void*)(obj & (~1));
14890 obj_conv.is_owned = false;
14891 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
14892 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14893 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14894 CVec_u8Z_free(ret_var);
14898 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
14899 LDKu8slice ser_ref;
14900 ser_ref.datalen = *((uint32_t*)ser);
14901 ser_ref.data = (int8_t*)(ser + 4);
14902 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14903 *ret_conv = ClosingSigned_read(ser_ref);
14904 return (long)ret_conv;
14907 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
14908 LDKCommitmentSigned obj_conv;
14909 obj_conv.inner = (void*)(obj & (~1));
14910 obj_conv.is_owned = false;
14911 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
14912 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14913 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14914 CVec_u8Z_free(ret_var);
14918 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
14919 LDKu8slice ser_ref;
14920 ser_ref.datalen = *((uint32_t*)ser);
14921 ser_ref.data = (int8_t*)(ser + 4);
14922 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14923 *ret_conv = CommitmentSigned_read(ser_ref);
14924 return (long)ret_conv;
14927 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
14928 LDKFundingCreated obj_conv;
14929 obj_conv.inner = (void*)(obj & (~1));
14930 obj_conv.is_owned = false;
14931 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
14932 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14933 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14934 CVec_u8Z_free(ret_var);
14938 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
14939 LDKu8slice ser_ref;
14940 ser_ref.datalen = *((uint32_t*)ser);
14941 ser_ref.data = (int8_t*)(ser + 4);
14942 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14943 *ret_conv = FundingCreated_read(ser_ref);
14944 return (long)ret_conv;
14947 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
14948 LDKFundingSigned obj_conv;
14949 obj_conv.inner = (void*)(obj & (~1));
14950 obj_conv.is_owned = false;
14951 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
14952 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14953 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14954 CVec_u8Z_free(ret_var);
14958 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
14959 LDKu8slice ser_ref;
14960 ser_ref.datalen = *((uint32_t*)ser);
14961 ser_ref.data = (int8_t*)(ser + 4);
14962 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14963 *ret_conv = FundingSigned_read(ser_ref);
14964 return (long)ret_conv;
14967 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
14968 LDKFundingLocked obj_conv;
14969 obj_conv.inner = (void*)(obj & (~1));
14970 obj_conv.is_owned = false;
14971 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
14972 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14973 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14974 CVec_u8Z_free(ret_var);
14978 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
14979 LDKu8slice ser_ref;
14980 ser_ref.datalen = *((uint32_t*)ser);
14981 ser_ref.data = (int8_t*)(ser + 4);
14982 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14983 *ret_conv = FundingLocked_read(ser_ref);
14984 return (long)ret_conv;
14987 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
14989 obj_conv.inner = (void*)(obj & (~1));
14990 obj_conv.is_owned = false;
14991 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
14992 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14993 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14994 CVec_u8Z_free(ret_var);
14998 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
14999 LDKu8slice ser_ref;
15000 ser_ref.datalen = *((uint32_t*)ser);
15001 ser_ref.data = (int8_t*)(ser + 4);
15002 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
15003 *ret_conv = Init_read(ser_ref);
15004 return (long)ret_conv;
15007 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
15008 LDKOpenChannel obj_conv;
15009 obj_conv.inner = (void*)(obj & (~1));
15010 obj_conv.is_owned = false;
15011 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
15012 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15013 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15014 CVec_u8Z_free(ret_var);
15018 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
15019 LDKu8slice ser_ref;
15020 ser_ref.datalen = *((uint32_t*)ser);
15021 ser_ref.data = (int8_t*)(ser + 4);
15022 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
15023 *ret_conv = OpenChannel_read(ser_ref);
15024 return (long)ret_conv;
15027 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
15028 LDKRevokeAndACK obj_conv;
15029 obj_conv.inner = (void*)(obj & (~1));
15030 obj_conv.is_owned = false;
15031 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
15032 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15033 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15034 CVec_u8Z_free(ret_var);
15038 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
15039 LDKu8slice ser_ref;
15040 ser_ref.datalen = *((uint32_t*)ser);
15041 ser_ref.data = (int8_t*)(ser + 4);
15042 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
15043 *ret_conv = RevokeAndACK_read(ser_ref);
15044 return (long)ret_conv;
15047 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
15048 LDKShutdown obj_conv;
15049 obj_conv.inner = (void*)(obj & (~1));
15050 obj_conv.is_owned = false;
15051 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
15052 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15053 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15054 CVec_u8Z_free(ret_var);
15058 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
15059 LDKu8slice ser_ref;
15060 ser_ref.datalen = *((uint32_t*)ser);
15061 ser_ref.data = (int8_t*)(ser + 4);
15062 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
15063 *ret_conv = Shutdown_read(ser_ref);
15064 return (long)ret_conv;
15067 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
15068 LDKUpdateFailHTLC obj_conv;
15069 obj_conv.inner = (void*)(obj & (~1));
15070 obj_conv.is_owned = false;
15071 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
15072 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15073 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15074 CVec_u8Z_free(ret_var);
15078 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
15079 LDKu8slice ser_ref;
15080 ser_ref.datalen = *((uint32_t*)ser);
15081 ser_ref.data = (int8_t*)(ser + 4);
15082 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
15083 *ret_conv = UpdateFailHTLC_read(ser_ref);
15084 return (long)ret_conv;
15087 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
15088 LDKUpdateFailMalformedHTLC obj_conv;
15089 obj_conv.inner = (void*)(obj & (~1));
15090 obj_conv.is_owned = false;
15091 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
15092 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15093 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15094 CVec_u8Z_free(ret_var);
15098 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
15099 LDKu8slice ser_ref;
15100 ser_ref.datalen = *((uint32_t*)ser);
15101 ser_ref.data = (int8_t*)(ser + 4);
15102 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
15103 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
15104 return (long)ret_conv;
15107 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
15108 LDKUpdateFee obj_conv;
15109 obj_conv.inner = (void*)(obj & (~1));
15110 obj_conv.is_owned = false;
15111 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
15112 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15113 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15114 CVec_u8Z_free(ret_var);
15118 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
15119 LDKu8slice ser_ref;
15120 ser_ref.datalen = *((uint32_t*)ser);
15121 ser_ref.data = (int8_t*)(ser + 4);
15122 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
15123 *ret_conv = UpdateFee_read(ser_ref);
15124 return (long)ret_conv;
15127 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
15128 LDKUpdateFulfillHTLC obj_conv;
15129 obj_conv.inner = (void*)(obj & (~1));
15130 obj_conv.is_owned = false;
15131 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
15132 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15133 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15134 CVec_u8Z_free(ret_var);
15138 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
15139 LDKu8slice ser_ref;
15140 ser_ref.datalen = *((uint32_t*)ser);
15141 ser_ref.data = (int8_t*)(ser + 4);
15142 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
15143 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
15144 return (long)ret_conv;
15147 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
15148 LDKUpdateAddHTLC obj_conv;
15149 obj_conv.inner = (void*)(obj & (~1));
15150 obj_conv.is_owned = false;
15151 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
15152 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15153 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15154 CVec_u8Z_free(ret_var);
15158 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
15159 LDKu8slice ser_ref;
15160 ser_ref.datalen = *((uint32_t*)ser);
15161 ser_ref.data = (int8_t*)(ser + 4);
15162 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15163 *ret_conv = UpdateAddHTLC_read(ser_ref);
15164 return (long)ret_conv;
15167 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
15169 obj_conv.inner = (void*)(obj & (~1));
15170 obj_conv.is_owned = false;
15171 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
15172 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15173 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15174 CVec_u8Z_free(ret_var);
15178 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
15179 LDKu8slice ser_ref;
15180 ser_ref.datalen = *((uint32_t*)ser);
15181 ser_ref.data = (int8_t*)(ser + 4);
15182 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15183 *ret_conv = Ping_read(ser_ref);
15184 return (long)ret_conv;
15187 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
15189 obj_conv.inner = (void*)(obj & (~1));
15190 obj_conv.is_owned = false;
15191 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
15192 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15193 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15194 CVec_u8Z_free(ret_var);
15198 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
15199 LDKu8slice ser_ref;
15200 ser_ref.datalen = *((uint32_t*)ser);
15201 ser_ref.data = (int8_t*)(ser + 4);
15202 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15203 *ret_conv = Pong_read(ser_ref);
15204 return (long)ret_conv;
15207 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
15208 LDKUnsignedChannelAnnouncement obj_conv;
15209 obj_conv.inner = (void*)(obj & (~1));
15210 obj_conv.is_owned = false;
15211 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
15212 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15213 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15214 CVec_u8Z_free(ret_var);
15218 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
15219 LDKu8slice ser_ref;
15220 ser_ref.datalen = *((uint32_t*)ser);
15221 ser_ref.data = (int8_t*)(ser + 4);
15222 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15223 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
15224 return (long)ret_conv;
15227 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
15228 LDKChannelAnnouncement obj_conv;
15229 obj_conv.inner = (void*)(obj & (~1));
15230 obj_conv.is_owned = false;
15231 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
15232 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15233 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15234 CVec_u8Z_free(ret_var);
15238 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
15239 LDKu8slice ser_ref;
15240 ser_ref.datalen = *((uint32_t*)ser);
15241 ser_ref.data = (int8_t*)(ser + 4);
15242 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15243 *ret_conv = ChannelAnnouncement_read(ser_ref);
15244 return (long)ret_conv;
15247 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
15248 LDKUnsignedChannelUpdate obj_conv;
15249 obj_conv.inner = (void*)(obj & (~1));
15250 obj_conv.is_owned = false;
15251 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
15252 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15253 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15254 CVec_u8Z_free(ret_var);
15258 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
15259 LDKu8slice ser_ref;
15260 ser_ref.datalen = *((uint32_t*)ser);
15261 ser_ref.data = (int8_t*)(ser + 4);
15262 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15263 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
15264 return (long)ret_conv;
15267 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
15268 LDKChannelUpdate obj_conv;
15269 obj_conv.inner = (void*)(obj & (~1));
15270 obj_conv.is_owned = false;
15271 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
15272 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15273 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15274 CVec_u8Z_free(ret_var);
15278 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
15279 LDKu8slice ser_ref;
15280 ser_ref.datalen = *((uint32_t*)ser);
15281 ser_ref.data = (int8_t*)(ser + 4);
15282 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15283 *ret_conv = ChannelUpdate_read(ser_ref);
15284 return (long)ret_conv;
15287 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
15288 LDKErrorMessage obj_conv;
15289 obj_conv.inner = (void*)(obj & (~1));
15290 obj_conv.is_owned = false;
15291 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
15292 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15293 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15294 CVec_u8Z_free(ret_var);
15298 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
15299 LDKu8slice ser_ref;
15300 ser_ref.datalen = *((uint32_t*)ser);
15301 ser_ref.data = (int8_t*)(ser + 4);
15302 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15303 *ret_conv = ErrorMessage_read(ser_ref);
15304 return (long)ret_conv;
15307 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
15308 LDKUnsignedNodeAnnouncement obj_conv;
15309 obj_conv.inner = (void*)(obj & (~1));
15310 obj_conv.is_owned = false;
15311 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
15312 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15313 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15314 CVec_u8Z_free(ret_var);
15318 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
15319 LDKu8slice ser_ref;
15320 ser_ref.datalen = *((uint32_t*)ser);
15321 ser_ref.data = (int8_t*)(ser + 4);
15322 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15323 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
15324 return (long)ret_conv;
15327 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
15328 LDKNodeAnnouncement obj_conv;
15329 obj_conv.inner = (void*)(obj & (~1));
15330 obj_conv.is_owned = false;
15331 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
15332 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15333 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15334 CVec_u8Z_free(ret_var);
15338 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
15339 LDKu8slice ser_ref;
15340 ser_ref.datalen = *((uint32_t*)ser);
15341 ser_ref.data = (int8_t*)(ser + 4);
15342 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15343 *ret_conv = NodeAnnouncement_read(ser_ref);
15344 return (long)ret_conv;
15347 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
15348 LDKu8slice ser_ref;
15349 ser_ref.datalen = *((uint32_t*)ser);
15350 ser_ref.data = (int8_t*)(ser + 4);
15351 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15352 *ret_conv = QueryShortChannelIds_read(ser_ref);
15353 return (long)ret_conv;
15356 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
15357 LDKQueryShortChannelIds obj_conv;
15358 obj_conv.inner = (void*)(obj & (~1));
15359 obj_conv.is_owned = false;
15360 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
15361 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15362 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15363 CVec_u8Z_free(ret_var);
15367 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
15368 LDKu8slice ser_ref;
15369 ser_ref.datalen = *((uint32_t*)ser);
15370 ser_ref.data = (int8_t*)(ser + 4);
15371 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15372 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
15373 return (long)ret_conv;
15376 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
15377 LDKReplyShortChannelIdsEnd obj_conv;
15378 obj_conv.inner = (void*)(obj & (~1));
15379 obj_conv.is_owned = false;
15380 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
15381 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15382 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15383 CVec_u8Z_free(ret_var);
15387 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
15388 LDKu8slice ser_ref;
15389 ser_ref.datalen = *((uint32_t*)ser);
15390 ser_ref.data = (int8_t*)(ser + 4);
15391 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15392 *ret_conv = QueryChannelRange_read(ser_ref);
15393 return (long)ret_conv;
15396 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
15397 LDKQueryChannelRange obj_conv;
15398 obj_conv.inner = (void*)(obj & (~1));
15399 obj_conv.is_owned = false;
15400 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
15401 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15402 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15403 CVec_u8Z_free(ret_var);
15407 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
15408 LDKu8slice ser_ref;
15409 ser_ref.datalen = *((uint32_t*)ser);
15410 ser_ref.data = (int8_t*)(ser + 4);
15411 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15412 *ret_conv = ReplyChannelRange_read(ser_ref);
15413 return (long)ret_conv;
15416 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
15417 LDKReplyChannelRange obj_conv;
15418 obj_conv.inner = (void*)(obj & (~1));
15419 obj_conv.is_owned = false;
15420 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
15421 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15422 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15423 CVec_u8Z_free(ret_var);
15427 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
15428 LDKu8slice ser_ref;
15429 ser_ref.datalen = *((uint32_t*)ser);
15430 ser_ref.data = (int8_t*)(ser + 4);
15431 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15432 *ret_conv = GossipTimestampFilter_read(ser_ref);
15433 return (long)ret_conv;
15436 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
15437 LDKGossipTimestampFilter obj_conv;
15438 obj_conv.inner = (void*)(obj & (~1));
15439 obj_conv.is_owned = false;
15440 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
15441 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15442 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15443 CVec_u8Z_free(ret_var);
15447 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_ptr) {
15448 LDKIgnoringMessageHandler this_ptr_conv;
15449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15450 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15451 IgnoringMessageHandler_free(this_ptr_conv);
15454 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
15455 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
15456 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15457 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15458 long ret_ref = (long)ret_var.inner;
15459 if (ret_var.is_owned) {
15465 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
15466 LDKIgnoringMessageHandler this_arg_conv;
15467 this_arg_conv.inner = (void*)(this_arg & (~1));
15468 this_arg_conv.is_owned = false;
15469 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
15470 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
15474 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
15475 LDKIgnoringMessageHandler this_arg_conv;
15476 this_arg_conv.inner = (void*)(this_arg & (~1));
15477 this_arg_conv.is_owned = false;
15478 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
15479 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
15483 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_ptr) {
15484 LDKErroringMessageHandler this_ptr_conv;
15485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15487 ErroringMessageHandler_free(this_ptr_conv);
15490 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
15491 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
15492 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15493 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15494 long ret_ref = (long)ret_var.inner;
15495 if (ret_var.is_owned) {
15501 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
15502 LDKErroringMessageHandler this_arg_conv;
15503 this_arg_conv.inner = (void*)(this_arg & (~1));
15504 this_arg_conv.is_owned = false;
15505 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
15506 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
15510 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
15511 LDKErroringMessageHandler this_arg_conv;
15512 this_arg_conv.inner = (void*)(this_arg & (~1));
15513 this_arg_conv.is_owned = false;
15514 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
15515 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
15519 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_ptr) {
15520 LDKMessageHandler this_ptr_conv;
15521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15522 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15523 MessageHandler_free(this_ptr_conv);
15526 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
15527 LDKMessageHandler this_ptr_conv;
15528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15529 this_ptr_conv.is_owned = false;
15530 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
15534 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
15535 LDKMessageHandler this_ptr_conv;
15536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15537 this_ptr_conv.is_owned = false;
15538 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
15539 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
15542 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
15543 LDKMessageHandler this_ptr_conv;
15544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15545 this_ptr_conv.is_owned = false;
15546 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
15550 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
15551 LDKMessageHandler this_ptr_conv;
15552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15553 this_ptr_conv.is_owned = false;
15554 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
15555 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
15558 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
15559 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
15560 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
15561 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
15562 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15563 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15564 long ret_ref = (long)ret_var.inner;
15565 if (ret_var.is_owned) {
15571 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
15572 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig;
15573 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
15574 *ret = SocketDescriptor_clone(orig_conv);
15578 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
15579 if ((this_ptr & 1) != 0) return;
15580 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
15581 FREE((void*)this_ptr);
15582 SocketDescriptor_free(this_ptr_conv);
15585 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_ptr) {
15586 LDKPeerHandleError this_ptr_conv;
15587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15588 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15589 PeerHandleError_free(this_ptr_conv);
15592 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
15593 LDKPeerHandleError this_ptr_conv;
15594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15595 this_ptr_conv.is_owned = false;
15596 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
15600 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
15601 LDKPeerHandleError this_ptr_conv;
15602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15603 this_ptr_conv.is_owned = false;
15604 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
15607 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
15608 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
15609 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15610 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15611 long ret_ref = (long)ret_var.inner;
15612 if (ret_var.is_owned) {
15618 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
15619 LDKPeerHandleError orig_conv;
15620 orig_conv.inner = (void*)(orig & (~1));
15621 orig_conv.is_owned = false;
15622 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
15623 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15624 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15625 long ret_ref = (long)ret_var.inner;
15626 if (ret_var.is_owned) {
15632 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_ptr) {
15633 LDKPeerManager this_ptr_conv;
15634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15635 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15636 PeerManager_free(this_ptr_conv);
15639 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) {
15640 LDKMessageHandler message_handler_conv;
15641 message_handler_conv.inner = (void*)(message_handler & (~1));
15642 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
15643 // Warning: we need a move here but no clone is available for LDKMessageHandler
15644 LDKSecretKey our_node_secret_ref;
15645 CHECK(*((uint32_t*)our_node_secret) == 32);
15646 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
15647 unsigned char ephemeral_random_data_arr[32];
15648 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
15649 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
15650 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
15651 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15652 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
15653 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15654 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15655 long ret_ref = (long)ret_var.inner;
15656 if (ret_var.is_owned) {
15662 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
15663 LDKPeerManager this_arg_conv;
15664 this_arg_conv.inner = (void*)(this_arg & (~1));
15665 this_arg_conv.is_owned = false;
15666 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
15667 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
15668 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
15669 for (size_t m = 0; m < ret_var.datalen; m++) {
15670 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15671 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
15672 ret_arr_ptr[m] = ret_conv_12_arr;
15674 FREE(ret_var.data);
15678 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
15679 LDKPeerManager this_arg_conv;
15680 this_arg_conv.inner = (void*)(this_arg & (~1));
15681 this_arg_conv.is_owned = false;
15682 LDKPublicKey their_node_id_ref;
15683 CHECK(*((uint32_t*)their_node_id) == 33);
15684 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
15685 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
15686 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
15687 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
15688 return (long)ret_conv;
15691 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
15692 LDKPeerManager this_arg_conv;
15693 this_arg_conv.inner = (void*)(this_arg & (~1));
15694 this_arg_conv.is_owned = false;
15695 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
15696 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
15697 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
15698 return (long)ret_conv;
15701 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
15702 LDKPeerManager this_arg_conv;
15703 this_arg_conv.inner = (void*)(this_arg & (~1));
15704 this_arg_conv.is_owned = false;
15705 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
15706 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
15707 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
15708 return (long)ret_conv;
15711 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
15712 LDKPeerManager this_arg_conv;
15713 this_arg_conv.inner = (void*)(this_arg & (~1));
15714 this_arg_conv.is_owned = false;
15715 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
15716 LDKu8slice data_ref;
15717 data_ref.datalen = *((uint32_t*)data);
15718 data_ref.data = (int8_t*)(data + 4);
15719 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
15720 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
15721 return (long)ret_conv;
15724 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
15725 LDKPeerManager this_arg_conv;
15726 this_arg_conv.inner = (void*)(this_arg & (~1));
15727 this_arg_conv.is_owned = false;
15728 PeerManager_process_events(&this_arg_conv);
15731 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
15732 LDKPeerManager this_arg_conv;
15733 this_arg_conv.inner = (void*)(this_arg & (~1));
15734 this_arg_conv.is_owned = false;
15735 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
15736 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
15739 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
15740 LDKPeerManager this_arg_conv;
15741 this_arg_conv.inner = (void*)(this_arg & (~1));
15742 this_arg_conv.is_owned = false;
15743 LDKPublicKey node_id_ref;
15744 CHECK(*((uint32_t*)node_id) == 33);
15745 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
15746 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
15749 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occured(uint32_t this_arg) {
15750 LDKPeerManager this_arg_conv;
15751 this_arg_conv.inner = (void*)(this_arg & (~1));
15752 this_arg_conv.is_owned = false;
15753 PeerManager_timer_tick_occured(&this_arg_conv);
15756 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
15757 unsigned char commitment_seed_arr[32];
15758 CHECK(*((uint32_t*)commitment_seed) == 32);
15759 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
15760 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
15761 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15762 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
15766 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
15767 LDKPublicKey per_commitment_point_ref;
15768 CHECK(*((uint32_t*)per_commitment_point) == 33);
15769 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
15770 unsigned char base_secret_arr[32];
15771 CHECK(*((uint32_t*)base_secret) == 32);
15772 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
15773 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
15774 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
15775 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
15776 return (long)ret_conv;
15779 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
15780 LDKPublicKey per_commitment_point_ref;
15781 CHECK(*((uint32_t*)per_commitment_point) == 33);
15782 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
15783 LDKPublicKey base_point_ref;
15784 CHECK(*((uint32_t*)base_point) == 33);
15785 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
15786 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15787 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
15788 return (long)ret_conv;
15791 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
15792 unsigned char per_commitment_secret_arr[32];
15793 CHECK(*((uint32_t*)per_commitment_secret) == 32);
15794 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
15795 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
15796 unsigned char countersignatory_revocation_base_secret_arr[32];
15797 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
15798 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
15799 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
15800 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
15801 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
15802 return (long)ret_conv;
15805 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
15806 LDKPublicKey per_commitment_point_ref;
15807 CHECK(*((uint32_t*)per_commitment_point) == 33);
15808 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
15809 LDKPublicKey countersignatory_revocation_base_point_ref;
15810 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
15811 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
15812 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15813 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
15814 return (long)ret_conv;
15817 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_ptr) {
15818 LDKTxCreationKeys this_ptr_conv;
15819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15820 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15821 TxCreationKeys_free(this_ptr_conv);
15824 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
15825 LDKTxCreationKeys this_ptr_conv;
15826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15827 this_ptr_conv.is_owned = false;
15828 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15829 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
15833 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
15834 LDKTxCreationKeys this_ptr_conv;
15835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15836 this_ptr_conv.is_owned = false;
15837 LDKPublicKey val_ref;
15838 CHECK(*((uint32_t*)val) == 33);
15839 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15840 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
15843 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
15844 LDKTxCreationKeys this_ptr_conv;
15845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15846 this_ptr_conv.is_owned = false;
15847 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15848 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
15852 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
15853 LDKTxCreationKeys this_ptr_conv;
15854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15855 this_ptr_conv.is_owned = false;
15856 LDKPublicKey val_ref;
15857 CHECK(*((uint32_t*)val) == 33);
15858 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15859 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
15862 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
15863 LDKTxCreationKeys this_ptr_conv;
15864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15865 this_ptr_conv.is_owned = false;
15866 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15867 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
15871 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
15872 LDKTxCreationKeys this_ptr_conv;
15873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15874 this_ptr_conv.is_owned = false;
15875 LDKPublicKey val_ref;
15876 CHECK(*((uint32_t*)val) == 33);
15877 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15878 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
15881 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
15882 LDKTxCreationKeys this_ptr_conv;
15883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15884 this_ptr_conv.is_owned = false;
15885 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15886 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
15890 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
15891 LDKTxCreationKeys this_ptr_conv;
15892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15893 this_ptr_conv.is_owned = false;
15894 LDKPublicKey val_ref;
15895 CHECK(*((uint32_t*)val) == 33);
15896 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15897 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
15900 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
15901 LDKTxCreationKeys this_ptr_conv;
15902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15903 this_ptr_conv.is_owned = false;
15904 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15905 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
15909 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
15910 LDKTxCreationKeys this_ptr_conv;
15911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15912 this_ptr_conv.is_owned = false;
15913 LDKPublicKey val_ref;
15914 CHECK(*((uint32_t*)val) == 33);
15915 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15916 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
15919 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) {
15920 LDKPublicKey per_commitment_point_arg_ref;
15921 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
15922 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
15923 LDKPublicKey revocation_key_arg_ref;
15924 CHECK(*((uint32_t*)revocation_key_arg) == 33);
15925 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
15926 LDKPublicKey broadcaster_htlc_key_arg_ref;
15927 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
15928 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
15929 LDKPublicKey countersignatory_htlc_key_arg_ref;
15930 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
15931 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
15932 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
15933 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
15934 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
15935 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);
15936 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15937 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15938 long ret_ref = (long)ret_var.inner;
15939 if (ret_var.is_owned) {
15945 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
15946 LDKTxCreationKeys orig_conv;
15947 orig_conv.inner = (void*)(orig & (~1));
15948 orig_conv.is_owned = false;
15949 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
15950 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15951 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15952 long ret_ref = (long)ret_var.inner;
15953 if (ret_var.is_owned) {
15959 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
15960 LDKTxCreationKeys obj_conv;
15961 obj_conv.inner = (void*)(obj & (~1));
15962 obj_conv.is_owned = false;
15963 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
15964 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15965 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15966 CVec_u8Z_free(ret_var);
15970 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
15971 LDKu8slice ser_ref;
15972 ser_ref.datalen = *((uint32_t*)ser);
15973 ser_ref.data = (int8_t*)(ser + 4);
15974 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
15975 *ret_conv = TxCreationKeys_read(ser_ref);
15976 return (long)ret_conv;
15979 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_ptr) {
15980 LDKChannelPublicKeys this_ptr_conv;
15981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15982 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15983 ChannelPublicKeys_free(this_ptr_conv);
15986 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
15987 LDKChannelPublicKeys this_ptr_conv;
15988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15989 this_ptr_conv.is_owned = false;
15990 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15991 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
15995 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
15996 LDKChannelPublicKeys this_ptr_conv;
15997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15998 this_ptr_conv.is_owned = false;
15999 LDKPublicKey val_ref;
16000 CHECK(*((uint32_t*)val) == 33);
16001 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16002 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
16005 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
16006 LDKChannelPublicKeys this_ptr_conv;
16007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16008 this_ptr_conv.is_owned = false;
16009 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16010 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
16014 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
16015 LDKChannelPublicKeys this_ptr_conv;
16016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16017 this_ptr_conv.is_owned = false;
16018 LDKPublicKey val_ref;
16019 CHECK(*((uint32_t*)val) == 33);
16020 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16021 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
16024 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
16025 LDKChannelPublicKeys this_ptr_conv;
16026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16027 this_ptr_conv.is_owned = false;
16028 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16029 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
16033 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
16034 LDKChannelPublicKeys this_ptr_conv;
16035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16036 this_ptr_conv.is_owned = false;
16037 LDKPublicKey val_ref;
16038 CHECK(*((uint32_t*)val) == 33);
16039 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16040 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
16043 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
16044 LDKChannelPublicKeys this_ptr_conv;
16045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16046 this_ptr_conv.is_owned = false;
16047 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16048 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
16052 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
16053 LDKChannelPublicKeys this_ptr_conv;
16054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16055 this_ptr_conv.is_owned = false;
16056 LDKPublicKey val_ref;
16057 CHECK(*((uint32_t*)val) == 33);
16058 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16059 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16062 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
16063 LDKChannelPublicKeys this_ptr_conv;
16064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16065 this_ptr_conv.is_owned = false;
16066 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16067 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
16071 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
16072 LDKChannelPublicKeys this_ptr_conv;
16073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16074 this_ptr_conv.is_owned = false;
16075 LDKPublicKey val_ref;
16076 CHECK(*((uint32_t*)val) == 33);
16077 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16078 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
16081 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) {
16082 LDKPublicKey funding_pubkey_arg_ref;
16083 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
16084 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
16085 LDKPublicKey revocation_basepoint_arg_ref;
16086 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
16087 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
16088 LDKPublicKey payment_point_arg_ref;
16089 CHECK(*((uint32_t*)payment_point_arg) == 33);
16090 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
16091 LDKPublicKey delayed_payment_basepoint_arg_ref;
16092 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
16093 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
16094 LDKPublicKey htlc_basepoint_arg_ref;
16095 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
16096 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
16097 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);
16098 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16099 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16100 long ret_ref = (long)ret_var.inner;
16101 if (ret_var.is_owned) {
16107 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
16108 LDKChannelPublicKeys orig_conv;
16109 orig_conv.inner = (void*)(orig & (~1));
16110 orig_conv.is_owned = false;
16111 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
16112 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16113 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16114 long ret_ref = (long)ret_var.inner;
16115 if (ret_var.is_owned) {
16121 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
16122 LDKChannelPublicKeys obj_conv;
16123 obj_conv.inner = (void*)(obj & (~1));
16124 obj_conv.is_owned = false;
16125 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
16126 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16127 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16128 CVec_u8Z_free(ret_var);
16132 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
16133 LDKu8slice ser_ref;
16134 ser_ref.datalen = *((uint32_t*)ser);
16135 ser_ref.data = (int8_t*)(ser + 4);
16136 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
16137 *ret_conv = ChannelPublicKeys_read(ser_ref);
16138 return (long)ret_conv;
16141 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) {
16142 LDKPublicKey per_commitment_point_ref;
16143 CHECK(*((uint32_t*)per_commitment_point) == 33);
16144 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16145 LDKPublicKey broadcaster_delayed_payment_base_ref;
16146 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
16147 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
16148 LDKPublicKey broadcaster_htlc_base_ref;
16149 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
16150 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
16151 LDKPublicKey countersignatory_revocation_base_ref;
16152 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
16153 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
16154 LDKPublicKey countersignatory_htlc_base_ref;
16155 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
16156 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
16157 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
16158 *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);
16159 return (long)ret_conv;
16162 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
16163 LDKPublicKey per_commitment_point_ref;
16164 CHECK(*((uint32_t*)per_commitment_point) == 33);
16165 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16166 LDKChannelPublicKeys broadcaster_keys_conv;
16167 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
16168 broadcaster_keys_conv.is_owned = false;
16169 LDKChannelPublicKeys countersignatory_keys_conv;
16170 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
16171 countersignatory_keys_conv.is_owned = false;
16172 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
16173 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
16174 return (long)ret_conv;
16177 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
16178 LDKPublicKey revocation_key_ref;
16179 CHECK(*((uint32_t*)revocation_key) == 33);
16180 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
16181 LDKPublicKey broadcaster_delayed_payment_key_ref;
16182 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
16183 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
16184 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
16185 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16186 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16187 CVec_u8Z_free(ret_var);
16191 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_ptr) {
16192 LDKHTLCOutputInCommitment this_ptr_conv;
16193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16194 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16195 HTLCOutputInCommitment_free(this_ptr_conv);
16198 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
16199 LDKHTLCOutputInCommitment this_ptr_conv;
16200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16201 this_ptr_conv.is_owned = false;
16202 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
16206 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
16207 LDKHTLCOutputInCommitment this_ptr_conv;
16208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16209 this_ptr_conv.is_owned = false;
16210 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
16213 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
16214 LDKHTLCOutputInCommitment this_ptr_conv;
16215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16216 this_ptr_conv.is_owned = false;
16217 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
16221 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
16222 LDKHTLCOutputInCommitment this_ptr_conv;
16223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16224 this_ptr_conv.is_owned = false;
16225 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
16228 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
16229 LDKHTLCOutputInCommitment this_ptr_conv;
16230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16231 this_ptr_conv.is_owned = false;
16232 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
16236 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
16237 LDKHTLCOutputInCommitment this_ptr_conv;
16238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16239 this_ptr_conv.is_owned = false;
16240 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
16243 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
16244 LDKHTLCOutputInCommitment this_ptr_conv;
16245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16246 this_ptr_conv.is_owned = false;
16247 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16248 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
16252 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
16253 LDKHTLCOutputInCommitment this_ptr_conv;
16254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16255 this_ptr_conv.is_owned = false;
16256 LDKThirtyTwoBytes val_ref;
16257 CHECK(*((uint32_t*)val) == 32);
16258 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16259 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
16262 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
16263 LDKHTLCOutputInCommitment orig_conv;
16264 orig_conv.inner = (void*)(orig & (~1));
16265 orig_conv.is_owned = false;
16266 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
16267 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16268 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16269 long ret_ref = (long)ret_var.inner;
16270 if (ret_var.is_owned) {
16276 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
16277 LDKHTLCOutputInCommitment obj_conv;
16278 obj_conv.inner = (void*)(obj & (~1));
16279 obj_conv.is_owned = false;
16280 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
16281 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16282 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16283 CVec_u8Z_free(ret_var);
16287 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
16288 LDKu8slice ser_ref;
16289 ser_ref.datalen = *((uint32_t*)ser);
16290 ser_ref.data = (int8_t*)(ser + 4);
16291 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
16292 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
16293 return (long)ret_conv;
16296 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
16297 LDKHTLCOutputInCommitment htlc_conv;
16298 htlc_conv.inner = (void*)(htlc & (~1));
16299 htlc_conv.is_owned = false;
16300 LDKTxCreationKeys keys_conv;
16301 keys_conv.inner = (void*)(keys & (~1));
16302 keys_conv.is_owned = false;
16303 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
16304 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16305 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16306 CVec_u8Z_free(ret_var);
16310 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
16311 LDKPublicKey broadcaster_ref;
16312 CHECK(*((uint32_t*)broadcaster) == 33);
16313 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
16314 LDKPublicKey countersignatory_ref;
16315 CHECK(*((uint32_t*)countersignatory) == 33);
16316 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
16317 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
16318 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16319 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16320 CVec_u8Z_free(ret_var);
16324 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) {
16325 unsigned char prev_hash_arr[32];
16326 CHECK(*((uint32_t*)prev_hash) == 32);
16327 memcpy(prev_hash_arr, (uint8_t*)(prev_hash + 4), 32);
16328 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
16329 LDKHTLCOutputInCommitment htlc_conv;
16330 htlc_conv.inner = (void*)(htlc & (~1));
16331 htlc_conv.is_owned = false;
16332 LDKPublicKey broadcaster_delayed_payment_key_ref;
16333 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
16334 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
16335 LDKPublicKey revocation_key_ref;
16336 CHECK(*((uint32_t*)revocation_key) == 33);
16337 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
16338 LDKTransaction ret_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
16339 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16340 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16341 Transaction_free(ret_var);
16345 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_ptr) {
16346 LDKChannelTransactionParameters this_ptr_conv;
16347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16348 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16349 ChannelTransactionParameters_free(this_ptr_conv);
16352 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
16353 LDKChannelTransactionParameters this_ptr_conv;
16354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16355 this_ptr_conv.is_owned = false;
16356 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
16357 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16358 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16359 long ret_ref = (long)ret_var.inner;
16360 if (ret_var.is_owned) {
16366 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
16367 LDKChannelTransactionParameters this_ptr_conv;
16368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16369 this_ptr_conv.is_owned = false;
16370 LDKChannelPublicKeys val_conv;
16371 val_conv.inner = (void*)(val & (~1));
16372 val_conv.is_owned = (val & 1) || (val == 0);
16373 val_conv = ChannelPublicKeys_clone(&val_conv);
16374 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
16377 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
16378 LDKChannelTransactionParameters this_ptr_conv;
16379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16380 this_ptr_conv.is_owned = false;
16381 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
16385 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
16386 LDKChannelTransactionParameters this_ptr_conv;
16387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16388 this_ptr_conv.is_owned = false;
16389 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
16392 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
16393 LDKChannelTransactionParameters this_ptr_conv;
16394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16395 this_ptr_conv.is_owned = false;
16396 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
16400 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
16401 LDKChannelTransactionParameters this_ptr_conv;
16402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16403 this_ptr_conv.is_owned = false;
16404 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
16407 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
16408 LDKChannelTransactionParameters this_ptr_conv;
16409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16410 this_ptr_conv.is_owned = false;
16411 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
16412 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16413 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16414 long ret_ref = (long)ret_var.inner;
16415 if (ret_var.is_owned) {
16421 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
16422 LDKChannelTransactionParameters this_ptr_conv;
16423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16424 this_ptr_conv.is_owned = false;
16425 LDKCounterpartyChannelTransactionParameters val_conv;
16426 val_conv.inner = (void*)(val & (~1));
16427 val_conv.is_owned = (val & 1) || (val == 0);
16428 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
16429 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
16432 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
16433 LDKChannelTransactionParameters this_ptr_conv;
16434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16435 this_ptr_conv.is_owned = false;
16436 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
16437 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16438 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16439 long ret_ref = (long)ret_var.inner;
16440 if (ret_var.is_owned) {
16446 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
16447 LDKChannelTransactionParameters this_ptr_conv;
16448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16449 this_ptr_conv.is_owned = false;
16450 LDKOutPoint val_conv;
16451 val_conv.inner = (void*)(val & (~1));
16452 val_conv.is_owned = (val & 1) || (val == 0);
16453 val_conv = OutPoint_clone(&val_conv);
16454 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
16457 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) {
16458 LDKChannelPublicKeys holder_pubkeys_arg_conv;
16459 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
16460 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
16461 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
16462 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
16463 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
16464 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
16465 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
16466 LDKOutPoint funding_outpoint_arg_conv;
16467 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
16468 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
16469 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
16470 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);
16471 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16472 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16473 long ret_ref = (long)ret_var.inner;
16474 if (ret_var.is_owned) {
16480 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
16481 LDKChannelTransactionParameters orig_conv;
16482 orig_conv.inner = (void*)(orig & (~1));
16483 orig_conv.is_owned = false;
16484 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
16485 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16486 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16487 long ret_ref = (long)ret_var.inner;
16488 if (ret_var.is_owned) {
16494 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_ptr) {
16495 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16497 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16498 CounterpartyChannelTransactionParameters_free(this_ptr_conv);
16501 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
16502 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16504 this_ptr_conv.is_owned = false;
16505 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
16506 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16507 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16508 long ret_ref = (long)ret_var.inner;
16509 if (ret_var.is_owned) {
16515 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
16516 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16518 this_ptr_conv.is_owned = false;
16519 LDKChannelPublicKeys val_conv;
16520 val_conv.inner = (void*)(val & (~1));
16521 val_conv.is_owned = (val & 1) || (val == 0);
16522 val_conv = ChannelPublicKeys_clone(&val_conv);
16523 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
16526 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
16527 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16529 this_ptr_conv.is_owned = false;
16530 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
16534 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
16535 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16537 this_ptr_conv.is_owned = false;
16538 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
16541 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
16542 LDKChannelPublicKeys pubkeys_arg_conv;
16543 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
16544 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
16545 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
16546 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
16547 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16548 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16549 long ret_ref = (long)ret_var.inner;
16550 if (ret_var.is_owned) {
16556 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
16557 LDKCounterpartyChannelTransactionParameters orig_conv;
16558 orig_conv.inner = (void*)(orig & (~1));
16559 orig_conv.is_owned = false;
16560 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
16561 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16562 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16563 long ret_ref = (long)ret_var.inner;
16564 if (ret_var.is_owned) {
16570 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
16571 LDKChannelTransactionParameters this_arg_conv;
16572 this_arg_conv.inner = (void*)(this_arg & (~1));
16573 this_arg_conv.is_owned = false;
16574 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
16578 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
16579 LDKChannelTransactionParameters this_arg_conv;
16580 this_arg_conv.inner = (void*)(this_arg & (~1));
16581 this_arg_conv.is_owned = false;
16582 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
16583 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16584 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16585 long ret_ref = (long)ret_var.inner;
16586 if (ret_var.is_owned) {
16592 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
16593 LDKChannelTransactionParameters this_arg_conv;
16594 this_arg_conv.inner = (void*)(this_arg & (~1));
16595 this_arg_conv.is_owned = false;
16596 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
16597 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16598 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16599 long ret_ref = (long)ret_var.inner;
16600 if (ret_var.is_owned) {
16606 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
16607 LDKCounterpartyChannelTransactionParameters obj_conv;
16608 obj_conv.inner = (void*)(obj & (~1));
16609 obj_conv.is_owned = false;
16610 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
16611 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16612 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16613 CVec_u8Z_free(ret_var);
16617 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
16618 LDKu8slice ser_ref;
16619 ser_ref.datalen = *((uint32_t*)ser);
16620 ser_ref.data = (int8_t*)(ser + 4);
16621 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
16622 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
16623 return (long)ret_conv;
16626 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
16627 LDKChannelTransactionParameters obj_conv;
16628 obj_conv.inner = (void*)(obj & (~1));
16629 obj_conv.is_owned = false;
16630 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
16631 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16632 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16633 CVec_u8Z_free(ret_var);
16637 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
16638 LDKu8slice ser_ref;
16639 ser_ref.datalen = *((uint32_t*)ser);
16640 ser_ref.data = (int8_t*)(ser + 4);
16641 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
16642 *ret_conv = ChannelTransactionParameters_read(ser_ref);
16643 return (long)ret_conv;
16646 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_ptr) {
16647 LDKDirectedChannelTransactionParameters this_ptr_conv;
16648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16650 DirectedChannelTransactionParameters_free(this_ptr_conv);
16653 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
16654 LDKDirectedChannelTransactionParameters this_arg_conv;
16655 this_arg_conv.inner = (void*)(this_arg & (~1));
16656 this_arg_conv.is_owned = false;
16657 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
16658 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16659 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16660 long ret_ref = (long)ret_var.inner;
16661 if (ret_var.is_owned) {
16667 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
16668 LDKDirectedChannelTransactionParameters this_arg_conv;
16669 this_arg_conv.inner = (void*)(this_arg & (~1));
16670 this_arg_conv.is_owned = false;
16671 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
16672 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16673 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16674 long ret_ref = (long)ret_var.inner;
16675 if (ret_var.is_owned) {
16681 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
16682 LDKDirectedChannelTransactionParameters this_arg_conv;
16683 this_arg_conv.inner = (void*)(this_arg & (~1));
16684 this_arg_conv.is_owned = false;
16685 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
16689 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
16690 LDKDirectedChannelTransactionParameters this_arg_conv;
16691 this_arg_conv.inner = (void*)(this_arg & (~1));
16692 this_arg_conv.is_owned = false;
16693 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
16697 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
16698 LDKDirectedChannelTransactionParameters this_arg_conv;
16699 this_arg_conv.inner = (void*)(this_arg & (~1));
16700 this_arg_conv.is_owned = false;
16701 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
16702 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16703 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16704 long ret_ref = (long)ret_var.inner;
16705 if (ret_var.is_owned) {
16711 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_ptr) {
16712 LDKHolderCommitmentTransaction this_ptr_conv;
16713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16714 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16715 HolderCommitmentTransaction_free(this_ptr_conv);
16718 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
16719 LDKHolderCommitmentTransaction this_ptr_conv;
16720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16721 this_ptr_conv.is_owned = false;
16722 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16723 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
16727 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
16728 LDKHolderCommitmentTransaction this_ptr_conv;
16729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16730 this_ptr_conv.is_owned = false;
16731 LDKSignature val_ref;
16732 CHECK(*((uint32_t*)val) == 64);
16733 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
16734 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
16737 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
16738 LDKHolderCommitmentTransaction this_ptr_conv;
16739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16740 this_ptr_conv.is_owned = false;
16741 LDKCVec_SignatureZ val_constr;
16742 val_constr.datalen = *((uint32_t*)val);
16743 if (val_constr.datalen > 0)
16744 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16746 val_constr.data = NULL;
16747 int8_tArray* val_vals = (int8_tArray*)(val + 4);
16748 for (size_t m = 0; m < val_constr.datalen; m++) {
16749 int8_tArray val_conv_12 = val_vals[m];
16750 LDKSignature val_conv_12_ref;
16751 CHECK(*((uint32_t*)val_conv_12) == 64);
16752 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
16753 val_constr.data[m] = val_conv_12_ref;
16755 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
16758 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
16759 LDKHolderCommitmentTransaction orig_conv;
16760 orig_conv.inner = (void*)(orig & (~1));
16761 orig_conv.is_owned = false;
16762 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_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 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
16773 LDKHolderCommitmentTransaction obj_conv;
16774 obj_conv.inner = (void*)(obj & (~1));
16775 obj_conv.is_owned = false;
16776 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
16777 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16778 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16779 CVec_u8Z_free(ret_var);
16783 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
16784 LDKu8slice ser_ref;
16785 ser_ref.datalen = *((uint32_t*)ser);
16786 ser_ref.data = (int8_t*)(ser + 4);
16787 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
16788 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
16789 return (long)ret_conv;
16792 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) {
16793 LDKCommitmentTransaction commitment_tx_conv;
16794 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
16795 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
16796 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
16797 LDKSignature counterparty_sig_ref;
16798 CHECK(*((uint32_t*)counterparty_sig) == 64);
16799 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
16800 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
16801 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
16802 if (counterparty_htlc_sigs_constr.datalen > 0)
16803 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16805 counterparty_htlc_sigs_constr.data = NULL;
16806 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
16807 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
16808 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
16809 LDKSignature counterparty_htlc_sigs_conv_12_ref;
16810 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
16811 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
16812 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
16814 LDKPublicKey holder_funding_key_ref;
16815 CHECK(*((uint32_t*)holder_funding_key) == 33);
16816 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
16817 LDKPublicKey counterparty_funding_key_ref;
16818 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
16819 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
16820 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
16821 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16822 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16823 long ret_ref = (long)ret_var.inner;
16824 if (ret_var.is_owned) {
16830 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_ptr) {
16831 LDKBuiltCommitmentTransaction this_ptr_conv;
16832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16833 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16834 BuiltCommitmentTransaction_free(this_ptr_conv);
16837 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
16838 LDKBuiltCommitmentTransaction this_ptr_conv;
16839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16840 this_ptr_conv.is_owned = false;
16841 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
16842 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16843 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16844 Transaction_free(ret_var);
16848 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
16849 LDKBuiltCommitmentTransaction this_ptr_conv;
16850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16851 this_ptr_conv.is_owned = false;
16852 LDKTransaction val_ref;
16853 val_ref.datalen = *((uint32_t*)val);
16854 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
16855 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
16856 val_ref.data_is_owned = true;
16857 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
16860 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
16861 LDKBuiltCommitmentTransaction this_ptr_conv;
16862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16863 this_ptr_conv.is_owned = false;
16864 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16865 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
16869 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
16870 LDKBuiltCommitmentTransaction this_ptr_conv;
16871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16872 this_ptr_conv.is_owned = false;
16873 LDKThirtyTwoBytes val_ref;
16874 CHECK(*((uint32_t*)val) == 32);
16875 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16876 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
16879 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
16880 LDKTransaction transaction_arg_ref;
16881 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
16882 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
16883 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
16884 transaction_arg_ref.data_is_owned = true;
16885 LDKThirtyTwoBytes txid_arg_ref;
16886 CHECK(*((uint32_t*)txid_arg) == 32);
16887 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
16888 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
16889 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16890 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16891 long ret_ref = (long)ret_var.inner;
16892 if (ret_var.is_owned) {
16898 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
16899 LDKBuiltCommitmentTransaction orig_conv;
16900 orig_conv.inner = (void*)(orig & (~1));
16901 orig_conv.is_owned = false;
16902 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
16903 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16904 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16905 long ret_ref = (long)ret_var.inner;
16906 if (ret_var.is_owned) {
16912 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
16913 LDKBuiltCommitmentTransaction obj_conv;
16914 obj_conv.inner = (void*)(obj & (~1));
16915 obj_conv.is_owned = false;
16916 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
16917 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16918 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16919 CVec_u8Z_free(ret_var);
16923 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
16924 LDKu8slice ser_ref;
16925 ser_ref.datalen = *((uint32_t*)ser);
16926 ser_ref.data = (int8_t*)(ser + 4);
16927 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
16928 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
16929 return (long)ret_conv;
16932 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
16933 LDKBuiltCommitmentTransaction this_arg_conv;
16934 this_arg_conv.inner = (void*)(this_arg & (~1));
16935 this_arg_conv.is_owned = false;
16936 LDKu8slice funding_redeemscript_ref;
16937 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
16938 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
16939 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16940 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
16944 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) {
16945 LDKBuiltCommitmentTransaction this_arg_conv;
16946 this_arg_conv.inner = (void*)(this_arg & (~1));
16947 this_arg_conv.is_owned = false;
16948 unsigned char funding_key_arr[32];
16949 CHECK(*((uint32_t*)funding_key) == 32);
16950 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
16951 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
16952 LDKu8slice funding_redeemscript_ref;
16953 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
16954 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
16955 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16956 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
16960 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_ptr) {
16961 LDKCommitmentTransaction this_ptr_conv;
16962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16963 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16964 CommitmentTransaction_free(this_ptr_conv);
16967 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
16968 LDKCommitmentTransaction orig_conv;
16969 orig_conv.inner = (void*)(orig & (~1));
16970 orig_conv.is_owned = false;
16971 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
16972 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16973 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16974 long ret_ref = (long)ret_var.inner;
16975 if (ret_var.is_owned) {
16981 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
16982 LDKCommitmentTransaction obj_conv;
16983 obj_conv.inner = (void*)(obj & (~1));
16984 obj_conv.is_owned = false;
16985 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
16986 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16987 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16988 CVec_u8Z_free(ret_var);
16992 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
16993 LDKu8slice ser_ref;
16994 ser_ref.datalen = *((uint32_t*)ser);
16995 ser_ref.data = (int8_t*)(ser + 4);
16996 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
16997 *ret_conv = CommitmentTransaction_read(ser_ref);
16998 return (long)ret_conv;
17001 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
17002 LDKCommitmentTransaction this_arg_conv;
17003 this_arg_conv.inner = (void*)(this_arg & (~1));
17004 this_arg_conv.is_owned = false;
17005 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
17009 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
17010 LDKCommitmentTransaction this_arg_conv;
17011 this_arg_conv.inner = (void*)(this_arg & (~1));
17012 this_arg_conv.is_owned = false;
17013 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
17017 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
17018 LDKCommitmentTransaction this_arg_conv;
17019 this_arg_conv.inner = (void*)(this_arg & (~1));
17020 this_arg_conv.is_owned = false;
17021 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
17025 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
17026 LDKCommitmentTransaction this_arg_conv;
17027 this_arg_conv.inner = (void*)(this_arg & (~1));
17028 this_arg_conv.is_owned = false;
17029 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
17033 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
17034 LDKCommitmentTransaction this_arg_conv;
17035 this_arg_conv.inner = (void*)(this_arg & (~1));
17036 this_arg_conv.is_owned = false;
17037 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
17038 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17039 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17040 long ret_ref = (long)ret_var.inner;
17041 if (ret_var.is_owned) {
17047 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
17048 LDKCommitmentTransaction this_arg_conv;
17049 this_arg_conv.inner = (void*)(this_arg & (~1));
17050 this_arg_conv.is_owned = false;
17051 LDKDirectedChannelTransactionParameters channel_parameters_conv;
17052 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
17053 channel_parameters_conv.is_owned = false;
17054 LDKChannelPublicKeys broadcaster_keys_conv;
17055 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
17056 broadcaster_keys_conv.is_owned = false;
17057 LDKChannelPublicKeys countersignatory_keys_conv;
17058 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
17059 countersignatory_keys_conv.is_owned = false;
17060 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
17061 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
17062 return (long)ret_conv;
17065 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_ptr) {
17066 LDKTrustedCommitmentTransaction this_ptr_conv;
17067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17068 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17069 TrustedCommitmentTransaction_free(this_ptr_conv);
17072 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
17073 LDKTrustedCommitmentTransaction this_arg_conv;
17074 this_arg_conv.inner = (void*)(this_arg & (~1));
17075 this_arg_conv.is_owned = false;
17076 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17077 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
17081 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
17082 LDKTrustedCommitmentTransaction this_arg_conv;
17083 this_arg_conv.inner = (void*)(this_arg & (~1));
17084 this_arg_conv.is_owned = false;
17085 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
17086 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17087 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17088 long ret_ref = (long)ret_var.inner;
17089 if (ret_var.is_owned) {
17095 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
17096 LDKTrustedCommitmentTransaction this_arg_conv;
17097 this_arg_conv.inner = (void*)(this_arg & (~1));
17098 this_arg_conv.is_owned = false;
17099 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
17100 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17101 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17102 long ret_ref = (long)ret_var.inner;
17103 if (ret_var.is_owned) {
17109 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
17110 LDKTrustedCommitmentTransaction this_arg_conv;
17111 this_arg_conv.inner = (void*)(this_arg & (~1));
17112 this_arg_conv.is_owned = false;
17113 unsigned char htlc_base_key_arr[32];
17114 CHECK(*((uint32_t*)htlc_base_key) == 32);
17115 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
17116 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
17117 LDKDirectedChannelTransactionParameters channel_parameters_conv;
17118 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
17119 channel_parameters_conv.is_owned = false;
17120 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
17121 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
17122 return (long)ret_conv;
17125 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) {
17126 LDKPublicKey broadcaster_payment_basepoint_ref;
17127 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
17128 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
17129 LDKPublicKey countersignatory_payment_basepoint_ref;
17130 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
17131 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
17132 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
17136 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
17137 LDKInitFeatures orig_conv;
17138 orig_conv.inner = (void*)(orig & (~1));
17139 orig_conv.is_owned = false;
17140 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
17141 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17142 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17143 long ret_ref = (long)ret_var.inner;
17144 if (ret_var.is_owned) {
17150 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
17151 LDKNodeFeatures orig_conv;
17152 orig_conv.inner = (void*)(orig & (~1));
17153 orig_conv.is_owned = false;
17154 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
17155 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17156 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17157 long ret_ref = (long)ret_var.inner;
17158 if (ret_var.is_owned) {
17164 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
17165 LDKChannelFeatures orig_conv;
17166 orig_conv.inner = (void*)(orig & (~1));
17167 orig_conv.is_owned = false;
17168 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
17169 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17170 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17171 long ret_ref = (long)ret_var.inner;
17172 if (ret_var.is_owned) {
17178 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_ptr) {
17179 LDKInitFeatures this_ptr_conv;
17180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17181 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17182 InitFeatures_free(this_ptr_conv);
17185 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_ptr) {
17186 LDKNodeFeatures this_ptr_conv;
17187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17188 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17189 NodeFeatures_free(this_ptr_conv);
17192 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_ptr) {
17193 LDKChannelFeatures this_ptr_conv;
17194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17195 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17196 ChannelFeatures_free(this_ptr_conv);
17199 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
17200 LDKInitFeatures ret_var = InitFeatures_empty();
17201 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17202 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17203 long ret_ref = (long)ret_var.inner;
17204 if (ret_var.is_owned) {
17210 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
17211 LDKInitFeatures ret_var = InitFeatures_known();
17212 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17213 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17214 long ret_ref = (long)ret_var.inner;
17215 if (ret_var.is_owned) {
17221 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
17222 LDKNodeFeatures ret_var = NodeFeatures_empty();
17223 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17224 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17225 long ret_ref = (long)ret_var.inner;
17226 if (ret_var.is_owned) {
17232 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
17233 LDKNodeFeatures ret_var = NodeFeatures_known();
17234 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17235 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17236 long ret_ref = (long)ret_var.inner;
17237 if (ret_var.is_owned) {
17243 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
17244 LDKChannelFeatures ret_var = ChannelFeatures_empty();
17245 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17246 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17247 long ret_ref = (long)ret_var.inner;
17248 if (ret_var.is_owned) {
17254 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
17255 LDKChannelFeatures ret_var = ChannelFeatures_known();
17256 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17257 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17258 long ret_ref = (long)ret_var.inner;
17259 if (ret_var.is_owned) {
17265 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
17266 LDKInitFeatures obj_conv;
17267 obj_conv.inner = (void*)(obj & (~1));
17268 obj_conv.is_owned = false;
17269 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
17270 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17271 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17272 CVec_u8Z_free(ret_var);
17276 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
17277 LDKNodeFeatures obj_conv;
17278 obj_conv.inner = (void*)(obj & (~1));
17279 obj_conv.is_owned = false;
17280 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
17281 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17282 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17283 CVec_u8Z_free(ret_var);
17287 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
17288 LDKChannelFeatures obj_conv;
17289 obj_conv.inner = (void*)(obj & (~1));
17290 obj_conv.is_owned = false;
17291 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
17292 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17293 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17294 CVec_u8Z_free(ret_var);
17298 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
17299 LDKu8slice ser_ref;
17300 ser_ref.datalen = *((uint32_t*)ser);
17301 ser_ref.data = (int8_t*)(ser + 4);
17302 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17303 *ret_conv = InitFeatures_read(ser_ref);
17304 return (long)ret_conv;
17307 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
17308 LDKu8slice ser_ref;
17309 ser_ref.datalen = *((uint32_t*)ser);
17310 ser_ref.data = (int8_t*)(ser + 4);
17311 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17312 *ret_conv = NodeFeatures_read(ser_ref);
17313 return (long)ret_conv;
17316 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
17317 LDKu8slice ser_ref;
17318 ser_ref.datalen = *((uint32_t*)ser);
17319 ser_ref.data = (int8_t*)(ser + 4);
17320 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17321 *ret_conv = ChannelFeatures_read(ser_ref);
17322 return (long)ret_conv;
17325 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_ptr) {
17326 LDKRouteHop this_ptr_conv;
17327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17328 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17329 RouteHop_free(this_ptr_conv);
17332 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
17333 LDKRouteHop this_ptr_conv;
17334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17335 this_ptr_conv.is_owned = false;
17336 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17337 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
17341 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
17342 LDKRouteHop this_ptr_conv;
17343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17344 this_ptr_conv.is_owned = false;
17345 LDKPublicKey val_ref;
17346 CHECK(*((uint32_t*)val) == 33);
17347 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17348 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
17351 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
17352 LDKRouteHop this_ptr_conv;
17353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17354 this_ptr_conv.is_owned = false;
17355 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
17356 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17357 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17358 long ret_ref = (long)ret_var.inner;
17359 if (ret_var.is_owned) {
17365 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
17366 LDKRouteHop this_ptr_conv;
17367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17368 this_ptr_conv.is_owned = false;
17369 LDKNodeFeatures val_conv;
17370 val_conv.inner = (void*)(val & (~1));
17371 val_conv.is_owned = (val & 1) || (val == 0);
17372 val_conv = NodeFeatures_clone(&val_conv);
17373 RouteHop_set_node_features(&this_ptr_conv, val_conv);
17376 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
17377 LDKRouteHop this_ptr_conv;
17378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17379 this_ptr_conv.is_owned = false;
17380 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
17384 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
17385 LDKRouteHop this_ptr_conv;
17386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17387 this_ptr_conv.is_owned = false;
17388 RouteHop_set_short_channel_id(&this_ptr_conv, val);
17391 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
17392 LDKRouteHop this_ptr_conv;
17393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17394 this_ptr_conv.is_owned = false;
17395 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
17396 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17397 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17398 long ret_ref = (long)ret_var.inner;
17399 if (ret_var.is_owned) {
17405 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
17406 LDKRouteHop this_ptr_conv;
17407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17408 this_ptr_conv.is_owned = false;
17409 LDKChannelFeatures val_conv;
17410 val_conv.inner = (void*)(val & (~1));
17411 val_conv.is_owned = (val & 1) || (val == 0);
17412 val_conv = ChannelFeatures_clone(&val_conv);
17413 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
17416 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
17417 LDKRouteHop this_ptr_conv;
17418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17419 this_ptr_conv.is_owned = false;
17420 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
17424 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
17425 LDKRouteHop this_ptr_conv;
17426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17427 this_ptr_conv.is_owned = false;
17428 RouteHop_set_fee_msat(&this_ptr_conv, val);
17431 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
17432 LDKRouteHop this_ptr_conv;
17433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17434 this_ptr_conv.is_owned = false;
17435 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
17439 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
17440 LDKRouteHop this_ptr_conv;
17441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17442 this_ptr_conv.is_owned = false;
17443 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
17446 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) {
17447 LDKPublicKey pubkey_arg_ref;
17448 CHECK(*((uint32_t*)pubkey_arg) == 33);
17449 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
17450 LDKNodeFeatures node_features_arg_conv;
17451 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
17452 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
17453 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
17454 LDKChannelFeatures channel_features_arg_conv;
17455 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
17456 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
17457 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
17458 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);
17459 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17460 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17461 long ret_ref = (long)ret_var.inner;
17462 if (ret_var.is_owned) {
17468 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
17469 LDKRouteHop orig_conv;
17470 orig_conv.inner = (void*)(orig & (~1));
17471 orig_conv.is_owned = false;
17472 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
17473 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17474 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17475 long ret_ref = (long)ret_var.inner;
17476 if (ret_var.is_owned) {
17482 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_ptr) {
17483 LDKRoute this_ptr_conv;
17484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17485 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17486 Route_free(this_ptr_conv);
17489 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
17490 LDKRoute this_ptr_conv;
17491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17492 this_ptr_conv.is_owned = false;
17493 LDKCVec_CVec_RouteHopZZ val_constr;
17494 val_constr.datalen = *((uint32_t*)val);
17495 if (val_constr.datalen > 0)
17496 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
17498 val_constr.data = NULL;
17499 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
17500 for (size_t m = 0; m < val_constr.datalen; m++) {
17501 uint32_tArray val_conv_12 = val_vals[m];
17502 LDKCVec_RouteHopZ val_conv_12_constr;
17503 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
17504 if (val_conv_12_constr.datalen > 0)
17505 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17507 val_conv_12_constr.data = NULL;
17508 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
17509 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
17510 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
17511 LDKRouteHop val_conv_12_conv_10_conv;
17512 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
17513 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
17514 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
17515 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
17517 val_constr.data[m] = val_conv_12_constr;
17519 Route_set_paths(&this_ptr_conv, val_constr);
17522 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) {
17523 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
17524 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
17525 if (paths_arg_constr.datalen > 0)
17526 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
17528 paths_arg_constr.data = NULL;
17529 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
17530 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
17531 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
17532 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
17533 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
17534 if (paths_arg_conv_12_constr.datalen > 0)
17535 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17537 paths_arg_conv_12_constr.data = NULL;
17538 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
17539 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
17540 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
17541 LDKRouteHop paths_arg_conv_12_conv_10_conv;
17542 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
17543 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
17544 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
17545 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
17547 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
17549 LDKRoute ret_var = Route_new(paths_arg_constr);
17550 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17551 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17552 long ret_ref = (long)ret_var.inner;
17553 if (ret_var.is_owned) {
17559 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
17560 LDKRoute orig_conv;
17561 orig_conv.inner = (void*)(orig & (~1));
17562 orig_conv.is_owned = false;
17563 LDKRoute ret_var = Route_clone(&orig_conv);
17564 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17565 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17566 long ret_ref = (long)ret_var.inner;
17567 if (ret_var.is_owned) {
17573 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
17575 obj_conv.inner = (void*)(obj & (~1));
17576 obj_conv.is_owned = false;
17577 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
17578 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17579 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17580 CVec_u8Z_free(ret_var);
17584 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
17585 LDKu8slice ser_ref;
17586 ser_ref.datalen = *((uint32_t*)ser);
17587 ser_ref.data = (int8_t*)(ser + 4);
17588 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17589 *ret_conv = Route_read(ser_ref);
17590 return (long)ret_conv;
17593 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_ptr) {
17594 LDKRouteHint this_ptr_conv;
17595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17596 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17597 RouteHint_free(this_ptr_conv);
17600 int8_tArray __attribute__((visibility("default"))) TS_RouteHint_get_src_node_id(uint32_t this_ptr) {
17601 LDKRouteHint this_ptr_conv;
17602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17603 this_ptr_conv.is_owned = false;
17604 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17605 memcpy((uint8_t*)(ret_arr + 4), RouteHint_get_src_node_id(&this_ptr_conv).compressed_form, 33);
17609 void __attribute__((visibility("default"))) TS_RouteHint_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
17610 LDKRouteHint this_ptr_conv;
17611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17612 this_ptr_conv.is_owned = false;
17613 LDKPublicKey val_ref;
17614 CHECK(*((uint32_t*)val) == 33);
17615 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17616 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
17619 int64_t __attribute__((visibility("default"))) TS_RouteHint_get_short_channel_id(uint32_t this_ptr) {
17620 LDKRouteHint this_ptr_conv;
17621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17622 this_ptr_conv.is_owned = false;
17623 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
17627 void __attribute__((visibility("default"))) TS_RouteHint_set_short_channel_id(uint32_t this_ptr, int64_t val) {
17628 LDKRouteHint this_ptr_conv;
17629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17630 this_ptr_conv.is_owned = false;
17631 RouteHint_set_short_channel_id(&this_ptr_conv, val);
17634 uint32_t __attribute__((visibility("default"))) TS_RouteHint_get_fees(uint32_t this_ptr) {
17635 LDKRouteHint this_ptr_conv;
17636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17637 this_ptr_conv.is_owned = false;
17638 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
17639 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17640 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17641 long ret_ref = (long)ret_var.inner;
17642 if (ret_var.is_owned) {
17648 void __attribute__((visibility("default"))) TS_RouteHint_set_fees(uint32_t this_ptr, uint32_t val) {
17649 LDKRouteHint this_ptr_conv;
17650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17651 this_ptr_conv.is_owned = false;
17652 LDKRoutingFees val_conv;
17653 val_conv.inner = (void*)(val & (~1));
17654 val_conv.is_owned = (val & 1) || (val == 0);
17655 val_conv = RoutingFees_clone(&val_conv);
17656 RouteHint_set_fees(&this_ptr_conv, val_conv);
17659 int16_t __attribute__((visibility("default"))) TS_RouteHint_get_cltv_expiry_delta(uint32_t this_ptr) {
17660 LDKRouteHint this_ptr_conv;
17661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17662 this_ptr_conv.is_owned = false;
17663 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
17667 void __attribute__((visibility("default"))) TS_RouteHint_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
17668 LDKRouteHint this_ptr_conv;
17669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17670 this_ptr_conv.is_owned = false;
17671 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
17674 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
17675 LDKRouteHint orig_conv;
17676 orig_conv.inner = (void*)(orig & (~1));
17677 orig_conv.is_owned = false;
17678 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
17679 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17680 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17681 long ret_ref = (long)ret_var.inner;
17682 if (ret_var.is_owned) {
17688 uint32_t __attribute__((visibility("default"))) TS_get_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
17689 LDKPublicKey our_node_id_ref;
17690 CHECK(*((uint32_t*)our_node_id) == 33);
17691 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
17692 LDKNetworkGraph network_conv;
17693 network_conv.inner = (void*)(network & (~1));
17694 network_conv.is_owned = false;
17695 LDKPublicKey payee_ref;
17696 CHECK(*((uint32_t*)payee) == 33);
17697 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
17698 LDKCVec_ChannelDetailsZ first_hops_constr;
17699 first_hops_constr.datalen = *((uint32_t*)first_hops);
17700 if (first_hops_constr.datalen > 0)
17701 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
17703 first_hops_constr.data = NULL;
17704 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
17705 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
17706 uint32_t first_hops_conv_16 = first_hops_vals[q];
17707 LDKChannelDetails first_hops_conv_16_conv;
17708 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
17709 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
17710 first_hops_constr.data[q] = first_hops_conv_16_conv;
17712 LDKCVec_RouteHintZ last_hops_constr;
17713 last_hops_constr.datalen = *((uint32_t*)last_hops);
17714 if (last_hops_constr.datalen > 0)
17715 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
17717 last_hops_constr.data = NULL;
17718 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
17719 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
17720 uint32_t last_hops_conv_11 = last_hops_vals[l];
17721 LDKRouteHint last_hops_conv_11_conv;
17722 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
17723 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
17724 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
17725 last_hops_constr.data[l] = last_hops_conv_11_conv;
17727 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17728 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17729 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
17730 FREE(first_hops_constr.data);
17731 return (long)ret_conv;
17734 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_ptr) {
17735 LDKNetworkGraph this_ptr_conv;
17736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17738 NetworkGraph_free(this_ptr_conv);
17741 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
17742 LDKNetworkGraph orig_conv;
17743 orig_conv.inner = (void*)(orig & (~1));
17744 orig_conv.is_owned = false;
17745 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
17746 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17747 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17748 long ret_ref = (long)ret_var.inner;
17749 if (ret_var.is_owned) {
17755 void __attribute__((visibility("default"))) TS_LockedNetworkGraph_free(uint32_t this_ptr) {
17756 LDKLockedNetworkGraph this_ptr_conv;
17757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17758 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17759 LockedNetworkGraph_free(this_ptr_conv);
17762 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_ptr) {
17763 LDKNetGraphMsgHandler this_ptr_conv;
17764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17765 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17766 NetGraphMsgHandler_free(this_ptr_conv);
17769 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(int8_tArray genesis_hash, uint32_t chain_access, uint32_t logger) {
17770 LDKThirtyTwoBytes genesis_hash_ref;
17771 CHECK(*((uint32_t*)genesis_hash) == 32);
17772 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
17773 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17774 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17775 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv, logger_conv);
17776 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17777 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17778 long ret_ref = (long)ret_var.inner;
17779 if (ret_var.is_owned) {
17785 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_from_net_graph(uint32_t chain_access, uint32_t logger, uint32_t network_graph) {
17786 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17787 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17788 LDKNetworkGraph network_graph_conv;
17789 network_graph_conv.inner = (void*)(network_graph & (~1));
17790 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
17791 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
17792 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
17793 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17794 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17795 long ret_ref = (long)ret_var.inner;
17796 if (ret_var.is_owned) {
17802 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
17803 LDKNetGraphMsgHandler this_arg_conv;
17804 this_arg_conv.inner = (void*)(this_arg & (~1));
17805 this_arg_conv.is_owned = false;
17806 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17807 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
17810 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_read_locked_graph(uint32_t this_arg) {
17811 LDKNetGraphMsgHandler this_arg_conv;
17812 this_arg_conv.inner = (void*)(this_arg & (~1));
17813 this_arg_conv.is_owned = false;
17814 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
17815 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17816 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17817 long ret_ref = (long)ret_var.inner;
17818 if (ret_var.is_owned) {
17824 uint32_t __attribute__((visibility("default"))) TS_LockedNetworkGraph_graph(uint32_t this_arg) {
17825 LDKLockedNetworkGraph this_arg_conv;
17826 this_arg_conv.inner = (void*)(this_arg & (~1));
17827 this_arg_conv.is_owned = false;
17828 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
17829 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17830 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17831 long ret_ref = (long)ret_var.inner;
17832 if (ret_var.is_owned) {
17838 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
17839 LDKNetGraphMsgHandler this_arg_conv;
17840 this_arg_conv.inner = (void*)(this_arg & (~1));
17841 this_arg_conv.is_owned = false;
17842 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
17843 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
17847 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
17848 LDKNetGraphMsgHandler this_arg_conv;
17849 this_arg_conv.inner = (void*)(this_arg & (~1));
17850 this_arg_conv.is_owned = false;
17851 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
17852 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
17856 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_ptr) {
17857 LDKDirectionalChannelInfo this_ptr_conv;
17858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17859 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17860 DirectionalChannelInfo_free(this_ptr_conv);
17863 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
17864 LDKDirectionalChannelInfo this_ptr_conv;
17865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17866 this_ptr_conv.is_owned = false;
17867 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
17871 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
17872 LDKDirectionalChannelInfo this_ptr_conv;
17873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17874 this_ptr_conv.is_owned = false;
17875 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
17878 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
17879 LDKDirectionalChannelInfo this_ptr_conv;
17880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17881 this_ptr_conv.is_owned = false;
17882 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
17886 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
17887 LDKDirectionalChannelInfo this_ptr_conv;
17888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17889 this_ptr_conv.is_owned = false;
17890 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
17893 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
17894 LDKDirectionalChannelInfo this_ptr_conv;
17895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17896 this_ptr_conv.is_owned = false;
17897 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
17901 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
17902 LDKDirectionalChannelInfo this_ptr_conv;
17903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17904 this_ptr_conv.is_owned = false;
17905 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
17908 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
17909 LDKDirectionalChannelInfo this_ptr_conv;
17910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17911 this_ptr_conv.is_owned = false;
17912 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
17916 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17917 LDKDirectionalChannelInfo this_ptr_conv;
17918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17919 this_ptr_conv.is_owned = false;
17920 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
17923 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
17924 LDKDirectionalChannelInfo this_ptr_conv;
17925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17926 this_ptr_conv.is_owned = false;
17927 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
17928 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17929 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17930 long ret_ref = (long)ret_var.inner;
17931 if (ret_var.is_owned) {
17937 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
17938 LDKDirectionalChannelInfo this_ptr_conv;
17939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17940 this_ptr_conv.is_owned = false;
17941 LDKRoutingFees val_conv;
17942 val_conv.inner = (void*)(val & (~1));
17943 val_conv.is_owned = (val & 1) || (val == 0);
17944 val_conv = RoutingFees_clone(&val_conv);
17945 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
17948 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
17949 LDKDirectionalChannelInfo this_ptr_conv;
17950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17951 this_ptr_conv.is_owned = false;
17952 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_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 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
17963 LDKDirectionalChannelInfo this_ptr_conv;
17964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17965 this_ptr_conv.is_owned = false;
17966 LDKChannelUpdate val_conv;
17967 val_conv.inner = (void*)(val & (~1));
17968 val_conv.is_owned = (val & 1) || (val == 0);
17969 val_conv = ChannelUpdate_clone(&val_conv);
17970 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
17973 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
17974 LDKDirectionalChannelInfo orig_conv;
17975 orig_conv.inner = (void*)(orig & (~1));
17976 orig_conv.is_owned = false;
17977 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
17978 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17979 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17980 long ret_ref = (long)ret_var.inner;
17981 if (ret_var.is_owned) {
17987 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
17988 LDKDirectionalChannelInfo obj_conv;
17989 obj_conv.inner = (void*)(obj & (~1));
17990 obj_conv.is_owned = false;
17991 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
17992 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17993 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17994 CVec_u8Z_free(ret_var);
17998 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
17999 LDKu8slice ser_ref;
18000 ser_ref.datalen = *((uint32_t*)ser);
18001 ser_ref.data = (int8_t*)(ser + 4);
18002 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
18003 *ret_conv = DirectionalChannelInfo_read(ser_ref);
18004 return (long)ret_conv;
18007 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_ptr) {
18008 LDKChannelInfo this_ptr_conv;
18009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18010 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18011 ChannelInfo_free(this_ptr_conv);
18014 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
18015 LDKChannelInfo this_ptr_conv;
18016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18017 this_ptr_conv.is_owned = false;
18018 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
18019 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18020 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18021 long ret_ref = (long)ret_var.inner;
18022 if (ret_var.is_owned) {
18028 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
18029 LDKChannelInfo this_ptr_conv;
18030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18031 this_ptr_conv.is_owned = false;
18032 LDKChannelFeatures val_conv;
18033 val_conv.inner = (void*)(val & (~1));
18034 val_conv.is_owned = (val & 1) || (val == 0);
18035 val_conv = ChannelFeatures_clone(&val_conv);
18036 ChannelInfo_set_features(&this_ptr_conv, val_conv);
18039 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
18040 LDKChannelInfo this_ptr_conv;
18041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18042 this_ptr_conv.is_owned = false;
18043 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18044 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
18048 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, int8_tArray val) {
18049 LDKChannelInfo this_ptr_conv;
18050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18051 this_ptr_conv.is_owned = false;
18052 LDKPublicKey val_ref;
18053 CHECK(*((uint32_t*)val) == 33);
18054 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18055 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
18058 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
18059 LDKChannelInfo this_ptr_conv;
18060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18061 this_ptr_conv.is_owned = false;
18062 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
18063 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18064 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18065 long ret_ref = (long)ret_var.inner;
18066 if (ret_var.is_owned) {
18072 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
18073 LDKChannelInfo this_ptr_conv;
18074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18075 this_ptr_conv.is_owned = false;
18076 LDKDirectionalChannelInfo val_conv;
18077 val_conv.inner = (void*)(val & (~1));
18078 val_conv.is_owned = (val & 1) || (val == 0);
18079 val_conv = DirectionalChannelInfo_clone(&val_conv);
18080 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
18083 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
18084 LDKChannelInfo this_ptr_conv;
18085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18086 this_ptr_conv.is_owned = false;
18087 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18088 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
18092 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, int8_tArray val) {
18093 LDKChannelInfo this_ptr_conv;
18094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18095 this_ptr_conv.is_owned = false;
18096 LDKPublicKey val_ref;
18097 CHECK(*((uint32_t*)val) == 33);
18098 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18099 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
18102 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
18103 LDKChannelInfo this_ptr_conv;
18104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18105 this_ptr_conv.is_owned = false;
18106 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
18107 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18108 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18109 long ret_ref = (long)ret_var.inner;
18110 if (ret_var.is_owned) {
18116 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
18117 LDKChannelInfo this_ptr_conv;
18118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18119 this_ptr_conv.is_owned = false;
18120 LDKDirectionalChannelInfo val_conv;
18121 val_conv.inner = (void*)(val & (~1));
18122 val_conv.is_owned = (val & 1) || (val == 0);
18123 val_conv = DirectionalChannelInfo_clone(&val_conv);
18124 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
18127 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
18128 LDKChannelInfo this_ptr_conv;
18129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18130 this_ptr_conv.is_owned = false;
18131 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
18132 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18133 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18134 long ret_ref = (long)ret_var.inner;
18135 if (ret_var.is_owned) {
18141 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
18142 LDKChannelInfo this_ptr_conv;
18143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18144 this_ptr_conv.is_owned = false;
18145 LDKChannelAnnouncement val_conv;
18146 val_conv.inner = (void*)(val & (~1));
18147 val_conv.is_owned = (val & 1) || (val == 0);
18148 val_conv = ChannelAnnouncement_clone(&val_conv);
18149 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
18152 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
18153 LDKChannelInfo orig_conv;
18154 orig_conv.inner = (void*)(orig & (~1));
18155 orig_conv.is_owned = false;
18156 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
18157 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18158 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18159 long ret_ref = (long)ret_var.inner;
18160 if (ret_var.is_owned) {
18166 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
18167 LDKChannelInfo obj_conv;
18168 obj_conv.inner = (void*)(obj & (~1));
18169 obj_conv.is_owned = false;
18170 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
18171 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18172 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18173 CVec_u8Z_free(ret_var);
18177 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
18178 LDKu8slice ser_ref;
18179 ser_ref.datalen = *((uint32_t*)ser);
18180 ser_ref.data = (int8_t*)(ser + 4);
18181 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
18182 *ret_conv = ChannelInfo_read(ser_ref);
18183 return (long)ret_conv;
18186 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_ptr) {
18187 LDKRoutingFees this_ptr_conv;
18188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18189 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18190 RoutingFees_free(this_ptr_conv);
18193 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
18194 LDKRoutingFees this_ptr_conv;
18195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18196 this_ptr_conv.is_owned = false;
18197 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
18201 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
18202 LDKRoutingFees this_ptr_conv;
18203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18204 this_ptr_conv.is_owned = false;
18205 RoutingFees_set_base_msat(&this_ptr_conv, val);
18208 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
18209 LDKRoutingFees this_ptr_conv;
18210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18211 this_ptr_conv.is_owned = false;
18212 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
18216 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
18217 LDKRoutingFees this_ptr_conv;
18218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18219 this_ptr_conv.is_owned = false;
18220 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
18223 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
18224 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
18225 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18226 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18227 long ret_ref = (long)ret_var.inner;
18228 if (ret_var.is_owned) {
18234 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
18235 LDKRoutingFees orig_conv;
18236 orig_conv.inner = (void*)(orig & (~1));
18237 orig_conv.is_owned = false;
18238 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
18239 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18240 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18241 long ret_ref = (long)ret_var.inner;
18242 if (ret_var.is_owned) {
18248 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
18249 LDKu8slice ser_ref;
18250 ser_ref.datalen = *((uint32_t*)ser);
18251 ser_ref.data = (int8_t*)(ser + 4);
18252 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
18253 *ret_conv = RoutingFees_read(ser_ref);
18254 return (long)ret_conv;
18257 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
18258 LDKRoutingFees obj_conv;
18259 obj_conv.inner = (void*)(obj & (~1));
18260 obj_conv.is_owned = false;
18261 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
18262 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18263 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18264 CVec_u8Z_free(ret_var);
18268 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_ptr) {
18269 LDKNodeAnnouncementInfo this_ptr_conv;
18270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18271 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18272 NodeAnnouncementInfo_free(this_ptr_conv);
18275 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
18276 LDKNodeAnnouncementInfo this_ptr_conv;
18277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18278 this_ptr_conv.is_owned = false;
18279 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
18280 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18281 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18282 long ret_ref = (long)ret_var.inner;
18283 if (ret_var.is_owned) {
18289 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
18290 LDKNodeAnnouncementInfo this_ptr_conv;
18291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18292 this_ptr_conv.is_owned = false;
18293 LDKNodeFeatures val_conv;
18294 val_conv.inner = (void*)(val & (~1));
18295 val_conv.is_owned = (val & 1) || (val == 0);
18296 val_conv = NodeFeatures_clone(&val_conv);
18297 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
18300 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
18301 LDKNodeAnnouncementInfo this_ptr_conv;
18302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18303 this_ptr_conv.is_owned = false;
18304 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
18308 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
18309 LDKNodeAnnouncementInfo this_ptr_conv;
18310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18311 this_ptr_conv.is_owned = false;
18312 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
18315 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
18316 LDKNodeAnnouncementInfo this_ptr_conv;
18317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18318 this_ptr_conv.is_owned = false;
18319 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
18320 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
18324 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
18325 LDKNodeAnnouncementInfo this_ptr_conv;
18326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18327 this_ptr_conv.is_owned = false;
18328 LDKThreeBytes val_ref;
18329 CHECK(*((uint32_t*)val) == 3);
18330 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
18331 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
18334 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
18335 LDKNodeAnnouncementInfo this_ptr_conv;
18336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18337 this_ptr_conv.is_owned = false;
18338 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18339 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
18343 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
18344 LDKNodeAnnouncementInfo this_ptr_conv;
18345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18346 this_ptr_conv.is_owned = false;
18347 LDKThirtyTwoBytes val_ref;
18348 CHECK(*((uint32_t*)val) == 32);
18349 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18350 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
18353 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
18354 LDKNodeAnnouncementInfo this_ptr_conv;
18355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18356 this_ptr_conv.is_owned = false;
18357 LDKCVec_NetAddressZ val_constr;
18358 val_constr.datalen = *((uint32_t*)val);
18359 if (val_constr.datalen > 0)
18360 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18362 val_constr.data = NULL;
18363 uint32_t* val_vals = (uint32_t*)(val + 4);
18364 for (size_t m = 0; m < val_constr.datalen; m++) {
18365 uint32_t val_conv_12 = val_vals[m];
18366 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
18367 FREE((void*)val_conv_12);
18368 val_constr.data[m] = val_conv_12_conv;
18370 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
18373 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
18374 LDKNodeAnnouncementInfo this_ptr_conv;
18375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18376 this_ptr_conv.is_owned = false;
18377 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
18378 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18379 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18380 long ret_ref = (long)ret_var.inner;
18381 if (ret_var.is_owned) {
18387 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
18388 LDKNodeAnnouncementInfo this_ptr_conv;
18389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18390 this_ptr_conv.is_owned = false;
18391 LDKNodeAnnouncement val_conv;
18392 val_conv.inner = (void*)(val & (~1));
18393 val_conv.is_owned = (val & 1) || (val == 0);
18394 val_conv = NodeAnnouncement_clone(&val_conv);
18395 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
18398 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) {
18399 LDKNodeFeatures features_arg_conv;
18400 features_arg_conv.inner = (void*)(features_arg & (~1));
18401 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
18402 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
18403 LDKThreeBytes rgb_arg_ref;
18404 CHECK(*((uint32_t*)rgb_arg) == 3);
18405 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
18406 LDKThirtyTwoBytes alias_arg_ref;
18407 CHECK(*((uint32_t*)alias_arg) == 32);
18408 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
18409 LDKCVec_NetAddressZ addresses_arg_constr;
18410 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
18411 if (addresses_arg_constr.datalen > 0)
18412 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18414 addresses_arg_constr.data = NULL;
18415 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
18416 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
18417 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
18418 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
18419 FREE((void*)addresses_arg_conv_12);
18420 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
18422 LDKNodeAnnouncement announcement_message_arg_conv;
18423 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
18424 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
18425 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
18426 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
18427 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18428 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18429 long ret_ref = (long)ret_var.inner;
18430 if (ret_var.is_owned) {
18436 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
18437 LDKNodeAnnouncementInfo orig_conv;
18438 orig_conv.inner = (void*)(orig & (~1));
18439 orig_conv.is_owned = false;
18440 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
18441 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18442 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18443 long ret_ref = (long)ret_var.inner;
18444 if (ret_var.is_owned) {
18450 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
18451 LDKNodeAnnouncementInfo obj_conv;
18452 obj_conv.inner = (void*)(obj & (~1));
18453 obj_conv.is_owned = false;
18454 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
18455 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18456 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18457 CVec_u8Z_free(ret_var);
18461 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
18462 LDKu8slice ser_ref;
18463 ser_ref.datalen = *((uint32_t*)ser);
18464 ser_ref.data = (int8_t*)(ser + 4);
18465 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
18466 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
18467 return (long)ret_conv;
18470 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_ptr) {
18471 LDKNodeInfo this_ptr_conv;
18472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18473 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18474 NodeInfo_free(this_ptr_conv);
18477 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
18478 LDKNodeInfo this_ptr_conv;
18479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18480 this_ptr_conv.is_owned = false;
18481 LDKCVec_u64Z val_constr;
18482 val_constr.datalen = *((uint32_t*)val);
18483 if (val_constr.datalen > 0)
18484 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
18486 val_constr.data = NULL;
18487 int64_t* val_vals = (int64_t*)(val + 4);
18488 for (size_t i = 0; i < val_constr.datalen; i++) {
18489 int64_t val_conv_8 = val_vals[i];
18490 val_constr.data[i] = val_conv_8;
18492 NodeInfo_set_channels(&this_ptr_conv, val_constr);
18495 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
18496 LDKNodeInfo this_ptr_conv;
18497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18498 this_ptr_conv.is_owned = false;
18499 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
18500 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18501 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18502 long ret_ref = (long)ret_var.inner;
18503 if (ret_var.is_owned) {
18509 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
18510 LDKNodeInfo this_ptr_conv;
18511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18512 this_ptr_conv.is_owned = false;
18513 LDKRoutingFees val_conv;
18514 val_conv.inner = (void*)(val & (~1));
18515 val_conv.is_owned = (val & 1) || (val == 0);
18516 val_conv = RoutingFees_clone(&val_conv);
18517 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
18520 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
18521 LDKNodeInfo this_ptr_conv;
18522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18523 this_ptr_conv.is_owned = false;
18524 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
18525 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18526 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18527 long ret_ref = (long)ret_var.inner;
18528 if (ret_var.is_owned) {
18534 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
18535 LDKNodeInfo this_ptr_conv;
18536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18537 this_ptr_conv.is_owned = false;
18538 LDKNodeAnnouncementInfo val_conv;
18539 val_conv.inner = (void*)(val & (~1));
18540 val_conv.is_owned = (val & 1) || (val == 0);
18541 val_conv = NodeAnnouncementInfo_clone(&val_conv);
18542 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
18545 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
18546 LDKCVec_u64Z channels_arg_constr;
18547 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
18548 if (channels_arg_constr.datalen > 0)
18549 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
18551 channels_arg_constr.data = NULL;
18552 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
18553 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
18554 int64_t channels_arg_conv_8 = channels_arg_vals[i];
18555 channels_arg_constr.data[i] = channels_arg_conv_8;
18557 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
18558 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
18559 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
18560 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
18561 LDKNodeAnnouncementInfo announcement_info_arg_conv;
18562 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
18563 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
18564 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
18565 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
18566 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18567 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18568 long ret_ref = (long)ret_var.inner;
18569 if (ret_var.is_owned) {
18575 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
18576 LDKNodeInfo orig_conv;
18577 orig_conv.inner = (void*)(orig & (~1));
18578 orig_conv.is_owned = false;
18579 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
18580 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18581 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18582 long ret_ref = (long)ret_var.inner;
18583 if (ret_var.is_owned) {
18589 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
18590 LDKNodeInfo obj_conv;
18591 obj_conv.inner = (void*)(obj & (~1));
18592 obj_conv.is_owned = false;
18593 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
18594 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18595 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18596 CVec_u8Z_free(ret_var);
18600 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
18601 LDKu8slice ser_ref;
18602 ser_ref.datalen = *((uint32_t*)ser);
18603 ser_ref.data = (int8_t*)(ser + 4);
18604 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
18605 *ret_conv = NodeInfo_read(ser_ref);
18606 return (long)ret_conv;
18609 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
18610 LDKNetworkGraph obj_conv;
18611 obj_conv.inner = (void*)(obj & (~1));
18612 obj_conv.is_owned = false;
18613 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
18614 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18615 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18616 CVec_u8Z_free(ret_var);
18620 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
18621 LDKu8slice ser_ref;
18622 ser_ref.datalen = *((uint32_t*)ser);
18623 ser_ref.data = (int8_t*)(ser + 4);
18624 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
18625 *ret_conv = NetworkGraph_read(ser_ref);
18626 return (long)ret_conv;
18629 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
18630 LDKThirtyTwoBytes genesis_hash_ref;
18631 CHECK(*((uint32_t*)genesis_hash) == 32);
18632 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
18633 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
18634 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18635 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18636 long ret_ref = (long)ret_var.inner;
18637 if (ret_var.is_owned) {
18643 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
18644 LDKNetworkGraph this_arg_conv;
18645 this_arg_conv.inner = (void*)(this_arg & (~1));
18646 this_arg_conv.is_owned = false;
18647 LDKNodeAnnouncement msg_conv;
18648 msg_conv.inner = (void*)(msg & (~1));
18649 msg_conv.is_owned = false;
18650 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18651 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
18652 return (long)ret_conv;
18655 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
18656 LDKNetworkGraph this_arg_conv;
18657 this_arg_conv.inner = (void*)(this_arg & (~1));
18658 this_arg_conv.is_owned = false;
18659 LDKUnsignedNodeAnnouncement msg_conv;
18660 msg_conv.inner = (void*)(msg & (~1));
18661 msg_conv.is_owned = false;
18662 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18663 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
18664 return (long)ret_conv;
18667 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
18668 LDKNetworkGraph this_arg_conv;
18669 this_arg_conv.inner = (void*)(this_arg & (~1));
18670 this_arg_conv.is_owned = false;
18671 LDKChannelAnnouncement msg_conv;
18672 msg_conv.inner = (void*)(msg & (~1));
18673 msg_conv.is_owned = false;
18674 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
18675 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18676 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
18677 return (long)ret_conv;
18680 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
18681 LDKNetworkGraph this_arg_conv;
18682 this_arg_conv.inner = (void*)(this_arg & (~1));
18683 this_arg_conv.is_owned = false;
18684 LDKUnsignedChannelAnnouncement msg_conv;
18685 msg_conv.inner = (void*)(msg & (~1));
18686 msg_conv.is_owned = false;
18687 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
18688 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18689 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
18690 return (long)ret_conv;
18693 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
18694 LDKNetworkGraph this_arg_conv;
18695 this_arg_conv.inner = (void*)(this_arg & (~1));
18696 this_arg_conv.is_owned = false;
18697 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
18700 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
18701 LDKNetworkGraph this_arg_conv;
18702 this_arg_conv.inner = (void*)(this_arg & (~1));
18703 this_arg_conv.is_owned = false;
18704 LDKChannelUpdate msg_conv;
18705 msg_conv.inner = (void*)(msg & (~1));
18706 msg_conv.is_owned = false;
18707 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18708 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
18709 return (long)ret_conv;
18712 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
18713 LDKNetworkGraph this_arg_conv;
18714 this_arg_conv.inner = (void*)(this_arg & (~1));
18715 this_arg_conv.is_owned = false;
18716 LDKUnsignedChannelUpdate msg_conv;
18717 msg_conv.inner = (void*)(msg & (~1));
18718 msg_conv.is_owned = false;
18719 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18720 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
18721 return (long)ret_conv;